Commit cacff58c authored by Alejandro Piñeiro's avatar Alejandro Piñeiro

glsl-es-3.10: port arb_shader_atomic_counters tests to glsl-es-3.10

This commits ports the existing execution tests for
arb_shader_atomic_counters tests to glsl-es-3.10 (so basically
changing the require section, the glsl version, and adding precision
highp if needed).

Notes that we also port the simple inc/dec/read test to fragment
shader, as there are some opengl es drivers, like v3d, that can't
provide atomic buffers on the vertex shader.
Reviewed-by: José Casanova Crespo's avatarJose Maria Casanova <jmcasanova@igalia.com>
parent d22c5b02
Pipeline #81590 passed with stages
in 5 minutes and 21 seconds
# Test layouts of atomic counters in a fragment shader.
[require]
GL ES >= 3.1
GLSL ES >= 3.10
INT GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS >= 2
[vertex shader passthrough]
[fragment shader]
#version 310 es
precision highp float;
layout(binding = 0, offset = 0) uniform atomic_uint a0;
layout(binding = 1, offset = 0) uniform atomic_uint b0;
layout(binding = 1, offset = 4) uniform atomic_uint b1[2];
uniform uint a0_expected;
uniform uint b0_expected;
uniform uint b1_expected;
uniform uint idx;
out vec4 color;
void main()
{
uint old_a0 = atomicCounterIncrement(a0);
uint old_b0 = atomicCounterIncrement(b0);
uint old_b1 = atomicCounterIncrement(b1[idx]);
if (old_a0 != a0_expected) {
color = vec4(1.0, 0.0, float(old_a0) / 255.0, 1.0);
return;
}
if (old_b0 != b0_expected) {
color = vec4(1.0, 0.1, float(old_b0) / 255.0, 1.0);
return;
}
if (old_b1 != b1_expected) {
color = vec4(1.0, 0.2, float(old_b1) / 255.0, 1.0);
return;
}
color = vec4(0.0, 1.0, 0.0, 1.0);
}
[test]
atomic counter buffer 0 1
atomic counter buffer 1 3
clear color 0.0 0.0 0.0 0.0
clear
atomic counter 0 0 17
atomic counter 1 0 31
atomic counter 1 1 4
atomic counter 1 2 9
uniform uint a0_expected 17
uniform uint b0_expected 31
uniform uint idx 1
uniform uint b1_expected 9
draw rect ortho 0 0 1 1
probe rgba 0 0 0.0 1.0 0.0 1.0
# Simple test of atomicCounterIncrement, atomicCounterDecrement and
# atomicCounter being used in the FS
[require]
GL ES >= 3.1
GLSL ES >= 3.10
INT GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS >= 2
[vertex shader passthrough]
[fragment shader]
#version 310 es
precision highp float;
layout(binding = 0) uniform atomic_uint a0;
layout(binding = 0) uniform atomic_uint a1;
out vec4 fcolor;
void main()
{
bool passed = true;
uint v0, v1;
/* Test that incrementing, followed by a read of an atomic
* counter results in a larger value.
*
* Note: atomicCounterIncrement return the old value
*/
v0 = atomicCounterIncrement(a0);
v1 = atomicCounter(a0);
if (v1 <= v0)
passed = false;
/* Skip one decrement since it may be the 0 => 0xffffffff
* transition.
*/
atomicCounterDecrement(a1);
/* Test that a read, followed by a decrement of an atomic
* counter results in a smaller value.
*
* Note: atomicCounterDecrement return the new value
*/
v0 = atomicCounter(a1);
v1 = atomicCounterDecrement(a1);
if (v1 >= v0)
passed = false;
if (passed)
fcolor = vec4(0.0, 1.0, 0.0, 1.0);
else
fcolor = vec4(1.0, 0.0, 0.0, 1.0);
}
[test]
atomic counters 2
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
# Simple test of atomicCounterIncrement, atomicCounterDecrement and
# atomicCounter being used in the VS.
[require]
GL ES >= 3.1
GLSL ES >= 3.10
INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2
[vertex shader]
#version 310 es
layout(binding = 0) uniform atomic_uint a0;
layout(binding = 0) uniform atomic_uint a1;
in vec4 piglit_vertex;
out vec4 vcolor;
void main()
{
bool passed = true;
uint v0, v1;
/* Test that incrementing, followed by a read of an atomic
* counter results in a larger value.
*
* Note: atomicCounterIncrement return the old value
*/
v0 = atomicCounterIncrement(a0);
v1 = atomicCounter(a0);
if (v1 <= v0)
passed = false;
/* Skip one decrement since it may be the 0 => 0xffffffff
* transition.
*/
atomicCounterDecrement(a1);
/* Test that a read, followed by a decrement of an atomic
* counter results in a smaller value.
*
* Note: atomicCounterDecrement return the new value
*/
v0 = atomicCounter(a1);
v1 = atomicCounterDecrement(a1);
if (v1 >= v0)
passed = false;
if (passed)
vcolor = vec4(0.0, 1.0, 0.0, 1.0);
else
vcolor = vec4(1.0, 0.0, 0.0, 1.0);
gl_Position = piglit_vertex;
}
[fragment shader]
#version 310 es
in vec4 vcolor;
out vec4 fcolor;
void main()
{
fcolor = vcolor;
}
[test]
atomic counters 2
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment