diff options
author | Alejandro Piñeiro <apinheiro@igalia.com> | 2019-11-15 12:03:45 +0100 |
---|---|---|
committer | Alejandro Piñeiro <apinheiro@igalia.com> | 2019-11-19 14:27:45 +0100 |
commit | 2b7637fca86534a758d8e12de60442875a68c56c (patch) | |
tree | dae76f5ab3bae7d671f80a9a03fce0d5bd0bba7f | |
parent | 348e3cd906241f85110ee06321287ffd9b9e8863 (diff) |
glsl-es-3.10: add some image load/store tests with predication.
While working to fix the following test with v3d:
dEQP-GLES31.functional.synchronization.inter_call.with_memory_barrier.image_atomic_multiple_interleaved_write_read
we found that predication with image atomic operations were not
properly working. This commit includes two tests for that case that
had each one a slightly different outcome, plus a normal image load
with predication as reference.
Reviewed-by: Jose Maria Casanova <jmcasanova@igalia.com>
3 files changed, 164 insertions, 0 deletions
diff --git a/tests/spec/glsl-es-3.10/execution/cs-image-atomic-if-else-2.shader_test b/tests/spec/glsl-es-3.10/execution/cs-image-atomic-if-else-2.shader_test new file mode 100644 index 000000000..0265ba355 --- /dev/null +++ b/tests/spec/glsl-es-3.10/execution/cs-image-atomic-if-else-2.shader_test @@ -0,0 +1,55 @@ +# Image atomic access with predication (if/else), and storing directly +# the atomic operation value. + +[require] +GL ES >= 3.1 +GLSL ES >= 3.10 + + +[compute shader] +#version 310 es +#extension GL_OES_shader_image_atomic : require + +layout (local_size_x = 1, local_size_y = 1) in; + +layout(r32i, binding=1) coherent uniform highp iimage2D in_image; + +layout(r32i, binding=2) coherent uniform highp iimage2D in_image_2; + +layout(binding=0, std430) buffer Buffer +{ + highp int data[]; +} out_ssbo; + +void main (void) +{ + int groupNdx = int(gl_NumWorkGroups.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x); + int value; + + if (groupNdx % 2 == 0) + { + value = imageAtomicExchange(in_image, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y)), 0); + } + else + { + value = imageAtomicExchange(in_image_2, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y)), 0); + } + + out_ssbo.data[groupNdx] = value; +} + +[test] +texture integer 1 (2,2) (2,0) GL_R32I +image texture 1 GL_R32I + +texture integer 2 (2,2) (2,10) GL_R32I +image texture 2 GL_R32I + +ssbo 0 64 + +compute 2 2 1 + +probe ssbo int 0 0 == 0 +probe ssbo int 0 4 == 11 +probe ssbo int 0 8 == 2 +probe ssbo int 0 12 == 13 diff --git a/tests/spec/glsl-es-3.10/execution/cs-image-atomic-if-else.shader_test b/tests/spec/glsl-es-3.10/execution/cs-image-atomic-if-else.shader_test new file mode 100644 index 000000000..c54c9d6b7 --- /dev/null +++ b/tests/spec/glsl-es-3.10/execution/cs-image-atomic-if-else.shader_test @@ -0,0 +1,55 @@ +# Image atomic access with predication (if/else), using the atomic +# operation value on a comparison. + +[require] +GL ES >= 3.1 +GLSL ES >= 3.10 + + +[compute shader] +#version 310 es +#extension GL_OES_shader_image_atomic : require + +layout (local_size_x = 1, local_size_y = 1) in; + +layout(r32i, binding=1) coherent uniform highp iimage2D in_image; + +layout(r32i, binding=2) coherent uniform highp iimage2D in_image_2; + +layout(binding=0, std430) buffer Buffer +{ + highp int data[]; +} out_ssbo; + +void main (void) +{ + int groupNdx = int(gl_NumWorkGroups.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x); + bool allOk = true; + + if (groupNdx % 2 == 0) + { + allOk = allOk && (imageAtomicExchange(in_image, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y)), 0) == groupNdx); + } + else + { + allOk = allOk && (imageAtomicExchange(in_image_2, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y)), 0) == groupNdx + 10); + } + + out_ssbo.data[groupNdx] = (allOk) ? (1) : (0); +} + +[test] +texture integer 1 (2,2) (2,0) GL_R32I +image texture 1 GL_R32I + +texture integer 2 (2,2) (2,10) GL_R32I +image texture 2 GL_R32I + +ssbo 0 64 + +compute 2 2 1 + +probe ssbo int 0 0 == 1 +probe ssbo int 0 4 == 1 +probe ssbo int 0 8 == 1 +probe ssbo int 0 12 == 1 diff --git a/tests/spec/glsl-es-3.10/execution/cs-image-load-if-else.shader_test b/tests/spec/glsl-es-3.10/execution/cs-image-load-if-else.shader_test new file mode 100644 index 000000000..120312a28 --- /dev/null +++ b/tests/spec/glsl-es-3.10/execution/cs-image-load-if-else.shader_test @@ -0,0 +1,54 @@ +# Image load test with predication (if/else) + +[require] +GL ES >= 3.1 +GLSL ES >= 3.10 + + +[compute shader] +#version 310 es +#extension GL_OES_shader_image_atomic : require + +layout (local_size_x = 1, local_size_y = 1) in; + +layout(r32i, binding=1) coherent uniform highp iimage2D in_image; + +layout(r32i, binding=2) coherent uniform highp iimage2D in_image_2; + +layout(binding=0, std430) buffer Buffer +{ + highp int data[]; +} out_ssbo; + +void main (void) +{ + int groupNdx = int(gl_NumWorkGroups.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x); + int value; + + if (groupNdx % 2 == 0) + { + value = imageLoad(in_image, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y))).x; + } + else + { + value = imageLoad(in_image_2, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y))).x; + } + + out_ssbo.data[groupNdx] = value; +} + +[test] +texture integer 1 (2,2) (2,0) GL_R32I +image texture 1 GL_R32I + +texture integer 2 (2,2) (2,10) GL_R32I +image texture 2 GL_R32I + +ssbo 0 64 + +compute 2 2 1 + +probe ssbo int 0 0 == 0 +probe ssbo int 0 4 == 11 +probe ssbo int 0 8 == 2 +probe ssbo int 0 12 == 13 |