[Piglit] [PATCH 17/19] arb_gpu_shader5: Add a constant eval bitfieldExtract execution test.

Matt Turner mattst88 at gmail.com
Sun Apr 28 15:39:41 PDT 2013


v2: Call nonexistent bad_constant_folding() function if test fails.
---
 .../const-bitfieldExtract.shader_test              | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitfieldExtract.shader_test

diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitfieldExtract.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitfieldExtract.shader_test
new file mode 100644
index 0000000..ed6b988
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitfieldExtract.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 vertex;
+
+void main() {
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+void bad_constant_folding();
+
+out vec4 color;
+
+void main()
+{
+	/* Green if both pass. */
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	if (ivec4(0) != bitfieldExtract(ivec4(2147483647, 15, 7, 3), 0, 0))
+		bad_constant_folding();
+
+	if (uvec4(0u) != bitfieldExtract(uvec4(0xFFFFFFFFu, 15u, 7u, 3u), 0, 0))
+		bad_constant_folding();
+
+	if (ivec4(-1) != bitfieldExtract(ivec4(1), 0, 1))
+		bad_constant_folding();
+
+	if (uvec4(1u) != bitfieldExtract(uvec4(1u), 0, 1))
+		bad_constant_folding();
+
+	if (ivec4(1, -1, -1, 1) != bitfieldExtract(ivec4(1, 3, 3, 1), 0, 2))
+		bad_constant_folding();
+
+	if (ivec4(-1, 0, 1, 3) != bitfieldExtract(ivec4(983040, 61440, 114688, 229376), 16, 4))
+		bad_constant_folding();
+
+	if (uvec4(0xFu, 0x0u, 0x1u, 0x3u) != bitfieldExtract(uvec4(0x000F0000u, 0x0000F000u, 0x0001C000u, 0x00038000u), 16, 4))
+		bad_constant_folding();
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.1.5



More information about the Piglit mailing list