1# Image load test with predication (if/else)
2
3[require]
4GL ES >= 3.1
5GLSL ES >= 3.10
6
7
8[compute shader]
9#version 310 es
10#extension GL_OES_shader_image_atomic : require
11
12layout (local_size_x = 1, local_size_y = 1) in;
13
14layout(r32i, binding=1) coherent uniform highp iimage2D in_image;
15
16layout(r32i, binding=2) coherent uniform highp iimage2D in_image_2;
17
18layout(binding=0, std430) buffer Buffer
19{
20	highp int data[];
21} out_ssbo;
22
23void main (void)
24{
25        int groupNdx = int(gl_NumWorkGroups.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x);
26	int value;
27
28	if (groupNdx % 2 == 0)
29	{
30	     value = imageLoad(in_image, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y))).x;
31	}
32	else
33	{
34 	     value = imageLoad(in_image_2, ivec2(int(gl_GlobalInvocationID.x), int(gl_GlobalInvocationID.y))).x;
35	}
36
37	out_ssbo.data[groupNdx] = value;
38}
39
40[test]
41texture integer 1 (2,2) (2,0) GL_R32I
42image texture 1 GL_R32I
43
44texture integer 2 (2,2) (2,10) GL_R32I
45image texture 2 GL_R32I
46
47ssbo 0 64
48
49compute 2 2 1
50
51probe ssbo int 0 0  == 0
52probe ssbo int 0 4  == 11
53probe ssbo int 0 8  == 2
54probe ssbo int 0 12 == 13
55