You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All released version of 4.x including the soon to be released 4.3
System information
All systems
Issue description
In many of our compute shaders we utilize memory barriers to synchronize threads before proceeding. Barriers must be uniform in terms of control flow, which means that they cannot be used in situations where one thread in a group may not reach them.
A common way where one thread may not reach a barrier in a group is if the barrier is behind an if statement and the condition is non-uniform. Another common way is if the shader returns before the barrier conditionally (non-uniform).
The latter is a common pattern in Godot. We do an early return for threads which won't contribute to the output of the shader.
The consequence of returning non-uniformly is that it is possible for the shader to crash, fail to run, or hang indefinitely. We first encountered this problem while working on HDDAGI and testing it on Intel devices.
This problem is likely responsible for a lot of the "Device Lost" errors that we get and should be remedied as soon as possible.
The solution is to move the non-uniform control flow statements to after all the barriers have been executed. For example, for the jumpflood stage of SDFGI, we could take the return here:
Tested versions
All released version of 4.x including the soon to be released 4.3
System information
All systems
Issue description
In many of our compute shaders we utilize memory barriers to synchronize threads before proceeding. Barriers must be uniform in terms of control flow, which means that they cannot be used in situations where one thread in a group may not reach them.
A common way where one thread may not reach a barrier in a group is if the barrier is behind an if statement and the condition is non-uniform. Another common way is if the shader returns before the barrier conditionally (non-uniform).
The latter is a common pattern in Godot. We do an early return for threads which won't contribute to the output of the shader.
The consequence of returning non-uniformly is that it is possible for the shader to crash, fail to run, or hang indefinitely. We first encountered this problem while working on HDDAGI and testing it on Intel devices.
This problem is likely responsible for a lot of the "Device Lost" errors that we get and should be remedied as soon as possible.
The solution is to move the non-uniform control flow statements to after all the barriers have been executed. For example, for the jumpflood stage of SDFGI, we could take the return here:
godot/servers/rendering/renderer_rd/shaders/environment/sdfgi_preprocess.glsl
Lines 377 to 384 in 607b230
And simply move it to be after the barrier.
Steps to reproduce
Run Godot with one of the following effects:
Minimal reproduction project (MRP)
The problem is internal to Godot
The text was updated successfully, but these errors were encountered: