From 0f13e5366964c1eb8a62aafbaeb37383cd2da360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 9 Jul 2018 22:26:48 +0200 Subject: Eevee: LightCache: Fix cache validation. --- source/blender/draw/engines/eevee/eevee_lightcache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index cd56e14a76a..0828d7bfa93 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -215,13 +215,15 @@ static bool EEVEE_lightcache_validate( const LightCache *light_cache, const int cube_len, const int cube_res, + const int grid_len, const int irr_size[3]) { if (light_cache) { /* See if we need the same amount of texture space. */ if ((irr_size[0] == light_cache->grid_tx.tex_size[0]) && (irr_size[1] == light_cache->grid_tx.tex_size[1]) && - (irr_size[2] == light_cache->grid_tx.tex_size[2])) + (irr_size[2] == light_cache->grid_tx.tex_size[2]) && + (grid_len != light_cache->grid_len)) { int mip_len = (int)(floorf(log2f(cube_res)) - MIN_CUBE_LOD_LEVEL); if ((cube_res == light_cache->cube_tx.tex_size[0]) && @@ -464,7 +466,7 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake) /* TODO validate irradiance and reflection cache independantly... */ if (lbake->lcache != NULL && - !EEVEE_lightcache_validate(lbake->lcache, lbake->cube_len, lbake->ref_cube_res, lbake->irr_size)) + !EEVEE_lightcache_validate(lbake->lcache, lbake->cube_len, lbake->ref_cube_res, lbake->grid_len, lbake->irr_size)) { eevee->light_cache = lbake->lcache = NULL; } -- cgit v1.2.3