[Piglit] [PATCH] arb_gpu_shader5: add compiler tests for interpolateAt*

Chris Forbes chrisf at ijw.co.nz
Sun Nov 10 01:09:15 PST 2013


---
 .../fs-interpolateAtCentroid-array.frag            | 25 ++++++++++++++++++
 .../fs-interpolateAtCentroid-bad-swizzle.frag      | 27 +++++++++++++++++++
 .../fs-interpolateAtCentroid-centroid.frag         | 30 ++++++++++++++++++++++
 .../fs-interpolateAtCentroid-flat.frag             | 30 ++++++++++++++++++++++
 .../fs-interpolateAtCentroid-no-output.frag        | 21 +++++++++++++++
 .../fs-interpolateAtCentroid-no-temp.frag          | 22 ++++++++++++++++
 .../fs-interpolateAtCentroid-no-uniform.frag       | 20 +++++++++++++++
 .../fs-interpolateAtCentroid-noperspective.frag    | 30 ++++++++++++++++++++++
 .../interpolation/fs-interpolateAtCentroid.frag    | 25 ++++++++++++++++++
 .../fs-interpolateAtOffset-nonconst.frag           | 27 +++++++++++++++++++
 .../interpolation/fs-interpolateAtOffset.frag      | 28 ++++++++++++++++++++
 .../interpolation/fs-interpolateAtSample.frag      | 25 ++++++++++++++++++
 12 files changed, 310 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-array.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-bad-swizzle.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-centroid.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-flat.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-output.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-temp.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-uniform.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-noperspective.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset-nonconst.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtSample.frag

diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-array.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-array.frag
new file mode 100644
index 0000000..274db83
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-array.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in float v1[2];
+in vec2 v2[2];
+in vec3 v3[2];
+in vec4 v4[2];
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtCentroid(v1[1]), 1, 1, 1);
+	res += vec4(interpolateAtCentroid(v2[1]), 1, 1);
+	res += vec4(interpolateAtCentroid(v3[1]), 1);
+	res += interpolateAtCentroid(v4[1]);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-bad-swizzle.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-bad-swizzle.frag
new file mode 100644
index 0000000..b815f13
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-bad-swizzle.frag
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// The ARB_gpu_shader5 spec says:
+//    "Component selection operators (e.g., ".xy") may not be used when
+//    specifying <interpolant>."
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec2 v2;
+in vec3 v3;
+in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtCentroid(v2.xy), 1, 1);
+	res += vec4(interpolateAtCentroid(v3.xyz), 1);
+	res += interpolateAtCentroid(v4.xyzw);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-centroid.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-centroid.frag
new file mode 100644
index 0000000..738c566
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-centroid.frag
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// From the ARB_gpu_shader5 spec:
+// "If <interpolant> is declared with a "flat" or
+// "centroid" qualifier, the qualifier will have no effect on the
+// interpolated value."
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+centroid in float v1;
+centroid in vec2 v2;
+centroid in vec3 v3;
+centroid in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtCentroid(v1), 1, 1, 1);
+	res += vec4(interpolateAtCentroid(v2), 1, 1);
+	res += vec4(interpolateAtCentroid(v3), 1);
+	res += interpolateAtCentroid(v4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-flat.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-flat.frag
new file mode 100644
index 0000000..8bce2d6
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-flat.frag
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// From the ARB_gpu_shader5 spec:
+// "If <interpolant> is declared with a "flat" or
+// "centroid" qualifier, the qualifier will have no effect on the
+// interpolated value."
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+flat in float v1;
+flat in vec2 v2;
+flat in vec3 v3;
+flat in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtCentroid(v1), 1, 1, 1);
+	res += vec4(interpolateAtCentroid(v2), 1, 1);
+	res += vec4(interpolateAtCentroid(v3), 1);
+	res += interpolateAtCentroid(v4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-output.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-output.frag
new file mode 100644
index 0000000..3f9b60e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-output.frag
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+out vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	// <interpolant> must be a shader input.
+
+	res += interpolateAtCentroid(v4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-temp.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-temp.frag
new file mode 100644
index 0000000..ef82be2
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-temp.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	// <interpolant> must be a shader input.
+	vec4 t4 = v4;
+
+	res += interpolateAtCentroid(t4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-uniform.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-uniform.frag
new file mode 100644
index 0000000..1d49dc3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-no-uniform.frag
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	// <interpolant> must be a shader input.
+	res += interpolateAtCentroid(v4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-noperspective.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-noperspective.frag
new file mode 100644
index 0000000..40a9111
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid-noperspective.frag
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// From the ARB_gpu_shader5 spec:
+// If <interpolant> is declared with the "noperspective"
+// qualifier, the interpolated value will be computed without perspective
+// correction.
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+noperspective in float v1;
+noperspective in vec2 v2;
+noperspective in vec3 v3;
+noperspective in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtCentroid(v1), 1, 1, 1);
+	res += vec4(interpolateAtCentroid(v2), 1, 1);
+	res += vec4(interpolateAtCentroid(v3), 1);
+	res += interpolateAtCentroid(v4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid.frag
new file mode 100644
index 0000000..5c67246
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtCentroid.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in float v1;
+in vec2 v2;
+in vec3 v3;
+in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtCentroid(v1), 1, 1, 1);
+	res += vec4(interpolateAtCentroid(v2), 1, 1);
+	res += vec4(interpolateAtCentroid(v3), 1);
+	res += interpolateAtCentroid(v4);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset-nonconst.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset-nonconst.frag
new file mode 100644
index 0000000..3b7ba9d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset-nonconst.frag
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in float v1;
+in vec2 v2;
+in vec3 v3;
+in vec4 v4;
+
+in vec2 offset;		// ARB_gpu_shader5 spec says nothing about the offset having to be constant.
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtOffset(v1, offset), 1, 1, 1);
+	res += vec4(interpolateAtOffset(v2, offset), 1, 1);
+	res += vec4(interpolateAtOffset(v3, offset), 1);
+	res += interpolateAtOffset(v4, offset);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset.frag
new file mode 100644
index 0000000..99ab8d9
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtOffset.frag
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in float v1;
+in vec2 v2;
+in vec3 v3;
+in vec4 v4;
+
+// ARB_gpu_shader5 requires at least -0.5 .. 0.5 to be supported.
+const vec2 offset = vec2(-0.5, 0.5);
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtOffset(v1, offset), 1, 1, 1);
+	res += vec4(interpolateAtOffset(v2, offset), 1, 1);
+	res += vec4(interpolateAtOffset(v3, offset), 1);
+	res += interpolateAtOffset(v4, offset);
+
+	gl_FragColor = res;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtSample.frag b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtSample.frag
new file mode 100644
index 0000000..825b961
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/interpolation/fs-interpolateAtSample.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in float v1;
+in vec2 v2;
+in vec3 v3;
+in vec4 v4;
+
+void main()
+{
+	vec4 res = vec4(0);
+
+	res += vec4(interpolateAtSample(v1, 0), 1, 1, 1);
+	res += vec4(interpolateAtSample(v2, 1), 1, 1);
+	res += vec4(interpolateAtSample(v3, 2), 1);
+	res += interpolateAtSample(v4, 3);
+
+	gl_FragColor = res;
+}
-- 
1.8.4.2



More information about the Piglit mailing list