[Piglit] [PATCH] Test precision and implied components of integer vertex attribs

Paul Berry stereotype441 at gmail.com
Mon Oct 31 17:26:10 PDT 2011


These test verify that for vertex attributes of integral types (in
particular, ivec4 and uvec4), the following are true:

(a) The vertex attributes have the full 32 bits of integer precision.

(b) Unspecified components are filled in with the proper integral
representation of y=0, z=0, and w=1.
---
 .../execution/vs-attrib-ivec4-implied.shader_test  |   48 ++++++++++++++++++++
 .../vs-attrib-ivec4-precision.shader_test          |   45 ++++++++++++++++++
 .../execution/vs-attrib-uvec4-implied.shader_test  |   48 ++++++++++++++++++++
 .../vs-attrib-uvec4-precision.shader_test          |   45 ++++++++++++++++++
 4 files changed, 186 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/execution/vs-attrib-ivec4-implied.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-attrib-ivec4-precision.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-attrib-uvec4-implied.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-attrib-uvec4-precision.shader_test

diff --git a/tests/spec/glsl-1.30/execution/vs-attrib-ivec4-implied.shader_test b/tests/spec/glsl-1.30/execution/vs-attrib-ivec4-implied.shader_test
new file mode 100644
index 0000000..7700878
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-attrib-ivec4-implied.shader_test
@@ -0,0 +1,48 @@
+# Check that unspecified components of vertex attributes are properly
+# filled in when the type is ivec4.
+#
+# This test sends the vertex shader a pair of vertex attributes of
+# type ivec4.  For the first attribute, it passes a size of 1,
+# indidcating that the only specified value is the x component, and
+# the y, z, and w components are implied to be 0, 0, and 1,
+# respectively.  For the second attribute, it passes a size of 4, and
+# specifies the values y=0, z=0, and w=1 explicitly.  The vertex
+# shader verifies that the two vertex attributes are equal.  This
+# verifies that the GL implementation properly filled in the values 0,
+# 0, and 1 in the first attribute.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+attribute vec4 vertex;
+attribute ivec4 x;
+attribute ivec4 y;
+
+void main()
+{
+	gl_Position = vertex;
+	if (x == y)
+		gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+void main()
+{
+	gl_FragColor = gl_Color;
+}
+
+[vertex data]
+vertex/float/2  x/int/1      y/int/4
+-1.0 -1.0       0x2f6dc4c6   0x2f6dc4c6 0 0 1
+ 1.0 -1.0      -0x45c1613a  -0x45c1613a 0 0 1
+ 1.0  1.0      -0x1839ec67  -0x1839ec67 0 0 1
+-1.0  1.0       0x6c77114e   0x6c77114e 0 0 1
+
+[test]
+draw arrays GL_QUADS 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-attrib-ivec4-precision.shader_test b/tests/spec/glsl-1.30/execution/vs-attrib-ivec4-precision.shader_test
new file mode 100644
index 0000000..d69d90e
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-attrib-ivec4-precision.shader_test
@@ -0,0 +1,45 @@
+# Check that vertex attributes whose type is ivec4 actually have 32
+# bits of precision.
+#
+#
+# This test sends the vertex shader various pairs of integral vertex
+# attributes that differ by exactly 1, and the vertex shader verifies
+# that the difference is exactly 1.  This verifies that the vertex
+# attributes haven't gone through a process that loses precision
+# (e.g. conversion to vec4 and back to ivec4).
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+attribute vec4 vertex;
+attribute ivec4 x;
+attribute ivec4 y;
+
+void main()
+{
+	gl_Position = vertex;
+	if (y - x == ivec4(1, 1, 1, 1))
+		gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+void main()
+{
+	gl_FragColor = gl_Color;
+}
+
+[vertex data]
+vertex/float/2 x/int/4                                          y/int/4
+-1.0 -1.0      0x2f6dc4c6 -0x3e433294 -0x2dcaca76  0x69c54892  0x2f6dc4c7 -0x3e433293 -0x2dcaca75  0x69c54893
+ 1.0 -1.0     -0x45c1613a  0x514c063c  0x54be6d2b -0x755a8610 -0x45c16139  0x514c063d  0x54be6d2c -0x755a860f
+ 1.0  1.0     -0x1839ec67  0x4f49620f -0x1509bf47  0x266ef031 -0x1839ec66  0x4f496210 -0x1509bf46  0x266ef032
+-1.0  1.0      0x6c77114e  0x0c975f8b  0x6e0467a1  0x11d6b169  0x6c77114f  0x0c975f8c  0x6e0467a2  0x11d6b16a
+
+[test]
+draw arrays GL_QUADS 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-attrib-uvec4-implied.shader_test b/tests/spec/glsl-1.30/execution/vs-attrib-uvec4-implied.shader_test
new file mode 100644
index 0000000..aab6d78
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-attrib-uvec4-implied.shader_test
@@ -0,0 +1,48 @@
+# Check that unspecified components of vertex attributes are properly
+# filled in when the type is uvec4.
+#
+# This test sends the vertex shader a pair of vertex attributes of
+# type uvec4.  For the first attribute, it passes a size of 1,
+# indidcating that the only specified value is the x component, and
+# the y, z, and w components are implied to be 0, 0, and 1,
+# respectively.  For the second attribute, it passes a size of 4, and
+# specifies the values y=0, z=0, and w=1 explicitly.  The vertex
+# shader verifies that the two vertex attributes are equal.  This
+# verifies that the GL implementation properly filled in the values 0,
+# 0, and 1 in the first attribute.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+attribute vec4 vertex;
+attribute uvec4 x;
+attribute uvec4 y;
+
+void main()
+{
+	gl_Position = vertex;
+	if (x == y)
+		gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+void main()
+{
+	gl_FragColor = gl_Color;
+}
+
+[vertex data]
+vertex/float/2 x/uint/1    y/uint/4
+-1.0 -1.0      0xa62b25d1  0xa62b25d1 0 0 1
+ 1.0 -1.0      0x19eb64f2  0x19eb64f2 0 0 1
+ 1.0  1.0      0x098b61e0  0x098b61e0 0 0 1
+-1.0  1.0      0xb0741d16  0xb0741d16 0 0 1
+
+[test]
+draw arrays GL_QUADS 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/vs-attrib-uvec4-precision.shader_test b/tests/spec/glsl-1.30/execution/vs-attrib-uvec4-precision.shader_test
new file mode 100644
index 0000000..99bee7f
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-attrib-uvec4-precision.shader_test
@@ -0,0 +1,45 @@
+# Check that vertex attributes whose type is uvec4 actually have 32
+# bits of precision.
+#
+#
+# This test sends the vertex shader various pairs of integral vertex
+# attributes that differ by exactly 1, and the vertex shader verifies
+# that the difference is exactly 1.  This verifies that the vertex
+# attributes haven't gone through a process that loses precision
+# (e.g. conversion to vec4 and back to uvec4).
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+attribute vec4 vertex;
+attribute uvec4 x;
+attribute uvec4 y;
+
+void main()
+{
+	gl_Position = vertex;
+	if (y - x == uvec4(1, 1, 1, 1))
+		gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+void main()
+{
+	gl_FragColor = gl_Color;
+}
+
+[vertex data]
+vertex/float/2 x/uint/4                                    y/uint/4
+-1.0 -1.0      0xa62b25d1 0x224e8e32 0x0c4ee1fc 0xc8f0e8ca 0xa62b25d2 0x224e8e33 0x0c4ee1fd 0xc8f0e8cb
+ 1.0 -1.0      0x19eb64f2 0x6699cf95 0xba1b25ac 0x7a399139 0x19eb64f3 0x6699cf96 0xba1b25ad 0x7a39913a
+ 1.0  1.0      0x098b61e0 0x730197b3 0x6aa4e07e 0xf79ca532 0x098b61e1 0x730197b4 0x6aa4e07f 0xf79ca533
+-1.0  1.0      0xb0741d16 0x5416e667 0xd25ea78d 0x2a64127f 0xb0741d17 0x5416e668 0xd25ea78e 0x2a641280
+
+[test]
+draw arrays GL_QUADS 0 4
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.7.6.4



More information about the Piglit mailing list