diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-01-16 21:45:08 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-01-16 21:47:19 +0300 |
commit | 5d5add5de2b384797851d5b9d964b2cf0e1410c7 (patch) | |
tree | de45b25b860b79632f9cb7dd2a83486dfb3a14d2 /source/blender/draw/engines/eevee/eevee_lightcache.c | |
parent | 7c2f0074f3fe2411daa7a6e351d7cbc535246871 (diff) |
Fix T69794 "Bake Cubemap Only" resets Irradiance Volume if world is updated
Was caused by a clear done for when irradiance need to be baked.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_lightcache.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightcache.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 261b7f00e42..aa904036463 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -830,17 +830,19 @@ static void eevee_lightbake_render_world_sample(void *ved, void *user_data) EEVEE_lightbake_render_world(sldata, vedata, lbake->rt_fb); EEVEE_lightbake_filter_diffuse(sldata, vedata, lbake->rt_color, lbake->store_fb, 0, 1.0f); - /* Clear the cache to avoid white values in the grid. */ - 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, 1.0f, 1.0f, 1.0f})); - DRW_draw_pass(vedata->psl->probe_grid_fill); + if (lcache->flag & LIGHTCACHE_UPDATE_GRID) { + /* Clear the cache to avoid white values in the grid. */ + 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, 1.0f, 1.0f, 1.0f})); + DRW_draw_pass(vedata->psl->probe_grid_fill); - SWAP(GPUTexture *, lbake->grid_prev, lcache->grid_tx.tex); + SWAP(GPUTexture *, lbake->grid_prev, lcache->grid_tx.tex); - /* Make a copy for later. */ - eevee_lightbake_copy_irradiance(lbake, lcache); + /* Make a copy for later. */ + eevee_lightbake_copy_irradiance(lbake, lcache); + } lcache->cube_len = 1; lcache->grid_len = lbake->grid_len; |