diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2018-10-05 16:37:27 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2018-10-24 15:14:41 -0700 |
commit | 3ec50346feec55b05d459fee59d7d2f41bddf9e1 (patch) | |
tree | 3fdf45095ee91cd6d1095ebf20c43eaf9cbb32bc | |
parent | 7045dfa0c6baead0d27d0ad2753cff619b3964e5 (diff) |
glsl-1.50: Verify that gl_ClipDistance cannot be redeclared to change qualifier or type
glslangValidator rejects all of the shaders that try to change the
qualifier with errors like:
ERROR: 0:8: 'redeclaration' : cannot change qualification of gl_ClipDistance
Mesa currently allows all of them to compile. Closed-source drivers
have not been tested.
glslangValidator rejects the shaders that try to change the type with:
ERROR: 0:8: 'gl_ClipDistance' : redeclaration of array with a different element type
Mesa currently rejects these with a somewhat less helpful error message.
Closed-source drivers have not been tested.
NOTE: The lone .vert test is here because vertex shader array input were
added in GLSL 1.50.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Andrii Simiklit <andrii.simiklit@globallogic.com>
6 files changed, 98 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom new file mode 100644 index 000000000..27fb48b7b --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom @@ -0,0 +1,17 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * [end config] + */ +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +float gl_ClipDistance[2]; + +void main() +{ + gl_Position = vec4(0); + EmitVertex(); +} diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom new file mode 100644 index 000000000..abbb9551c --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom @@ -0,0 +1,17 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * [end config] + */ +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +in float gl_ClipDistance[2]; + +void main() +{ + gl_Position = vec4(0); + EmitVertex(); +} diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert new file mode 100644 index 000000000..a2b671d28 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * [end config] + */ +#version 150 + +in float gl_ClipDistance[2]; + +void main() +{ + gl_Position = gl_Vertex; +} diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom new file mode 100644 index 000000000..680d44d4d --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom @@ -0,0 +1,17 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * [end config] + */ +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +out vec2 gl_ClipDistance[2]; + +void main() +{ + gl_Position = vec4(0); + EmitVertex(); +} diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom new file mode 100644 index 000000000..54e3ccc2f --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom @@ -0,0 +1,17 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.50 + * [end config] + */ +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +out float gl_ClipDistance[2]; + +void main() +{ + gl_Position = vec4(0); + EmitVertex(); +} diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom new file mode 100644 index 000000000..e0c550edd --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom @@ -0,0 +1,17 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * [end config] + */ +#version 150 + +layout(points) in; +layout(points, max_vertices = 1) out; + +uniform float gl_ClipDistance[2]; + +void main() +{ + gl_Position = vec4(0); + EmitVertex(); +} |