summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2014-08-07 21:01:25 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2014-09-18 02:18:00 -0400
commit948af4eb07bdb7b9c868fa22659b70e744e8e6e8 (patch)
tree5c57df2a2cce21c9a30cba5be8beda0d03377331
parent1ade98282e485a06d4d0e3f031b3e89ea3c773dc (diff)
arb_gs5: add nonconst sampler access tests
These test some of the annoying cases of fermi/kepler instruction encodings. Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r--tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test49
-rw-r--r--tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test49
-rw-r--r--tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test55
-rw-r--r--tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test55
4 files changed, 208 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test
new file mode 100644
index 000000000..d4193091e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array-grad.shader_test
@@ -0,0 +1,49 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+out vec2 texcoords;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ texcoords = (piglit_vertex.xy + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: enable
+in vec2 texcoords;
+
+/* The idea is that the tex array doesn't come first (and so 'other' must get
+ * some sort of usage), and we also want to ensure that the index is actually
+ * respected.
+ */
+uniform sampler2DArray other;
+uniform sampler2DArray tex[3];
+uniform int n;
+uniform float zero = 0.0;
+
+void main()
+{
+ gl_FragColor = textureGrad(tex[n], vec3(texcoords, 1.0), vec2(0), vec2(0)) +
+ texture(other, vec3(texcoords, 1.0)) * zero;
+}
+
+[test]
+uniform int other 2
+uniform int tex[0] 3
+uniform int tex[1] 1
+uniform int tex[2] 4
+uniform int n 1
+
+texture rgbw 2DArray 1 (8, 8, 4)
+texture junk 2DArray 2 (8, 8, 4)
+texture junk 2DArray 3 (8, 8, 4)
+texture junk 2DArray 4 (8, 8, 4)
+
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test
new file mode 100644
index 000000000..0bb882bd0
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-array.shader_test
@@ -0,0 +1,49 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+out vec2 texcoords;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ texcoords = (piglit_vertex.xy + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: enable
+in vec2 texcoords;
+
+/* The idea is that the tex array doesn't come first (and so 'other' must get
+ * some sort of usage), and we also want to ensure that the index is actually
+ * respected.
+ */
+uniform sampler2DArray other;
+uniform sampler2DArray tex[3];
+uniform int n;
+uniform float zero = 0.0;
+
+void main()
+{
+ gl_FragColor = texture(tex[n], vec3(texcoords, 1.0)) +
+ texture(other, vec3(texcoords, 1.0)) * zero;
+}
+
+[test]
+uniform int other 2
+uniform int tex[0] 3
+uniform int tex[1] 1
+uniform int tex[2] 4
+uniform int n 1
+
+texture rgbw 2DArray 1 (8, 8, 4)
+texture junk 2DArray 2 (8, 8, 4)
+texture junk 2DArray 3 (8, 8, 4)
+texture junk 2DArray 4 (8, 8, 4)
+
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test
new file mode 100644
index 000000000..8c5203d71
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d-grad.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+out vec2 texcoords;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ texcoords = (piglit_vertex.xy + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: enable
+in vec2 texcoords;
+
+/* The idea is that the tex array doesn't come first (and so 'other' must get
+ * some sort of usage), and we also want to ensure that the index is actually
+ * respected.
+ */
+uniform sampler2D other;
+uniform sampler2D tex[3];
+uniform int n;
+uniform float zero = 0.0;
+
+void main()
+{
+ gl_FragColor = textureGrad(tex[n], texcoords, vec2(0), vec2(0)) +
+ texture(other, texcoords) * zero;
+}
+
+[test]
+uniform int other 2
+uniform int tex[0] 3
+uniform int tex[1] 1
+uniform int tex[2] 4
+uniform int n 1
+
+texture rgbw 1 (8, 8)
+texture checkerboard 2 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 1.0, 0.0, 0.0)
+texparameter 2D min linear
+texture checkerboard 3 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (0.0, 1.0, 1.0, 0.0)
+texparameter 2D min linear
+texture checkerboard 4 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 0.0, 1.0, 0.0)
+texparameter 2D min linear
+
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test
new file mode 100644
index 000000000..29e3aff37
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/sampler-nonconst-2d.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+out vec2 texcoords;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ texcoords = (piglit_vertex.xy + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: enable
+in vec2 texcoords;
+
+/* The idea is that the tex array doesn't come first (and so 'other' must get
+ * some sort of usage), and we also want to ensure that the index is actually
+ * respected.
+ */
+uniform sampler2D other;
+uniform sampler2D tex[3];
+uniform int n;
+uniform float zero = 0.0;
+
+void main()
+{
+ gl_FragColor = texture(tex[n], texcoords) +
+ texture(other, texcoords) * zero;
+}
+
+[test]
+uniform int other 2
+uniform int tex[0] 3
+uniform int tex[1] 1
+uniform int tex[2] 4
+uniform int n 1
+
+texture rgbw 1 (8, 8)
+texture checkerboard 2 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 1.0, 0.0, 0.0)
+texparameter 2D min linear
+texture checkerboard 3 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (0.0, 1.0, 1.0, 0.0)
+texparameter 2D min linear
+texture checkerboard 4 0 (8, 8) (0.0, 0.0, 0.0, 0.0) (1.0, 0.0, 1.0, 0.0)
+texparameter 2D min linear
+
+draw rect -1 -1 2 2
+relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
+relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0)
+relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0)
+relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)