Fix: EEVEE: Light: Invalid read in Shadow Setup shader
This happened in scenes with high light count and with some local light being culled. The culled lights indices would still be processed and load undefined data. This undefined data might be interpreted as a sunlight and go into the cascade setup loop with an undefined number of levels. This created loops of 1 billion iteration per thread which triggered the TDR on windows. The fix is to skip the culled light indices. Fixes #123413 Fixes #123190
This commit is contained in:
@@ -252,7 +252,14 @@ void cubeface_sync(int tilemap_id,
|
||||
void main()
|
||||
{
|
||||
uint l_idx = gl_GlobalInvocationID.x;
|
||||
if (l_idx >= light_cull_buf.items_count) {
|
||||
/* We are dispatching (with padding) over the culled light array.
|
||||
* This array is not contiguous. Visible local lights are packed at the begining
|
||||
* and directional lights at the end. There is a range of uninitialized value in between that
|
||||
* needs to be avoided. */
|
||||
bool valid_local = (l_idx < light_cull_buf.visible_count);
|
||||
bool valid_directional = (l_idx >= light_cull_buf.local_lights_len) &&
|
||||
(l_idx < light_cull_buf.items_count);
|
||||
if (!valid_local || !valid_directional) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user