From d93b78cfda4487c8bf9254f1188f114716f11cd9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 5 Oct 2018 12:42:27 -0700 Subject: glsl-1.10: Verify that gl_TexCoord 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_TexCoord 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_TexCoord' : 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. Signed-off-by: Ian Romanick Cc: Andrii Simiklit --- .../compiler/redeclarations/gl_TexCoord-as-global.frag | 13 +++++++++++++ .../compiler/redeclarations/gl_TexCoord-as-global.vert | 13 +++++++++++++ .../compiler/redeclarations/gl_TexCoord-as-uniform.frag | 13 +++++++++++++ .../compiler/redeclarations/gl_TexCoord-as-uniform.vert | 13 +++++++++++++ .../redeclarations/gl_TexCoord-as-varying-vec3.frag | 13 +++++++++++++ .../redeclarations/gl_TexCoord-as-varying-vec3.vert | 13 +++++++++++++ .../compiler/redeclarations/gl_TexCoord-as-varying.frag | 13 +++++++++++++ .../compiler/redeclarations/gl_TexCoord-as-varying.vert | 13 +++++++++++++ 8 files changed, 104 insertions(+) create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.frag create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.vert create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.frag create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.vert create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.frag create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.vert create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.frag create mode 100644 tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.vert diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.frag b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.frag new file mode 100644 index 000000000..e2480444e --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.frag @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +vec4 gl_TexCoord[2]; + +void main() +{ + gl_FragColor = vec4(0); +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.vert b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.vert new file mode 100644 index 000000000..510073343 --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-global.vert @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +vec4 gl_TexCoord[2]; + +void main() +{ + gl_Position = gl_Vertex; +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.frag b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.frag new file mode 100644 index 000000000..21e33bb06 --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.frag @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +uniform vec4 gl_TexCoord[2]; + +void main() +{ + gl_FragColor = vec4(0); +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.vert b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.vert new file mode 100644 index 000000000..db734efed --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-uniform.vert @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +uniform vec4 gl_TexCoord[2]; + +void main() +{ + gl_Position = gl_Vertex; +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.frag b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.frag new file mode 100644 index 000000000..4c8d603db --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.frag @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +varying vec3 gl_TexCoord[2]; + +void main() +{ + gl_FragColor = vec4(0); +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.vert b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.vert new file mode 100644 index 000000000..537a0be93 --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying-vec3.vert @@ -0,0 +1,13 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +varying vec3 gl_TexCoord[2]; + +void main() +{ + gl_Position = gl_Vertex; +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.frag b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.frag new file mode 100644 index 000000000..c40aad933 --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.frag @@ -0,0 +1,13 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +varying vec4 gl_TexCoord[2]; + +void main() +{ + gl_FragColor = vec4(0); +} diff --git a/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.vert b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.vert new file mode 100644 index 000000000..25950b3be --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/redeclarations/gl_TexCoord-as-varying.vert @@ -0,0 +1,13 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.10 + * [end config] + */ +#version 110 + +varying vec4 gl_TexCoord[2]; + +void main() +{ + gl_Position = gl_Vertex; +} -- cgit v1.2.3