[Bf-blender-cvs] [a21742a07b4] temp-eeveelightcache: Eevee: LightCache: Small fixes and cleanups

Clément Foucault noreply at git.blender.org
Mon Jul 9 23:03:45 CEST 2018


Commit: a21742a07b4240e08386427c2ae5f20d5e45fade
Author: Clément Foucault
Date:   Mon Jul 9 15:48:12 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rBa21742a07b4240e08386427c2ae5f20d5e45fade

Eevee: LightCache: Small fixes and cleanups

===================================================================

M	source/blender/draw/engines/eevee/eevee_lightcache.c
M	source/blender/draw/engines/eevee/eevee_lightprobes.c

===================================================================

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. */



More information about the Bf-blender-cvs mailing list