Commit: 0aca8b017436395fc3af62d6265d16fd6d531f1a
Author: Jeroen Bakker
Date:   Tue Mar 19 13:29:22 2019 +0100
Branches: master
https://developer.blender.org/rB0aca8b017436395fc3af62d6265d16fd6d531f1a

EEVEE/LookDev: Fix Cache In Quad View

When using LookDev in Quad view the cache was only updated for the first
Q-view. The evaluation data of the last cache was not stored with the
lightprobe textures. As the evaluation data was reused between the
Q-views only the lightprobe textures of the first view was updated.

With this patch the evaluated data is stored amongside the actual
lightprobe textures.

Fix T59046

Reviewed By: fclem

Maniphest Tasks: T59046

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

M       source/blender/draw/engines/eevee/eevee_lookdev.c
M       source/blender/draw/engines/eevee/eevee_private.h

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

diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c 
b/source/blender/draw/engines/eevee/eevee_lookdev.c
index 2f89476e832..b07b20386a8 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -41,6 +41,7 @@
 static void eevee_lookdev_lightcache_delete(EEVEE_Data *vedata)
 {
        EEVEE_StorageList *stl = vedata->stl;
+       EEVEE_PrivateData *g_data = stl->g_data;
        EEVEE_TextureList *txl = vedata->txl;
 
        MEM_SAFE_FREE(stl->lookdev_lightcache);
@@ -48,6 +49,8 @@ static void eevee_lookdev_lightcache_delete(EEVEE_Data 
*vedata)
        MEM_SAFE_FREE(stl->lookdev_cube_data);
        DRW_TEXTURE_FREE_SAFE(txl->lookdev_grid_tx);
        DRW_TEXTURE_FREE_SAFE(txl->lookdev_cube_tx);
+       g_data->studiolight_index = -1;
+       g_data->studiolight_rot_z = 0.0f;
 }
 
 void EEVEE_lookdev_cache_init(
@@ -57,6 +60,7 @@ void EEVEE_lookdev_cache_init(
 {
        EEVEE_StorageList *stl = vedata->stl;
        EEVEE_TextureList *txl = vedata->txl;
+       EEVEE_PrivateData *g_data = stl->g_data;
        const DRWContextState *draw_ctx = DRW_context_state_get();
        View3D *v3d = draw_ctx->v3d;
        if (LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)) {
@@ -132,13 +136,12 @@ void EEVEE_lookdev_cache_init(
                        DRW_shgroup_uniform_texture(*grp, "image", tex);
 
                        /* Do we need to recalc the lightprobes? */
-                       if (pinfo &&
-                           ((pinfo->studiolight_index != sl->index) ||
-                            (pinfo->studiolight_rot_z != 
v3d->shading.studiolight_rot_z)))
+                       if (g_data->studiolight_index != sl->index ||
+                           g_data->studiolight_rot_z != 
v3d->shading.studiolight_rot_z)
                        {
                                stl->lookdev_lightcache->flag |= 
LIGHTCACHE_UPDATE_WORLD;
-                               pinfo->studiolight_index = sl->index;
-                               pinfo->studiolight_rot_z = 
v3d->shading.studiolight_rot_z;
+                               g_data->studiolight_index = sl->index;
+                               g_data->studiolight_rot_z = 
v3d->shading.studiolight_rot_z;
                        }
                }
        }
diff --git a/source/blender/draw/engines/eevee/eevee_private.h 
b/source/blender/draw/engines/eevee/eevee_private.h
index e0ee689f5df..c9ae245c550 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -486,8 +486,6 @@ typedef struct EEVEE_LightProbesInfo {
        float visibility_blur;
        float intensity_fac;
        int shres;
-       int studiolight_index;
-       float studiolight_rot_z;
        EEVEE_LightProbeVisTest planar_vis_tests[MAX_PLANAR];
        /* UBO Storage : data used by UBO */
        EEVEE_LightProbe probe_data[MAX_PROBE];
@@ -818,6 +816,11 @@ typedef struct EEVEE_PrivateData {
 
        /* Color Management */
        bool use_color_render_settings;
+
+       /* LookDev Settings */
+       int studiolight_index;
+       float studiolight_rot_z;
+
 } EEVEE_PrivateData; /* Transient data */
 
 /* eevee_data.c */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to