[Bf-blender-cvs] [a498ffd4f69] temp-eeveelightcache: Eevee: LightCache: Fix a warning, a mistake and two oversight

Clément Foucault noreply at git.blender.org
Sun Jun 24 21:58:52 CEST 2018


Commit: a498ffd4f697c73a960791fef801abea79f65845
Author: Clément Foucault
Date:   Sun Jun 24 21:40:50 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rBa498ffd4f697c73a960791fef801abea79f65845

Eevee: LightCache: Fix a warning, a mistake and two oversight

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

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

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index bcede16334f..ff6880fb786 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -325,6 +325,8 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake)
 		DEG_id_tag_update(&scene_orig->id, DEG_TAG_COPY_ON_WRITE);
 	}
 
+	lcache->vis_res = lbake->vis_res;
+
 	lcache->flag = LIGHTCACHE_UPDATE_WORLD | LIGHTCACHE_UPDATE_CUBE | LIGHTCACHE_UPDATE_GRID | LIGHTCACHE_BAKING;
 
 	/* Share light cache with the evaluated (baking) layer and the original layer.
@@ -483,7 +485,7 @@ static void eevee_lightbake_render_world_sample(void *ved, void *user_data)
 	GPU_framebuffer_texture_attach(lbake->store_fb, lbake->grid_prev, 0, 0);
 	GPU_framebuffer_bind(lbake->store_fb);
 	/* Clear to 1.0f for visibility. */
-	GPU_framebuffer_clear_color(lbake->store_fb, (float[4]){1.0f});
+	GPU_framebuffer_clear_color(lbake->store_fb, ((float[4]){1.0f, 1.0f, 1.0f, 1.0f}));
 	DRW_draw_pass(vedata->psl->probe_grid_fill);
 
 	SWAP(GPUTexture *, lbake->grid_prev, lcache->grid_tx);
@@ -609,12 +611,12 @@ static void eevee_lightbake_render_grid_sample(void *ved, void *user_data)
 	}
 
 	/* Update level for progressive update. */
-	if (lbake->bounce_curr == 0) {
-		egrid->level_bias = (float)(stride << 1);
-	}
-	else if (is_last_bounce_sample) {
+	if (is_last_bounce_sample) {
 		egrid->level_bias = 1.0f;
 	}
+	else if (lbake->bounce_curr == 0) {
+		egrid->level_bias = (float)(stride << 1);
+	}
 
 	/* Only run this for the last sample of a bounce. */
 	if (is_last_bounce_sample) {
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 7520b8e0e7c..bfb20a86733 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -380,7 +380,6 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
 		struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
 		DRWShadingGroup *grp = NULL;
 
-		const DRWContextState *draw_ctx = DRW_context_state_get();
 		Scene *scene = draw_ctx->scene;
 		World *wo = scene->world;
 
@@ -605,6 +604,7 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
 	/* For shading, save max level of the octahedron map */
 	int mipsize = GPU_texture_width(light_cache->cube_tx);
 	sldata->common_data.prb_lod_cube_max = (float)(floorf(log2f(mipsize)) - MIN_CUBE_LOD_LEVEL) - 1.0f;
+	sldata->common_data.prb_irradiance_vis_size = light_cache->vis_res;
 	sldata->common_data.prb_num_render_cube = max_ii(1, light_cache->cube_count);
 	sldata->common_data.prb_num_render_grid = max_ii(1, light_cache->grid_count);
 }
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index bec238108a5..441e13b3acb 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -757,6 +757,7 @@ typedef struct EEVEE_LightCache {
 
 	/* only a single cache for now */
 	int cube_count, grid_count;      /* Number of probes to use for rendering. */
+	int vis_res;                     /* Size of a visibility sample. */
 	/* We bake to and render with the same textures.
 	 * This prevent concurent use of it. In the future,
 	 * we could create a bigger texture containing multiple



More information about the Bf-blender-cvs mailing list