Closed paulthomson closed 5 years ago
I believe dFdy is not allowed in a compute shader, and that we found this issue due to having a bug in GraphicsFuzz where fragment processing builtins were getting used in compute shaders.
@johnkslang should glslang complain when a fragment processing builtin is used in a compute shader?
Yes, it is a semantic error. I suspect some extensions broadened where these were accepted, without enough error checking.
It looks like GL_NV_compute_shader_derivatives, via beae2251b, unconditionally added these functions to the compute stage, and then conditionally required extensions to use them for the fragment stage, leaving them wide open in the compute stage.
The specification says:
This extension can be applied to OpenGL GLSL versions 4.50 (#version 450) and higher.
This extension can be applied to OpenGL ES ESSL versions 3.20 (#version 320) and higher.
This logic was attempted for setting the extensions, except done the fragment stage instead of the compute stage, while the logic was not applied at all for where the base functions are provided, hence ES picked them all up for free, no extension required.
bug_report.zip
Issue found using GraphicsFuzz.
Tool versions:
To reproduce:
glslangValidator -V shader.comp -o shader.comp.spv
spirv-val shader.comp.spv
The following shader files are included in the attached archive, some of which are also shown inline below:
0_glsl/shader.comp:
1_spirv_asm/shader.comp.asm: