Browse Source

Clear last frame directional light buffer when number of lights changes.
This ensures that the buffers don't go out of sync.

clayjohn 2 years ago
parent
commit
72d899702b

+ 1 - 0
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -683,6 +683,7 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
 				light_data_dirty = true;
 				light_data_dirty = true;
 				for (uint32_t i = sky_globals.directional_light_count; i < sky_globals.max_directional_lights; i++) {
 				for (uint32_t i = sky_globals.directional_light_count; i < sky_globals.max_directional_lights; i++) {
 					sky_globals.directional_lights[i].enabled = false;
 					sky_globals.directional_lights[i].enabled = false;
+					sky_globals.last_frame_directional_lights[i].enabled = false;
 				}
 				}
 			}
 			}
 
 

+ 1 - 0
servers/rendering/renderer_rd/environment/sky.cpp

@@ -1261,6 +1261,7 @@ void SkyRD::setup(RID p_env, Ref<RenderSceneBuffersRD> p_render_buffers, const P
 				light_data_dirty = true;
 				light_data_dirty = true;
 				for (uint32_t i = sky_scene_state.ubo.directional_light_count; i < sky_scene_state.max_directional_lights; i++) {
 				for (uint32_t i = sky_scene_state.ubo.directional_light_count; i < sky_scene_state.max_directional_lights; i++) {
 					sky_scene_state.directional_lights[i].enabled = false;
 					sky_scene_state.directional_lights[i].enabled = false;
+					sky_scene_state.last_frame_directional_lights[i].enabled = false;
 				}
 				}
 			}
 			}