diff options
author | Anuj Phogat <anuj.phogat@gmail.com> | 2014-02-10 18:03:15 -0800 |
---|---|---|
committer | Anuj Phogat <anuj.phogat@gmail.com> | 2014-02-20 13:09:11 -0800 |
commit | 347b3def80228a0824bef2093969e10c6b8c2373 (patch) | |
tree | 2b073bd6a147bbd98ab0017bc57cac34fcb207ed /tests/spec/glsl-1.50 | |
parent | f82ec911dea1d6ca97d3929a8fa50a789d723818 (diff) |
glsl-1.50: Add compiler tests to verify gl_FragCoord layout qualifiers
Both tests in this patch pass with proprietary linux drivers of:
NVIDIA (version 331.38) and AMD (version 9.012).
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests/spec/glsl-1.50')
3 files changed, 111 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag new file mode 100644 index 000000000..558800e7e --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-1.frag @@ -0,0 +1,37 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * check_link: false + * [end config] + */ + +/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says: + * + * "Fragment shaders can have an input layout only for redeclaring the + * built-in variable gl_FragCoord (see section 7.2 Fragment Shader + * Special Variables). The layout qualifier identifiers for + * gl_FragCoord are + * + * layout-qualifier-id: + * origin_upper_left + * pixel_center_integer" + * + * "If gl_FragCoord is redeclared in any fragment shader in a program, + * it must be redeclared in all the fragment shaders in that program + * that have a static use gl_FragCoord. All redeclarations of + * gl_FragCoord in all fragment shaders in a single program must have + * the same set of qualifiers." + * + * Tests the conflicting redeclarations of gl_FragCoord within same fragment + * shader. + */ + +#version 150 + +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; +layout(origin_upper_left) in vec4 gl_FragCoord; +out vec4 fragcolor; +void main() +{ + fragcolor = gl_FragCoord.xyzz; +} diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag new file mode 100644 index 000000000..9a3e9f5ac --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-2.frag @@ -0,0 +1,37 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * check_link: false + * [end config] + */ + +/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says: + * + * "Fragment shaders can have an input layout only for redeclaring the + * built-in variable gl_FragCoord (see section 7.2 Fragment Shader + * Special Variables). The layout qualifier identifiers for + * gl_FragCoord are + * + * layout-qualifier-id: + * origin_upper_left + * pixel_center_integer" + * + * "If gl_FragCoord is redeclared in any fragment shader in a program, + * it must be redeclared in all the fragment shaders in that program + * that have a static use gl_FragCoord. All redeclarations of + * gl_FragCoord in all fragment shaders in a single program must have + * the same set of qualifiers." + * + * Tests the conflicting redeclarations in a fragment shader cause the compile + * failure even if gl_FragCoord is not used. + */ + +#version 150 + +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; +layout(origin_upper_left) in vec4 gl_FragCoord; +out vec4 fragcolor; +void main() +{ + fragcolor = vec4(1.0); +} diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag new file mode 100644 index 000000000..63942cc58 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-matching.frag @@ -0,0 +1,37 @@ +/* [config] + * expect_result: pass + * glsl_version: 1.50 + * check_link: false + * [end config] + */ + +/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says: + * + * "Fragment shaders can have an input layout only for redeclaring the + * built-in variable gl_FragCoord (see section 7.2 Fragment Shader + * Special Variables). The layout qualifier identifiers for + * gl_FragCoord are + * + * layout-qualifier-id: + * origin_upper_left + * pixel_center_integer" + * + * "If gl_FragCoord is redeclared in any fragment shader in a program, + * it must be redeclared in all the fragment shaders in that program + * that have a static use gl_FragCoord. All redeclarations of + * gl_FragCoord in all fragment shaders in a single program must have + * the same set of qualifiers." + * + * Tests the matching redeclarations of gl_FragCoord within same fragment + * shader. + */ + +#version 150 + +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; +layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; + +void main() +{ + gl_FragColor = gl_FragCoord.xyzz; +} |