1 # -------------------------------------------------
2 # drawElements Quality Program OpenGL ES 3.2 Module
3 # -------------------------------------------------
5 # Copyright 2016 The Android Open Source Project
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 group extension_macros "Extension macro definitions"
22 case android_extension_pack_es31a
24 desc "Test GL_ANDROID_extension_pack_es31a macro"
27 output float out0 = 1.0;
32 ${VERTEX_DECLARATIONS}
41 precision mediump float;
42 ${FRAGMENT_DECLARATIONS}
46 out0 = float(GL_ANDROID_extension_pack_es31a);
53 group extension_directive "Extension directive"
55 case oes_sample_variables
57 desc "Test oes_sample_variables extension"
60 output float out0 = 1.0;
65 ${VERTEX_DECLARATIONS}
74 precision mediump float;
75 ${FRAGMENT_DECLARATIONS}
79 out0 = (gl_SampleID < 0) ? (0.0) : (1.0);
85 case oes_shader_image_atomic
87 desc "Test oes_shader_image_atomic extension"
88 expect build_successful
92 ${VERTEX_DECLARATIONS}
101 precision mediump float;
102 ${FRAGMENT_DECLARATIONS}
103 layout(binding=0, r32i) coherent uniform highp iimage2D u_image;
107 if (imageAtomicXor(u_image, ivec2(0, 0), 1) == 0)
114 case oes_shader_multisample_interpolation
116 desc "Test oes_shader_multisample_interpolation extension"
119 input float in0 = 1.0;
120 output float out0 = 1.0;
125 ${VERTEX_DECLARATIONS}
126 sample out highp float v_var;
136 precision mediump float;
137 ${FRAGMENT_DECLARATIONS}
138 sample in mediump float v_var;
148 case oes_texture_storage_multisample_2d_array
150 desc "Test oes_texture_storage_multisample_2d_array extension"
151 expect build_successful
155 ${VERTEX_DECLARATIONS}
164 precision mediump float;
165 ${FRAGMENT_DECLARATIONS}
166 uniform mediump sampler2DMSArray u_sampler;
170 if (texelFetch(u_sampler, ivec3(0, 0, 0), 0).r > 0.5)
177 case ext_geometry_shader
179 desc "Test ext_geometry_shader extension"
182 input float in0 = 1.0;
183 output float out0 = 1.0;
188 ${VERTEX_DECLARATIONS}
189 out highp float geo_in;
198 ${GEOMETRY_DECLARATIONS}
199 in lowp float geo_in[];
200 out mediump float geo_out;
203 for (int ndx = 0; ndx < gl_in.length(); ++ndx)
205 geo_out = geo_in[ndx];
206 gl_Position = gl_in[ndx].gl_Position;
213 precision mediump float;
214 ${FRAGMENT_DECLARATIONS}
215 in mediump float geo_out;
226 desc "Test ext_gpu_shader5 extension"
229 input float in0 = 1.0;
230 output float out0 = 2.0;
235 ${VERTEX_DECLARATIONS}
236 out highp float v_var;
245 precision mediump float;
246 ${FRAGMENT_DECLARATIONS}
247 in mediump float v_var;
250 precise float fmaResult = fma(v_var, v_var, v_var);
257 case ext_primitive_bounding_box
259 desc "Test ext_primitive_bounding_box extension"
262 input float in0 = 1.0;
263 output float out0 = 1.0;
268 ${VERTEX_DECLARATIONS}
269 out highp float tc_in;
276 tessellation_control ""
278 ${TESSELLATION_CONTROL_DECLARATIONS}
279 in highp float tc_in[];
280 out highp float tc_out[];
283 tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
284 // set bounding box to (-1,-1,-1, 1) .. (1,1,1,1)
285 gl_BoundingBox[0] = vec4(tc_in[0]-2.0, tc_in[1]-2.0, tc_in[2]-2.0, 1.0);
286 gl_BoundingBox[1] = vec4(tc_in[0], tc_in[1], tc_in[2], 1.0);
287 ${TESSELLATION_CONTROL_OUTPUT}
290 tessellation_evaluation ""
292 ${TESSELLATION_EVALUATION_DECLARATIONS}
293 in highp float tc_out[];
294 out highp float te_out;
298 ${TESSELLATION_EVALUATION_OUTPUT}
303 precision mediump float;
304 ${FRAGMENT_DECLARATIONS}
305 in mediump float te_out;
314 case ext_shader_io_blocks
316 desc "Test ext_shader_io_blocks extension"
319 input float in0 = 1.0;
320 output float out0 = 1.0;
325 ${VERTEX_DECLARATIONS}
326 out VaryingIOBlockName { highp float v_var; } instanceName;
329 instanceName.v_var = in0;
335 precision mediump float;
336 ${FRAGMENT_DECLARATIONS}
337 in VaryingIOBlockName { highp float v_var; } instanceName;
340 out0 = instanceName.v_var;
346 case ext_tessellation_shader
348 desc "Test ext_tessellation_shader extension"
351 input float in0 = 1.0;
352 output float out0 = 1.0;
357 ${VERTEX_DECLARATIONS}
358 out highp float tc_in;
365 tessellation_control ""
367 ${TESSELLATION_CONTROL_DECLARATIONS}
368 in highp float tc_in[];
369 out highp float tc_out[];
372 tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
373 ${TESSELLATION_CONTROL_OUTPUT}
376 tessellation_evaluation ""
378 ${TESSELLATION_EVALUATION_DECLARATIONS}
379 in highp float tc_out[];
380 out highp float te_out;
384 ${TESSELLATION_EVALUATION_OUTPUT}
389 precision mediump float;
390 ${FRAGMENT_DECLARATIONS}
391 in mediump float te_out;
400 case ext_texture_buffer
402 desc "Test ext_texture_buffer extension"
403 expect build_successful
407 ${VERTEX_DECLARATIONS}
416 precision mediump float;
417 ${FRAGMENT_DECLARATIONS}
418 uniform mediump samplerBuffer u_sampler;
422 if (textureSize(u_sampler) > 10)
429 case ext_texture_cube_map_array
431 desc "Test ext_texture_cube_map_array extension"
432 expect build_successful
436 ${VERTEX_DECLARATIONS}
445 precision mediump float;
446 ${FRAGMENT_DECLARATIONS}
447 uniform mediump samplerCubeArray u_sampler;
451 if (textureSize(u_sampler, 3).y > 10)
459 group implementation_limits "Extended implementation limits"
461 case max_fragment_atomic_counter_buffers
463 desc "Test MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS limit"
464 expect build_successful
468 ${VERTEX_DECLARATIONS}
477 precision mediump float;
478 ${FRAGMENT_DECLARATIONS}
479 layout(binding=0) uniform atomic_uint u_counter;
483 if (atomicCounterIncrement(u_counter) == 0u)
490 case max_fragment_atomic_counters
492 desc "Test MAX_FRAGMENT_ATOMIC_COUNTERS limit"
493 expect build_successful
497 ${VERTEX_DECLARATIONS}
506 precision mediump float;
507 ${FRAGMENT_DECLARATIONS}
508 layout(binding=0) uniform atomic_uint u_counter[8];
512 if (atomicCounterIncrement(u_counter[0]) == 0u)
514 if (atomicCounterIncrement(u_counter[1]) == 0u)
516 if (atomicCounterIncrement(u_counter[2]) == 0u)
518 if (atomicCounterIncrement(u_counter[3]) == 0u)
520 if (atomicCounterIncrement(u_counter[4]) == 0u)
522 if (atomicCounterIncrement(u_counter[5]) == 0u)
524 if (atomicCounterIncrement(u_counter[6]) == 0u)
526 if (atomicCounterIncrement(u_counter[7]) == 0u)
533 case max_fragment_image_uniforms
535 desc "Test MAX_FRAGMENT_IMAGE_UNIFORMS limit"
536 expect build_successful
540 ${VERTEX_DECLARATIONS}
549 precision mediump float;
550 ${FRAGMENT_DECLARATIONS}
551 layout(binding=0, r32i) uniform readonly highp iimage2D u_image0;
552 layout(binding=1, rgba16i) uniform readonly highp iimage3D u_image1;
553 layout(binding=2, rgba8ui) uniform readonly highp uimageCube u_image2;
554 layout(binding=3, rgba16f) uniform readonly highp image2DArray u_image3;
558 if (imageLoad(u_image0, ivec2(0, 0)).r == 0)
560 if (imageLoad(u_image1, ivec3(0, 0, 0)).r == 0)
562 if (imageLoad(u_image2, ivec3(0, 0, 0)).r == 0u)
564 if (imageLoad(u_image3, ivec3(0, 0, 0)).r == 0.0)
571 case max_fragment_shader_storage_blocks
573 desc "Test MAX_FRAGMENT_SHADER_STORAGE_BLOCKS limit"
574 expect build_successful
578 ${VERTEX_DECLARATIONS}
587 precision mediump float;
588 ${FRAGMENT_DECLARATIONS}
589 layout(binding=0, std430) coherent readonly buffer Buffer0
592 highp float vals[32];
594 layout(binding=1, std140) volatile buffer Buffer1
598 layout(binding=2, packed) restrict buffer Buffer2
602 layout(binding=3, std140) writeonly buffer Buffer3
609 highp int readNdx = abs(int(gl_FragCoord.x));
610 highp int writeNdx = abs(int(gl_FragCoord.y));
612 if (buffer0.vals[readNdx % 32] == 0.0)
615 if (buffer1.vals[readNdx % 1024] == 0.0)
617 buffer1.vals[writeNdx % 1024] = float(readNdx);
619 if (buffer2.vals[readNdx % 15] == 0)
621 buffer2.vals[writeNdx % 15] = readNdx;
623 buffer3.vals[writeNdx % 8] = vec3(float(writeNdx), 0.0, float(readNdx));