1 # Verify reading from multiple images
7 GL_ARB_shader_image_load_store
11 #extension GL_ARB_compute_shader: enable
12 #extension GL_ARB_shader_image_load_store: enable
14 uniform int select_textures;
15 layout(rgba8) readonly uniform image2D src0;
16 layout(rgba8) readonly uniform image2D src1;
17 writeonly uniform image2D dst;
19 layout(local_size_x = 16, local_size_y = 16) in;
23 ivec2 coord = ivec2(gl_GlobalInvocationID.xy);
24 vec4 color = vec4(0, 0, 0, 0);
25 if ((select_textures & 1) == 1) {
26 color += imageLoad(src0, coord);
28 if ((select_textures & 2) == 2) {
29 color += imageLoad(src1, coord);
31 imageStore(dst, coord, color);
36 texture rgbw 0 (16, 16) GL_RGBA8
38 image texture 0 GL_RGBA8
40 clear color 1.0 0.0 1.0 0.0
44 texture rgbw 1 (16, 16) GL_RGBA8
46 image texture 1 GL_RGBA8
48 clear color 0.0 1.0 0.0 1.0
52 texture rgbw 2 (16, 16) GL_RGBA8
54 image texture 2 GL_RGBA8
57 # Clear dst image to not have the same color as the first test case
58 clear color 0.5 0.5 0.5 0.5
60 probe all rgba 0.5 0.5 0.5 0.5
62 # Use neither source image
63 uniform int select_textures 0
65 probe all rgba 0.0 0.0 0.0 0.0
68 uniform int select_textures 1
70 probe all rgba 1.0 0.0 1.0 0.0
73 uniform int select_textures 2
75 probe all rgba 0.0 1.0 0.0 1.0
77 # Use both src0 and src1 images
78 uniform int select_textures 3
80 probe all rgba 1.0 1.0 1.0 1.0