[Piglit] [PATCH] glsl-fs-main-return-conditional: Test for using return in main

sroland at vmware.com sroland at vmware.com
Fri Mar 22 15:28:38 PDT 2013


From: Roland Scheidegger <sroland at vmware.com>

Similar to glsl-fs-main-return (and glsl-vs-main-return), this is testing
using return in main. Contrary to the these other tests, this hits both
the cases where the return path is and is NOT taken (the gallivm code
got it wrong and always did an early exit which got unnoticed by the
existing tests, see https://bugs.freedesktop.org/show_bug.cgi?id=62357).
It also needs glsl 1.30 (even though this is not specific to what's tested
here).
---
 .../glsl-fs-main-return-conditional.shader_test    |   34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 tests/shaders/glsl-fs-main-return-conditional.shader_test

diff --git a/tests/shaders/glsl-fs-main-return-conditional.shader_test b/tests/shaders/glsl-fs-main-return-conditional.shader_test
new file mode 100644
index 0000000..124a4cd
--- /dev/null
+++ b/tests/shaders/glsl-fs-main-return-conditional.shader_test
@@ -0,0 +1,34 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+uniform vec4 v;
+
+void main()
+{
+	uint posintx = uint(gl_FragCoord.x);
+	uint one = uint(1);
+	gl_FragColor = v;
+	if ((posintx & one) == one) {
+		return;  // return for every second pixel
+	}
+	gl_FragColor = vec4(1.0) - v;
+}
+
+[test]
+uniform vec4 v 0 1 0 1
+
+draw rect -1 -1 2 2
+probe rgb 0 0 1 0 1
+probe rgb 1 0 0 1 0
+probe rgb 2 0 1 0 1
+probe rgb 3 0 0 1 0
+
-- 
1.7.9.5


More information about the Piglit mailing list