1#!amber 2 3# Copyright 2019 Google LLC 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17 18# A test for a bug found by GraphicsFuzz. 19 20# Short description: A fragment shader performing a search computation, then writing red regardless 21 22# The test passes because the uniform values used to run the shader guarantee 23# that red will be written at the end, regardless of what the prior computation 24# does. 25 26SHADER vertex variant_vertex_shader PASSTHROUGH 27 28# variant_fragment_shader is derived from the following GLSL: 29# #version 310 es 30# precision highp float; 31# 32# layout(location = 0) out vec4 _GLF_color; 33# 34# layout(set = 0, binding = 0) uniform buf0 { 35# vec2 injectionSwitch; 36# }; 37# struct BST { 38# int data; 39# int leftIndex; 40# int rightIndex; 41# } ; 42# 43# BST tree[10]; 44# 45# struct Obj { 46# float odd_numbers[10]; 47# float even_numbers[10]; 48# } ; 49# 50# void makeTreeNode(inout BST tree, int data) 51# { 52# tree.data = data; 53# tree.leftIndex = - 1; 54# tree.rightIndex = - 1; 55# } 56# void insert(int treeIndex, int data) 57# { 58# int baseIndex = 0; 59# while(baseIndex <= treeIndex) 60# { 61# if(data <= tree[baseIndex].data) 62# { 63# if(tree[baseIndex].leftIndex == - 1) 64# { 65# tree[baseIndex].leftIndex = treeIndex; 66# makeTreeNode(tree[treeIndex], data); 67# return; 68# } 69# else 70# { 71# baseIndex = tree[baseIndex].leftIndex; 72# continue; 73# } 74# } 75# else 76# { 77# if(tree[baseIndex].rightIndex == - 1) 78# { 79# tree[baseIndex].rightIndex = treeIndex; 80# makeTreeNode(tree[treeIndex], data); 81# return; 82# } 83# else 84# { 85# int GLF_live8i = 1; 86# float GLF_live8A[50]; 87# GLF_live8A[GLF_live8i >= 0 && GLF_live8i < 50 ? GLF_live8i : 0] += GLF_live8A[(1 - 1) >= 0 && (1 - 1) < 50 ? 1 - 1 : 0]; 88# do 89# { 90# baseIndex = tree[baseIndex].rightIndex; 91# } 92# while((injectionSwitch.x > injectionSwitch.y)); 93# continue; 94# } 95# } 96# } 97# } 98# int search(int target) 99# { 100# BST currentNode; 101# int index = 0; 102# while(index != - 1) 103# { 104# currentNode = tree[index]; 105# if(currentNode.data == target) 106# { 107# return target; 108# } 109# index = target > currentNode.data ? currentNode.rightIndex : currentNode.leftIndex; 110# } 111# return - 1; 112# } 113# vec3 hueColor(float angle) 114# { 115# float nodeData = float(search(15)); 116# return (30.0 + angle * vec3(1.0, 5.0, nodeData)) / 50.0; 117# } 118# float makeFrame(float v) 119# { 120# v *= 6.5; 121# if(v < 1.5) 122# { 123# return float(search(100)); 124# } 125# if(v < 4.0) 126# { 127# return 0.0; 128# } 129# if(v < float(search(6))) 130# { 131# return 1.0; 132# } 133# return 10.0 + float(search(30)); 134# } 135# void main() 136# { 137# int treeIndex = 0; 138# makeTreeNode(tree[0], 9); 139# treeIndex ++; 140# insert(treeIndex, 5); 141# treeIndex ++; 142# int GLF_live1_looplimiter2 = 0; 143# for( 144# int GLF_live1i = 0; 145# 1 < 4; 146# GLF_live1i ++ 147# ) 148# { 149# if(GLF_live1_looplimiter2 >= 7) 150# { 151# break; 152# } 153# GLF_live1_looplimiter2 ++; 154# } 155# insert(treeIndex, 12); 156# treeIndex ++; 157# insert(treeIndex, 15); 158# treeIndex ++; 159# insert(treeIndex, 7); 160# treeIndex ++; 161# insert(treeIndex, 8); 162# treeIndex ++; 163# insert(treeIndex, 2); 164# treeIndex ++; 165# insert(treeIndex, 6); 166# treeIndex ++; 167# Obj GLF_live4obj; 168# int GLF_live4_looplimiter3 = 0; 169# for( 170# int GLF_live4i = 0; 171# 1 < 9; 172# GLF_live4i ++ 173# ) 174# { 175# if(GLF_live4_looplimiter3 >= 3) 176# { 177# break; 178# } 179# GLF_live4_looplimiter3 ++; 180# int GLF_live4index = 1; 181# GLF_live4obj.even_numbers[GLF_live4index >= 0 && GLF_live4index < 10 ? GLF_live4index : 0] = GLF_live4obj.even_numbers[1 >= 0 && 1 < 10 ? 1 : 0]; 182# GLF_live4obj.even_numbers[GLF_live4i >= 0 && GLF_live4i < 10 ? GLF_live4i : 0] = 1.0; 183# } 184# insert(treeIndex, 17); 185# if((injectionSwitch.x > injectionSwitch.y)) 186# { 187# return; 188# } 189# treeIndex ++; 190# insert(treeIndex, 13); 191# vec2 z = (gl_FragCoord.yx / vec2(256.0, 256.0)); 192# float x = makeFrame(z.x); 193# float y = makeFrame(z.y); 194# int sum = - 100; 195# for( 196# int target = 0; 197# target < 20; 198# target ++ 199# ) 200# { 201# int result = search(target); 202# if(result > 0) 203# { 204# } 205# else 206# { 207# switch(result) 208# { 209# case - 1: 210# sum += 1; 211# break; 212# case 0: 213# return; 214# } 215# } 216# } 217# float a = x + y * float(sum); 218# _GLF_color = vec4(injectionSwitch.x < injectionSwitch.y ? vec3(1.0, 0.0, 0.0) : hueColor(a), 1.); 219# } 220SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 221; SPIR-V 222; Version: 1.0 223; Generator: Khronos Glslang Reference Front End; 7 224; Bound: 456 225; Schema: 0 226 OpCapability Shader 227 %1 = OpExtInstImport "GLSL.std.450" 228 OpMemoryModel Logical GLSL450 229 OpEntryPoint Fragment %4 "main" %381 %436 230 OpExecutionMode %4 OriginUpperLeft 231 OpSource ESSL 310 232 OpName %4 "main" 233 OpName %7 "BST" 234 OpMemberName %7 0 "data" 235 OpMemberName %7 1 "leftIndex" 236 OpMemberName %7 2 "rightIndex" 237 OpName %13 "makeTreeNode(struct-BST-i1-i1-i11;i1;" 238 OpName %11 "tree" 239 OpName %12 "data" 240 OpName %18 "insert(i1;i1;" 241 OpName %16 "treeIndex" 242 OpName %17 "data" 243 OpName %22 "search(i1;" 244 OpName %21 "target" 245 OpName %29 "hueColor(f1;" 246 OpName %28 "angle" 247 OpName %33 "makeFrame(f1;" 248 OpName %32 "v" 249 OpName %43 "baseIndex" 250 OpName %58 "tree" 251 OpName %76 "param" 252 OpName %80 "param" 253 OpName %102 "param" 254 OpName %105 "param" 255 OpName %112 "GLF_live8i" 256 OpName %116 "GLF_live8A" 257 OpName %139 "buf0" 258 OpMemberName %139 0 "injectionSwitch" 259 OpName %141 "" 260 OpName %151 "index" 261 OpName %159 "currentNode" 262 OpName %186 "nodeData" 263 OpName %188 "param" 264 OpName %214 "param" 265 OpName %227 "param" 266 OpName %236 "param" 267 OpName %242 "treeIndex" 268 OpName %244 "param" 269 OpName %247 "param" 270 OpName %254 "param" 271 OpName %256 "param" 272 OpName %260 "GLF_live1_looplimiter2" 273 OpName %261 "GLF_live1i" 274 OpName %279 "param" 275 OpName %281 "param" 276 OpName %285 "param" 277 OpName %287 "param" 278 OpName %291 "param" 279 OpName %293 "param" 280 OpName %298 "param" 281 OpName %300 "param" 282 OpName %304 "param" 283 OpName %306 "param" 284 OpName %310 "param" 285 OpName %312 "param" 286 OpName %316 "GLF_live4_looplimiter3" 287 OpName %317 "GLF_live4i" 288 OpName %331 "GLF_live4index" 289 OpName %333 "Obj" 290 OpMemberName %333 0 "odd_numbers" 291 OpMemberName %333 1 "even_numbers" 292 OpName %335 "GLF_live4obj" 293 OpName %358 "param" 294 OpName %360 "param" 295 OpName %373 "param" 296 OpName %375 "param" 297 OpName %378 "z" 298 OpName %381 "gl_FragCoord" 299 OpName %387 "x" 300 OpName %388 "param" 301 OpName %392 "y" 302 OpName %393 "param" 303 OpName %397 "sum" 304 OpName %399 "target" 305 OpName %408 "result" 306 OpName %409 "param" 307 OpName %428 "a" 308 OpName %436 "_GLF_color" 309 OpName %448 "param" 310 OpMemberDecorate %7 0 RelaxedPrecision 311 OpMemberDecorate %7 1 RelaxedPrecision 312 OpMemberDecorate %7 2 RelaxedPrecision 313 OpDecorate %12 RelaxedPrecision 314 OpDecorate %16 RelaxedPrecision 315 OpDecorate %17 RelaxedPrecision 316 OpDecorate %22 RelaxedPrecision 317 OpDecorate %21 RelaxedPrecision 318 OpDecorate %36 RelaxedPrecision 319 OpDecorate %43 RelaxedPrecision 320 OpDecorate %49 RelaxedPrecision 321 OpDecorate %50 RelaxedPrecision 322 OpDecorate %53 RelaxedPrecision 323 OpDecorate %59 RelaxedPrecision 324 OpDecorate %62 RelaxedPrecision 325 OpDecorate %66 RelaxedPrecision 326 OpDecorate %68 RelaxedPrecision 327 OpDecorate %72 RelaxedPrecision 328 OpDecorate %73 RelaxedPrecision 329 OpDecorate %75 RelaxedPrecision 330 OpDecorate %81 RelaxedPrecision 331 OpDecorate %87 RelaxedPrecision 332 OpDecorate %89 RelaxedPrecision 333 OpDecorate %92 RelaxedPrecision 334 OpDecorate %94 RelaxedPrecision 335 OpDecorate %98 RelaxedPrecision 336 OpDecorate %99 RelaxedPrecision 337 OpDecorate %101 RelaxedPrecision 338 OpDecorate %106 RelaxedPrecision 339 OpDecorate %112 RelaxedPrecision 340 OpDecorate %117 RelaxedPrecision 341 OpDecorate %119 RelaxedPrecision 342 OpDecorate %123 RelaxedPrecision 343 OpDecorate %135 RelaxedPrecision 344 OpDecorate %137 RelaxedPrecision 345 OpMemberDecorate %139 0 Offset 0 346 OpDecorate %139 Block 347 OpDecorate %141 DescriptorSet 0 348 OpDecorate %141 Binding 0 349 OpDecorate %151 RelaxedPrecision 350 OpDecorate %157 RelaxedPrecision 351 OpDecorate %160 RelaxedPrecision 352 OpDecorate %164 RelaxedPrecision 353 OpDecorate %165 RelaxedPrecision 354 OpDecorate %169 RelaxedPrecision 355 OpDecorate %171 RelaxedPrecision 356 OpDecorate %173 RelaxedPrecision 357 OpDecorate %179 RelaxedPrecision 358 OpDecorate %182 RelaxedPrecision 359 OpDecorate %183 RelaxedPrecision 360 OpDecorate %189 RelaxedPrecision 361 OpDecorate %215 RelaxedPrecision 362 OpDecorate %228 RelaxedPrecision 363 OpDecorate %237 RelaxedPrecision 364 OpDecorate %242 RelaxedPrecision 365 OpDecorate %251 RelaxedPrecision 366 OpDecorate %252 RelaxedPrecision 367 OpDecorate %255 RelaxedPrecision 368 OpDecorate %258 RelaxedPrecision 369 OpDecorate %259 RelaxedPrecision 370 OpDecorate %260 RelaxedPrecision 371 OpDecorate %261 RelaxedPrecision 372 OpDecorate %268 RelaxedPrecision 373 OpDecorate %274 RelaxedPrecision 374 OpDecorate %275 RelaxedPrecision 375 OpDecorate %276 RelaxedPrecision 376 OpDecorate %277 RelaxedPrecision 377 OpDecorate %280 RelaxedPrecision 378 OpDecorate %283 RelaxedPrecision 379 OpDecorate %284 RelaxedPrecision 380 OpDecorate %286 RelaxedPrecision 381 OpDecorate %289 RelaxedPrecision 382 OpDecorate %290 RelaxedPrecision 383 OpDecorate %292 RelaxedPrecision 384 OpDecorate %295 RelaxedPrecision 385 OpDecorate %296 RelaxedPrecision 386 OpDecorate %299 RelaxedPrecision 387 OpDecorate %302 RelaxedPrecision 388 OpDecorate %303 RelaxedPrecision 389 OpDecorate %305 RelaxedPrecision 390 OpDecorate %308 RelaxedPrecision 391 OpDecorate %309 RelaxedPrecision 392 OpDecorate %311 RelaxedPrecision 393 OpDecorate %314 RelaxedPrecision 394 OpDecorate %315 RelaxedPrecision 395 OpDecorate %316 RelaxedPrecision 396 OpDecorate %317 RelaxedPrecision 397 OpDecorate %323 RelaxedPrecision 398 OpDecorate %329 RelaxedPrecision 399 OpDecorate %330 RelaxedPrecision 400 OpDecorate %331 RelaxedPrecision 401 OpDecorate %336 RelaxedPrecision 402 OpDecorate %338 RelaxedPrecision 403 OpDecorate %342 RelaxedPrecision 404 OpDecorate %347 RelaxedPrecision 405 OpDecorate %349 RelaxedPrecision 406 OpDecorate %352 RelaxedPrecision 407 OpDecorate %355 RelaxedPrecision 408 OpDecorate %356 RelaxedPrecision 409 OpDecorate %359 RelaxedPrecision 410 OpDecorate %370 RelaxedPrecision 411 OpDecorate %371 RelaxedPrecision 412 OpDecorate %374 RelaxedPrecision 413 OpDecorate %381 BuiltIn FragCoord 414 OpDecorate %397 RelaxedPrecision 415 OpDecorate %399 RelaxedPrecision 416 OpDecorate %405 RelaxedPrecision 417 OpDecorate %408 RelaxedPrecision 418 OpDecorate %410 RelaxedPrecision 419 OpDecorate %411 RelaxedPrecision 420 OpDecorate %412 RelaxedPrecision 421 OpDecorate %417 RelaxedPrecision 422 OpDecorate %421 RelaxedPrecision 423 OpDecorate %422 RelaxedPrecision 424 OpDecorate %426 RelaxedPrecision 425 OpDecorate %427 RelaxedPrecision 426 OpDecorate %431 RelaxedPrecision 427 OpDecorate %436 Location 0 428 %2 = OpTypeVoid 429 %3 = OpTypeFunction %2 430 %6 = OpTypeInt 32 1 431 %7 = OpTypeStruct %6 %6 %6 432 %8 = OpTypePointer Function %7 433 %9 = OpTypePointer Function %6 434 %10 = OpTypeFunction %2 %8 %9 435 %15 = OpTypeFunction %2 %9 %9 436 %20 = OpTypeFunction %6 %9 437 %24 = OpTypeFloat 32 438 %25 = OpTypePointer Function %24 439 %26 = OpTypeVector %24 3 440 %27 = OpTypeFunction %26 %25 441 %31 = OpTypeFunction %24 %25 442 %35 = OpConstant %6 0 443 %38 = OpConstant %6 1 444 %39 = OpConstant %6 -1 445 %41 = OpConstant %6 2 446 %51 = OpTypeBool 447 %54 = OpTypeInt 32 0 448 %55 = OpConstant %54 10 449 %56 = OpTypeArray %7 %55 450 %57 = OpTypePointer Private %56 451 %58 = OpVariable %57 Private 452 %60 = OpTypePointer Private %6 453 %77 = OpTypePointer Private %7 454 %113 = OpConstant %54 50 455 %114 = OpTypeArray %24 %113 456 %115 = OpTypePointer Function %114 457 %120 = OpConstant %6 50 458 %138 = OpTypeVector %24 2 459 %139 = OpTypeStruct %138 460 %140 = OpTypePointer Uniform %139 461 %141 = OpVariable %140 Uniform 462 %142 = OpConstant %54 0 463 %143 = OpTypePointer Uniform %24 464 %146 = OpConstant %54 1 465 %187 = OpConstant %6 15 466 %191 = OpConstant %24 30 467 %193 = OpConstant %24 1 468 %194 = OpConstant %24 5 469 %200 = OpConstant %24 50 470 %205 = OpConstant %24 6.5 471 %209 = OpConstant %24 1.5 472 %213 = OpConstant %6 100 473 %219 = OpConstant %24 4 474 %223 = OpConstant %24 0 475 %226 = OpConstant %6 6 476 %234 = OpConstant %24 10 477 %235 = OpConstant %6 30 478 %243 = OpConstant %6 9 479 %253 = OpConstant %6 5 480 %267 = OpConstantTrue %51 481 %269 = OpConstant %6 7 482 %278 = OpConstant %6 12 483 %297 = OpConstant %6 8 484 %324 = OpConstant %6 3 485 %332 = OpTypeArray %24 %55 486 %333 = OpTypeStruct %332 %332 487 %334 = OpTypePointer Function %333 488 %339 = OpConstant %6 10 489 %357 = OpConstant %6 17 490 %372 = OpConstant %6 13 491 %377 = OpTypePointer Function %138 492 %379 = OpTypeVector %24 4 493 %380 = OpTypePointer Input %379 494 %381 = OpVariable %380 Input 495 %384 = OpConstant %24 256 496 %385 = OpConstantComposite %138 %384 %384 497 %398 = OpConstant %6 -100 498 %406 = OpConstant %6 20 499 %435 = OpTypePointer Output %379 500 %436 = OpVariable %435 Output 501 %442 = OpTypePointer Function %26 502 %446 = OpConstantComposite %26 %193 %223 %223 503 %4 = OpFunction %2 None %3 504 %5 = OpLabel 505 %242 = OpVariable %9 Function 506 %244 = OpVariable %8 Function 507 %247 = OpVariable %9 Function 508 %254 = OpVariable %9 Function 509 %256 = OpVariable %9 Function 510 %260 = OpVariable %9 Function 511 %261 = OpVariable %9 Function 512 %279 = OpVariable %9 Function 513 %281 = OpVariable %9 Function 514 %285 = OpVariable %9 Function 515 %287 = OpVariable %9 Function 516 %291 = OpVariable %9 Function 517 %293 = OpVariable %9 Function 518 %298 = OpVariable %9 Function 519 %300 = OpVariable %9 Function 520 %304 = OpVariable %9 Function 521 %306 = OpVariable %9 Function 522 %310 = OpVariable %9 Function 523 %312 = OpVariable %9 Function 524 %316 = OpVariable %9 Function 525 %317 = OpVariable %9 Function 526 %331 = OpVariable %9 Function 527 %335 = OpVariable %334 Function 528 %358 = OpVariable %9 Function 529 %360 = OpVariable %9 Function 530 %373 = OpVariable %9 Function 531 %375 = OpVariable %9 Function 532 %378 = OpVariable %377 Function 533 %387 = OpVariable %25 Function 534 %388 = OpVariable %25 Function 535 %392 = OpVariable %25 Function 536 %393 = OpVariable %25 Function 537 %397 = OpVariable %9 Function 538 %399 = OpVariable %9 Function 539 %408 = OpVariable %9 Function 540 %409 = OpVariable %9 Function 541 %428 = OpVariable %25 Function 542 %443 = OpVariable %442 Function 543 %448 = OpVariable %25 Function 544 OpStore %242 %35 545 %245 = OpAccessChain %77 %58 %35 546 %246 = OpLoad %7 %245 547 OpStore %244 %246 548 OpStore %247 %243 549 %248 = OpFunctionCall %2 %13 %244 %247 550 %249 = OpLoad %7 %244 551 %250 = OpAccessChain %77 %58 %35 552 OpStore %250 %249 553 %251 = OpLoad %6 %242 554 %252 = OpIAdd %6 %251 %38 555 OpStore %242 %252 556 %255 = OpLoad %6 %242 557 OpStore %254 %255 558 OpStore %256 %253 559 %257 = OpFunctionCall %2 %18 %254 %256 560 %258 = OpLoad %6 %242 561 %259 = OpIAdd %6 %258 %38 562 OpStore %242 %259 563 OpStore %260 %35 564 OpStore %261 %35 565 OpBranch %262 566 %262 = OpLabel 567 OpLoopMerge %264 %265 None 568 OpBranch %266 569 %266 = OpLabel 570 OpBranchConditional %267 %263 %264 571 %263 = OpLabel 572 %268 = OpLoad %6 %260 573 %270 = OpSGreaterThanEqual %51 %268 %269 574 OpSelectionMerge %272 None 575 OpBranchConditional %270 %271 %272 576 %271 = OpLabel 577 OpBranch %264 578 %272 = OpLabel 579 %274 = OpLoad %6 %260 580 %275 = OpIAdd %6 %274 %38 581 OpStore %260 %275 582 OpBranch %265 583 %265 = OpLabel 584 %276 = OpLoad %6 %261 585 %277 = OpIAdd %6 %276 %38 586 OpStore %261 %277 587 OpBranch %262 588 %264 = OpLabel 589 %280 = OpLoad %6 %242 590 OpStore %279 %280 591 OpStore %281 %278 592 %282 = OpFunctionCall %2 %18 %279 %281 593 %283 = OpLoad %6 %242 594 %284 = OpIAdd %6 %283 %38 595 OpStore %242 %284 596 %286 = OpLoad %6 %242 597 OpStore %285 %286 598 OpStore %287 %187 599 %288 = OpFunctionCall %2 %18 %285 %287 600 %289 = OpLoad %6 %242 601 %290 = OpIAdd %6 %289 %38 602 OpStore %242 %290 603 %292 = OpLoad %6 %242 604 OpStore %291 %292 605 OpStore %293 %269 606 %294 = OpFunctionCall %2 %18 %291 %293 607 %295 = OpLoad %6 %242 608 %296 = OpIAdd %6 %295 %38 609 OpStore %242 %296 610 %299 = OpLoad %6 %242 611 OpStore %298 %299 612 OpStore %300 %297 613 %301 = OpFunctionCall %2 %18 %298 %300 614 %302 = OpLoad %6 %242 615 %303 = OpIAdd %6 %302 %38 616 OpStore %242 %303 617 %305 = OpLoad %6 %242 618 OpStore %304 %305 619 OpStore %306 %41 620 %307 = OpFunctionCall %2 %18 %304 %306 621 %308 = OpLoad %6 %242 622 %309 = OpIAdd %6 %308 %38 623 OpStore %242 %309 624 %311 = OpLoad %6 %242 625 OpStore %310 %311 626 OpStore %312 %226 627 %313 = OpFunctionCall %2 %18 %310 %312 628 %314 = OpLoad %6 %242 629 %315 = OpIAdd %6 %314 %38 630 OpStore %242 %315 631 OpStore %316 %35 632 OpStore %317 %35 633 OpBranch %318 634 %318 = OpLabel 635 OpLoopMerge %320 %321 None 636 OpBranch %322 637 %322 = OpLabel 638 OpBranchConditional %267 %319 %320 639 %319 = OpLabel 640 %323 = OpLoad %6 %316 641 %325 = OpSGreaterThanEqual %51 %323 %324 642 OpSelectionMerge %327 None 643 OpBranchConditional %325 %326 %327 644 %326 = OpLabel 645 OpBranch %320 646 %327 = OpLabel 647 %329 = OpLoad %6 %316 648 %330 = OpIAdd %6 %329 %38 649 OpStore %316 %330 650 OpStore %331 %38 651 %336 = OpLoad %6 %331 652 %337 = OpSGreaterThanEqual %51 %336 %35 653 %338 = OpLoad %6 %331 654 %340 = OpSLessThan %51 %338 %339 655 %341 = OpLogicalAnd %51 %337 %340 656 %342 = OpLoad %6 %331 657 %343 = OpSelect %6 %341 %342 %35 658 %344 = OpAccessChain %25 %335 %38 %38 659 %345 = OpLoad %24 %344 660 %346 = OpAccessChain %25 %335 %38 %343 661 OpStore %346 %345 662 %347 = OpLoad %6 %317 663 %348 = OpSGreaterThanEqual %51 %347 %35 664 %349 = OpLoad %6 %317 665 %350 = OpSLessThan %51 %349 %339 666 %351 = OpLogicalAnd %51 %348 %350 667 %352 = OpLoad %6 %317 668 %353 = OpSelect %6 %351 %352 %35 669 %354 = OpAccessChain %25 %335 %38 %353 670 OpStore %354 %193 671 OpBranch %321 672 %321 = OpLabel 673 %355 = OpLoad %6 %317 674 %356 = OpIAdd %6 %355 %38 675 OpStore %317 %356 676 OpBranch %318 677 %320 = OpLabel 678 %359 = OpLoad %6 %242 679 OpStore %358 %359 680 OpStore %360 %357 681 %361 = OpFunctionCall %2 %18 %358 %360 682 %362 = OpAccessChain %143 %141 %35 %142 683 %363 = OpLoad %24 %362 684 %364 = OpAccessChain %143 %141 %35 %146 685 %365 = OpLoad %24 %364 686 %366 = OpFOrdGreaterThan %51 %363 %365 687 OpSelectionMerge %368 None 688 OpBranchConditional %366 %367 %368 689 %367 = OpLabel 690 OpReturn 691 %368 = OpLabel 692 %370 = OpLoad %6 %242 693 %371 = OpIAdd %6 %370 %38 694 OpStore %242 %371 695 %374 = OpLoad %6 %242 696 OpStore %373 %374 697 OpStore %375 %372 698 %376 = OpFunctionCall %2 %18 %373 %375 699 %382 = OpLoad %379 %381 700 %383 = OpVectorShuffle %138 %382 %382 1 0 701 %386 = OpFDiv %138 %383 %385 702 OpStore %378 %386 703 %389 = OpAccessChain %25 %378 %142 704 %390 = OpLoad %24 %389 705 OpStore %388 %390 706 %391 = OpFunctionCall %24 %33 %388 707 OpStore %387 %391 708 %394 = OpAccessChain %25 %378 %146 709 %395 = OpLoad %24 %394 710 OpStore %393 %395 711 %396 = OpFunctionCall %24 %33 %393 712 OpStore %392 %396 713 OpStore %397 %398 714 OpStore %399 %35 715 OpBranch %400 716 %400 = OpLabel 717 OpLoopMerge %402 %403 None 718 OpBranch %404 719 %404 = OpLabel 720 %405 = OpLoad %6 %399 721 %407 = OpSLessThan %51 %405 %406 722 OpBranchConditional %407 %401 %402 723 %401 = OpLabel 724 %410 = OpLoad %6 %399 725 OpStore %409 %410 726 %411 = OpFunctionCall %6 %22 %409 727 OpStore %408 %411 728 %412 = OpLoad %6 %408 729 %413 = OpSGreaterThan %51 %412 %35 730 OpSelectionMerge %415 None 731 OpBranchConditional %413 %414 %416 732 %414 = OpLabel 733 OpBranch %415 734 %416 = OpLabel 735 %417 = OpLoad %6 %408 736 OpSelectionMerge %420 None 737 OpSwitch %417 %420 -1 %418 0 %419 738 %418 = OpLabel 739 %421 = OpLoad %6 %397 740 %422 = OpIAdd %6 %421 %38 741 OpStore %397 %422 742 OpBranch %420 743 %419 = OpLabel 744 OpReturn 745 %420 = OpLabel 746 OpBranch %415 747 %415 = OpLabel 748 OpBranch %403 749 %403 = OpLabel 750 %426 = OpLoad %6 %399 751 %427 = OpIAdd %6 %426 %38 752 OpStore %399 %427 753 OpBranch %400 754 %402 = OpLabel 755 %429 = OpLoad %24 %387 756 %430 = OpLoad %24 %392 757 %431 = OpLoad %6 %397 758 %432 = OpConvertSToF %24 %431 759 %433 = OpFMul %24 %430 %432 760 %434 = OpFAdd %24 %429 %433 761 OpStore %428 %434 762 %437 = OpAccessChain %143 %141 %35 %142 763 %438 = OpLoad %24 %437 764 %439 = OpAccessChain %143 %141 %35 %146 765 %440 = OpLoad %24 %439 766 %441 = OpFOrdLessThan %51 %438 %440 767 OpSelectionMerge %445 None 768 OpBranchConditional %441 %444 %447 769 %444 = OpLabel 770 OpStore %443 %446 771 OpBranch %445 772 %447 = OpLabel 773 %449 = OpLoad %24 %428 774 OpStore %448 %449 775 %450 = OpFunctionCall %26 %29 %448 776 OpStore %443 %450 777 OpBranch %445 778 %445 = OpLabel 779 %451 = OpLoad %26 %443 780 %452 = OpCompositeExtract %24 %451 0 781 %453 = OpCompositeExtract %24 %451 1 782 %454 = OpCompositeExtract %24 %451 2 783 %455 = OpCompositeConstruct %379 %452 %453 %454 %193 784 OpStore %436 %455 785 OpReturn 786 OpFunctionEnd 787 %13 = OpFunction %2 None %10 788 %11 = OpFunctionParameter %8 789 %12 = OpFunctionParameter %9 790 %14 = OpLabel 791 %36 = OpLoad %6 %12 792 %37 = OpAccessChain %9 %11 %35 793 OpStore %37 %36 794 %40 = OpAccessChain %9 %11 %38 795 OpStore %40 %39 796 %42 = OpAccessChain %9 %11 %41 797 OpStore %42 %39 798 OpReturn 799 OpFunctionEnd 800 %18 = OpFunction %2 None %15 801 %16 = OpFunctionParameter %9 802 %17 = OpFunctionParameter %9 803 %19 = OpLabel 804 %43 = OpVariable %9 Function 805 %76 = OpVariable %8 Function 806 %80 = OpVariable %9 Function 807 %102 = OpVariable %8 Function 808 %105 = OpVariable %9 Function 809 %112 = OpVariable %9 Function 810 %116 = OpVariable %115 Function 811 OpStore %43 %35 812 OpBranch %44 813 %44 = OpLabel 814 OpLoopMerge %46 %47 None 815 OpBranch %48 816 %48 = OpLabel 817 %49 = OpLoad %6 %43 818 %50 = OpLoad %6 %16 819 %52 = OpSLessThanEqual %51 %49 %50 820 OpBranchConditional %52 %45 %46 821 %45 = OpLabel 822 %53 = OpLoad %6 %17 823 %59 = OpLoad %6 %43 824 %61 = OpAccessChain %60 %58 %59 %35 825 %62 = OpLoad %6 %61 826 %63 = OpSLessThanEqual %51 %53 %62 827 OpSelectionMerge %65 None 828 OpBranchConditional %63 %64 %91 829 %64 = OpLabel 830 %66 = OpLoad %6 %43 831 %67 = OpAccessChain %60 %58 %66 %38 832 %68 = OpLoad %6 %67 833 %69 = OpIEqual %51 %68 %39 834 OpSelectionMerge %71 None 835 OpBranchConditional %69 %70 %86 836 %70 = OpLabel 837 %72 = OpLoad %6 %43 838 %73 = OpLoad %6 %16 839 %74 = OpAccessChain %60 %58 %72 %38 840 OpStore %74 %73 841 %75 = OpLoad %6 %16 842 %78 = OpAccessChain %77 %58 %75 843 %79 = OpLoad %7 %78 844 OpStore %76 %79 845 %81 = OpLoad %6 %17 846 OpStore %80 %81 847 %82 = OpFunctionCall %2 %13 %76 %80 848 %83 = OpLoad %7 %76 849 %84 = OpAccessChain %77 %58 %75 850 OpStore %84 %83 851 OpReturn 852 %86 = OpLabel 853 %87 = OpLoad %6 %43 854 %88 = OpAccessChain %60 %58 %87 %38 855 %89 = OpLoad %6 %88 856 OpStore %43 %89 857 OpBranch %47 858 %71 = OpLabel 859 OpBranch %65 860 %91 = OpLabel 861 %92 = OpLoad %6 %43 862 %93 = OpAccessChain %60 %58 %92 %41 863 %94 = OpLoad %6 %93 864 %95 = OpIEqual %51 %94 %39 865 OpSelectionMerge %97 None 866 OpBranchConditional %95 %96 %111 867 %96 = OpLabel 868 %98 = OpLoad %6 %43 869 %99 = OpLoad %6 %16 870 %100 = OpAccessChain %60 %58 %98 %41 871 OpStore %100 %99 872 %101 = OpLoad %6 %16 873 %103 = OpAccessChain %77 %58 %101 874 %104 = OpLoad %7 %103 875 OpStore %102 %104 876 %106 = OpLoad %6 %17 877 OpStore %105 %106 878 %107 = OpFunctionCall %2 %13 %102 %105 879 %108 = OpLoad %7 %102 880 %109 = OpAccessChain %77 %58 %101 881 OpStore %109 %108 882 OpReturn 883 %111 = OpLabel 884 OpStore %112 %38 885 %117 = OpLoad %6 %112 886 %118 = OpSGreaterThanEqual %51 %117 %35 887 %119 = OpLoad %6 %112 888 %121 = OpSLessThan %51 %119 %120 889 %122 = OpLogicalAnd %51 %118 %121 890 %123 = OpLoad %6 %112 891 %124 = OpSelect %6 %122 %123 %35 892 %125 = OpAccessChain %25 %116 %35 893 %126 = OpLoad %24 %125 894 %127 = OpAccessChain %25 %116 %124 895 %128 = OpLoad %24 %127 896 %129 = OpFAdd %24 %128 %126 897 %130 = OpAccessChain %25 %116 %124 898 OpStore %130 %129 899 OpBranch %131 900 %131 = OpLabel 901 OpLoopMerge %133 %134 None 902 OpBranch %132 903 %132 = OpLabel 904 %135 = OpLoad %6 %43 905 %136 = OpAccessChain %60 %58 %135 %41 906 %137 = OpLoad %6 %136 907 OpStore %43 %137 908 OpBranch %134 909 %134 = OpLabel 910 %144 = OpAccessChain %143 %141 %35 %142 911 %145 = OpLoad %24 %144 912 %147 = OpAccessChain %143 %141 %35 %146 913 %148 = OpLoad %24 %147 914 %149 = OpFOrdGreaterThan %51 %145 %148 915 OpBranchConditional %149 %131 %133 916 %133 = OpLabel 917 OpBranch %47 918 %97 = OpLabel 919 OpBranch %65 920 %65 = OpLabel 921 OpBranch %47 922 %47 = OpLabel 923 OpBranch %44 924 %46 = OpLabel 925 OpReturn 926 OpFunctionEnd 927 %22 = OpFunction %6 None %20 928 %21 = OpFunctionParameter %9 929 %23 = OpLabel 930 %151 = OpVariable %9 Function 931 %159 = OpVariable %8 Function 932 %175 = OpVariable %9 Function 933 OpStore %151 %35 934 OpBranch %152 935 %152 = OpLabel 936 OpLoopMerge %154 %155 None 937 OpBranch %156 938 %156 = OpLabel 939 %157 = OpLoad %6 %151 940 %158 = OpINotEqual %51 %157 %39 941 OpBranchConditional %158 %153 %154 942 %153 = OpLabel 943 %160 = OpLoad %6 %151 944 %161 = OpAccessChain %77 %58 %160 945 %162 = OpLoad %7 %161 946 OpStore %159 %162 947 %163 = OpAccessChain %9 %159 %35 948 %164 = OpLoad %6 %163 949 %165 = OpLoad %6 %21 950 %166 = OpIEqual %51 %164 %165 951 OpSelectionMerge %168 None 952 OpBranchConditional %166 %167 %168 953 %167 = OpLabel 954 %169 = OpLoad %6 %21 955 OpReturnValue %169 956 %168 = OpLabel 957 %171 = OpLoad %6 %21 958 %172 = OpAccessChain %9 %159 %35 959 %173 = OpLoad %6 %172 960 %174 = OpSGreaterThan %51 %171 %173 961 OpSelectionMerge %177 None 962 OpBranchConditional %174 %176 %180 963 %176 = OpLabel 964 %178 = OpAccessChain %9 %159 %41 965 %179 = OpLoad %6 %178 966 OpStore %175 %179 967 OpBranch %177 968 %180 = OpLabel 969 %181 = OpAccessChain %9 %159 %38 970 %182 = OpLoad %6 %181 971 OpStore %175 %182 972 OpBranch %177 973 %177 = OpLabel 974 %183 = OpLoad %6 %175 975 OpStore %151 %183 976 OpBranch %155 977 %155 = OpLabel 978 OpBranch %152 979 %154 = OpLabel 980 OpReturnValue %39 981 OpFunctionEnd 982 %29 = OpFunction %26 None %27 983 %28 = OpFunctionParameter %25 984 %30 = OpLabel 985 %186 = OpVariable %25 Function 986 %188 = OpVariable %9 Function 987 OpStore %188 %187 988 %189 = OpFunctionCall %6 %22 %188 989 %190 = OpConvertSToF %24 %189 990 OpStore %186 %190 991 %192 = OpLoad %24 %28 992 %195 = OpLoad %24 %186 993 %196 = OpCompositeConstruct %26 %193 %194 %195 994 %197 = OpVectorTimesScalar %26 %196 %192 995 %198 = OpCompositeConstruct %26 %191 %191 %191 996 %199 = OpFAdd %26 %198 %197 997 %201 = OpCompositeConstruct %26 %200 %200 %200 998 %202 = OpFDiv %26 %199 %201 999 OpReturnValue %202 1000 OpFunctionEnd 1001 %33 = OpFunction %24 None %31 1002 %32 = OpFunctionParameter %25 1003 %34 = OpLabel 1004 %214 = OpVariable %9 Function 1005 %227 = OpVariable %9 Function 1006 %236 = OpVariable %9 Function 1007 %206 = OpLoad %24 %32 1008 %207 = OpFMul %24 %206 %205 1009 OpStore %32 %207 1010 %208 = OpLoad %24 %32 1011 %210 = OpFOrdLessThan %51 %208 %209 1012 OpSelectionMerge %212 None 1013 OpBranchConditional %210 %211 %212 1014 %211 = OpLabel 1015 OpStore %214 %213 1016 %215 = OpFunctionCall %6 %22 %214 1017 %216 = OpConvertSToF %24 %215 1018 OpReturnValue %216 1019 %212 = OpLabel 1020 %218 = OpLoad %24 %32 1021 %220 = OpFOrdLessThan %51 %218 %219 1022 OpSelectionMerge %222 None 1023 OpBranchConditional %220 %221 %222 1024 %221 = OpLabel 1025 OpReturnValue %223 1026 %222 = OpLabel 1027 %225 = OpLoad %24 %32 1028 OpStore %227 %226 1029 %228 = OpFunctionCall %6 %22 %227 1030 %229 = OpConvertSToF %24 %228 1031 %230 = OpFOrdLessThan %51 %225 %229 1032 OpSelectionMerge %232 None 1033 OpBranchConditional %230 %231 %232 1034 %231 = OpLabel 1035 OpReturnValue %193 1036 %232 = OpLabel 1037 OpStore %236 %235 1038 %237 = OpFunctionCall %6 %22 %236 1039 %238 = OpConvertSToF %24 %237 1040 %239 = OpFAdd %24 %234 %238 1041 OpReturnValue %239 1042 OpFunctionEnd 1043END 1044 1045# uniforms for variant 1046 1047# injectionSwitch 1048BUFFER variant_injectionSwitch DATA_TYPE vec2<float> DATA 1049 0.0 1.0 1050END 1051 1052BUFFER framebuffer FORMAT B8G8R8A8_UNORM 1053 1054PIPELINE graphics gfz_pipeline 1055 ATTACH variant_vertex_shader 1056 ATTACH variant_fragment_shader 1057 FRAMEBUFFER_SIZE 256 256 1058 BIND BUFFER framebuffer AS color LOCATION 0 1059 BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 1060END 1061CLEAR_COLOR gfz_pipeline 0 0 0 255 1062 1063CLEAR gfz_pipeline 1064RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256 1065EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGB 255 0 0