On 03/22/2013 06:42 PM, srol...@vmware.com wrote:
From: Roland Scheidegger <srol...@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).

v2: use mod() instead of integer arithmetic suggested by Ian Romanick.
This gets rid of the glsl 1.30 requirement. And do minor simplifications.

As long as it still reproduces the bug you were trying to reproduce,

Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

---
  .../glsl-fs-main-return-conditional.shader_test    |   28 ++++++++++++++++++++
  1 file changed, 28 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..173ae03
--- /dev/null
+++ b/tests/shaders/glsl-fs-main-return-conditional.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+       gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+const vec4 v = vec4(0., 1., 0., 1.);
+
+void main()
+{
+       gl_FragColor = v;
+       if (mod(gl_FragCoord.x, 2.0) >= 1.0)
+               return;  // return for every second pixel
+
+       gl_FragColor = vec4(1.0) - v;
+}
+
+[test]
+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
+


_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to