[Piglit] [PATCH 3/3] ext_texture_array: add simple 1D/2D array rendering tests

Brian Paul brianp at vmware.com
Fri Aug 1 08:07:50 PDT 2014


Check that we're sampling from the expected array slices.
---
 .../render-1darray-1slice.shader_test              |   35 +++++++++++++++
 .../ext_texture_array/render-1darray.shader_test   |   45 ++++++++++++++++++++
 .../render-2darray-1slice.shader_test              |   34 +++++++++++++++
 .../ext_texture_array/render-2darray.shader_test   |   44 +++++++++++++++++++
 4 files changed, 158 insertions(+)
 create mode 100644 tests/spec/ext_texture_array/render-1darray-1slice.shader_test
 create mode 100644 tests/spec/ext_texture_array/render-1darray.shader_test
 create mode 100644 tests/spec/ext_texture_array/render-2darray-1slice.shader_test
 create mode 100644 tests/spec/ext_texture_array/render-2darray.shader_test

diff --git a/tests/spec/ext_texture_array/render-1darray-1slice.shader_test b/tests/spec/ext_texture_array/render-1darray-1slice.shader_test
new file mode 100644
index 0000000..f524c06
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-1darray-1slice.shader_test
@@ -0,0 +1,35 @@
+# Test GL_TEXTURE_1D_ARRAY texture with just one layer
+[require]
+GLSL >= 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler1DArray tex;
+uniform float layer;
+
+void main()
+{
+	vec2 p = vec2(texcoords.x, layer);
+	gl_FragColor = texture1DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 1DArray 0 ( 64 , 1 )
+
+# layer=12 should get clamped to zero
+uniform float layer 12
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
+
diff --git a/tests/spec/ext_texture_array/render-1darray.shader_test b/tests/spec/ext_texture_array/render-1darray.shader_test
new file mode 100644
index 0000000..74b6154
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-1darray.shader_test
@@ -0,0 +1,45 @@
+# Test GL_TEXTURE_1D_ARRAY texture with four layers
+[require]
+GLSL >= 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler1DArray tex;
+uniform float layer;
+
+void main()
+{
+	vec2 p = vec2(texcoords.x, layer);
+	gl_FragColor = texture1DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 1DArray 0 ( 64 , 4 )
+
+uniform float layer 0
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
+
+uniform float layer 1
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
+
+uniform float layer 2
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (0.0, 0.0, 1.0, 1.0)
+
+uniform float layer 3
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 1.0, 1.0, 1.0)
diff --git a/tests/spec/ext_texture_array/render-2darray-1slice.shader_test b/tests/spec/ext_texture_array/render-2darray-1slice.shader_test
new file mode 100644
index 0000000..335436d
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-2darray-1slice.shader_test
@@ -0,0 +1,34 @@
+# Test GL_TEXTURE_2D_ARRAY with just one slice
+[require]
+GLSL >= 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler2DArray tex;
+uniform float layer;
+
+void main()
+{
+	vec3 p = vec3(texcoords.xy, layer);
+	gl_FragColor = texture2DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 2DArray 0 (32, 32, 1)
+
+# layer=12 should get clamped to zero
+uniform float layer 12
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
diff --git a/tests/spec/ext_texture_array/render-2darray.shader_test b/tests/spec/ext_texture_array/render-2darray.shader_test
new file mode 100644
index 0000000..189bb13
--- /dev/null
+++ b/tests/spec/ext_texture_array/render-2darray.shader_test
@@ -0,0 +1,44 @@
+[require]
+GLSL >= 1.10
+GL_EXT_texture_array
+
+[vertex shader]
+#version 110
+varying vec4 texcoords;
+void main() {
+	gl_Position = gl_Vertex;
+	texcoords = (gl_Vertex + 1.0) / 2.0;
+}
+
+[fragment shader]
+#version 110
+#extension GL_EXT_texture_array : enable
+varying vec4 texcoords;
+uniform sampler2DArray tex;
+uniform float layer;
+
+void main()
+{
+	vec3 p = vec3(texcoords.xy, layer);
+	gl_FragColor = texture2DArray(tex, p);
+}
+
+[test]
+uniform int tex 0
+texture rgbw 2DArray 0 (32, 32, 4)
+
+uniform float layer 0
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
+
+uniform float layer 1
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
+
+uniform float layer 2
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (0.0, 0.0, 1.0, 1.0)
+
+uniform float layer 3
+draw rect -1 -1 2 2
+relative probe rgba (0.5, 0.5) (1.0, 1.0, 1.0, 1.0)
-- 
1.7.10.4



More information about the Piglit mailing list