1group extension_macros "Extension macro definitions" 2 3 case android_extension_pack_es31a 4 version 310 es 5 desc "Test GL_ANDROID_extension_pack_es31a macro" 6 require extension { "GL_ANDROID_extension_pack_es31a" } 7 values 8 { 9 output float out0 = 1.0; 10 } 11 12 vertex "" 13 #version 310 es 14 ${VERTEX_DECLARATIONS} 15 16 void main() 17 { 18 ${VERTEX_OUTPUT} 19 } 20 "" 21 fragment "" 22 #version 310 es 23 precision mediump float; 24 ${FRAGMENT_DECLARATIONS} 25 26 void main() 27 { 28 out0 = float(GL_ANDROID_extension_pack_es31a); 29 ${FRAGMENT_OUTPUT} 30 } 31 "" 32 end 33end 34 35group extension_directive "Extension directive" 36 37 case oes_sample_variables 38 version 310 es 39 desc "Test oes_sample_variables extension" 40 require extension { "GL_ANDROID_extension_pack_es31a" } 41 values 42 { 43 output float out0 = 1.0; 44 } 45 46 vertex "" 47 #version 310 es 48 ${VERTEX_DECLARATIONS} 49 50 void main() 51 { 52 ${VERTEX_OUTPUT} 53 } 54 "" 55 fragment "" 56 #version 310 es 57 precision mediump float; 58 ${FRAGMENT_DECLARATIONS} 59 60 void main() 61 { 62 out0 = (gl_SampleID < 0) ? (0.0) : (1.0); 63 ${FRAGMENT_OUTPUT} 64 } 65 "" 66 end 67 68 case oes_shader_image_atomic 69 version 310 es 70 desc "Test oes_shader_image_atomic extension" 71 require extension { "GL_ANDROID_extension_pack_es31a" } 72 expect build_successful 73 74 vertex "" 75 #version 310 es 76 ${VERTEX_DECLARATIONS} 77 78 void main() 79 { 80 ${VERTEX_OUTPUT} 81 } 82 "" 83 fragment "" 84 #version 310 es 85 precision mediump float; 86 ${FRAGMENT_DECLARATIONS} 87 layout(binding=0, r32i) coherent uniform highp iimage2D u_image; 88 89 void main() 90 { 91 if (imageAtomicXor(u_image, ivec2(0, 0), 1) == 0) 92 discard; 93 ${FRAGMENT_OUTPUT} 94 } 95 "" 96 end 97 98 case oes_shader_multisample_interpolation 99 version 310 es 100 desc "Test oes_shader_multisample_interpolation extension" 101 require extension { "GL_ANDROID_extension_pack_es31a" } 102 values 103 { 104 input float in0 = 1.0; 105 output float out0 = 1.0; 106 } 107 108 vertex "" 109 #version 310 es 110 ${VERTEX_DECLARATIONS} 111 sample out highp float v_var; 112 113 void main() 114 { 115 v_var = in0; 116 ${VERTEX_OUTPUT} 117 } 118 "" 119 fragment "" 120 #version 310 es 121 precision mediump float; 122 ${FRAGMENT_DECLARATIONS} 123 sample in mediump float v_var; 124 125 void main() 126 { 127 out0 = v_var; 128 ${FRAGMENT_OUTPUT} 129 } 130 "" 131 end 132 133 case oes_texture_storage_multisample_2d_array 134 version 310 es 135 desc "Test oes_texture_storage_multisample_2d_array extension" 136 require extension { "GL_ANDROID_extension_pack_es31a" } 137 expect build_successful 138 139 vertex "" 140 #version 310 es 141 ${VERTEX_DECLARATIONS} 142 143 void main() 144 { 145 ${VERTEX_OUTPUT} 146 } 147 "" 148 fragment "" 149 #version 310 es 150 precision mediump float; 151 ${FRAGMENT_DECLARATIONS} 152 uniform mediump sampler2DMSArray u_sampler; 153 154 void main() 155 { 156 if (texelFetch(u_sampler, ivec3(0, 0, 0), 0).r > 0.5) 157 discard; 158 ${FRAGMENT_OUTPUT} 159 } 160 "" 161 end 162 163 case ext_geometry_shader 164 version 310 es 165 desc "Test ext_geometry_shader extension" 166 require extension { "GL_ANDROID_extension_pack_es31a" } 167 values 168 { 169 input float in0 = 1.0; 170 output float out0 = 1.0; 171 } 172 173 vertex "" 174 #version 310 es 175 ${VERTEX_DECLARATIONS} 176 out highp float geo_in; 177 void main() 178 { 179 geo_in = in0; 180 ${VERTEX_OUTPUT} 181 } 182 "" 183 geometry "" 184 #version 310 es 185 ${GEOMETRY_DECLARATIONS} 186 in lowp float geo_in[]; 187 out mediump float geo_out; 188 void main() 189 { 190 for (int ndx = 0; ndx < gl_in.length(); ++ndx) 191 { 192 geo_out = geo_in[ndx]; 193 gl_Position = gl_in[ndx].gl_Position; 194 EmitVertex(); 195 } 196 } 197 "" 198 fragment "" 199 #version 310 es 200 precision mediump float; 201 ${FRAGMENT_DECLARATIONS} 202 in mediump float geo_out; 203 void main() 204 { 205 out0 = geo_out; 206 ${FRAGMENT_OUTPUT} 207 } 208 "" 209 end 210 211 case ext_gpu_shader5 212 version 310 es 213 desc "Test ext_gpu_shader5 extension" 214 require extension { "GL_ANDROID_extension_pack_es31a" } 215 values 216 { 217 input float in0 = 1.0; 218 output float out0 = 2.0; 219 } 220 221 vertex "" 222 #version 310 es 223 ${VERTEX_DECLARATIONS} 224 out highp float v_var; 225 void main() 226 { 227 v_var = in0; 228 ${VERTEX_OUTPUT} 229 } 230 "" 231 fragment "" 232 #version 310 es 233 precision mediump float; 234 ${FRAGMENT_DECLARATIONS} 235 in mediump float v_var; 236 void main() 237 { 238 precise float fmaResult = fma(v_var, v_var, v_var); 239 out0 = fmaResult; 240 ${FRAGMENT_OUTPUT} 241 } 242 "" 243 end 244 245 case ext_primitive_bounding_box 246 version 310 es 247 desc "Test ext_primitive_bounding_box extension" 248 require extension { "GL_ANDROID_extension_pack_es31a" } 249 values 250 { 251 input float in0 = 1.0; 252 output float out0 = 1.0; 253 } 254 255 vertex "" 256 #version 310 es 257 ${VERTEX_DECLARATIONS} 258 out highp float tc_in; 259 void main() 260 { 261 tc_in = in0; 262 ${VERTEX_OUTPUT} 263 } 264 "" 265 tessellation_control "" 266 #version 310 es 267 ${TESSELLATION_CONTROL_DECLARATIONS} 268 in highp float tc_in[]; 269 out highp float tc_out[]; 270 void main() 271 { 272 tc_out[gl_InvocationID] = tc_in[gl_InvocationID]; 273 // set bounding box to (-1,-1,-1, 1) .. (1,1,1,1) 274 gl_BoundingBoxEXT[0] = vec4(tc_in[0]-2.0, tc_in[1]-2.0, tc_in[2]-2.0, 1.0); 275 gl_BoundingBoxEXT[1] = vec4(tc_in[0], tc_in[1], tc_in[2], 1.0); 276 ${TESSELLATION_CONTROL_OUTPUT} 277 } 278 "" 279 tessellation_evaluation "" 280 #version 310 es 281 ${TESSELLATION_EVALUATION_DECLARATIONS} 282 in highp float tc_out[]; 283 out highp float te_out; 284 void main() 285 { 286 te_out = tc_out[2]; 287 ${TESSELLATION_EVALUATION_OUTPUT} 288 } 289 "" 290 fragment "" 291 #version 310 es 292 precision mediump float; 293 ${FRAGMENT_DECLARATIONS} 294 in mediump float te_out; 295 void main() 296 { 297 out0 = te_out; 298 ${FRAGMENT_OUTPUT} 299 } 300 "" 301 end 302 303 case ext_shader_io_blocks 304 version 310 es 305 desc "Test ext_shader_io_blocks extension" 306 require extension { "GL_ANDROID_extension_pack_es31a" } 307 values 308 { 309 input float in0 = 1.0; 310 output float out0 = 1.0; 311 } 312 313 vertex "" 314 #version 310 es 315 ${VERTEX_DECLARATIONS} 316 out VaryingIOBlockName { highp float v_var; } instanceName; 317 void main() 318 { 319 instanceName.v_var = in0; 320 ${VERTEX_OUTPUT} 321 } 322 "" 323 fragment "" 324 #version 310 es 325 precision mediump float; 326 ${FRAGMENT_DECLARATIONS} 327 in VaryingIOBlockName { highp float v_var; } instanceName; 328 void main() 329 { 330 out0 = instanceName.v_var; 331 ${FRAGMENT_OUTPUT} 332 } 333 "" 334 end 335 336 case ext_tessellation_shader 337 version 310 es 338 desc "Test ext_tessellation_shader extension" 339 require extension { "GL_ANDROID_extension_pack_es31a" } 340 values 341 { 342 input float in0 = 1.0; 343 output float out0 = 1.0; 344 } 345 346 vertex "" 347 #version 310 es 348 ${VERTEX_DECLARATIONS} 349 out highp float tc_in; 350 void main() 351 { 352 tc_in = in0; 353 ${VERTEX_OUTPUT} 354 } 355 "" 356 tessellation_control "" 357 #version 310 es 358 ${TESSELLATION_CONTROL_DECLARATIONS} 359 in highp float tc_in[]; 360 out highp float tc_out[]; 361 void main() 362 { 363 tc_out[gl_InvocationID] = tc_in[gl_InvocationID]; 364 ${TESSELLATION_CONTROL_OUTPUT} 365 } 366 "" 367 tessellation_evaluation "" 368 #version 310 es 369 ${TESSELLATION_EVALUATION_DECLARATIONS} 370 in highp float tc_out[]; 371 out highp float te_out; 372 void main() 373 { 374 te_out = tc_out[2]; 375 ${TESSELLATION_EVALUATION_OUTPUT} 376 } 377 "" 378 fragment "" 379 #version 310 es 380 precision mediump float; 381 ${FRAGMENT_DECLARATIONS} 382 in mediump float te_out; 383 void main() 384 { 385 out0 = te_out; 386 ${FRAGMENT_OUTPUT} 387 } 388 "" 389 end 390 391 case ext_texture_buffer 392 version 310 es 393 desc "Test ext_texture_buffer extension" 394 require extension { "GL_ANDROID_extension_pack_es31a" } 395 expect build_successful 396 397 vertex "" 398 #version 310 es 399 ${VERTEX_DECLARATIONS} 400 401 void main() 402 { 403 ${VERTEX_OUTPUT} 404 } 405 "" 406 fragment "" 407 #version 310 es 408 precision mediump float; 409 ${FRAGMENT_DECLARATIONS} 410 uniform mediump samplerBuffer u_sampler; 411 412 void main() 413 { 414 if (textureSize(u_sampler) > 10) 415 discard; 416 ${FRAGMENT_OUTPUT} 417 } 418 "" 419 end 420 421 case ext_texture_cube_map_array 422 version 310 es 423 desc "Test ext_texture_cube_map_array extension" 424 require extension { "GL_ANDROID_extension_pack_es31a" } 425 expect build_successful 426 427 vertex "" 428 #version 310 es 429 ${VERTEX_DECLARATIONS} 430 431 void main() 432 { 433 ${VERTEX_OUTPUT} 434 } 435 "" 436 fragment "" 437 #version 310 es 438 precision mediump float; 439 ${FRAGMENT_DECLARATIONS} 440 uniform mediump samplerCubeArray u_sampler; 441 442 void main() 443 { 444 if (textureSize(u_sampler, 3).y > 10) 445 discard; 446 ${FRAGMENT_OUTPUT} 447 } 448 "" 449 end 450end 451 452group implementation_limits "Extended implementation limits" 453 454 case max_fragment_atomic_counter_buffers 455 version 310 es 456 desc "Test MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS limit" 457 require extension { "GL_ANDROID_extension_pack_es31a" } 458 expect build_successful 459 460 vertex "" 461 #version 310 es 462 ${VERTEX_DECLARATIONS} 463 464 void main() 465 { 466 ${VERTEX_OUTPUT} 467 } 468 "" 469 fragment "" 470 #version 310 es 471 precision mediump float; 472 ${FRAGMENT_DECLARATIONS} 473 layout(binding=0) uniform atomic_uint u_counter; 474 475 void main() 476 { 477 if (atomicCounterIncrement(u_counter) == 0u) 478 discard; 479 ${FRAGMENT_OUTPUT} 480 } 481 "" 482 end 483 484 case max_fragment_atomic_counters 485 version 310 es 486 desc "Test MAX_FRAGMENT_ATOMIC_COUNTERS limit" 487 require extension { "GL_ANDROID_extension_pack_es31a" } 488 expect build_successful 489 490 vertex "" 491 #version 310 es 492 ${VERTEX_DECLARATIONS} 493 494 void main() 495 { 496 ${VERTEX_OUTPUT} 497 } 498 "" 499 fragment "" 500 #version 310 es 501 precision mediump float; 502 ${FRAGMENT_DECLARATIONS} 503 layout(binding=0) uniform atomic_uint u_counter[8]; 504 505 void main() 506 { 507 if (atomicCounterIncrement(u_counter[0]) == 0u) 508 discard; 509 if (atomicCounterIncrement(u_counter[1]) == 0u) 510 discard; 511 if (atomicCounterIncrement(u_counter[2]) == 0u) 512 discard; 513 if (atomicCounterIncrement(u_counter[3]) == 0u) 514 discard; 515 if (atomicCounterIncrement(u_counter[4]) == 0u) 516 discard; 517 if (atomicCounterIncrement(u_counter[5]) == 0u) 518 discard; 519 if (atomicCounterIncrement(u_counter[6]) == 0u) 520 discard; 521 if (atomicCounterIncrement(u_counter[7]) == 0u) 522 discard; 523 ${FRAGMENT_OUTPUT} 524 } 525 "" 526 end 527 528 case max_fragment_image_uniforms 529 version 310 es 530 desc "Test MAX_FRAGMENT_IMAGE_UNIFORMS limit" 531 require extension { "GL_ANDROID_extension_pack_es31a" } 532 expect build_successful 533 534 vertex "" 535 #version 310 es 536 ${VERTEX_DECLARATIONS} 537 538 void main() 539 { 540 ${VERTEX_OUTPUT} 541 } 542 "" 543 fragment "" 544 #version 310 es 545 precision mediump float; 546 ${FRAGMENT_DECLARATIONS} 547 layout(binding=0, r32i) uniform readonly highp iimage2D u_image0; 548 layout(binding=1, rgba16i) uniform readonly highp iimage3D u_image1; 549 layout(binding=2, rgba8ui) uniform readonly highp uimageCube u_image2; 550 layout(binding=3, rgba16f) uniform readonly highp image2DArray u_image3; 551 552 void main() 553 { 554 if (imageLoad(u_image0, ivec2(0, 0)).r == 0) 555 discard; 556 if (imageLoad(u_image1, ivec3(0, 0, 0)).r == 0) 557 discard; 558 if (imageLoad(u_image2, ivec3(0, 0, 0)).r == 0u) 559 discard; 560 if (imageLoad(u_image3, ivec3(0, 0, 0)).r == 0.0) 561 discard; 562 ${FRAGMENT_OUTPUT} 563 } 564 "" 565 end 566 567 case max_fragment_shader_storage_blocks 568 version 310 es 569 desc "Test MAX_FRAGMENT_SHADER_STORAGE_BLOCKS limit" 570 require extension { "GL_ANDROID_extension_pack_es31a" } 571 expect build_successful 572 573 vertex "" 574 #version 310 es 575 ${VERTEX_DECLARATIONS} 576 577 void main() 578 { 579 ${VERTEX_OUTPUT} 580 } 581 "" 582 fragment "" 583 #version 310 es 584 precision mediump float; 585 ${FRAGMENT_DECLARATIONS} 586 layout(binding=0, std430) coherent readonly buffer Buffer0 587 { 588 highp int val; 589 highp float vals[32]; 590 } buffer0; 591 layout(binding=1, std140) volatile buffer Buffer1 592 { 593 highp float vals[]; 594 } buffer1; 595 layout(binding=2, packed) restrict buffer Buffer2 596 { 597 highp int vals[15]; 598 } buffer2; 599 layout(binding=3, std140) writeonly buffer Buffer3 600 { 601 highp vec3 vals[8]; 602 } buffer3; 603 604 void main() 605 { 606 highp int readNdx = abs(int(gl_FragCoord.x)); 607 highp int writeNdx = abs(int(gl_FragCoord.y)); 608 609 if (buffer0.vals[readNdx % 32] == 0.0) 610 discard; 611 612 if (buffer1.vals[readNdx % 1024] == 0.0) 613 discard; 614 buffer1.vals[writeNdx % 1024] = float(readNdx); 615 616 if (buffer2.vals[readNdx % 15] == 0) 617 discard; 618 buffer2.vals[writeNdx % 15] = readNdx; 619 620 buffer3.vals[writeNdx % 8] = vec3(float(writeNdx), 0.0, float(readNdx)); 621 ${FRAGMENT_OUTPUT} 622 } 623 "" 624 end 625end 626