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-10-23 19:04:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-10-23 19:04:45 +0300
commited7f6b511f817d9b93eecb07955a30eb3a5afb87 (patch)
treecdcdbe3cbc99e017c092bfe6cd446ac033ce763e /source/blender/draw
parent8e8d1cab6f605d738911bf2172cbe6e04870da9f (diff)
Eevee: Fix lightcache not working for small caches
Was caused by a threading issue. The lightcache was free before the endjob function pass it to the scene. Also fix cache reuse if size matches.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index f7945da196e..425749b0b52 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -226,7 +226,7 @@ static bool EEVEE_lightcache_validate(
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]) &&
- (grid_len != light_cache->grid_len))
+ (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]) &&
@@ -472,8 +472,7 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake)
lbake->lcache = eevee->light_cache;
/* TODO validate irradiance and reflection cache independently... */
- if (lbake->lcache != NULL &&
- !EEVEE_lightcache_validate(lbake->lcache, lbake->cube_len, lbake->ref_cube_res, lbake->grid_len, lbake->irr_size))
+ if (!EEVEE_lightcache_validate(lbake->lcache, lbake->cube_len, lbake->ref_cube_res, lbake->grid_len, lbake->irr_size))
{
eevee->light_cache = lbake->lcache = NULL;
}
@@ -613,11 +612,6 @@ static void eevee_lightbake_delete_resources(EEVEE_LightBake *lbake)
DRW_opengl_context_enable();
}
- if (lbake->own_light_cache) {
- EEVEE_lightcache_free(lbake->lcache);
- lbake->lcache = NULL;
- }
-
/* XXX Free the resources contained in the viewlayer data
* to be able to free the context before deleting the depsgraph. */
if (lbake->sldata) {