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
Using the variable gl_WorkGroupSize before a workgroup size declaration in the source results in the builtin having the value {1,1,1}. I think this doesn't align with the specification, but even if it does, I think this behavior is counterintuitive and bug-prone, and should merit at least a warning or an error.
I agree that this is a bug, based on this passage from the GLSL spec:
It is a compile-time error to use gl_WorkGroupSize in a shader that does not declare a fixed
workgroup size, or before that shader has declared a fixed workgroup size, using local_size_x,
local_size_y, and local_size_z.
I interpret the word before here as referring to static position, since a dynamic interpretation is trivially true.
I consequently believe that the compiler should have given an error on the usage of gl_WorkgroupSize in fn() since it had not been completely initialized at this static position in the program.
I believe the GLSL spec is clear on this point and does not need to be updated.
I will ping the GLSL spec editor @gnl21 to confirm.
Would you like to submit a PR or have someone else fix it? I should be able to get to this in the near-to-medium term.
I agree that this is a bug and that it should be an error. Perhaps the spec should say that no compilation unit (rather than shader) may use the workgroup size without declaring it.
Using the variable gl_WorkGroupSize before a workgroup size declaration in the source results in the builtin having the value {1,1,1}. I think this doesn't align with the specification, but even if it does, I think this behavior is counterintuitive and bug-prone, and should merit at least a warning or an error.
http://shader-playground.timjones.io/a5c1b173a1fd1458c9059677b745b6c0
The text was updated successfully, but these errors were encountered: