[Piglit] [PATCH 6/8] arb_gpu_shader5: Add fma fragment shader execution test.

Matt Turner mattst88 at gmail.com
Thu Aug 22 16:07:32 PDT 2013


---
 .../built-in-functions/fs-fma.shader_test          | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-fma.shader_test

diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-fma.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-fma.shader_test
new file mode 100644
index 0000000..f1c5957
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-fma.shader_test
@@ -0,0 +1,58 @@
+[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
+
+out vec4 color;
+
+uniform vec4 a, b, c;
+uniform vec4 expected;
+
+void main()
+{
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	if (expected.x != fma(a.x, b.x, c.x)) {
+		color.r = 1.0;
+	}
+	if (expected.xy != fma(a.xy, b.xy, c.xy)) {
+		color.r = 1.0;
+	}
+	if (expected.xyz != fma(a.xyz, b.xyz, c.xyz)) {
+		color.r = 1.0;
+	}
+	if (expected != fma(a, b, c)) {
+		color.r = 1.0;
+	}
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform vec4 a 0.0 0.0 2.0 2.0
+uniform vec4 b 1.0 1.0 2.0 2.0
+uniform vec4 c 0.0 1.0 0.0 3.0
+uniform vec4 expected 0.0 1.0 4.0 7.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform vec4 a  0.0 -1.0  2.0  2.0
+uniform vec4 b  1.0  1.0 -2.0  2.0
+uniform vec4 c -1.0  1.0  0.0 -3.0
+uniform vec4 expected -1.0 0.0 -4.0 1.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.3.2



More information about the Piglit mailing list