Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-07-09 16:48:12 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-07-09 16:48:12 +0300
commita21742a07b4240e08386427c2ae5f20d5e45fade (patch)
tree30d175c8fefad1b1cbf38f9c4dd3124c454a9b19
parent65ac6e214dfe19c4adeb118ed80acc3005ef4782 (diff)
Eevee: LightCache: Small fixes and cleanups
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c9
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c6
2 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index d0dcf563ae7..07b07bc85cd 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -177,8 +177,11 @@ static bool EEVEE_lightcache_validate(
(irr_size[1] == light_cache->grid_tx.tex_size[1]) &&
(irr_size[2] == light_cache->grid_tx.tex_size[2]))
{
+ int mip_len = (int)(floorf(log2f(cube_res)) - MIN_CUBE_LOD_LEVEL);
if ((cube_res == light_cache->cube_tx.tex_size[0]) &&
- (cube_len == light_cache->cube_tx.tex_size[2])) {
+ (cube_len == light_cache->cube_tx.tex_size[2]) &&
+ (mip_len == light_cache->mips_len))
+ {
return true;
}
}
@@ -430,7 +433,10 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake)
eevee->light_cache = lbake->lcache;
}
+ EEVEE_lightcache_load(eevee->light_cache);
+
lbake->lcache->flag |= LIGHTCACHE_BAKING;
+ lbake->lcache->cube_len = 1;
}
wmJob *EEVEE_lightbake_job_create(
@@ -1010,7 +1016,6 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float
/* Render reflections */
if (lcache->flag & LIGHTCACHE_UPDATE_CUBE) {
- lcache->cube_len = 1;
/* Bypass world, start at 1. */
lbake->probe = lbake->cube_prb + 1;
lbake->cube = lcache->cube_data + 1;
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index bca667d2ab0..54bf59234b3 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -493,8 +493,8 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
psl->probe_display = DRW_pass_create("LightProbe Display", state);
/* Cube Display */
- if (scene_eval->eevee.flag & SCE_EEVEE_SHOW_CUBEMAPS) {
- int cube_len = GPU_texture_layers(lcache->cube_tx.tex) - 1; /* don't count the world. */
+ if (scene_eval->eevee.flag & SCE_EEVEE_SHOW_CUBEMAPS && lcache->cube_len > 1) {
+ int cube_len = lcache->cube_len - 1; /* don't count the world. */
DRWShadingGroup *grp = DRW_shgroup_empty_tri_batch_create(e_data.probe_cube_display_sh,
psl->probe_display, cube_len * 2);
DRW_shgroup_uniform_texture_ref(grp, "probeCubes", &lcache->cube_tx.tex);
@@ -842,12 +842,10 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
if (scene_orig->eevee.light_cache != NULL) {
if (pinfo->do_grid_update) {
scene_orig->eevee.light_cache->flag |= LIGHTCACHE_UPDATE_GRID;
- printf("LIGHTCACHE_UPDATE_GRID\n");
}
/* If we update grid we need to update the cubemaps too.
* So always refresh cubemaps. */
scene_orig->eevee.light_cache->flag |= LIGHTCACHE_UPDATE_CUBE;
- printf("LIGHTCACHE_UPDATE_CUBE\n");
}
/* Use a notifier to trigger the operator after drawing. */