[Piglit] [PATCH] arb_shader_subroutine/arb_shader_fp64: test returning doubles from subroutines

Dave Airlie airlied at gmail.com
Thu Dec 10 21:56:17 PST 2015


From: Dave Airlie <airlied at redhat.com>

This found a bug in the mesa/st code, and is inspired by
GL41-CTS.shader_subroutine.two_subroutines_single_subroutine_uniform
from CTS.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 .../two-subroutines-double-array.shader_test       | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 tests/spec/arb_shader_subroutine/execution/two-subroutines-double-array.shader_test

diff --git a/tests/spec/arb_shader_subroutine/execution/two-subroutines-double-array.shader_test b/tests/spec/arb_shader_subroutine/execution/two-subroutines-double-array.shader_test
new file mode 100644
index 0000000..a05e4d6
--- /dev/null
+++ b/tests/spec/arb_shader_subroutine/execution/two-subroutines-double-array.shader_test
@@ -0,0 +1,58 @@
+# shader subroutine fp64 cross over test.
+# return an array of doubles from a function.
+# This exposed a bug in the glsl->tgsi state
+# tracker for doubles.
+#
+[require]
+GLSL >= 1.50
+GL_ARB_shader_subroutine
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_subroutine: enable
+#extension GL_ARB_gpu_shader_fp64: enable
+out vec4 color;
+
+subroutine double[2] dadd2(double vin[2]);
+subroutine uniform dadd2 my_dadd2;
+
+subroutine(dadd2)
+double[2] add3(double vin[2])
+{
+	double vout[2];
+	vout[0] = vin[0] + 0.3LF;
+	vout[1] = vin[1] + 0.3LF;
+	return vout;
+}
+
+subroutine(dadd2)
+double[2] add4(double vin[2])
+{
+	double vout[2];
+	vout[0] = vin[0] + 0.4LF;
+	vout[1] = vin[1] + 0.4LF;
+	return vout;
+}
+
+void main()
+{
+	double temp[2], temp2[2];
+
+	temp[0] = 0.1LF;
+	temp[1] = 0.2LF;
+	temp2 = my_dadd2(temp);
+	color = vec4(float(temp2[0]), float(temp2[1]), 0.0, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 1.0 0.0
+clear
+subuniform GL_FRAGMENT_SHADER my_dadd2 add3
+draw rect -1 -1 2 2
+probe all rgba 0.4 0.5 0.0 1.0
+subuniform GL_FRAGMENT_SHADER my_dadd2 add4
+draw rect -1 -1 2 2
+probe all rgba 0.5 0.6 0.0 1.0
-- 
2.5.0



More information about the Piglit mailing list