Commit: 4e7d9b7a98452907c19154d12a825dab274253ae
Author: Clément Foucault
Date:   Tue Mar 6 02:36:00 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB4e7d9b7a98452907c19154d12a825dab274253ae

Eevee: Fix probes not working after a world update.

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

M       source/blender/draw/engines/eevee/eevee_lightprobes.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c 
b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 9705ba7d645..4d8c6f90fc5 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -428,20 +428,15 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *vedat
 
                        if (wo->update_flag != 0 || pinfo->prev_world != wo || 
pinfo->prev_wo_sh_compiled != wo_sh_compiled) {
                                pinfo->update_world |= PROBE_UPDATE_ALL;
-                               pinfo->updated_bounce = 0;
-                               pinfo->grid_initialized = false;
-
                                pinfo->prev_wo_sh_compiled = wo_sh_compiled;
                                pinfo->prev_world = wo;
                        }
                        wo->update_flag = 0;
                }
                else if (pinfo->prev_world) {
+                       pinfo->update_world |= PROBE_UPDATE_ALL;
                        pinfo->prev_wo_sh_compiled = false;
                        pinfo->prev_world = NULL;
-                       pinfo->update_world |= PROBE_UPDATE_ALL;
-                       pinfo->updated_bounce = 0;
-                       pinfo->grid_initialized = false;
                }
 
                /* Fallback if shader fails or if not using nodetree. */
@@ -885,6 +880,7 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *ved
        /* Free textures if number mismatch. */
        if (pinfo->num_cube != pinfo->cache_num_cube) {
                DRW_TEXTURE_FREE_SAFE(sldata->probe_pool);
+               pinfo->cache_num_cube = pinfo->num_cube;
        }
 
        if (pinfo->num_planar != pinfo->cache_num_planar) {
@@ -914,12 +910,12 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *ved
                if (sldata->probe_filter_fb) {
                        DRW_framebuffer_texture_attach(sldata->probe_filter_fb, 
sldata->probe_pool, 0, 0);
                }
-
                /* Tag probes to refresh */
                pinfo->update_world |= PROBE_UPDATE_CUBE;
-               common_data->prb_num_render_cube = 0;
-               pinfo->cache_num_cube = pinfo->num_cube;
+       }
 
+       if ((pinfo->update_world & PROBE_UPDATE_CUBE) != 0) {
+               common_data->prb_num_render_cube = 0;
                for (int i = 1; (ob = pinfo->probes_cube_ref[i]) && (i < 
MAX_PROBE); i++) {
                        EEVEE_LightProbeEngineData *ped = 
EEVEE_lightprobe_data_ensure(ob);
                        ped->need_update = true;
@@ -949,11 +945,14 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *ved
                        sldata->irradiance_rt = 
DRW_texture_create_2D_array(irr_size[0], irr_size[1], irr_size[2],
                                                                            
irradiance_format, DRW_TEX_FILTER, NULL);
                }
-               common_data->prb_num_render_grid = 0;
-               pinfo->updated_bounce = 0;
-               pinfo->grid_initialized = false;
+               /* Tag probes to refresh */
                pinfo->update_world |= PROBE_UPDATE_GRID;
+               pinfo->grid_initialized = false;
+       }
 
+       if ((pinfo->update_world & PROBE_UPDATE_GRID) != 0) {
+               common_data->prb_num_render_grid = 0;
+               pinfo->updated_bounce = 0;
                for (int i = 1; (ob = pinfo->probes_grid_ref[i]) && (i < 
MAX_PROBE); i++) {
                        EEVEE_LightProbeEngineData *ped = 
EEVEE_lightprobe_data_ensure(ob);
                        ped->need_update = true;

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

Reply via email to