[Piglit] [PATCH v2 5/5] arb_bindless_texture: add execution-related tests
Samuel Pitoiset
samuel.pitoiset at gmail.com
Fri Apr 7 16:59:01 UTC 2017
v2: - rename basic-image.shader_test to basic-imageStore.shader_test
- rename basic-texture.shader_test to basic-texture2D.shader_test
- rename basic-vertex.shader_test to sampler-input-output.shader_test
- add multiple-resident-images-reading.shader_test
- add image-input-output.shader_test
- add basic-imageAtomicExchange.shader_test
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com> (v1)
---
.../basic-imageAtomicExchange.shader_test | 39 ++++++++++
.../execution/basic-imageStore.shader_test | 43 +++++++++++
.../execution/basic-texture2D.shader_test | 26 +++++++
.../execution/image-input-output.shader_test | 58 +++++++++++++++
.../multiple-resident-images-reading.shader_test | 84 ++++++++++++++++++++++
.../execution/sampler-input-output.shader_test | 41 +++++++++++
6 files changed, 291 insertions(+)
create mode 100644 tests/spec/arb_bindless_texture/execution/basic-imageAtomicExchange.shader_test
create mode 100644 tests/spec/arb_bindless_texture/execution/basic-imageStore.shader_test
create mode 100644 tests/spec/arb_bindless_texture/execution/basic-texture2D.shader_test
create mode 100644 tests/spec/arb_bindless_texture/execution/image-input-output.shader_test
create mode 100644 tests/spec/arb_bindless_texture/execution/multiple-resident-images-reading.shader_test
create mode 100644 tests/spec/arb_bindless_texture/execution/sampler-input-output.shader_test
diff --git a/tests/spec/arb_bindless_texture/execution/basic-imageAtomicExchange.shader_test b/tests/spec/arb_bindless_texture/execution/basic-imageAtomicExchange.shader_test
new file mode 100644
index 000000000..6919c42d3
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/basic-imageAtomicExchange.shader_test
@@ -0,0 +1,39 @@
+# Based on arb_shader_image_load_store/execution/gl45-imageAtomicExchange-float.shader_test
+[require]
+GL >= 4.5
+GLSL >= 4.50
+GL_ARB_bindless_texture
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 450
+#extension GL_ARB_bindless_texture: require
+
+layout (bindless_image) uniform;
+
+layout (r32f) uniform image2D img;
+uniform float v;
+out vec4 color;
+
+void main()
+{
+ color = vec4(imageAtomicExchange(img, ivec2(gl_FragCoord.xy), v));
+}
+
+[test]
+texture rgbw 0 (250, 250) GL_R32F
+resident image texture 0 GL_R32F
+uniform handle img 0
+
+uniform float v 0.5
+draw rect -1 -1 2 2
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 1.0, 1.0)
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 0.0)
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 0.0, 0.0)
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
+
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgb 0.5 0.0 0.0
diff --git a/tests/spec/arb_bindless_texture/execution/basic-imageStore.shader_test b/tests/spec/arb_bindless_texture/execution/basic-imageStore.shader_test
new file mode 100644
index 000000000..5ce66c5e8
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/basic-imageStore.shader_test
@@ -0,0 +1,43 @@
+# In this test, just perform an image store with a resident texture image.
+# Based on arb_shader_image_load_store/execution/basic-imageStore-from-uniform.shader_test
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+uniform vec4 color;
+layout (bindless_image) writeonly uniform image2D tex;
+out vec4 outcolor;
+
+void main()
+{
+ imageStore(tex, ivec2(gl_FragCoord.xy), color);
+ outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+# Texture 0 is the imageStore output.
+texture rgbw 0 (16, 16) GL_RGBA8
+resident image texture 0 GL_RGBA8
+uniform handle tex 0
+
+# Texture 1 is the rendering output. We don't care about this.
+texture rgbw 1 (16, 16) GL_RGBA8
+
+# Store red using imageStore
+uniform vec4 color 1.0 0.0 0.0 1.0
+fb tex 2d 1
+draw rect -1 -1 2 2
+
+# Test the result of imageStore
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 1.0 0.0 0.0 1.0
diff --git a/tests/spec/arb_bindless_texture/execution/basic-texture2D.shader_test b/tests/spec/arb_bindless_texture/execution/basic-texture2D.shader_test
new file mode 100644
index 000000000..2312d0801
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/basic-texture2D.shader_test
@@ -0,0 +1,26 @@
+# In this test, just perform a texture lookup with a resident texture.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+layout (bindless_sampler) uniform sampler2D tex;
+out vec4 finalColor;
+
+void main()
+{
+ finalColor = texture2D(tex, vec2(0, 0));
+}
+
+[test]
+texture rgbw 0 (16, 16)
+resident texture 0
+uniform handle tex 0
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
diff --git a/tests/spec/arb_bindless_texture/execution/image-input-output.shader_test b/tests/spec/arb_bindless_texture/execution/image-input-output.shader_test
new file mode 100644
index 000000000..005255858
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/image-input-output.shader_test
@@ -0,0 +1,58 @@
+# In this test, the image to use is selected in a vertex shader, passed
+# to the fragment shader as a (flat) input, and then used for an image store.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+layout (bindless_image) writeonly uniform image2D img;
+in vec4 piglit_vertex;
+
+flat out writeonly image2D image_vs;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ image_vs = img;
+}
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+
+flat in writeonly image2D image_vs;
+
+uniform vec4 color;
+out vec4 outcolor;
+
+void main()
+{
+ imageStore(image_vs, ivec2(gl_FragCoord.xy), color);
+ outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+# Texture 0 is the imageStore output.
+texture rgbw 0 (16, 16) GL_RGBA8
+resident image texture 0 GL_RGBA8
+uniform handle img 0
+
+# Texture 1 is the rendering output. We don't care about this.
+texture rgbw 1 (16, 16) GL_RGBA8
+
+# Store red using imageStore
+uniform vec4 color 1.0 0.0 0.0 1.0
+fb tex 2d 1
+draw rect -1 -1 2 2
+
+# Test the result of imageStore
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 1.0 0.0 0.0 1.0
diff --git a/tests/spec/arb_bindless_texture/execution/multiple-resident-images-reading.shader_test b/tests/spec/arb_bindless_texture/execution/multiple-resident-images-reading.shader_test
new file mode 100644
index 000000000..ac32bf727
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/multiple-resident-images-reading.shader_test
@@ -0,0 +1,84 @@
+# Verify reading from multiple resident images.
+# Based on arb_compute_shader/execution/multiple-texture-reading.shader_test.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_image_load_store
+GL_ARB_bindless_texture
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_image_load_store: enable
+#extension GL_ARB_bindless_texture: enable
+
+layout (bindless_image) uniform;
+
+uniform int select_textures;
+layout(rgba8) readonly uniform image2D src0;
+layout(rgba8) readonly uniform image2D src1;
+writeonly uniform image2D dst;
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+void main()
+{
+ ivec2 coord = ivec2(gl_GlobalInvocationID.xy);
+ vec4 color = vec4(0, 0, 0, 0);
+ if ((select_textures & 1) == 1) {
+ color += imageLoad(src0, coord);
+ }
+ if ((select_textures & 2) == 2) {
+ color += imageLoad(src1, coord);
+ }
+ imageStore(dst, coord, color);
+}
+
+[test]
+# Setup src0 image
+texture rgbw 0 (16, 16) GL_RGBA8
+resident image texture 0 GL_RGBA8
+uniform handle src0 0
+fb tex 2d 0
+clear color 1.0 0.0 1.0 0.0
+clear
+
+# Setup src1 image
+texture rgbw 1 (16, 16) GL_RGBA8
+resident image texture 1 GL_RGBA8
+uniform handle src1 1
+fb tex 2d 1
+clear color 0.0 1.0 0.0 1.0
+clear
+
+# Setup dst image
+texture rgbw 2 (16, 16) GL_RGBA8
+resident image texture 2 GL_RGBA8
+uniform handle dst 2
+fb tex 2d 2
+
+# Clear dst image to not have the same color as the first test case
+clear color 0.5 0.5 0.5 0.5
+clear
+probe all rgba 0.5 0.5 0.5 0.5
+
+# Use neither source image
+uniform int select_textures 0
+compute 1 1 1
+probe all rgba 0.0 0.0 0.0 0.0
+
+# Use src0 image only
+uniform int select_textures 1
+compute 1 1 1
+probe all rgba 1.0 0.0 1.0 0.0
+
+# Use src1 image only
+uniform int select_textures 2
+compute 1 1 1
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Use both src0 and src1 images
+uniform int select_textures 3
+compute 1 1 1
+probe all rgba 1.0 1.0 1.0 1.0
diff --git a/tests/spec/arb_bindless_texture/execution/sampler-input-output.shader_test b/tests/spec/arb_bindless_texture/execution/sampler-input-output.shader_test
new file mode 100644
index 000000000..3493b80b6
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/sampler-input-output.shader_test
@@ -0,0 +1,41 @@
+# In this test, the sampler to use is selected in a vertex shader, passed
+# to the fragment shader as a (flat) input, and then used for a texture
+# lookup.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+
+[vertex shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+layout (bindless_sampler) uniform sampler2D tex;
+in vec4 piglit_vertex;
+
+flat out sampler2D sampler_vs;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ sampler_vs = tex;
+}
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+
+flat in sampler2D sampler_vs;
+out vec4 color;
+
+void main()
+{
+ color = texture2D(sampler_vs, vec2(0, 0));
+}
+
+[test]
+texture rgbw 0 (16, 16)
+resident texture 0
+uniform handle tex 0
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0)
--
2.12.2
More information about the Piglit
mailing list