No subject
Tue Sep 6 13:13:38 PDT 2011
As with all arrays, indices used to subscript gl_TexCoord must
either be an integral constant expressions, or this array must be
re-declared by the shader with a size. The size can be at most
gl_MaxTextureCoords.
This patch adds test to verify that when gl_TexCoord is implicitly
sized, it is an error to access it with an integral constant
expression equal to gl_MaxTextureCoords.
I've verified that these tests pass on the nVidia proprietary Linux
driver.
---
.../compiler/texcoord/implicit-access-max.frag | 26 +++++++++++++++++++
.../compiler/texcoord/implicit-access-max.vert | 27 ++++++++++++++++++++
2 files changed, 53 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.frag
create mode 100644 tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.vert
diff --git a/tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.frag b/tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.frag
new file mode 100644
index 0000000..9840b05
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.frag
@@ -0,0 +1,26 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.10 spec section 7.6 (Varying Variables):
+ *
+ * As with all arrays, indices used to subscript gl_TexCoord must
+ * either be an integral constant expressions, or this array must be
+ * re-declared by the shader with a size. The size can be at most
+ * gl_MaxTextureCoords.
+ *
+ * This implies that when gl_TexCoord is implicitly sized, it must not
+ * be accessed with integral constant expressions larger than (or
+ * equal to) gl_MaxTextureCoords.
+ *
+ * This test checks that the an error occurs when the size of
+ * gl_TexCoord is implicit, and we try to access a non-existent
+ * element (gl_TexCoord[gl_MaxTextureCoords]) using an integral
+ * constant expression.
+ */
+void main()
+{
+ gl_FragColor = gl_TexCoord[gl_MaxTextureCoords];
+}
diff --git a/tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.vert b/tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.vert
new file mode 100644
index 0000000..a17406f
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/texcoord/implicit-access-max.vert
@@ -0,0 +1,27 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.10 spec section 7.6 (Varying Variables):
+ *
+ * As with all arrays, indices used to subscript gl_TexCoord must
+ * either be an integral constant expressions, or this array must be
+ * re-declared by the shader with a size. The size can be at most
+ * gl_MaxTextureCoords.
+ *
+ * This implies that when gl_TexCoord is implicitly sized, it must not
+ * be accessed with integral constant expressions larger than (or
+ * equal to) gl_MaxTextureCoords.
+ *
+ * This test checks that the an error occurs when the size of
+ * gl_TexCoord is implicit, and we try to access a non-existent
+ * element (gl_TexCoord[gl_MaxTextureCoords]) using an integral
+ * constant expression.
+ */
+void main()
+{
+ gl_Position = gl_Vertex;
+ gl_TexCoord[gl_MaxTextureCoords] = vec4(1.0);
+}
--
1.7.6
More information about the Piglit
mailing list