dEQP-VK.graphicsfuzz.spv-double-branch-to-same-block3
dEQP-VK.graphicsfuzz.spv-load-from-frag-color
dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll
+dEQP-VK.graphicsfuzz.spv-stable-bifurcation-Os-mutate-var-vector-shuffle
+dEQP-VK.graphicsfuzz.spv-stable-collatz-O-mutate-composite-construct-extract
+dEQP-VK.graphicsfuzz.spv-stable-colorgrid-modulo-O-move-block-down
+dEQP-VK.graphicsfuzz.spv-stable-maze-flatten-copy-composite
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-O-prop-up-mutate-var
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-flatten-selection-dead-continues
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-func-inline-mutate-var
+dEQP-VK.graphicsfuzz.spv-stable-orbit-O-mutate-variable
+dEQP-VK.graphicsfuzz.spv-stable-orbit-Os-access-chain-mutate-pointer
+dEQP-VK.graphicsfuzz.spv-stable-pillars-O-op-select-to-op-phi
+dEQP-VK.graphicsfuzz.spv-stable-quicksort-mat-func-param
+dEQP-VK.graphicsfuzz.spv-stable-rects-Os-mutate-var-push-through-var
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-with-loop-read-write-global
dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-injected-conditional-true
dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-true-conditional-simple-loop
dEQP-VK.graphicsfuzz.spv-double-branch-to-same-block3
dEQP-VK.graphicsfuzz.spv-load-from-frag-color
dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll
+dEQP-VK.graphicsfuzz.spv-stable-bifurcation-Os-mutate-var-vector-shuffle
+dEQP-VK.graphicsfuzz.spv-stable-collatz-O-mutate-composite-construct-extract
+dEQP-VK.graphicsfuzz.spv-stable-colorgrid-modulo-O-move-block-down
+dEQP-VK.graphicsfuzz.spv-stable-maze-flatten-copy-composite
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-O-prop-up-mutate-var
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-flatten-selection-dead-continues
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-func-inline-mutate-var
+dEQP-VK.graphicsfuzz.spv-stable-orbit-O-mutate-variable
+dEQP-VK.graphicsfuzz.spv-stable-orbit-Os-access-chain-mutate-pointer
+dEQP-VK.graphicsfuzz.spv-stable-pillars-O-op-select-to-op-phi
+dEQP-VK.graphicsfuzz.spv-stable-quicksort-mat-func-param
+dEQP-VK.graphicsfuzz.spv-stable-rects-Os-mutate-var-push-through-var
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-with-loop-read-write-global
dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-injected-conditional-true
dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-true-conditional-simple-loop
{ "spv-double-branch-to-same-block3.amber", "spv-double-branch-to-same-block3", "Equivalent shaders, one with more complex branching" },
{ "spv-load-from-frag-color.amber", "spv-load-from-frag-color", "Equivalent shaders, one with extra access chains and load" },
{ "spv-null-in-phi-and-unroll.amber", "spv-null-in-phi-and-unroll", "Equivalent shaders, one that uses null for 0 and an Unroll annotation" },
+{ "spv-stable-bifurcation-Os-mutate-var-vector-shuffle.amber", "spv-stable-bifurcation-Os-mutate-var-vector-shuffle", "Three shaders diff: mutate var, vector shuffle" },
+{ "spv-stable-collatz-O-mutate-composite-construct-extract.amber", "spv-stable-collatz-O-mutate-composite-construct-extract", "Two shaders diff: mutate var, comp extract/construct" },
+{ "spv-stable-colorgrid-modulo-O-move-block-down.amber", "spv-stable-colorgrid-modulo-O-move-block-down", "Two shaders with diff: some blocks moved down" },
+{ "spv-stable-maze-flatten-copy-composite.amber", "spv-stable-maze-flatten-copy-composite", "Three shaders with diff: conditional %270 is flattened" },
+{ "spv-stable-mergesort-O-prop-up-mutate-var.amber", "spv-stable-mergesort-O-prop-up-mutate-var", "Three shaders with diff: mutate var" },
+{ "spv-stable-mergesort-flatten-selection-dead-continues.amber", "spv-stable-mergesort-flatten-selection-dead-continues", "Shaders diff: selection %25 flattened; dead continues" },
+{ "spv-stable-mergesort-func-inline-mutate-var.amber", "spv-stable-mergesort-func-inline-mutate-var", "Three shaders diff: mutated var" },
+{ "spv-stable-orbit-O-mutate-variable.amber", "spv-stable-orbit-O-mutate-variable", "Two shaders with diff: variable mutated" },
+{ "spv-stable-orbit-Os-access-chain-mutate-pointer.amber", "spv-stable-orbit-Os-access-chain-mutate-pointer", "Three shaders with diff: added mutate pointer" },
+{ "spv-stable-pillars-O-op-select-to-op-phi.amber", "spv-stable-pillars-O-op-select-to-op-phi", "Three shaders diff: OpSelect -> OpPhi" },
+{ "spv-stable-quicksort-mat-func-param.amber", "spv-stable-quicksort-mat-func-param", "Two shaders with diff: added mat3x3 func param" },
+{ "spv-stable-rects-Os-mutate-var-push-through-var.amber", "spv-stable-rects-Os-mutate-var-push-through-var", "Three shaders diff: new variable used and mutated" },
{ "stable-binarysearch-tree-with-loop-read-write-global.amber", "stable-binarysearch-tree-with-loop-read-write-global", "A pair of fragment shaders that both render red" },
{ "stable-colorgrid-modulo-injected-conditional-true.amber", "stable-colorgrid-modulo-injected-conditional-true", "A fragment shader with an always true conditional" },
{ "stable-colorgrid-modulo-true-conditional-simple-loop.amber", "stable-colorgrid-modulo-true-conditional-simple-loop", "A fragment shader with conditional and simple loop" },
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders diff: mutate var, vector shuffle
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 107
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %12 %74
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %74 "_GLF_color"
+ OpName %100 "indexable"
+ OpDecorate %12 BuiltIn FragCoord
+ OpMemberDecorate %15 0 Offset 0
+ OpDecorate %15 Block
+ OpDecorate %17 DescriptorSet 0
+ OpDecorate %17 Binding 0
+ OpDecorate %74 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %10 = OpTypeVector %6 4
+ %11 = OpTypePointer Input %10
+ %12 = OpVariable %11 Input
+ %15 = OpTypeStruct %7
+ %16 = OpTypePointer Uniform %15
+ %17 = OpVariable %16 Uniform
+ %18 = OpTypeInt 32 1
+ %19 = OpConstant %18 0
+ %20 = OpTypePointer Uniform %7
+ %27 = OpTypeInt 32 0
+ %32 = OpConstant %6 10
+ %47 = OpConstant %18 10
+ %51 = OpConstant %18 100
+ %60 = OpTypeBool
+ %62 = OpConstant %18 4
+ %65 = OpConstant %18 1000
+ %71 = OpConstant %18 1
+ %73 = OpTypePointer Output %10
+ %74 = OpVariable %73 Output
+ %75 = OpConstant %27 16
+ %76 = OpTypeArray %10 %75
+ %77 = OpConstant %6 0
+ %78 = OpConstant %6 1
+ %79 = OpConstantComposite %10 %77 %77 %77 %78
+ %80 = OpConstant %6 0.5
+ %81 = OpConstantComposite %10 %80 %77 %77 %78
+ %82 = OpConstantComposite %10 %77 %80 %77 %78
+ %83 = OpConstantComposite %10 %80 %80 %77 %78
+ %84 = OpConstantComposite %10 %77 %77 %80 %78
+ %85 = OpConstantComposite %10 %80 %77 %80 %78
+ %86 = OpConstantComposite %10 %77 %80 %80 %78
+ %87 = OpConstantComposite %10 %80 %80 %80 %78
+ %88 = OpConstantComposite %10 %78 %77 %77 %78
+ %89 = OpConstantComposite %10 %77 %78 %77 %78
+ %90 = OpConstantComposite %10 %78 %78 %77 %78
+ %91 = OpConstantComposite %10 %77 %77 %78 %78
+ %92 = OpConstantComposite %10 %78 %77 %78 %78
+ %93 = OpConstantComposite %10 %77 %78 %78 %78
+ %94 = OpConstantComposite %10 %78 %78 %78 %78
+ %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94
+ %97 = OpConstant %18 16
+ %99 = OpTypePointer Function %76
+ %101 = OpTypePointer Function %10
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %100 = OpVariable %99 Function
+ %13 = OpLoad %10 %12
+ %14 = OpVectorShuffle %7 %13 %13 0 1
+ %21 = OpAccessChain %20 %17 %19
+ %22 = OpLoad %7 %21
+ %23 = OpFDiv %7 %14 %22
+ %31 = OpCompositeExtract %6 %23 0
+ %33 = OpFMul %6 %31 %32
+ %34 = OpConvertFToS %18 %33
+ %37 = OpCompositeExtract %6 %23 1
+ %38 = OpFMul %6 %37 %32
+ %39 = OpConvertFToS %18 %38
+ %48 = OpIMul %18 %39 %47
+ %49 = OpIAdd %18 %34 %48
+ OpBranch %53
+ %53 = OpLabel
+ %106 = OpPhi %18 %51 %5 %69 %54
+ %104 = OpPhi %18 %19 %5 %72 %54
+ %61 = OpSLessThan %60 %104 %49
+ OpLoopMerge %55 %54 None
+ OpBranchConditional %61 %54 %55
+ %54 = OpLabel
+ %64 = OpIMul %18 %62 %106
+ %67 = OpISub %18 %65 %106
+ %68 = OpIMul %18 %64 %67
+ %69 = OpSDiv %18 %68 %65
+ %72 = OpIAdd %18 %104 %71
+ OpBranch %53
+ %55 = OpLabel
+ %98 = OpSMod %18 %106 %97
+ OpStore %100 %95
+ %102 = OpAccessChain %101 %100 %98
+ %103 = OpLoad %10 %102
+ OpStore %74 %103
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 263
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %12 %74
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %74 "_GLF_color"
+ OpName %100 "indexable"
+ OpDecorate %12 BuiltIn FragCoord
+ OpMemberDecorate %15 0 Offset 0
+ OpDecorate %15 Block
+ OpDecorate %17 DescriptorSet 0
+ OpDecorate %17 Binding 0
+ OpDecorate %74 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %10 = OpTypeVector %6 4
+ %11 = OpTypePointer Input %10
+ %12 = OpVariable %11 Input
+ %15 = OpTypeStruct %7
+ %16 = OpTypePointer Uniform %15
+ %17 = OpVariable %16 Uniform
+ %18 = OpTypeInt 32 1
+ %19 = OpConstant %18 0
+ %20 = OpTypePointer Uniform %7
+ %27 = OpTypeInt 32 0
+ %32 = OpConstant %6 10
+ %47 = OpConstant %18 10
+ %51 = OpConstant %18 100
+ %60 = OpTypeBool
+ %62 = OpConstant %18 4
+ %65 = OpConstant %18 1000
+ %71 = OpConstant %18 1
+ %73 = OpTypePointer Output %10
+ %74 = OpVariable %73 Output
+ %75 = OpConstant %27 16
+ %76 = OpTypeArray %10 %75
+ %77 = OpConstant %6 0
+ %78 = OpConstant %6 1
+ %79 = OpConstantComposite %10 %77 %77 %77 %78
+ %80 = OpConstant %6 0.5
+ %81 = OpConstantComposite %10 %80 %77 %77 %78
+ %82 = OpConstantComposite %10 %77 %80 %77 %78
+ %83 = OpConstantComposite %10 %80 %80 %77 %78
+ %84 = OpConstantComposite %10 %77 %77 %80 %78
+ %85 = OpConstantComposite %10 %80 %77 %80 %78
+ %86 = OpConstantComposite %10 %77 %80 %80 %78
+ %87 = OpConstantComposite %10 %80 %80 %80 %78
+ %88 = OpConstantComposite %10 %78 %77 %77 %78
+ %89 = OpConstantComposite %10 %77 %78 %77 %78
+ %90 = OpConstantComposite %10 %78 %78 %77 %78
+ %91 = OpConstantComposite %10 %77 %77 %78 %78
+ %92 = OpConstantComposite %10 %78 %77 %78 %78
+ %93 = OpConstantComposite %10 %77 %78 %78 %78
+ %94 = OpConstantComposite %10 %78 %78 %78 %78
+ %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94
+ %97 = OpConstant %18 16
+ %99 = OpTypePointer Function %76
+ %101 = OpTypePointer Function %10
+ %234 = OpConstant %6 0
+ %235 = OpConstantComposite %10 %234 %234 %234 %234
+ %236 = OpConstantComposite %76 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %100 = OpVariable %99 Function
+ %13 = OpLoad %10 %12
+ %14 = OpVectorShuffle %7 %13 %13 0 1
+ %21 = OpAccessChain %20 %17 %19
+ %22 = OpLoad %7 %21
+ %23 = OpFDiv %7 %14 %22
+ %31 = OpCompositeExtract %6 %23 0
+ %33 = OpFMul %6 %31 %32
+ %34 = OpConvertFToS %18 %33
+ %37 = OpCompositeExtract %6 %23 1
+ %38 = OpFMul %6 %37 %32
+ %39 = OpConvertFToS %18 %38
+ %48 = OpIMul %18 %39 %47
+ %49 = OpIAdd %18 %34 %48
+ OpBranch %53
+ %53 = OpLabel
+ %106 = OpPhi %18 %51 %5 %69 %54
+ %104 = OpPhi %18 %19 %5 %72 %54
+ %61 = OpSLessThan %60 %104 %49
+ OpLoopMerge %55 %54 None
+ OpBranchConditional %61 %54 %55
+ %54 = OpLabel
+ %64 = OpIMul %18 %62 %106
+ %67 = OpISub %18 %65 %106
+ %68 = OpIMul %18 %64 %67
+ %69 = OpSDiv %18 %68 %65
+ %72 = OpIAdd %18 %104 %71
+ OpBranch %53
+ %55 = OpLabel
+ %98 = OpSMod %18 %106 %97
+ OpStore %100 %95
+ %262 = OpLoad %76 %100
+ OpStore %100 %236
+ OpStore %100 %262
+ %231 = OpVectorShuffle %7 %89 %85 1 4
+ %102 = OpAccessChain %101 %100 %98
+ %103 = OpLoad %10 %102
+ OpStore %74 %103
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 237
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %12 %74
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %74 "_GLF_color"
+ OpName %100 "indexable"
+ OpDecorate %12 BuiltIn FragCoord
+ OpMemberDecorate %15 0 Offset 0
+ OpDecorate %15 Block
+ OpDecorate %17 DescriptorSet 0
+ OpDecorate %17 Binding 0
+ OpDecorate %74 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %10 = OpTypeVector %6 4
+ %11 = OpTypePointer Input %10
+ %12 = OpVariable %11 Input
+ %15 = OpTypeStruct %7
+ %16 = OpTypePointer Uniform %15
+ %17 = OpVariable %16 Uniform
+ %18 = OpTypeInt 32 1
+ %19 = OpConstant %18 0
+ %20 = OpTypePointer Uniform %7
+ %27 = OpTypeInt 32 0
+ %32 = OpConstant %6 10
+ %47 = OpConstant %18 10
+ %51 = OpConstant %18 100
+ %60 = OpTypeBool
+ %62 = OpConstant %18 4
+ %65 = OpConstant %18 1000
+ %71 = OpConstant %18 1
+ %73 = OpTypePointer Output %10
+ %74 = OpVariable %73 Output
+ %75 = OpConstant %27 16
+ %76 = OpTypeArray %10 %75
+ %77 = OpConstant %6 0
+ %78 = OpConstant %6 1
+ %79 = OpConstantComposite %10 %77 %77 %77 %78
+ %80 = OpConstant %6 0.5
+ %81 = OpConstantComposite %10 %80 %77 %77 %78
+ %82 = OpConstantComposite %10 %77 %80 %77 %78
+ %83 = OpConstantComposite %10 %80 %80 %77 %78
+ %84 = OpConstantComposite %10 %77 %77 %80 %78
+ %85 = OpConstantComposite %10 %80 %77 %80 %78
+ %86 = OpConstantComposite %10 %77 %80 %80 %78
+ %87 = OpConstantComposite %10 %80 %80 %80 %78
+ %88 = OpConstantComposite %10 %78 %77 %77 %78
+ %89 = OpConstantComposite %10 %77 %78 %77 %78
+ %90 = OpConstantComposite %10 %78 %78 %77 %78
+ %91 = OpConstantComposite %10 %77 %77 %78 %78
+ %92 = OpConstantComposite %10 %78 %77 %78 %78
+ %93 = OpConstantComposite %10 %77 %78 %78 %78
+ %94 = OpConstantComposite %10 %78 %78 %78 %78
+ %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94
+ %97 = OpConstant %18 16
+ %99 = OpTypePointer Function %76
+ %101 = OpTypePointer Function %10
+ %234 = OpConstant %6 0
+ %235 = OpConstantComposite %10 %234 %234 %234 %234
+ %236 = OpConstantComposite %76 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235 %235
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %100 = OpVariable %99 Function
+ %13 = OpLoad %10 %12
+ %14 = OpVectorShuffle %7 %13 %13 0 1
+ %21 = OpAccessChain %20 %17 %19
+ %22 = OpLoad %7 %21
+ %23 = OpFDiv %7 %14 %22
+ %31 = OpCompositeExtract %6 %23 0
+ %33 = OpFMul %6 %31 %32
+ %34 = OpConvertFToS %18 %33
+ %37 = OpCompositeExtract %6 %23 1
+ %38 = OpFMul %6 %37 %32
+ %39 = OpConvertFToS %18 %38
+ %48 = OpIMul %18 %39 %47
+ %49 = OpIAdd %18 %34 %48
+ OpBranch %53
+ %53 = OpLabel
+ %106 = OpPhi %18 %51 %5 %69 %54
+ %104 = OpPhi %18 %19 %5 %72 %54
+ %61 = OpSLessThan %60 %104 %49
+ OpLoopMerge %55 %54 None
+ OpBranchConditional %61 %54 %55
+ %54 = OpLabel
+ %64 = OpIMul %18 %62 %106
+ %67 = OpISub %18 %65 %106
+ %68 = OpIMul %18 %64 %67
+ %69 = OpSDiv %18 %68 %65
+ %72 = OpIAdd %18 %104 %71
+ OpBranch %53
+ %55 = OpLabel
+ %98 = OpSMod %18 %106 %97
+ OpStore %100 %95
+ %231 = OpVectorShuffle %7 %89 %85 1 4
+ %102 = OpAccessChain %101 %100 %98
+ %103 = OpLoad %10 %102
+ OpStore %74 %103
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# resolution
+BUFFER variant_2_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Two shaders diff: mutate var, comp extract/construct
+
+# The test renders two images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 138
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %47 %76
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %47 "gl_FragCoord"
+ OpName %50 "buf0"
+ OpMemberName %50 0 "resolution"
+ OpName %52 ""
+ OpName %76 "_GLF_color"
+ OpName %104 "indexable"
+ OpDecorate %47 BuiltIn FragCoord
+ OpMemberDecorate %50 0 Offset 0
+ OpDecorate %50 Block
+ OpDecorate %52 DescriptorSet 0
+ OpDecorate %52 Binding 0
+ OpDecorate %76 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %13 = OpConstant %6 0
+ %20 = OpConstant %6 1
+ %21 = OpTypeBool
+ %28 = OpConstant %6 3
+ %33 = OpConstant %6 2
+ %41 = OpTypeFloat 32
+ %42 = OpTypeVector %41 2
+ %45 = OpTypeVector %41 4
+ %46 = OpTypePointer Input %45
+ %47 = OpVariable %46 Input
+ %50 = OpTypeStruct %42
+ %51 = OpTypePointer Uniform %50
+ %52 = OpVariable %51 Uniform
+ %53 = OpTypePointer Uniform %42
+ %58 = OpConstant %41 8
+ %62 = OpTypeInt 32 0
+ %68 = OpConstant %6 8
+ %75 = OpTypePointer Output %45
+ %76 = OpVariable %75 Output
+ %77 = OpConstant %62 16
+ %78 = OpTypeArray %45 %77
+ %79 = OpConstant %41 0
+ %80 = OpConstant %41 1
+ %81 = OpConstantComposite %45 %79 %79 %79 %80
+ %82 = OpConstant %41 0.5
+ %83 = OpConstantComposite %45 %82 %79 %79 %80
+ %84 = OpConstantComposite %45 %79 %82 %79 %80
+ %85 = OpConstantComposite %45 %82 %82 %79 %80
+ %86 = OpConstantComposite %45 %79 %79 %82 %80
+ %87 = OpConstantComposite %45 %82 %79 %82 %80
+ %88 = OpConstantComposite %45 %79 %82 %82 %80
+ %89 = OpConstantComposite %45 %82 %82 %82 %80
+ %90 = OpConstantComposite %45 %80 %79 %79 %80
+ %91 = OpConstantComposite %45 %79 %80 %79 %80
+ %92 = OpConstantComposite %45 %80 %80 %79 %80
+ %93 = OpConstantComposite %45 %79 %79 %80 %80
+ %94 = OpConstantComposite %45 %80 %79 %80 %80
+ %95 = OpConstantComposite %45 %79 %80 %80 %80
+ %96 = OpConstantComposite %45 %80 %80 %80 %80
+ %97 = OpConstantComposite %78 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96
+ %101 = OpConstant %6 16
+ %103 = OpTypePointer Function %78
+ %105 = OpTypePointer Function %45
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %104 = OpVariable %103 Function
+ %48 = OpLoad %45 %47
+ %49 = OpVectorShuffle %42 %48 %48 0 1
+ %54 = OpAccessChain %53 %52 %13
+ %55 = OpLoad %42 %54
+ %56 = OpFDiv %42 %49 %55
+ %59 = OpVectorTimesScalar %42 %56 %58
+ %60 = OpExtInst %42 %1 Floor %59
+ %66 = OpCompositeExtract %41 %60 0
+ %67 = OpConvertFToS %6 %66
+ %69 = OpIMul %6 %67 %68
+ %72 = OpCompositeExtract %41 %60 1
+ %73 = OpConvertFToS %6 %72
+ %74 = OpIAdd %6 %69 %73
+ OpBranch %111
+ %111 = OpLabel
+ %135 = OpPhi %6 %13 %5 %128 %129
+ %134 = OpPhi %6 %74 %5 %137 %129
+ %114 = OpSGreaterThan %21 %134 %20
+ OpLoopMerge %130 %129 None
+ OpBranchConditional %114 %115 %130
+ %115 = OpLabel
+ %117 = OpBitwiseAnd %6 %134 %20
+ %118 = OpIEqual %21 %117 %20
+ OpSelectionMerge %126 None
+ OpBranchConditional %118 %119 %123
+ %119 = OpLabel
+ %121 = OpIMul %6 %28 %134
+ %122 = OpIAdd %6 %121 %20
+ OpBranch %126
+ %123 = OpLabel
+ %125 = OpSDiv %6 %134 %33
+ OpBranch %126
+ %126 = OpLabel
+ %137 = OpPhi %6 %122 %119 %125 %123
+ %128 = OpIAdd %6 %135 %20
+ OpBranch %129
+ %129 = OpLabel
+ OpBranch %111
+ %130 = OpLabel
+ %102 = OpSMod %6 %135 %101
+ OpStore %104 %97
+ %106 = OpAccessChain %105 %104 %102
+ %107 = OpLoad %45 %106
+ OpStore %76 %107
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 502
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %47 %76
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %47 "gl_FragCoord"
+ OpName %50 "buf0"
+ OpMemberName %50 0 "resolution"
+ OpName %52 ""
+ OpName %76 "_GLF_color"
+ OpName %104 "indexable"
+ OpDecorate %47 BuiltIn FragCoord
+ OpMemberDecorate %50 0 Offset 0
+ OpDecorate %50 Block
+ OpDecorate %52 DescriptorSet 0
+ OpDecorate %52 Binding 0
+ OpDecorate %76 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %13 = OpConstant %6 0
+ %20 = OpConstant %6 1
+ %21 = OpTypeBool
+ %28 = OpConstant %6 3
+ %33 = OpConstant %6 2
+ %41 = OpTypeFloat 32
+ %42 = OpTypeVector %41 2
+ %45 = OpTypeVector %41 4
+ %46 = OpTypePointer Input %45
+ %47 = OpVariable %46 Input
+ %50 = OpTypeStruct %42
+ %51 = OpTypePointer Uniform %50
+ %52 = OpVariable %51 Uniform
+ %53 = OpTypePointer Uniform %42
+ %58 = OpConstant %41 8
+ %62 = OpTypeInt 32 0
+ %68 = OpConstant %6 8
+ %75 = OpTypePointer Output %45
+ %76 = OpVariable %75 Output
+ %77 = OpConstant %62 16
+ %78 = OpTypeArray %45 %77
+ %79 = OpConstant %41 0
+ %80 = OpConstant %41 1
+ %81 = OpConstantComposite %45 %79 %79 %79 %80
+ %82 = OpConstant %41 0.5
+ %83 = OpConstantComposite %45 %82 %79 %79 %80
+ %84 = OpConstantComposite %45 %79 %82 %79 %80
+ %85 = OpConstantComposite %45 %82 %82 %79 %80
+ %86 = OpConstantComposite %45 %79 %79 %82 %80
+ %87 = OpConstantComposite %45 %82 %79 %82 %80
+ %88 = OpConstantComposite %45 %79 %82 %82 %80
+ %89 = OpConstantComposite %45 %82 %82 %82 %80
+ %90 = OpConstantComposite %45 %80 %79 %79 %80
+ %91 = OpConstantComposite %45 %79 %80 %79 %80
+ %92 = OpConstantComposite %45 %80 %80 %79 %80
+ %93 = OpConstantComposite %45 %79 %79 %80 %80
+ %94 = OpConstantComposite %45 %80 %79 %80 %80
+ %95 = OpConstantComposite %45 %79 %80 %80 %80
+ %96 = OpConstantComposite %45 %80 %80 %80 %80
+ %97 = OpConstantComposite %78 %81 %83 %84 %85 %86 %87 %88 %89 %81 %90 %91 %92 %93 %94 %95 %96
+ %101 = OpConstant %6 16
+ %103 = OpTypePointer Function %78
+ %105 = OpTypePointer Function %45
+ %403 = OpConstant %41 0
+ %404 = OpConstantComposite %45 %403 %403 %403 %403
+ %405 = OpConstantComposite %78 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404 %404
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %104 = OpVariable %103 Function
+ %48 = OpLoad %45 %47
+ %49 = OpVectorShuffle %42 %48 %48 0 1
+ %238 = OpCompositeConstruct %45 %79 %58 %49
+ %54 = OpAccessChain %53 %52 %13
+ %55 = OpLoad %42 %54
+ %239 = OpCompositeConstruct %78 %86 %94 %88 %95 %96 %88 %88 %87 %92 %48 %86 %85 %84 %83 %91 %90
+ %56 = OpFDiv %42 %49 %55
+ %59 = OpVectorTimesScalar %42 %56 %58
+ %60 = OpExtInst %42 %1 Floor %59
+ %241 = OpCompositeConstruct %45 %59 %82 %80
+ %66 = OpCompositeExtract %41 %60 0
+ %67 = OpConvertFToS %6 %66
+ %69 = OpIMul %6 %67 %68
+ %72 = OpCompositeExtract %41 %60 1
+ %73 = OpConvertFToS %6 %72
+ %74 = OpIAdd %6 %69 %73
+ OpBranch %111
+ %111 = OpLabel
+ %135 = OpPhi %6 %13 %5 %128 %129
+ %134 = OpPhi %6 %74 %5 %137 %129
+ %114 = OpSGreaterThan %21 %134 %20
+ OpLoopMerge %130 %129 None
+ OpBranchConditional %114 %115 %130
+ %115 = OpLabel
+ %117 = OpBitwiseAnd %6 %134 %20
+ %118 = OpIEqual %21 %117 %20
+ OpSelectionMerge %126 None
+ OpBranchConditional %118 %119 %123
+ %119 = OpLabel
+ %121 = OpIMul %6 %28 %134
+ %122 = OpIAdd %6 %121 %20
+ OpBranch %126
+ %123 = OpLabel
+ %125 = OpSDiv %6 %134 %33
+ OpBranch %126
+ %126 = OpLabel
+ %137 = OpPhi %6 %122 %119 %125 %123
+ %128 = OpIAdd %6 %135 %20
+ OpBranch %129
+ %129 = OpLabel
+ OpBranch %111
+ %130 = OpLabel
+ %102 = OpSMod %6 %135 %101
+ OpStore %104 %97
+ %501 = OpLoad %78 %104
+ OpStore %104 %405
+ OpStore %104 %501
+ %248 = OpCompositeExtract %45 %239 1
+ %245 = OpCompositeConstruct %78 %87 %87 %91 %81 %87 %89 %94 %81 %91 %238 %86 %88 %87 %92 %94 %241
+ %106 = OpAccessChain %105 %104 %102
+ %107 = OpLoad %45 %106
+ OpStore %76 %107
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Two shaders with diff: some blocks moved down
+
+# The test renders two images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 290
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %85 %137
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %66 "c"
+ OpName %73 "buf0"
+ OpMemberName %73 0 "resolution"
+ OpName %75 ""
+ OpName %85 "gl_FragCoord"
+ OpName %137 "_GLF_color"
+ OpMemberDecorate %73 0 Offset 0
+ OpDecorate %73 Block
+ OpDecorate %75 DescriptorSet 0
+ OpDecorate %75 Binding 0
+ OpDecorate %85 BuiltIn FragCoord
+ OpDecorate %137 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypePointer Function %6
+ %14 = OpConstant %6 -0.5
+ %15 = OpTypeInt 32 1
+ %18 = OpConstant %15 1
+ %25 = OpConstant %15 800
+ %26 = OpTypeBool
+ %29 = OpConstant %15 32
+ %31 = OpConstant %15 0
+ %35 = OpConstant %6 0.400000006
+ %44 = OpConstant %6 0.00999999978
+ %48 = OpConstant %6 100
+ %64 = OpTypeVector %6 3
+ %65 = OpTypePointer Function %64
+ %67 = OpConstant %6 7
+ %68 = OpConstant %6 8
+ %69 = OpConstant %6 9
+ %70 = OpConstantComposite %64 %67 %68 %69
+ %72 = OpTypeVector %6 2
+ %73 = OpTypeStruct %72
+ %74 = OpTypePointer Uniform %73
+ %75 = OpVariable %74 Uniform
+ %76 = OpTypeInt 32 0
+ %77 = OpConstant %76 0
+ %78 = OpTypePointer Uniform %6
+ %83 = OpTypeVector %6 4
+ %84 = OpTypePointer Input %83
+ %85 = OpVariable %84 Input
+ %87 = OpTypePointer Input %6
+ %95 = OpConstant %76 1
+ %107 = OpConstant %76 2
+ %116 = OpConstant %15 3
+ %121 = OpConstant %6 1
+ %136 = OpTypePointer Output %83
+ %137 = OpVariable %136 Output
+ %149 = OpConstantFalse %26
+ %152 = OpConstantTrue %26
+ %261 = OpUndef %6
+ %289 = OpConstant %6 0.125
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %66 = OpVariable %65 Function
+ OpStore %66 %70
+ %79 = OpAccessChain %78 %75 %31 %77
+ %80 = OpLoad %6 %79
+ %81 = OpFMul %6 %80 %289
+ %82 = OpExtInst %6 %1 Round %81
+ %88 = OpAccessChain %87 %85 %77
+ %89 = OpLoad %6 %88
+ OpSelectionMerge %199 None
+ OpSwitch %77 %161
+ %161 = OpLabel
+ OpBranch %162
+ %162 = OpLabel
+ %248 = OpPhi %6 %14 %161 %251 %192
+ %247 = OpPhi %15 %18 %161 %194 %192
+ %165 = OpSLessThan %26 %247 %25
+ OpLoopMerge %195 %192 None
+ OpBranchConditional %165 %166 %195
+ %166 = OpLabel
+ %168 = OpSMod %15 %247 %29
+ %169 = OpIEqual %26 %168 %31
+ OpSelectionMerge %184 None
+ OpBranchConditional %169 %170 %173
+ %170 = OpLabel
+ %172 = OpFAdd %6 %248 %35
+ OpBranch %184
+ %173 = OpLabel
+ %175 = OpConvertSToF %6 %247
+ %177 = OpExtInst %6 %1 Round %82
+ %178 = OpFMod %6 %175 %177
+ %179 = OpFOrdLessThanEqual %26 %178 %44
+ OpSelectionMerge %183 None
+ OpBranchConditional %179 %180 %183
+ %180 = OpLabel
+ %182 = OpFAdd %6 %248 %48
+ OpBranch %183
+ %183 = OpLabel
+ %252 = OpPhi %6 %248 %173 %182 %180
+ OpBranch %184
+ %184 = OpLabel
+ %251 = OpPhi %6 %172 %170 %252 %183
+ %186 = OpConvertSToF %6 %247
+ %188 = OpFOrdGreaterThanEqual %26 %186 %89
+ OpSelectionMerge %191 None
+ OpBranchConditional %188 %189 %191
+ %189 = OpLabel
+ OpBranch %195
+ %191 = OpLabel
+ OpBranch %192
+ %192 = OpLabel
+ %194 = OpIAdd %15 %247 %18
+ OpBranch %162
+ %195 = OpLabel
+ %259 = OpPhi %6 %261 %162 %251 %189
+ %257 = OpPhi %6 %248 %162 %251 %189
+ %253 = OpPhi %26 %149 %162 %152 %189
+ OpSelectionMerge %197 None
+ OpBranchConditional %253 %199 %197
+ %197 = OpLabel
+ OpBranch %199
+ %199 = OpLabel
+ %258 = OpPhi %6 %259 %195 %257 %197
+ %93 = OpAccessChain %7 %66 %77
+ OpStore %93 %258
+ %96 = OpAccessChain %87 %85 %95
+ %97 = OpLoad %6 %96
+ OpSelectionMerge %245 None
+ OpSwitch %77 %207
+ %207 = OpLabel
+ OpBranch %208
+ %208 = OpLabel
+ %265 = OpPhi %6 %14 %207 %268 %238
+ %264 = OpPhi %15 %18 %207 %240 %238
+ %211 = OpSLessThan %26 %264 %25
+ OpLoopMerge %241 %238 None
+ OpBranchConditional %211 %212 %241
+ %212 = OpLabel
+ %214 = OpSMod %15 %264 %29
+ %215 = OpIEqual %26 %214 %31
+ OpSelectionMerge %230 None
+ OpBranchConditional %215 %216 %219
+ %216 = OpLabel
+ %218 = OpFAdd %6 %265 %35
+ OpBranch %230
+ %219 = OpLabel
+ %221 = OpConvertSToF %6 %264
+ %223 = OpExtInst %6 %1 Round %82
+ %224 = OpFMod %6 %221 %223
+ %225 = OpFOrdLessThanEqual %26 %224 %44
+ OpSelectionMerge %229 None
+ OpBranchConditional %225 %226 %229
+ %226 = OpLabel
+ %228 = OpFAdd %6 %265 %48
+ OpBranch %229
+ %229 = OpLabel
+ %269 = OpPhi %6 %265 %219 %228 %226
+ OpBranch %230
+ %230 = OpLabel
+ %268 = OpPhi %6 %218 %216 %269 %229
+ %232 = OpConvertSToF %6 %264
+ %234 = OpFOrdGreaterThanEqual %26 %232 %97
+ OpSelectionMerge %237 None
+ OpBranchConditional %234 %235 %237
+ %235 = OpLabel
+ OpBranch %241
+ %237 = OpLabel
+ OpBranch %238
+ %238 = OpLabel
+ %240 = OpIAdd %15 %264 %18
+ OpBranch %208
+ %241 = OpLabel
+ %276 = OpPhi %6 %261 %208 %268 %235
+ %274 = OpPhi %6 %265 %208 %268 %235
+ %270 = OpPhi %26 %149 %208 %152 %235
+ OpSelectionMerge %243 None
+ OpBranchConditional %270 %245 %243
+ %243 = OpLabel
+ OpBranch %245
+ %245 = OpLabel
+ %275 = OpPhi %6 %276 %241 %274 %243
+ %101 = OpAccessChain %7 %66 %95
+ OpStore %101 %275
+ %103 = OpLoad %6 %93
+ %105 = OpLoad %6 %101
+ %106 = OpFAdd %6 %103 %105
+ %108 = OpAccessChain %7 %66 %107
+ OpStore %108 %106
+ OpBranch %110
+ %110 = OpLabel
+ %285 = OpPhi %15 %31 %245 %135 %113
+ %117 = OpSLessThan %26 %285 %116
+ OpLoopMerge %112 %113 None
+ OpBranchConditional %117 %111 %112
+ %111 = OpLabel
+ %119 = OpAccessChain %7 %66 %285
+ %120 = OpLoad %6 %119
+ %122 = OpFOrdGreaterThanEqual %26 %120 %121
+ OpSelectionMerge %124 None
+ OpBranchConditional %122 %123 %124
+ %123 = OpLabel
+ %128 = OpLoad %6 %119
+ %131 = OpLoad %6 %119
+ %132 = OpFMul %6 %128 %131
+ OpStore %119 %132
+ OpBranch %124
+ %124 = OpLabel
+ OpBranch %113
+ %113 = OpLabel
+ %135 = OpIAdd %15 %285 %18
+ OpBranch %110
+ %112 = OpLabel
+ %138 = OpLoad %64 %66
+ %139 = OpExtInst %64 %1 FAbs %138
+ %140 = OpExtInst %64 %1 Normalize %139
+ %141 = OpCompositeExtract %6 %140 0
+ %142 = OpCompositeExtract %6 %140 1
+ %143 = OpCompositeExtract %6 %140 2
+ %144 = OpCompositeConstruct %83 %141 %142 %143 %121
+ OpStore %137 %144
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 290
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %85 %137
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %66 "c"
+ OpName %73 "buf0"
+ OpMemberName %73 0 "resolution"
+ OpName %75 ""
+ OpName %85 "gl_FragCoord"
+ OpName %137 "_GLF_color"
+ OpMemberDecorate %73 0 Offset 0
+ OpDecorate %73 Block
+ OpDecorate %75 DescriptorSet 0
+ OpDecorate %75 Binding 0
+ OpDecorate %85 BuiltIn FragCoord
+ OpDecorate %137 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypePointer Function %6
+ %14 = OpConstant %6 -0.5
+ %15 = OpTypeInt 32 1
+ %18 = OpConstant %15 1
+ %25 = OpConstant %15 800
+ %26 = OpTypeBool
+ %29 = OpConstant %15 32
+ %31 = OpConstant %15 0
+ %35 = OpConstant %6 0.400000006
+ %44 = OpConstant %6 0.00999999978
+ %48 = OpConstant %6 100
+ %64 = OpTypeVector %6 3
+ %65 = OpTypePointer Function %64
+ %67 = OpConstant %6 7
+ %68 = OpConstant %6 8
+ %69 = OpConstant %6 9
+ %70 = OpConstantComposite %64 %67 %68 %69
+ %72 = OpTypeVector %6 2
+ %73 = OpTypeStruct %72
+ %74 = OpTypePointer Uniform %73
+ %75 = OpVariable %74 Uniform
+ %76 = OpTypeInt 32 0
+ %77 = OpConstant %76 0
+ %78 = OpTypePointer Uniform %6
+ %83 = OpTypeVector %6 4
+ %84 = OpTypePointer Input %83
+ %85 = OpVariable %84 Input
+ %87 = OpTypePointer Input %6
+ %95 = OpConstant %76 1
+ %107 = OpConstant %76 2
+ %116 = OpConstant %15 3
+ %121 = OpConstant %6 1
+ %136 = OpTypePointer Output %83
+ %137 = OpVariable %136 Output
+ %149 = OpConstantFalse %26
+ %152 = OpConstantTrue %26
+ %261 = OpUndef %6
+ %289 = OpConstant %6 0.125
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %66 = OpVariable %65 Function
+ OpStore %66 %70
+ %79 = OpAccessChain %78 %75 %31 %77
+ %80 = OpLoad %6 %79
+ %81 = OpFMul %6 %80 %289
+ %82 = OpExtInst %6 %1 Round %81
+ %88 = OpAccessChain %87 %85 %77
+ %89 = OpLoad %6 %88
+ OpSelectionMerge %199 None
+ OpSwitch %77 %161
+ %161 = OpLabel
+ OpBranch %162
+ %162 = OpLabel
+ %248 = OpPhi %6 %14 %161 %251 %192
+ %247 = OpPhi %15 %18 %161 %194 %192
+ %165 = OpSLessThan %26 %247 %25
+ OpLoopMerge %195 %192 None
+ OpBranchConditional %165 %166 %195
+ %166 = OpLabel
+ %168 = OpSMod %15 %247 %29
+ %169 = OpIEqual %26 %168 %31
+ OpSelectionMerge %184 None
+ OpBranchConditional %169 %170 %173
+ %170 = OpLabel
+ %172 = OpFAdd %6 %248 %35
+ OpBranch %184
+ %173 = OpLabel
+ %175 = OpConvertSToF %6 %247
+ %177 = OpExtInst %6 %1 Round %82
+ %178 = OpFMod %6 %175 %177
+ %179 = OpFOrdLessThanEqual %26 %178 %44
+ OpSelectionMerge %183 None
+ OpBranchConditional %179 %180 %183
+ %180 = OpLabel
+ %182 = OpFAdd %6 %248 %48
+ OpBranch %183
+ %183 = OpLabel
+ %252 = OpPhi %6 %248 %173 %182 %180
+ OpBranch %184
+ %184 = OpLabel
+ %251 = OpPhi %6 %172 %170 %252 %183
+ %186 = OpConvertSToF %6 %247
+ %188 = OpFOrdGreaterThanEqual %26 %186 %89
+ OpSelectionMerge %191 None
+ OpBranchConditional %188 %189 %191
+ %189 = OpLabel
+ OpBranch %195
+ %191 = OpLabel
+ OpBranch %192
+ %192 = OpLabel
+ %194 = OpIAdd %15 %247 %18
+ OpBranch %162
+ %195 = OpLabel
+ %259 = OpPhi %6 %261 %162 %251 %189
+ %257 = OpPhi %6 %248 %162 %251 %189
+ %253 = OpPhi %26 %149 %162 %152 %189
+ OpSelectionMerge %197 None
+ OpBranchConditional %253 %199 %197
+ %197 = OpLabel
+ OpBranch %199
+ %199 = OpLabel
+ %258 = OpPhi %6 %259 %195 %257 %197
+ %93 = OpAccessChain %7 %66 %77
+ OpStore %93 %258
+ %96 = OpAccessChain %87 %85 %95
+ %97 = OpLoad %6 %96
+ OpSelectionMerge %245 None
+ OpSwitch %77 %207
+ %207 = OpLabel
+ OpBranch %208
+ %208 = OpLabel
+ %265 = OpPhi %6 %14 %207 %268 %238
+ %264 = OpPhi %15 %18 %207 %240 %238
+ %211 = OpSLessThan %26 %264 %25
+ OpLoopMerge %241 %238 None
+ OpBranchConditional %211 %212 %241
+ %212 = OpLabel
+ %214 = OpSMod %15 %264 %29
+ %215 = OpIEqual %26 %214 %31
+ OpSelectionMerge %230 None
+ OpBranchConditional %215 %216 %219
+ %219 = OpLabel
+ %221 = OpConvertSToF %6 %264
+ %223 = OpExtInst %6 %1 Round %82
+ %224 = OpFMod %6 %221 %223
+ %225 = OpFOrdLessThanEqual %26 %224 %44
+ OpSelectionMerge %229 None
+ OpBranchConditional %225 %226 %229
+ %226 = OpLabel
+ %228 = OpFAdd %6 %265 %48
+ OpBranch %229
+ %229 = OpLabel
+ %269 = OpPhi %6 %265 %219 %228 %226
+ OpBranch %230
+ %230 = OpLabel
+ %268 = OpPhi %6 %218 %216 %269 %229
+ %232 = OpConvertSToF %6 %264
+ %234 = OpFOrdGreaterThanEqual %26 %232 %97
+ OpSelectionMerge %237 None
+ OpBranchConditional %234 %235 %237
+ %235 = OpLabel
+ OpBranch %241
+ %241 = OpLabel
+ %276 = OpPhi %6 %261 %208 %268 %235
+ %274 = OpPhi %6 %265 %208 %268 %235
+ %270 = OpPhi %26 %149 %208 %152 %235
+ OpSelectionMerge %243 None
+ OpBranchConditional %270 %245 %243
+ %216 = OpLabel
+ %218 = OpFAdd %6 %265 %35
+ OpBranch %230
+ %237 = OpLabel
+ OpBranch %238
+ %238 = OpLabel
+ %240 = OpIAdd %15 %264 %18
+ OpBranch %208
+ %243 = OpLabel
+ OpBranch %245
+ %245 = OpLabel
+ %275 = OpPhi %6 %276 %241 %274 %243
+ %101 = OpAccessChain %7 %66 %95
+ OpStore %101 %275
+ %103 = OpLoad %6 %93
+ %105 = OpLoad %6 %101
+ %106 = OpFAdd %6 %103 %105
+ %108 = OpAccessChain %7 %66 %107
+ OpStore %108 %106
+ OpBranch %110
+ %110 = OpLabel
+ %285 = OpPhi %15 %31 %245 %135 %113
+ %117 = OpSLessThan %26 %285 %116
+ OpLoopMerge %112 %113 None
+ OpBranchConditional %117 %111 %112
+ %111 = OpLabel
+ %119 = OpAccessChain %7 %66 %285
+ %120 = OpLoad %6 %119
+ %122 = OpFOrdGreaterThanEqual %26 %120 %121
+ OpSelectionMerge %124 None
+ OpBranchConditional %122 %123 %124
+ %123 = OpLabel
+ %128 = OpLoad %6 %119
+ %131 = OpLoad %6 %119
+ %132 = OpFMul %6 %128 %131
+ OpStore %119 %132
+ OpBranch %124
+ %124 = OpLabel
+ OpBranch %113
+ %113 = OpLabel
+ %135 = OpIAdd %15 %285 %18
+ OpBranch %110
+ %112 = OpLabel
+ %138 = OpLoad %64 %66
+ %139 = OpExtInst %64 %1 FAbs %138
+ %140 = OpExtInst %64 %1 Normalize %139
+ %141 = OpCompositeExtract %6 %140 0
+ %142 = OpCompositeExtract %6 %140 1
+ %143 = OpCompositeExtract %6 %140 2
+ %144 = OpCompositeConstruct %83 %141 %142 %143 %121
+ OpStore %137 %144
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders with diff: conditional %270 is flattened
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 442
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %12 %435
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %9 "pos"
+ OpName %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %26 "ipos"
+ OpName %42 "i"
+ OpName %55 "map"
+ OpName %62 "p"
+ OpName %65 "canwalk"
+ OpName %67 "v"
+ OpName %74 "directions"
+ OpName %171 "j"
+ OpName %208 "d"
+ OpName %435 "_GLF_color"
+ OpDecorate %12 BuiltIn FragCoord
+ OpMemberDecorate %15 0 Offset 0
+ OpDecorate %15 Block
+ OpDecorate %17 DescriptorSet 0
+ OpDecorate %17 Binding 0
+ OpDecorate %435 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %8 = OpTypePointer Function %7
+ %10 = OpTypeVector %6 4
+ %11 = OpTypePointer Input %10
+ %12 = OpVariable %11 Input
+ %15 = OpTypeStruct %7
+ %16 = OpTypePointer Uniform %15
+ %17 = OpVariable %16 Uniform
+ %18 = OpTypeInt 32 1
+ %19 = OpConstant %18 0
+ %20 = OpTypePointer Uniform %7
+ %24 = OpTypeVector %18 2
+ %25 = OpTypePointer Function %24
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %29 = OpTypePointer Function %6
+ %32 = OpConstant %6 16
+ %35 = OpConstant %27 1
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %54 = OpTypePointer Private %53
+ %55 = OpVariable %54 Private
+ %57 = OpTypePointer Private %18
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %64 = OpTypePointer Function %50
+ %66 = OpConstantTrue %50
+ %82 = OpConstant %18 2
+ %86 = OpConstant %18 16
+ %119 = OpConstant %18 14
+ %162 = OpConstantFalse %50
+ %169 = OpConstant %18 8
+ %434 = OpTypePointer Output %10
+ %435 = OpVariable %434 Output
+ %436 = OpConstant %6 1
+ %437 = OpConstantComposite %10 %436 %436 %436 %436
+ %440 = OpConstant %6 0
+ %441 = OpConstantComposite %10 %440 %440 %440 %436
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %9 = OpVariable %8 Function
+ %26 = OpVariable %25 Function
+ %42 = OpVariable %41 Function
+ %62 = OpVariable %25 Function
+ %65 = OpVariable %64 Function
+ %67 = OpVariable %41 Function
+ %74 = OpVariable %41 Function
+ %171 = OpVariable %41 Function
+ %208 = OpVariable %41 Function
+ %13 = OpLoad %10 %12
+ %14 = OpVectorShuffle %7 %13 %13 0 1
+ %21 = OpAccessChain %20 %17 %19
+ %22 = OpLoad %7 %21
+ %23 = OpFDiv %7 %14 %22
+ OpStore %9 %23
+ %30 = OpAccessChain %29 %9 %28
+ %31 = OpLoad %6 %30
+ %33 = OpFMul %6 %31 %32
+ %34 = OpConvertFToS %18 %33
+ %36 = OpAccessChain %29 %9 %35
+ %37 = OpLoad %6 %36
+ %38 = OpFMul %6 %37 %32
+ %39 = OpConvertFToS %18 %38
+ %40 = OpCompositeConstruct %24 %34 %39
+ OpStore %26 %40
+ OpStore %42 %19
+ OpBranch %43
+ %43 = OpLabel
+ OpLoopMerge %45 %46 None
+ OpBranch %47
+ %47 = OpLabel
+ %48 = OpLoad %18 %42
+ %51 = OpSLessThan %50 %48 %49
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %56 = OpLoad %18 %42
+ %58 = OpAccessChain %57 %55 %56
+ OpStore %58 %19
+ OpBranch %46
+ %46 = OpLabel
+ %59 = OpLoad %18 %42
+ %61 = OpIAdd %18 %59 %60
+ OpStore %42 %61
+ OpBranch %43
+ %45 = OpLabel
+ OpStore %62 %63
+ OpStore %65 %66
+ OpStore %67 %19
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %72 = OpLoad %18 %67
+ %73 = OpIAdd %18 %72 %60
+ OpStore %67 %73
+ OpStore %74 %19
+ %75 = OpAccessChain %41 %62 %28
+ %76 = OpLoad %18 %75
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %80 = OpAccessChain %41 %62 %28
+ %81 = OpLoad %18 %80
+ %83 = OpISub %18 %81 %82
+ %84 = OpAccessChain %41 %62 %35
+ %85 = OpLoad %18 %84
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %57 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ OpSelectionMerge %94 None
+ OpBranchConditional %92 %93 %94
+ %93 = OpLabel
+ %95 = OpLoad %18 %74
+ %96 = OpIAdd %18 %95 %60
+ OpStore %74 %96
+ OpBranch %94
+ %94 = OpLabel
+ %97 = OpAccessChain %41 %62 %35
+ %98 = OpLoad %18 %97
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %102 = OpAccessChain %41 %62 %28
+ %103 = OpLoad %18 %102
+ %104 = OpAccessChain %41 %62 %35
+ %105 = OpLoad %18 %104
+ %106 = OpISub %18 %105 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %103 %107
+ %109 = OpAccessChain %57 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %94 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %115 = OpLoad %18 %74
+ %116 = OpIAdd %18 %115 %60
+ OpStore %74 %116
+ OpBranch %114
+ %114 = OpLabel
+ %117 = OpAccessChain %41 %62 %28
+ %118 = OpLoad %18 %117
+ %120 = OpSLessThan %50 %118 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %123 = OpAccessChain %41 %62 %28
+ %124 = OpLoad %18 %123
+ %125 = OpIAdd %18 %124 %82
+ %126 = OpAccessChain %41 %62 %35
+ %127 = OpLoad %18 %126
+ %128 = OpIMul %18 %127 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %57 %55 %129
+ %131 = OpLoad %18 %130
+ %132 = OpIEqual %50 %131 %19
+ OpBranch %122
+ %122 = OpLabel
+ %133 = OpPhi %50 %120 %114 %132 %121
+ OpSelectionMerge %135 None
+ OpBranchConditional %133 %134 %135
+ %134 = OpLabel
+ %136 = OpLoad %18 %74
+ %137 = OpIAdd %18 %136 %60
+ OpStore %74 %137
+ OpBranch %135
+ %135 = OpLabel
+ %138 = OpAccessChain %41 %62 %35
+ %139 = OpLoad %18 %138
+ %140 = OpSLessThan %50 %139 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %143 = OpAccessChain %41 %62 %28
+ %144 = OpLoad %18 %143
+ %145 = OpAccessChain %41 %62 %35
+ %146 = OpLoad %18 %145
+ %147 = OpIAdd %18 %146 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %144 %148
+ %150 = OpAccessChain %57 %55 %149
+ %151 = OpLoad %18 %150
+ %152 = OpIEqual %50 %151 %19
+ OpBranch %142
+ %142 = OpLabel
+ %153 = OpPhi %50 %140 %135 %152 %141
+ OpSelectionMerge %155 None
+ OpBranchConditional %153 %154 %155
+ %154 = OpLabel
+ %156 = OpLoad %18 %74
+ %157 = OpIAdd %18 %156 %60
+ OpStore %74 %157
+ OpBranch %155
+ %155 = OpLabel
+ %158 = OpLoad %18 %74
+ %159 = OpIEqual %50 %158 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpStore %65 %162
+ OpStore %42 %19
+ OpBranch %163
+ %163 = OpLabel
+ OpLoopMerge %165 %166 None
+ OpBranch %167
+ %167 = OpLabel
+ %168 = OpLoad %18 %42
+ %170 = OpSLessThan %50 %168 %169
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpStore %171 %19
+ OpBranch %172
+ %172 = OpLabel
+ OpLoopMerge %174 %175 None
+ OpBranch %176
+ %176 = OpLabel
+ %177 = OpLoad %18 %171
+ %178 = OpSLessThan %50 %177 %169
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %179 = OpLoad %18 %171
+ %180 = OpIMul %18 %179 %82
+ %181 = OpLoad %18 %42
+ %182 = OpIMul %18 %181 %82
+ %183 = OpIMul %18 %182 %86
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %57 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %190 = OpLoad %18 %171
+ %191 = OpIMul %18 %190 %82
+ %192 = OpAccessChain %41 %62 %28
+ OpStore %192 %191
+ %193 = OpLoad %18 %42
+ %194 = OpIMul %18 %193 %82
+ %195 = OpAccessChain %41 %62 %35
+ OpStore %195 %194
+ OpStore %65 %66
+ OpBranch %189
+ %189 = OpLabel
+ OpBranch %175
+ %175 = OpLabel
+ %196 = OpLoad %18 %171
+ %197 = OpIAdd %18 %196 %60
+ OpStore %171 %197
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %198 = OpLoad %18 %42
+ %199 = OpIAdd %18 %198 %60
+ OpStore %42 %199
+ OpBranch %163
+ %165 = OpLabel
+ %200 = OpAccessChain %41 %62 %28
+ %201 = OpLoad %18 %200
+ %202 = OpAccessChain %41 %62 %35
+ %203 = OpLoad %18 %202
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %57 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %209 = OpLoad %18 %67
+ %210 = OpLoad %18 %74
+ %211 = OpSMod %18 %209 %210
+ OpStore %208 %211
+ %212 = OpLoad %18 %74
+ %213 = OpLoad %18 %67
+ %214 = OpIAdd %18 %213 %212
+ OpStore %67 %214
+ %215 = OpLoad %18 %208
+ %216 = OpSGreaterThanEqual %50 %215 %19
+ OpSelectionMerge %218 None
+ OpBranchConditional %216 %217 %218
+ %217 = OpLabel
+ %219 = OpAccessChain %41 %62 %28
+ %220 = OpLoad %18 %219
+ %221 = OpSGreaterThan %50 %220 %19
+ OpBranch %218
+ %218 = OpLabel
+ %222 = OpPhi %50 %216 %207 %221 %217
+ OpSelectionMerge %224 None
+ OpBranchConditional %222 %223 %224
+ %223 = OpLabel
+ %225 = OpAccessChain %41 %62 %28
+ %226 = OpLoad %18 %225
+ %227 = OpISub %18 %226 %82
+ %228 = OpAccessChain %41 %62 %35
+ %229 = OpLoad %18 %228
+ %230 = OpIMul %18 %229 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %57 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %222 %218 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %238 = OpLoad %18 %208
+ %239 = OpISub %18 %238 %60
+ OpStore %208 %239
+ %240 = OpAccessChain %41 %62 %28
+ %241 = OpLoad %18 %240
+ %242 = OpAccessChain %41 %62 %35
+ %243 = OpLoad %18 %242
+ %244 = OpIMul %18 %243 %86
+ %245 = OpIAdd %18 %241 %244
+ %246 = OpAccessChain %57 %55 %245
+ OpStore %246 %60
+ %247 = OpAccessChain %41 %62 %28
+ %248 = OpLoad %18 %247
+ %249 = OpISub %18 %248 %60
+ %250 = OpAccessChain %41 %62 %35
+ %251 = OpLoad %18 %250
+ %252 = OpIMul %18 %251 %86
+ %253 = OpIAdd %18 %249 %252
+ %254 = OpAccessChain %57 %55 %253
+ OpStore %254 %60
+ %255 = OpAccessChain %41 %62 %28
+ %256 = OpLoad %18 %255
+ %257 = OpISub %18 %256 %82
+ %258 = OpAccessChain %41 %62 %35
+ %259 = OpLoad %18 %258
+ %260 = OpIMul %18 %259 %86
+ %261 = OpIAdd %18 %257 %260
+ %262 = OpAccessChain %57 %55 %261
+ OpStore %262 %60
+ %263 = OpAccessChain %41 %62 %28
+ %264 = OpLoad %18 %263
+ %265 = OpISub %18 %264 %82
+ %266 = OpAccessChain %41 %62 %28
+ OpStore %266 %265
+ OpBranch %237
+ %237 = OpLabel
+ %267 = OpLoad %18 %208
+ %268 = OpSGreaterThanEqual %50 %267 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %271 = OpAccessChain %41 %62 %35
+ %272 = OpLoad %18 %271
+ %273 = OpSGreaterThan %50 %272 %19
+ OpBranch %270
+ %270 = OpLabel
+ %274 = OpPhi %50 %268 %237 %273 %269
+ OpSelectionMerge %276 None
+ OpBranchConditional %274 %275 %276
+ %275 = OpLabel
+ %277 = OpAccessChain %41 %62 %28
+ %278 = OpLoad %18 %277
+ %279 = OpAccessChain %41 %62 %35
+ %280 = OpLoad %18 %279
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %57 %55 %283
+ %285 = OpLoad %18 %284
+ %286 = OpIEqual %50 %285 %19
+ OpBranch %276
+ %276 = OpLabel
+ %287 = OpPhi %50 %274 %270 %286 %275
+ OpSelectionMerge %289 None
+ OpBranchConditional %287 %288 %289
+ %288 = OpLabel
+ %290 = OpLoad %18 %208
+ %291 = OpISub %18 %290 %60
+ OpStore %208 %291
+ %292 = OpAccessChain %41 %62 %28
+ %293 = OpLoad %18 %292
+ %294 = OpAccessChain %41 %62 %35
+ %295 = OpLoad %18 %294
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %57 %55 %297
+ OpStore %298 %60
+ %299 = OpAccessChain %41 %62 %28
+ %300 = OpLoad %18 %299
+ %301 = OpAccessChain %41 %62 %35
+ %302 = OpLoad %18 %301
+ %303 = OpISub %18 %302 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %300 %304
+ %306 = OpAccessChain %57 %55 %305
+ OpStore %306 %60
+ %307 = OpAccessChain %41 %62 %28
+ %308 = OpLoad %18 %307
+ %309 = OpAccessChain %41 %62 %35
+ %310 = OpLoad %18 %309
+ %311 = OpISub %18 %310 %82
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %308 %312
+ %314 = OpAccessChain %57 %55 %313
+ OpStore %314 %60
+ %315 = OpAccessChain %41 %62 %35
+ %316 = OpLoad %18 %315
+ %317 = OpISub %18 %316 %82
+ %318 = OpAccessChain %41 %62 %35
+ OpStore %318 %317
+ OpBranch %289
+ %289 = OpLabel
+ %319 = OpLoad %18 %208
+ %320 = OpSGreaterThanEqual %50 %319 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %323 = OpAccessChain %41 %62 %28
+ %324 = OpLoad %18 %323
+ %325 = OpSLessThan %50 %324 %119
+ OpBranch %322
+ %322 = OpLabel
+ %326 = OpPhi %50 %320 %289 %325 %321
+ OpSelectionMerge %328 None
+ OpBranchConditional %326 %327 %328
+ %327 = OpLabel
+ %329 = OpAccessChain %41 %62 %28
+ %330 = OpLoad %18 %329
+ %331 = OpIAdd %18 %330 %82
+ %332 = OpAccessChain %41 %62 %35
+ %333 = OpLoad %18 %332
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %57 %55 %335
+ %337 = OpLoad %18 %336
+ %338 = OpIEqual %50 %337 %19
+ OpBranch %328
+ %328 = OpLabel
+ %339 = OpPhi %50 %326 %322 %338 %327
+ OpSelectionMerge %341 None
+ OpBranchConditional %339 %340 %341
+ %340 = OpLabel
+ %342 = OpLoad %18 %208
+ %343 = OpISub %18 %342 %60
+ OpStore %208 %343
+ %344 = OpAccessChain %41 %62 %28
+ %345 = OpLoad %18 %344
+ %346 = OpAccessChain %41 %62 %35
+ %347 = OpLoad %18 %346
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %57 %55 %349
+ OpStore %350 %60
+ %351 = OpAccessChain %41 %62 %28
+ %352 = OpLoad %18 %351
+ %353 = OpIAdd %18 %352 %60
+ %354 = OpAccessChain %41 %62 %35
+ %355 = OpLoad %18 %354
+ %356 = OpIMul %18 %355 %86
+ %357 = OpIAdd %18 %353 %356
+ %358 = OpAccessChain %57 %55 %357
+ OpStore %358 %60
+ %359 = OpAccessChain %41 %62 %28
+ %360 = OpLoad %18 %359
+ %361 = OpIAdd %18 %360 %82
+ %362 = OpAccessChain %41 %62 %35
+ %363 = OpLoad %18 %362
+ %364 = OpIMul %18 %363 %86
+ %365 = OpIAdd %18 %361 %364
+ %366 = OpAccessChain %57 %55 %365
+ OpStore %366 %60
+ %367 = OpAccessChain %41 %62 %28
+ %368 = OpLoad %18 %367
+ %369 = OpIAdd %18 %368 %82
+ %370 = OpAccessChain %41 %62 %28
+ OpStore %370 %369
+ OpBranch %341
+ %341 = OpLabel
+ %371 = OpLoad %18 %208
+ %372 = OpSGreaterThanEqual %50 %371 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %375 = OpAccessChain %41 %62 %35
+ %376 = OpLoad %18 %375
+ %377 = OpSLessThan %50 %376 %119
+ OpBranch %374
+ %374 = OpLabel
+ %378 = OpPhi %50 %372 %341 %377 %373
+ OpSelectionMerge %380 None
+ OpBranchConditional %378 %379 %380
+ %379 = OpLabel
+ %381 = OpAccessChain %41 %62 %28
+ %382 = OpLoad %18 %381
+ %383 = OpAccessChain %41 %62 %35
+ %384 = OpLoad %18 %383
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %57 %55 %387
+ %389 = OpLoad %18 %388
+ %390 = OpIEqual %50 %389 %19
+ OpBranch %380
+ %380 = OpLabel
+ %391 = OpPhi %50 %378 %374 %390 %379
+ OpSelectionMerge %393 None
+ OpBranchConditional %391 %392 %393
+ %392 = OpLabel
+ %394 = OpLoad %18 %208
+ %395 = OpISub %18 %394 %60
+ OpStore %208 %395
+ %396 = OpAccessChain %41 %62 %28
+ %397 = OpLoad %18 %396
+ %398 = OpAccessChain %41 %62 %35
+ %399 = OpLoad %18 %398
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %57 %55 %401
+ OpStore %402 %60
+ %403 = OpAccessChain %41 %62 %28
+ %404 = OpLoad %18 %403
+ %405 = OpAccessChain %41 %62 %35
+ %406 = OpLoad %18 %405
+ %407 = OpIAdd %18 %406 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %404 %408
+ %410 = OpAccessChain %57 %55 %409
+ OpStore %410 %60
+ %411 = OpAccessChain %41 %62 %28
+ %412 = OpLoad %18 %411
+ %413 = OpAccessChain %41 %62 %35
+ %414 = OpLoad %18 %413
+ %415 = OpIAdd %18 %414 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %412 %416
+ %418 = OpAccessChain %57 %55 %417
+ OpStore %418 %60
+ %419 = OpAccessChain %41 %62 %35
+ %420 = OpLoad %18 %419
+ %421 = OpIAdd %18 %420 %82
+ %422 = OpAccessChain %41 %62 %35
+ OpStore %422 %421
+ OpBranch %393
+ %393 = OpLabel
+ OpBranch %161
+ %161 = OpLabel
+ %423 = OpAccessChain %41 %26 %35
+ %424 = OpLoad %18 %423
+ %425 = OpIMul %18 %424 %86
+ %426 = OpAccessChain %41 %26 %28
+ %427 = OpLoad %18 %426
+ %428 = OpIAdd %18 %425 %427
+ %429 = OpAccessChain %57 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpReturn
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ %439 = OpLoad %50 %65
+ OpBranchConditional %439 %68 %70
+ %70 = OpLabel
+ OpStore %435 %441
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 1443
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %12 %435
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %9 "pos"
+ OpName %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %26 "ipos"
+ OpName %42 "i"
+ OpName %55 "map"
+ OpName %62 "p"
+ OpName %65 "canwalk"
+ OpName %67 "v"
+ OpName %74 "directions"
+ OpName %171 "j"
+ OpName %208 "d"
+ OpName %435 "_GLF_color"
+ OpDecorate %12 BuiltIn FragCoord
+ OpMemberDecorate %15 0 Offset 0
+ OpDecorate %15 Block
+ OpDecorate %17 DescriptorSet 0
+ OpDecorate %17 Binding 0
+ OpDecorate %435 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %8 = OpTypePointer Function %7
+ %10 = OpTypeVector %6 4
+ %11 = OpTypePointer Input %10
+ %12 = OpVariable %11 Input
+ %15 = OpTypeStruct %7
+ %16 = OpTypePointer Uniform %15
+ %17 = OpVariable %16 Uniform
+ %18 = OpTypeInt 32 1
+ %19 = OpConstant %18 0
+ %20 = OpTypePointer Uniform %7
+ %24 = OpTypeVector %18 2
+ %25 = OpTypePointer Function %24
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %29 = OpTypePointer Function %6
+ %32 = OpConstant %6 16
+ %35 = OpConstant %27 1
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %54 = OpTypePointer Private %53
+ %55 = OpVariable %54 Private
+ %57 = OpTypePointer Private %18
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %64 = OpTypePointer Function %50
+ %66 = OpConstantTrue %50
+ %82 = OpConstant %18 2
+ %86 = OpConstant %18 16
+ %119 = OpConstant %18 14
+ %162 = OpConstantFalse %50
+ %169 = OpConstant %18 8
+ %434 = OpTypePointer Output %10
+ %435 = OpVariable %434 Output
+ %436 = OpConstant %6 1
+ %437 = OpConstantComposite %10 %436 %436 %436 %436
+ %440 = OpConstant %6 0
+ %441 = OpConstantComposite %10 %440 %440 %440 %436
+ %542 = OpConstant %18 0
+ %566 = OpConstantComposite %53 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %9 = OpVariable %8 Function
+ %26 = OpVariable %25 Function
+ %42 = OpVariable %41 Function
+ %62 = OpVariable %25 Function
+ %65 = OpVariable %64 Function
+ %67 = OpVariable %41 Function
+ %74 = OpVariable %41 Function
+ %171 = OpVariable %41 Function
+ %208 = OpVariable %41 Function
+ %13 = OpLoad %10 %12
+ %14 = OpVectorShuffle %7 %13 %13 0 1
+ %21 = OpAccessChain %20 %17 %19
+ %22 = OpLoad %7 %21
+ %23 = OpFDiv %7 %14 %22
+ OpStore %9 %23
+ %30 = OpAccessChain %29 %9 %28
+ %31 = OpLoad %6 %30
+ %33 = OpFMul %6 %31 %32
+ %34 = OpConvertFToS %18 %33
+ %36 = OpAccessChain %29 %9 %35
+ %37 = OpLoad %6 %36
+ %38 = OpFMul %6 %37 %32
+ %39 = OpConvertFToS %18 %38
+ %40 = OpCompositeConstruct %24 %34 %39
+ OpStore %26 %40
+ OpStore %42 %19
+ OpBranch %43
+ %43 = OpLabel
+ OpLoopMerge %45 %46 None
+ OpBranch %47
+ %47 = OpLabel
+ %48 = OpLoad %18 %42
+ %51 = OpSLessThan %50 %48 %49
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %56 = OpLoad %18 %42
+ %58 = OpAccessChain %57 %55 %56
+ OpStore %58 %19
+ OpBranch %46
+ %46 = OpLabel
+ %59 = OpLoad %18 %42
+ %61 = OpIAdd %18 %59 %60
+ OpStore %42 %61
+ OpBranch %43
+ %45 = OpLabel
+ OpStore %62 %63
+ OpStore %65 %66
+ OpStore %67 %19
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %72 = OpLoad %18 %67
+ %73 = OpIAdd %18 %72 %60
+ OpStore %67 %73
+ OpStore %74 %19
+ %75 = OpAccessChain %41 %62 %28
+ %76 = OpLoad %18 %75
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %80 = OpAccessChain %41 %62 %28
+ %81 = OpLoad %18 %80
+ %83 = OpISub %18 %81 %82
+ %84 = OpAccessChain %41 %62 %35
+ %85 = OpLoad %18 %84
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %57 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ OpSelectionMerge %94 None
+ OpBranchConditional %92 %93 %94
+ %93 = OpLabel
+ %95 = OpLoad %18 %74
+ %96 = OpIAdd %18 %95 %60
+ OpStore %74 %96
+ OpBranch %94
+ %94 = OpLabel
+ %97 = OpAccessChain %41 %62 %35
+ %98 = OpLoad %18 %97
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %102 = OpAccessChain %41 %62 %28
+ %103 = OpLoad %18 %102
+ %104 = OpAccessChain %41 %62 %35
+ %105 = OpLoad %18 %104
+ %106 = OpISub %18 %105 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %103 %107
+ %109 = OpAccessChain %57 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %94 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %115 = OpLoad %18 %74
+ %116 = OpIAdd %18 %115 %60
+ OpStore %74 %116
+ OpBranch %114
+ %114 = OpLabel
+ %117 = OpAccessChain %41 %62 %28
+ %118 = OpLoad %18 %117
+ %120 = OpSLessThan %50 %118 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %123 = OpAccessChain %41 %62 %28
+ %124 = OpLoad %18 %123
+ %125 = OpIAdd %18 %124 %82
+ %126 = OpAccessChain %41 %62 %35
+ %127 = OpLoad %18 %126
+ %128 = OpIMul %18 %127 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %57 %55 %129
+ %131 = OpLoad %18 %130
+ %132 = OpIEqual %50 %131 %19
+ OpBranch %122
+ %122 = OpLabel
+ %133 = OpPhi %50 %120 %114 %132 %121
+ OpSelectionMerge %135 None
+ OpBranchConditional %133 %134 %135
+ %134 = OpLabel
+ %136 = OpLoad %18 %74
+ %137 = OpIAdd %18 %136 %60
+ OpStore %74 %137
+ OpBranch %135
+ %135 = OpLabel
+ %138 = OpAccessChain %41 %62 %35
+ %139 = OpLoad %18 %138
+ %140 = OpSLessThan %50 %139 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %143 = OpAccessChain %41 %62 %28
+ %144 = OpLoad %18 %143
+ %145 = OpAccessChain %41 %62 %35
+ %146 = OpLoad %18 %145
+ %147 = OpIAdd %18 %146 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %144 %148
+ %150 = OpAccessChain %57 %55 %149
+ %151 = OpLoad %18 %150
+ %152 = OpIEqual %50 %151 %19
+ OpBranch %142
+ %142 = OpLabel
+ %153 = OpPhi %50 %140 %135 %152 %141
+ OpSelectionMerge %155 None
+ OpBranchConditional %153 %154 %155
+ %154 = OpLabel
+ %156 = OpLoad %18 %74
+ %157 = OpIAdd %18 %156 %60
+ OpStore %74 %157
+ OpBranch %155
+ %155 = OpLabel
+ %158 = OpLoad %18 %74
+ %159 = OpIEqual %50 %158 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpStore %65 %162
+ OpStore %42 %19
+ OpBranch %163
+ %163 = OpLabel
+ OpLoopMerge %165 %166 None
+ OpBranch %167
+ %167 = OpLabel
+ %168 = OpLoad %18 %42
+ %170 = OpSLessThan %50 %168 %169
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpStore %171 %19
+ OpBranch %172
+ %172 = OpLabel
+ OpLoopMerge %174 %175 None
+ OpBranch %176
+ %176 = OpLabel
+ %177 = OpLoad %18 %171
+ %178 = OpSLessThan %50 %177 %169
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %179 = OpLoad %18 %171
+ %180 = OpIMul %18 %179 %82
+ %181 = OpLoad %18 %42
+ %182 = OpIMul %18 %181 %82
+ %183 = OpIMul %18 %182 %86
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %57 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %190 = OpLoad %18 %171
+ %191 = OpIMul %18 %190 %82
+ %192 = OpAccessChain %41 %62 %28
+ OpStore %192 %191
+ %193 = OpLoad %18 %42
+ %194 = OpIMul %18 %193 %82
+ %195 = OpAccessChain %41 %62 %35
+ OpStore %195 %194
+ OpStore %65 %66
+ OpBranch %189
+ %189 = OpLabel
+ OpBranch %175
+ %175 = OpLabel
+ %196 = OpLoad %18 %171
+ %197 = OpIAdd %18 %196 %60
+ OpStore %171 %197
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %198 = OpLoad %18 %42
+ %199 = OpIAdd %18 %198 %60
+ OpStore %42 %199
+ OpBranch %163
+ %165 = OpLabel
+ %200 = OpAccessChain %41 %62 %28
+ %201 = OpLoad %18 %200
+ %202 = OpAccessChain %41 %62 %35
+ %203 = OpLoad %18 %202
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %57 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %209 = OpLoad %18 %67
+ %210 = OpLoad %18 %74
+ %211 = OpSMod %18 %209 %210
+ OpStore %208 %211
+ %212 = OpLoad %18 %74
+ %213 = OpLoad %18 %67
+ %214 = OpIAdd %18 %213 %212
+ OpStore %67 %214
+ %215 = OpLoad %18 %208
+ %216 = OpSGreaterThanEqual %50 %215 %19
+ OpSelectionMerge %218 None
+ OpBranchConditional %216 %217 %218
+ %217 = OpLabel
+ %219 = OpAccessChain %41 %62 %28
+ %220 = OpLoad %18 %219
+ %221 = OpSGreaterThan %50 %220 %19
+ OpBranch %218
+ %218 = OpLabel
+ %222 = OpPhi %50 %216 %207 %221 %217
+ OpSelectionMerge %224 None
+ OpBranchConditional %222 %223 %224
+ %223 = OpLabel
+ %225 = OpAccessChain %41 %62 %28
+ %226 = OpLoad %18 %225
+ %227 = OpISub %18 %226 %82
+ %228 = OpAccessChain %41 %62 %35
+ %229 = OpLoad %18 %228
+ %230 = OpIMul %18 %229 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %57 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %222 %218 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %238 = OpLoad %18 %208
+ %239 = OpISub %18 %238 %60
+ OpStore %208 %239
+ %240 = OpAccessChain %41 %62 %28
+ %241 = OpLoad %18 %240
+ %242 = OpAccessChain %41 %62 %35
+ %243 = OpLoad %18 %242
+ %244 = OpIMul %18 %243 %86
+ %245 = OpIAdd %18 %241 %244
+ %246 = OpAccessChain %57 %55 %245
+ OpStore %246 %60
+ %247 = OpAccessChain %41 %62 %28
+ %248 = OpLoad %18 %247
+ %249 = OpISub %18 %248 %60
+ %250 = OpAccessChain %41 %62 %35
+ %251 = OpLoad %18 %250
+ %252 = OpIMul %18 %251 %86
+ %253 = OpIAdd %18 %249 %252
+ %254 = OpAccessChain %57 %55 %253
+ OpStore %254 %60
+ %255 = OpAccessChain %41 %62 %28
+ %256 = OpLoad %18 %255
+ %257 = OpISub %18 %256 %82
+ %258 = OpAccessChain %41 %62 %35
+ %259 = OpLoad %18 %258
+ %260 = OpIMul %18 %259 %86
+ %261 = OpIAdd %18 %257 %260
+ %262 = OpAccessChain %57 %55 %261
+ OpStore %262 %60
+ %263 = OpAccessChain %41 %62 %28
+ %264 = OpLoad %18 %263
+ %265 = OpISub %18 %264 %82
+ %266 = OpAccessChain %41 %62 %28
+ OpStore %266 %265
+ OpBranch %237
+ %237 = OpLabel
+ %267 = OpLoad %18 %208
+ %268 = OpSGreaterThanEqual %50 %267 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %271 = OpAccessChain %41 %62 %35
+ %272 = OpLoad %18 %271
+ %273 = OpSGreaterThan %50 %272 %19
+ OpBranch %270
+ %270 = OpLabel
+ %274 = OpPhi %50 %268 %237 %273 %269
+ OpBranch %275
+ %275 = OpLabel
+ %277 = OpAccessChain %41 %62 %28
+ OpSelectionMerge %1419 None
+ OpBranchConditional %274 %1420 %1422
+ %1420 = OpLabel
+ %1421 = OpLoad %18 %277
+ OpBranch %1419
+ %1422 = OpLabel
+ %1423 = OpCopyObject %18 %542
+ OpBranch %1419
+ %1419 = OpLabel
+ %278 = OpPhi %18 %1421 %1420 %1423 %1422
+ %279 = OpAccessChain %41 %62 %35
+ OpSelectionMerge %1424 None
+ OpBranchConditional %274 %1425 %1427
+ %1425 = OpLabel
+ %1426 = OpLoad %18 %279
+ OpBranch %1424
+ %1427 = OpLabel
+ %1428 = OpCopyObject %18 %542
+ OpBranch %1424
+ %1424 = OpLabel
+ %280 = OpPhi %18 %1426 %1425 %1428 %1427
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ OpSelectionMerge %1434 None
+ OpBranchConditional %274 %1435 %1437
+ %1435 = OpLabel
+ %1436 = OpLoad %53 %55
+ OpBranch %1434
+ %1437 = OpLabel
+ %1438 = OpCopyObject %53 %566
+ OpBranch %1434
+ %1434 = OpLabel
+ %773 = OpPhi %53 %1436 %1435 %1438 %1437
+ OpSelectionMerge %1439 None
+ OpBranchConditional %274 %1440 %1439
+ %1440 = OpLabel
+ OpStore %55 %566
+ OpBranch %1439
+ %1439 = OpLabel
+ OpSelectionMerge %1441 None
+ OpBranchConditional %274 %1442 %1441
+ %1442 = OpLabel
+ OpStore %55 %773
+ OpBranch %1441
+ %1441 = OpLabel
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %57 %55 %283
+ OpSelectionMerge %1429 None
+ OpBranchConditional %274 %1430 %1432
+ %1430 = OpLabel
+ %1431 = OpLoad %18 %284
+ OpBranch %1429
+ %1432 = OpLabel
+ %1433 = OpCopyObject %18 %542
+ OpBranch %1429
+ %1429 = OpLabel
+ %285 = OpPhi %18 %1431 %1430 %1433 %1432
+ %286 = OpIEqual %50 %285 %19
+ OpBranch %276
+ %276 = OpLabel
+ %287 = OpSelect %50 %274 %286 %274
+ OpSelectionMerge %289 None
+ OpBranchConditional %287 %288 %289
+ %288 = OpLabel
+ %290 = OpLoad %18 %208
+ %291 = OpISub %18 %290 %60
+ OpStore %208 %291
+ %292 = OpAccessChain %41 %62 %28
+ %293 = OpLoad %18 %292
+ %294 = OpAccessChain %41 %62 %35
+ %295 = OpLoad %18 %294
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %57 %55 %297
+ OpStore %298 %60
+ %299 = OpAccessChain %41 %62 %28
+ %300 = OpLoad %18 %299
+ %301 = OpAccessChain %41 %62 %35
+ %302 = OpLoad %18 %301
+ %303 = OpISub %18 %302 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %300 %304
+ %306 = OpAccessChain %57 %55 %305
+ OpStore %306 %60
+ %307 = OpAccessChain %41 %62 %28
+ %308 = OpLoad %18 %307
+ %309 = OpAccessChain %41 %62 %35
+ %310 = OpLoad %18 %309
+ %311 = OpISub %18 %310 %82
+ %800 = OpLoad %53 %55
+ OpStore %55 %566
+ OpStore %55 %800
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %308 %312
+ %314 = OpAccessChain %57 %55 %313
+ OpStore %314 %60
+ %315 = OpAccessChain %41 %62 %35
+ %316 = OpLoad %18 %315
+ %317 = OpISub %18 %316 %82
+ %318 = OpAccessChain %41 %62 %35
+ OpStore %318 %317
+ OpBranch %289
+ %289 = OpLabel
+ %319 = OpLoad %18 %208
+ %320 = OpSGreaterThanEqual %50 %319 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %323 = OpAccessChain %41 %62 %28
+ %324 = OpLoad %18 %323
+ %325 = OpSLessThan %50 %324 %119
+ OpBranch %322
+ %322 = OpLabel
+ %326 = OpPhi %50 %320 %289 %325 %321
+ OpSelectionMerge %328 None
+ OpBranchConditional %326 %327 %328
+ %327 = OpLabel
+ %329 = OpAccessChain %41 %62 %28
+ %330 = OpLoad %18 %329
+ %331 = OpIAdd %18 %330 %82
+ %332 = OpAccessChain %41 %62 %35
+ %333 = OpLoad %18 %332
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %57 %55 %335
+ %337 = OpLoad %18 %336
+ %338 = OpIEqual %50 %337 %19
+ OpBranch %328
+ %328 = OpLabel
+ %339 = OpPhi %50 %326 %322 %338 %327
+ OpSelectionMerge %341 None
+ OpBranchConditional %339 %340 %341
+ %340 = OpLabel
+ %342 = OpLoad %18 %208
+ %343 = OpISub %18 %342 %60
+ OpStore %208 %343
+ %344 = OpAccessChain %41 %62 %28
+ %345 = OpLoad %18 %344
+ %346 = OpAccessChain %41 %62 %35
+ %347 = OpLoad %18 %346
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %57 %55 %349
+ OpStore %350 %60
+ %351 = OpAccessChain %41 %62 %28
+ %352 = OpLoad %18 %351
+ %353 = OpIAdd %18 %352 %60
+ %354 = OpAccessChain %41 %62 %35
+ %355 = OpLoad %18 %354
+ %356 = OpIMul %18 %355 %86
+ %357 = OpIAdd %18 %353 %356
+ %358 = OpAccessChain %57 %55 %357
+ OpStore %358 %60
+ %359 = OpAccessChain %41 %62 %28
+ %360 = OpLoad %18 %359
+ %361 = OpIAdd %18 %360 %82
+ %362 = OpAccessChain %41 %62 %35
+ %363 = OpLoad %18 %362
+ %364 = OpIMul %18 %363 %86
+ %365 = OpIAdd %18 %361 %364
+ %366 = OpAccessChain %57 %55 %365
+ OpStore %366 %60
+ %367 = OpAccessChain %41 %62 %28
+ %368 = OpLoad %18 %367
+ %369 = OpIAdd %18 %368 %82
+ %370 = OpAccessChain %41 %62 %28
+ OpStore %370 %369
+ OpBranch %341
+ %341 = OpLabel
+ %371 = OpLoad %18 %208
+ %372 = OpSGreaterThanEqual %50 %371 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %375 = OpAccessChain %41 %62 %35
+ %376 = OpLoad %18 %375
+ %377 = OpSLessThan %50 %376 %119
+ OpBranch %374
+ %374 = OpLabel
+ %378 = OpPhi %50 %372 %341 %377 %373
+ OpSelectionMerge %380 None
+ OpBranchConditional %378 %379 %380
+ %379 = OpLabel
+ %381 = OpAccessChain %41 %62 %28
+ %382 = OpLoad %18 %381
+ %383 = OpAccessChain %41 %62 %35
+ %384 = OpLoad %18 %383
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %57 %55 %387
+ %389 = OpLoad %18 %388
+ %390 = OpIEqual %50 %389 %19
+ OpBranch %380
+ %380 = OpLabel
+ %391 = OpPhi %50 %378 %374 %390 %379
+ OpSelectionMerge %393 None
+ OpBranchConditional %391 %392 %393
+ %392 = OpLabel
+ %394 = OpLoad %18 %208
+ %395 = OpISub %18 %394 %60
+ OpStore %208 %395
+ %396 = OpAccessChain %41 %62 %28
+ %397 = OpLoad %18 %396
+ %398 = OpAccessChain %41 %62 %35
+ %399 = OpLoad %18 %398
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %57 %55 %401
+ OpStore %402 %60
+ %403 = OpAccessChain %41 %62 %28
+ %404 = OpLoad %18 %403
+ %405 = OpAccessChain %41 %62 %35
+ %406 = OpLoad %18 %405
+ %407 = OpIAdd %18 %406 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %404 %408
+ %410 = OpAccessChain %57 %55 %409
+ OpStore %410 %60
+ %411 = OpAccessChain %41 %62 %28
+ %412 = OpLoad %18 %411
+ %413 = OpAccessChain %41 %62 %35
+ %414 = OpLoad %18 %413
+ %415 = OpIAdd %18 %414 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %412 %416
+ %418 = OpAccessChain %57 %55 %417
+ OpStore %418 %60
+ %419 = OpAccessChain %41 %62 %35
+ %420 = OpLoad %18 %419
+ %421 = OpIAdd %18 %420 %82
+ %422 = OpAccessChain %41 %62 %35
+ OpStore %422 %421
+ OpBranch %393
+ %393 = OpLabel
+ OpBranch %161
+ %161 = OpLabel
+ %423 = OpAccessChain %41 %26 %35
+ %424 = OpLoad %18 %423
+ %425 = OpIMul %18 %424 %86
+ %426 = OpAccessChain %41 %26 %28
+ %427 = OpLoad %18 %426
+ %428 = OpIAdd %18 %425 %427
+ %429 = OpAccessChain %57 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpReturn
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ %439 = OpLoad %50 %65
+ OpBranchConditional %439 %68 %70
+ %70 = OpLabel
+ OpStore %435 %441
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 801
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %12 %435
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %9 "pos"
+ OpName %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %26 "ipos"
+ OpName %42 "i"
+ OpName %55 "map"
+ OpName %62 "p"
+ OpName %65 "canwalk"
+ OpName %67 "v"
+ OpName %74 "directions"
+ OpName %171 "j"
+ OpName %208 "d"
+ OpName %435 "_GLF_color"
+ OpDecorate %12 BuiltIn FragCoord
+ OpMemberDecorate %15 0 Offset 0
+ OpDecorate %15 Block
+ OpDecorate %17 DescriptorSet 0
+ OpDecorate %17 Binding 0
+ OpDecorate %435 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %8 = OpTypePointer Function %7
+ %10 = OpTypeVector %6 4
+ %11 = OpTypePointer Input %10
+ %12 = OpVariable %11 Input
+ %15 = OpTypeStruct %7
+ %16 = OpTypePointer Uniform %15
+ %17 = OpVariable %16 Uniform
+ %18 = OpTypeInt 32 1
+ %19 = OpConstant %18 0
+ %20 = OpTypePointer Uniform %7
+ %24 = OpTypeVector %18 2
+ %25 = OpTypePointer Function %24
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %29 = OpTypePointer Function %6
+ %32 = OpConstant %6 16
+ %35 = OpConstant %27 1
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %54 = OpTypePointer Private %53
+ %55 = OpVariable %54 Private
+ %57 = OpTypePointer Private %18
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %64 = OpTypePointer Function %50
+ %66 = OpConstantTrue %50
+ %82 = OpConstant %18 2
+ %86 = OpConstant %18 16
+ %119 = OpConstant %18 14
+ %162 = OpConstantFalse %50
+ %169 = OpConstant %18 8
+ %434 = OpTypePointer Output %10
+ %435 = OpVariable %434 Output
+ %436 = OpConstant %6 1
+ %437 = OpConstantComposite %10 %436 %436 %436 %436
+ %440 = OpConstant %6 0
+ %441 = OpConstantComposite %10 %440 %440 %440 %436
+ %542 = OpConstant %18 0
+ %566 = OpConstantComposite %53 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542 %542
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %9 = OpVariable %8 Function
+ %26 = OpVariable %25 Function
+ %42 = OpVariable %41 Function
+ %62 = OpVariable %25 Function
+ %65 = OpVariable %64 Function
+ %67 = OpVariable %41 Function
+ %74 = OpVariable %41 Function
+ %171 = OpVariable %41 Function
+ %208 = OpVariable %41 Function
+ %13 = OpLoad %10 %12
+ %14 = OpVectorShuffle %7 %13 %13 0 1
+ %21 = OpAccessChain %20 %17 %19
+ %22 = OpLoad %7 %21
+ %23 = OpFDiv %7 %14 %22
+ OpStore %9 %23
+ %30 = OpAccessChain %29 %9 %28
+ %31 = OpLoad %6 %30
+ %33 = OpFMul %6 %31 %32
+ %34 = OpConvertFToS %18 %33
+ %36 = OpAccessChain %29 %9 %35
+ %37 = OpLoad %6 %36
+ %38 = OpFMul %6 %37 %32
+ %39 = OpConvertFToS %18 %38
+ %40 = OpCompositeConstruct %24 %34 %39
+ OpStore %26 %40
+ OpStore %42 %19
+ OpBranch %43
+ %43 = OpLabel
+ OpLoopMerge %45 %46 None
+ OpBranch %47
+ %47 = OpLabel
+ %48 = OpLoad %18 %42
+ %51 = OpSLessThan %50 %48 %49
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %56 = OpLoad %18 %42
+ %58 = OpAccessChain %57 %55 %56
+ OpStore %58 %19
+ OpBranch %46
+ %46 = OpLabel
+ %59 = OpLoad %18 %42
+ %61 = OpIAdd %18 %59 %60
+ OpStore %42 %61
+ OpBranch %43
+ %45 = OpLabel
+ OpStore %62 %63
+ OpStore %65 %66
+ OpStore %67 %19
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %72 = OpLoad %18 %67
+ %73 = OpIAdd %18 %72 %60
+ OpStore %67 %73
+ OpStore %74 %19
+ %75 = OpAccessChain %41 %62 %28
+ %76 = OpLoad %18 %75
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %80 = OpAccessChain %41 %62 %28
+ %81 = OpLoad %18 %80
+ %83 = OpISub %18 %81 %82
+ %84 = OpAccessChain %41 %62 %35
+ %85 = OpLoad %18 %84
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %57 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ OpSelectionMerge %94 None
+ OpBranchConditional %92 %93 %94
+ %93 = OpLabel
+ %95 = OpLoad %18 %74
+ %96 = OpIAdd %18 %95 %60
+ OpStore %74 %96
+ OpBranch %94
+ %94 = OpLabel
+ %97 = OpAccessChain %41 %62 %35
+ %98 = OpLoad %18 %97
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %102 = OpAccessChain %41 %62 %28
+ %103 = OpLoad %18 %102
+ %104 = OpAccessChain %41 %62 %35
+ %105 = OpLoad %18 %104
+ %106 = OpISub %18 %105 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %103 %107
+ %109 = OpAccessChain %57 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %94 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %115 = OpLoad %18 %74
+ %116 = OpIAdd %18 %115 %60
+ OpStore %74 %116
+ OpBranch %114
+ %114 = OpLabel
+ %117 = OpAccessChain %41 %62 %28
+ %118 = OpLoad %18 %117
+ %120 = OpSLessThan %50 %118 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %123 = OpAccessChain %41 %62 %28
+ %124 = OpLoad %18 %123
+ %125 = OpIAdd %18 %124 %82
+ %126 = OpAccessChain %41 %62 %35
+ %127 = OpLoad %18 %126
+ %128 = OpIMul %18 %127 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %57 %55 %129
+ %131 = OpLoad %18 %130
+ %132 = OpIEqual %50 %131 %19
+ OpBranch %122
+ %122 = OpLabel
+ %133 = OpPhi %50 %120 %114 %132 %121
+ OpSelectionMerge %135 None
+ OpBranchConditional %133 %134 %135
+ %134 = OpLabel
+ %136 = OpLoad %18 %74
+ %137 = OpIAdd %18 %136 %60
+ OpStore %74 %137
+ OpBranch %135
+ %135 = OpLabel
+ %138 = OpAccessChain %41 %62 %35
+ %139 = OpLoad %18 %138
+ %140 = OpSLessThan %50 %139 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %143 = OpAccessChain %41 %62 %28
+ %144 = OpLoad %18 %143
+ %145 = OpAccessChain %41 %62 %35
+ %146 = OpLoad %18 %145
+ %147 = OpIAdd %18 %146 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %144 %148
+ %150 = OpAccessChain %57 %55 %149
+ %151 = OpLoad %18 %150
+ %152 = OpIEqual %50 %151 %19
+ OpBranch %142
+ %142 = OpLabel
+ %153 = OpPhi %50 %140 %135 %152 %141
+ OpSelectionMerge %155 None
+ OpBranchConditional %153 %154 %155
+ %154 = OpLabel
+ %156 = OpLoad %18 %74
+ %157 = OpIAdd %18 %156 %60
+ OpStore %74 %157
+ OpBranch %155
+ %155 = OpLabel
+ %158 = OpLoad %18 %74
+ %159 = OpIEqual %50 %158 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpStore %65 %162
+ OpStore %42 %19
+ OpBranch %163
+ %163 = OpLabel
+ OpLoopMerge %165 %166 None
+ OpBranch %167
+ %167 = OpLabel
+ %168 = OpLoad %18 %42
+ %170 = OpSLessThan %50 %168 %169
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpStore %171 %19
+ OpBranch %172
+ %172 = OpLabel
+ OpLoopMerge %174 %175 None
+ OpBranch %176
+ %176 = OpLabel
+ %177 = OpLoad %18 %171
+ %178 = OpSLessThan %50 %177 %169
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %179 = OpLoad %18 %171
+ %180 = OpIMul %18 %179 %82
+ %181 = OpLoad %18 %42
+ %182 = OpIMul %18 %181 %82
+ %183 = OpIMul %18 %182 %86
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %57 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %190 = OpLoad %18 %171
+ %191 = OpIMul %18 %190 %82
+ %192 = OpAccessChain %41 %62 %28
+ OpStore %192 %191
+ %193 = OpLoad %18 %42
+ %194 = OpIMul %18 %193 %82
+ %195 = OpAccessChain %41 %62 %35
+ OpStore %195 %194
+ OpStore %65 %66
+ OpBranch %189
+ %189 = OpLabel
+ OpBranch %175
+ %175 = OpLabel
+ %196 = OpLoad %18 %171
+ %197 = OpIAdd %18 %196 %60
+ OpStore %171 %197
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %198 = OpLoad %18 %42
+ %199 = OpIAdd %18 %198 %60
+ OpStore %42 %199
+ OpBranch %163
+ %165 = OpLabel
+ %200 = OpAccessChain %41 %62 %28
+ %201 = OpLoad %18 %200
+ %202 = OpAccessChain %41 %62 %35
+ %203 = OpLoad %18 %202
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %57 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %209 = OpLoad %18 %67
+ %210 = OpLoad %18 %74
+ %211 = OpSMod %18 %209 %210
+ OpStore %208 %211
+ %212 = OpLoad %18 %74
+ %213 = OpLoad %18 %67
+ %214 = OpIAdd %18 %213 %212
+ OpStore %67 %214
+ %215 = OpLoad %18 %208
+ %216 = OpSGreaterThanEqual %50 %215 %19
+ OpSelectionMerge %218 None
+ OpBranchConditional %216 %217 %218
+ %217 = OpLabel
+ %219 = OpAccessChain %41 %62 %28
+ %220 = OpLoad %18 %219
+ %221 = OpSGreaterThan %50 %220 %19
+ OpBranch %218
+ %218 = OpLabel
+ %222 = OpPhi %50 %216 %207 %221 %217
+ OpSelectionMerge %224 None
+ OpBranchConditional %222 %223 %224
+ %223 = OpLabel
+ %225 = OpAccessChain %41 %62 %28
+ %226 = OpLoad %18 %225
+ %227 = OpISub %18 %226 %82
+ %228 = OpAccessChain %41 %62 %35
+ %229 = OpLoad %18 %228
+ %230 = OpIMul %18 %229 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %57 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %222 %218 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %238 = OpLoad %18 %208
+ %239 = OpISub %18 %238 %60
+ OpStore %208 %239
+ %240 = OpAccessChain %41 %62 %28
+ %241 = OpLoad %18 %240
+ %242 = OpAccessChain %41 %62 %35
+ %243 = OpLoad %18 %242
+ %244 = OpIMul %18 %243 %86
+ %245 = OpIAdd %18 %241 %244
+ %246 = OpAccessChain %57 %55 %245
+ OpStore %246 %60
+ %247 = OpAccessChain %41 %62 %28
+ %248 = OpLoad %18 %247
+ %249 = OpISub %18 %248 %60
+ %250 = OpAccessChain %41 %62 %35
+ %251 = OpLoad %18 %250
+ %252 = OpIMul %18 %251 %86
+ %253 = OpIAdd %18 %249 %252
+ %254 = OpAccessChain %57 %55 %253
+ OpStore %254 %60
+ %255 = OpAccessChain %41 %62 %28
+ %256 = OpLoad %18 %255
+ %257 = OpISub %18 %256 %82
+ %258 = OpAccessChain %41 %62 %35
+ %259 = OpLoad %18 %258
+ %260 = OpIMul %18 %259 %86
+ %261 = OpIAdd %18 %257 %260
+ %262 = OpAccessChain %57 %55 %261
+ OpStore %262 %60
+ %263 = OpAccessChain %41 %62 %28
+ %264 = OpLoad %18 %263
+ %265 = OpISub %18 %264 %82
+ %266 = OpAccessChain %41 %62 %28
+ OpStore %266 %265
+ OpBranch %237
+ %237 = OpLabel
+ %267 = OpLoad %18 %208
+ %268 = OpSGreaterThanEqual %50 %267 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %271 = OpAccessChain %41 %62 %35
+ %272 = OpLoad %18 %271
+ %273 = OpSGreaterThan %50 %272 %19
+ OpBranch %270
+ %270 = OpLabel
+ %274 = OpPhi %50 %268 %237 %273 %269
+ OpSelectionMerge %276 None
+ OpBranchConditional %274 %275 %276
+ %275 = OpLabel
+ %277 = OpAccessChain %41 %62 %28
+ %278 = OpLoad %18 %277
+ %279 = OpAccessChain %41 %62 %35
+ %280 = OpLoad %18 %279
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ %773 = OpLoad %53 %55
+ OpStore %55 %566
+ OpStore %55 %773
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %57 %55 %283
+ %285 = OpLoad %18 %284
+ %286 = OpIEqual %50 %285 %19
+ OpBranch %276
+ %276 = OpLabel
+ %287 = OpPhi %50 %274 %270 %286 %275
+ OpSelectionMerge %289 None
+ OpBranchConditional %287 %288 %289
+ %288 = OpLabel
+ %290 = OpLoad %18 %208
+ %291 = OpISub %18 %290 %60
+ OpStore %208 %291
+ %292 = OpAccessChain %41 %62 %28
+ %293 = OpLoad %18 %292
+ %294 = OpAccessChain %41 %62 %35
+ %295 = OpLoad %18 %294
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %57 %55 %297
+ OpStore %298 %60
+ %299 = OpAccessChain %41 %62 %28
+ %300 = OpLoad %18 %299
+ %301 = OpAccessChain %41 %62 %35
+ %302 = OpLoad %18 %301
+ %303 = OpISub %18 %302 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %300 %304
+ %306 = OpAccessChain %57 %55 %305
+ OpStore %306 %60
+ %307 = OpAccessChain %41 %62 %28
+ %308 = OpLoad %18 %307
+ %309 = OpAccessChain %41 %62 %35
+ %310 = OpLoad %18 %309
+ %311 = OpISub %18 %310 %82
+ %800 = OpLoad %53 %55
+ OpStore %55 %566
+ OpStore %55 %800
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %308 %312
+ %314 = OpAccessChain %57 %55 %313
+ OpStore %314 %60
+ %315 = OpAccessChain %41 %62 %35
+ %316 = OpLoad %18 %315
+ %317 = OpISub %18 %316 %82
+ %318 = OpAccessChain %41 %62 %35
+ OpStore %318 %317
+ OpBranch %289
+ %289 = OpLabel
+ %319 = OpLoad %18 %208
+ %320 = OpSGreaterThanEqual %50 %319 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %323 = OpAccessChain %41 %62 %28
+ %324 = OpLoad %18 %323
+ %325 = OpSLessThan %50 %324 %119
+ OpBranch %322
+ %322 = OpLabel
+ %326 = OpPhi %50 %320 %289 %325 %321
+ OpSelectionMerge %328 None
+ OpBranchConditional %326 %327 %328
+ %327 = OpLabel
+ %329 = OpAccessChain %41 %62 %28
+ %330 = OpLoad %18 %329
+ %331 = OpIAdd %18 %330 %82
+ %332 = OpAccessChain %41 %62 %35
+ %333 = OpLoad %18 %332
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %57 %55 %335
+ %337 = OpLoad %18 %336
+ %338 = OpIEqual %50 %337 %19
+ OpBranch %328
+ %328 = OpLabel
+ %339 = OpPhi %50 %326 %322 %338 %327
+ OpSelectionMerge %341 None
+ OpBranchConditional %339 %340 %341
+ %340 = OpLabel
+ %342 = OpLoad %18 %208
+ %343 = OpISub %18 %342 %60
+ OpStore %208 %343
+ %344 = OpAccessChain %41 %62 %28
+ %345 = OpLoad %18 %344
+ %346 = OpAccessChain %41 %62 %35
+ %347 = OpLoad %18 %346
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %57 %55 %349
+ OpStore %350 %60
+ %351 = OpAccessChain %41 %62 %28
+ %352 = OpLoad %18 %351
+ %353 = OpIAdd %18 %352 %60
+ %354 = OpAccessChain %41 %62 %35
+ %355 = OpLoad %18 %354
+ %356 = OpIMul %18 %355 %86
+ %357 = OpIAdd %18 %353 %356
+ %358 = OpAccessChain %57 %55 %357
+ OpStore %358 %60
+ %359 = OpAccessChain %41 %62 %28
+ %360 = OpLoad %18 %359
+ %361 = OpIAdd %18 %360 %82
+ %362 = OpAccessChain %41 %62 %35
+ %363 = OpLoad %18 %362
+ %364 = OpIMul %18 %363 %86
+ %365 = OpIAdd %18 %361 %364
+ %366 = OpAccessChain %57 %55 %365
+ OpStore %366 %60
+ %367 = OpAccessChain %41 %62 %28
+ %368 = OpLoad %18 %367
+ %369 = OpIAdd %18 %368 %82
+ %370 = OpAccessChain %41 %62 %28
+ OpStore %370 %369
+ OpBranch %341
+ %341 = OpLabel
+ %371 = OpLoad %18 %208
+ %372 = OpSGreaterThanEqual %50 %371 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %375 = OpAccessChain %41 %62 %35
+ %376 = OpLoad %18 %375
+ %377 = OpSLessThan %50 %376 %119
+ OpBranch %374
+ %374 = OpLabel
+ %378 = OpPhi %50 %372 %341 %377 %373
+ OpSelectionMerge %380 None
+ OpBranchConditional %378 %379 %380
+ %379 = OpLabel
+ %381 = OpAccessChain %41 %62 %28
+ %382 = OpLoad %18 %381
+ %383 = OpAccessChain %41 %62 %35
+ %384 = OpLoad %18 %383
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %57 %55 %387
+ %389 = OpLoad %18 %388
+ %390 = OpIEqual %50 %389 %19
+ OpBranch %380
+ %380 = OpLabel
+ %391 = OpPhi %50 %378 %374 %390 %379
+ OpSelectionMerge %393 None
+ OpBranchConditional %391 %392 %393
+ %392 = OpLabel
+ %394 = OpLoad %18 %208
+ %395 = OpISub %18 %394 %60
+ OpStore %208 %395
+ %396 = OpAccessChain %41 %62 %28
+ %397 = OpLoad %18 %396
+ %398 = OpAccessChain %41 %62 %35
+ %399 = OpLoad %18 %398
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %57 %55 %401
+ OpStore %402 %60
+ %403 = OpAccessChain %41 %62 %28
+ %404 = OpLoad %18 %403
+ %405 = OpAccessChain %41 %62 %35
+ %406 = OpLoad %18 %405
+ %407 = OpIAdd %18 %406 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %404 %408
+ %410 = OpAccessChain %57 %55 %409
+ OpStore %410 %60
+ %411 = OpAccessChain %41 %62 %28
+ %412 = OpLoad %18 %411
+ %413 = OpAccessChain %41 %62 %35
+ %414 = OpLoad %18 %413
+ %415 = OpIAdd %18 %414 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %412 %416
+ %418 = OpAccessChain %57 %55 %417
+ OpStore %418 %60
+ %419 = OpAccessChain %41 %62 %35
+ %420 = OpLoad %18 %419
+ %421 = OpIAdd %18 %420 %82
+ %422 = OpAccessChain %41 %62 %35
+ OpStore %422 %421
+ OpBranch %393
+ %393 = OpLabel
+ OpBranch %161
+ %161 = OpLabel
+ %423 = OpAccessChain %41 %26 %35
+ %424 = OpLoad %18 %423
+ %425 = OpIMul %18 %424 %86
+ %426 = OpAccessChain %41 %26 %28
+ %427 = OpLoad %18 %426
+ %428 = OpIAdd %18 %425 %427
+ %429 = OpAccessChain %57 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpReturn
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ %439 = OpLoad %50 %65
+ OpBranchConditional %439 %68 %70
+ %70 = OpLabel
+ OpStore %435 %441
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# resolution
+BUFFER variant_2_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders with diff: mutate var
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 540
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %243 "gl_FragCoord"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %255 = OpConstant %157 0.5
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %373 = OpConstant %157 1
+ %507 = OpTypePointer Function %39
+ %539 = OpConstant %157 0.100000001
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %52 = OpVariable %507 Function
+ %41 = OpVariable %507 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpBranch %167
+ %167 = OpLabel
+ %508 = OpPhi %6 %166 %5 %222 %170
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ OpSelectionMerge %182 None
+ OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %185 = OpAccessChain %7 %41 %508
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %189 = OpAccessChain %7 %41 %508
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %192 = OpAccessChain %7 %41 %508
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %195 = OpAccessChain %7 %41 %508
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %198 = OpAccessChain %7 %41 %508
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %202 = OpAccessChain %7 %41 %508
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %206 = OpAccessChain %7 %41 %508
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %210 = OpAccessChain %7 %41 %508
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %214 = OpAccessChain %7 %41 %508
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %218 = OpAccessChain %7 %41 %508
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %222 = OpIAdd %6 %508 %22
+ OpBranch %170
+ %170 = OpLabel
+ %224 = OpSLessThan %31 %222 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpBranch %226
+ %226 = OpLabel
+ %510 = OpPhi %6 %105 %169 %239 %227
+ %232 = OpSLessThan %31 %510 %74
+ OpLoopMerge %228 %227 None
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %235 = OpAccessChain %7 %41 %510
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %7 %52 %510
+ OpStore %237 %236
+ %239 = OpIAdd %6 %510 %22
+ OpBranch %226
+ %228 = OpLabel
+ OpBranch %389
+ %389 = OpLabel
+ %511 = OpPhi %6 %22 %228 %426 %424
+ %393 = OpSLessThanEqual %31 %511 %107
+ OpLoopMerge %427 %424 None
+ OpBranchConditional %393 %394 %427
+ %394 = OpLabel
+ OpBranch %396
+ %396 = OpLabel
+ %519 = OpPhi %6 %105 %394 %410 %418
+ %400 = OpSLessThan %31 %519 %107
+ OpLoopMerge %423 %418 None
+ OpBranchConditional %400 %401 %423
+ %401 = OpLabel
+ %405 = OpIAdd %6 %519 %511
+ %406 = OpISub %6 %405 %22
+ %409 = OpIMul %6 %136 %511
+ %410 = OpIAdd %6 %519 %409
+ %411 = OpISub %6 %410 %22
+ %413 = OpExtInst %6 %1 SMin %411 %107
+ OpBranch %437
+ %437 = OpLabel
+ %532 = OpPhi %6 %519 %401 %456 %471
+ %522 = OpPhi %6 %405 %401 %534 %471
+ %521 = OpPhi %6 %519 %401 %533 %471
+ %441 = OpSLessThanEqual %31 %521 %406
+ %444 = OpSLessThanEqual %31 %522 %413
+ %445 = OpLogicalAnd %31 %441 %444
+ OpLoopMerge %472 %471 None
+ OpBranchConditional %445 %446 %472
+ %446 = OpLabel
+ %448 = OpAccessChain %7 %41 %521
+ %449 = OpLoad %6 %448
+ %451 = OpAccessChain %7 %41 %522
+ %452 = OpLoad %6 %451
+ %453 = OpSLessThan %31 %449 %452
+ %456 = OpIAdd %6 %532 %22
+ OpSelectionMerge %470 None
+ OpBranchConditional %453 %454 %462
+ %454 = OpLabel
+ %458 = OpIAdd %6 %521 %22
+ %460 = OpLoad %6 %448
+ %461 = OpAccessChain %7 %52 %532
+ OpStore %461 %460
+ OpBranch %470
+ %462 = OpLabel
+ %466 = OpIAdd %6 %522 %22
+ %468 = OpLoad %6 %451
+ %469 = OpAccessChain %7 %52 %532
+ OpStore %469 %468
+ OpBranch %470
+ %470 = OpLabel
+ %534 = OpPhi %6 %522 %454 %466 %462
+ %533 = OpPhi %6 %458 %454 %521 %462
+ OpBranch %471
+ %471 = OpLabel
+ OpBranch %437
+ %472 = OpLabel
+ OpBranch %473
+ %473 = OpLabel
+ %531 = OpPhi %6 %532 %472 %483 %481
+ %523 = OpPhi %6 %521 %472 %485 %481
+ %476 = OpSLessThan %31 %523 %74
+ %479 = OpSLessThanEqual %31 %523 %406
+ %480 = OpLogicalAnd %31 %476 %479
+ OpLoopMerge %490 %481 None
+ OpBranchConditional %480 %481 %490
+ %481 = OpLabel
+ %483 = OpIAdd %6 %531 %22
+ %485 = OpIAdd %6 %523 %22
+ %486 = OpAccessChain %7 %41 %523
+ %487 = OpLoad %6 %486
+ %488 = OpAccessChain %7 %52 %531
+ OpStore %488 %487
+ OpBranch %473
+ %490 = OpLabel
+ OpBranch %492
+ %492 = OpLabel
+ %524 = OpPhi %6 %519 %490 %505 %497
+ %496 = OpSLessThanEqual %31 %524 %413
+ OpLoopMerge %506 %497 None
+ OpBranchConditional %496 %497 %506
+ %497 = OpLabel
+ %500 = OpAccessChain %7 %52 %524
+ %501 = OpLoad %6 %500
+ %502 = OpAccessChain %7 %41 %524
+ OpStore %502 %501
+ %505 = OpIAdd %6 %524 %22
+ OpBranch %492
+ %506 = OpLabel
+ OpBranch %418
+ %418 = OpLabel
+ OpBranch %396
+ %423 = OpLabel
+ OpBranch %424
+ %424 = OpLabel
+ %426 = OpIMul %6 %136 %511
+ OpBranch %389
+ %427 = OpLabel
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %7 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFMul %157 %258 %539
+ %261 = OpFAdd %157 %255 %260
+ OpBranch %252
+ %262 = OpLabel
+ %267 = OpSLessThan %31 %248 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %7 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFMul %157 %272 %539
+ %274 = OpFAdd %157 %255 %273
+ OpBranch %269
+ %275 = OpLabel
+ %280 = OpSLessThan %31 %248 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %7 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFMul %157 %285 %539
+ %287 = OpFAdd %157 %255 %286
+ OpBranch %282
+ %288 = OpLabel
+ %293 = OpSLessThan %31 %248 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %7 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFMul %157 %298 %539
+ %300 = OpFAdd %157 %255 %299
+ OpBranch %295
+ %301 = OpLabel
+ %306 = OpSLessThan %31 %248 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %315 = OpSLessThan %31 %248 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %7 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFMul %157 %321 %539
+ %323 = OpFAdd %157 %255 %322
+ OpBranch %317
+ %324 = OpLabel
+ %329 = OpSLessThan %31 %248 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %7 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFMul %157 %335 %539
+ %337 = OpFAdd %157 %255 %336
+ OpBranch %331
+ %338 = OpLabel
+ %343 = OpSLessThan %31 %248 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %7 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFMul %157 %349 %539
+ %351 = OpFAdd %157 %255 %350
+ OpBranch %345
+ %352 = OpLabel
+ %357 = OpSLessThan %31 %248 %356
+ OpSelectionMerge %358 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %7 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFMul %157 %363 %539
+ %365 = OpFAdd %157 %255 %364
+ OpBranch %345
+ %366 = OpLabel
+ OpKill
+ %345 = OpLabel
+ %518 = OpPhi %157 %351 %344 %365 %358
+ OpBranch %331
+ %331 = OpLabel
+ %517 = OpPhi %157 %337 %330 %518 %345
+ OpBranch %317
+ %317 = OpLabel
+ %516 = OpPhi %157 %323 %316 %517 %331
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ %515 = OpPhi %157 %300 %294 %516 %308
+ OpBranch %282
+ %282 = OpLabel
+ %514 = OpPhi %157 %287 %281 %515 %295
+ OpBranch %269
+ %269 = OpLabel
+ %513 = OpPhi %157 %274 %268 %514 %282
+ OpBranch %252
+ %252 = OpLabel
+ %512 = OpPhi %157 %261 %251 %513 %269
+ %377 = OpCompositeConstruct %241 %512 %512 %512 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# injectionSwitch
+BUFFER reference_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 677
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %243 "gl_FragCoord"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %255 = OpConstant %157 0.5
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %373 = OpConstant %157 1
+ %507 = OpTypePointer Function %39
+ %539 = OpConstant %157 0.100000001
+ %670 = OpConstant %6 0
+ %671 = OpConstantComposite %39 %670 %670 %670 %670 %670 %670 %670 %670 %670 %670
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %52 = OpVariable %507 Function
+ %41 = OpVariable %507 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpBranch %167
+ %167 = OpLabel
+ %508 = OpPhi %6 %166 %5 %222 %170
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %676 = OpLoad %39 %41
+ OpStore %41 %671
+ OpStore %41 %676
+ %651 = OpIAdd %6 %508 %22
+ OpSelectionMerge %182 None
+ OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %185 = OpAccessChain %7 %41 %508
+ OpStore %185 %184
+ %652 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %173 = OpLabel
+ %189 = OpAccessChain %7 %41 %508
+ OpStore %189 %188
+ %653 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %174 = OpLabel
+ %192 = OpAccessChain %7 %41 %508
+ OpStore %192 %136
+ %654 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %175 = OpLabel
+ %195 = OpAccessChain %7 %41 %508
+ OpStore %195 %22
+ %655 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %176 = OpLabel
+ %198 = OpAccessChain %7 %41 %508
+ OpStore %198 %105
+ %656 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %177 = OpLabel
+ %202 = OpAccessChain %7 %41 %508
+ OpStore %202 %201
+ %657 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %178 = OpLabel
+ %206 = OpAccessChain %7 %41 %508
+ OpStore %206 %205
+ %658 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %179 = OpLabel
+ %210 = OpAccessChain %7 %41 %508
+ OpStore %210 %209
+ %659 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %180 = OpLabel
+ %214 = OpAccessChain %7 %41 %508
+ OpStore %214 %213
+ %660 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %181 = OpLabel
+ %218 = OpAccessChain %7 %41 %508
+ OpStore %218 %217
+ %661 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %182 = OpLabel
+ %222 = OpPhi %6 %651 %168 %652 %172 %653 %173 %654 %174 %655 %175 %656 %176 %657 %177 %658 %178 %659 %179 %660 %180 %661 %181
+ OpBranch %170
+ %170 = OpLabel
+ %224 = OpSLessThan %31 %222 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpBranch %226
+ %226 = OpLabel
+ %510 = OpPhi %6 %105 %169 %239 %227
+ %232 = OpSLessThan %31 %510 %74
+ OpLoopMerge %228 %227 None
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %235 = OpAccessChain %7 %41 %510
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %7 %52 %510
+ OpStore %237 %236
+ %239 = OpIAdd %6 %510 %22
+ OpBranch %226
+ %228 = OpLabel
+ OpBranch %389
+ %389 = OpLabel
+ %511 = OpPhi %6 %22 %228 %426 %424
+ %393 = OpSLessThanEqual %31 %511 %107
+ OpLoopMerge %427 %424 None
+ OpBranchConditional %393 %394 %427
+ %394 = OpLabel
+ OpBranch %396
+ %396 = OpLabel
+ %519 = OpPhi %6 %105 %394 %410 %418
+ %400 = OpSLessThan %31 %519 %107
+ OpLoopMerge %423 %418 None
+ OpBranchConditional %400 %401 %423
+ %401 = OpLabel
+ %405 = OpIAdd %6 %519 %511
+ %406 = OpISub %6 %405 %22
+ %409 = OpIMul %6 %136 %511
+ %410 = OpIAdd %6 %519 %409
+ %411 = OpISub %6 %410 %22
+ %413 = OpExtInst %6 %1 SMin %411 %107
+ OpBranch %437
+ %437 = OpLabel
+ %532 = OpPhi %6 %519 %401 %456 %471
+ %522 = OpPhi %6 %405 %401 %534 %471
+ %521 = OpPhi %6 %519 %401 %533 %471
+ %441 = OpSLessThanEqual %31 %521 %406
+ %444 = OpSLessThanEqual %31 %522 %413
+ %445 = OpLogicalAnd %31 %441 %444
+ OpLoopMerge %472 %471 None
+ OpBranchConditional %445 %446 %472
+ %446 = OpLabel
+ %448 = OpAccessChain %7 %41 %521
+ %449 = OpLoad %6 %448
+ %451 = OpAccessChain %7 %41 %522
+ %452 = OpLoad %6 %451
+ %453 = OpSLessThan %31 %449 %452
+ %456 = OpIAdd %6 %532 %22
+ OpSelectionMerge %470 None
+ OpBranchConditional %453 %454 %462
+ %454 = OpLabel
+ %458 = OpIAdd %6 %521 %22
+ %460 = OpLoad %6 %448
+ %461 = OpAccessChain %7 %52 %532
+ OpStore %461 %460
+ OpBranch %470
+ %462 = OpLabel
+ %466 = OpIAdd %6 %522 %22
+ %468 = OpLoad %6 %451
+ %469 = OpAccessChain %7 %52 %532
+ OpStore %469 %468
+ OpBranch %470
+ %470 = OpLabel
+ %534 = OpPhi %6 %522 %454 %466 %462
+ %533 = OpPhi %6 %458 %454 %521 %462
+ OpBranch %471
+ %471 = OpLabel
+ OpBranch %437
+ %472 = OpLabel
+ OpBranch %473
+ %473 = OpLabel
+ %531 = OpPhi %6 %532 %472 %483 %481
+ %523 = OpPhi %6 %521 %472 %485 %481
+ %476 = OpSLessThan %31 %523 %74
+ %479 = OpSLessThanEqual %31 %523 %406
+ %480 = OpLogicalAnd %31 %476 %479
+ OpLoopMerge %490 %481 None
+ OpBranchConditional %480 %481 %490
+ %481 = OpLabel
+ %483 = OpIAdd %6 %531 %22
+ %485 = OpIAdd %6 %523 %22
+ %486 = OpAccessChain %7 %41 %523
+ %487 = OpLoad %6 %486
+ %488 = OpAccessChain %7 %52 %531
+ OpStore %488 %487
+ OpBranch %473
+ %490 = OpLabel
+ OpBranch %492
+ %492 = OpLabel
+ %524 = OpPhi %6 %519 %490 %505 %497
+ %496 = OpSLessThanEqual %31 %524 %413
+ OpLoopMerge %506 %497 None
+ OpBranchConditional %496 %497 %506
+ %497 = OpLabel
+ %500 = OpAccessChain %7 %52 %524
+ %501 = OpLoad %6 %500
+ %502 = OpAccessChain %7 %41 %524
+ OpStore %502 %501
+ %505 = OpIAdd %6 %524 %22
+ OpBranch %492
+ %506 = OpLabel
+ OpBranch %418
+ %418 = OpLabel
+ OpBranch %396
+ %423 = OpLabel
+ OpBranch %424
+ %424 = OpLabel
+ %426 = OpIMul %6 %136 %511
+ OpBranch %389
+ %427 = OpLabel
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %7 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFMul %157 %258 %539
+ %261 = OpFAdd %157 %255 %260
+ OpBranch %252
+ %262 = OpLabel
+ %267 = OpSLessThan %31 %248 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %7 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFMul %157 %272 %539
+ %274 = OpFAdd %157 %255 %273
+ OpBranch %269
+ %275 = OpLabel
+ %280 = OpSLessThan %31 %248 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %7 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFMul %157 %285 %539
+ %287 = OpFAdd %157 %255 %286
+ OpBranch %282
+ %288 = OpLabel
+ %293 = OpSLessThan %31 %248 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %7 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFMul %157 %298 %539
+ %300 = OpFAdd %157 %255 %299
+ OpBranch %295
+ %301 = OpLabel
+ %306 = OpSLessThan %31 %248 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %315 = OpSLessThan %31 %248 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %7 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFMul %157 %321 %539
+ %323 = OpFAdd %157 %255 %322
+ OpBranch %317
+ %324 = OpLabel
+ %329 = OpSLessThan %31 %248 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %7 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFMul %157 %335 %539
+ %337 = OpFAdd %157 %255 %336
+ OpBranch %331
+ %338 = OpLabel
+ %343 = OpSLessThan %31 %248 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %7 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFMul %157 %349 %539
+ %351 = OpFAdd %157 %255 %350
+ OpBranch %345
+ %352 = OpLabel
+ %357 = OpSLessThan %31 %248 %356
+ OpSelectionMerge %358 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %7 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFMul %157 %363 %539
+ %365 = OpFAdd %157 %255 %364
+ OpBranch %345
+ %366 = OpLabel
+ OpKill
+ %345 = OpLabel
+ %518 = OpPhi %157 %351 %344 %365 %358
+ OpBranch %331
+ %331 = OpLabel
+ %517 = OpPhi %157 %337 %330 %518 %345
+ OpBranch %317
+ %317 = OpLabel
+ %516 = OpPhi %157 %323 %316 %517 %331
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ %515 = OpPhi %157 %300 %294 %516 %308
+ OpBranch %282
+ %282 = OpLabel
+ %514 = OpPhi %157 %287 %281 %515 %295
+ OpBranch %269
+ %269 = OpLabel
+ %513 = OpPhi %157 %274 %268 %514 %282
+ OpBranch %252
+ %252 = OpLabel
+ %512 = OpPhi %157 %261 %251 %513 %269
+ %377 = OpCompositeConstruct %241 %512 %512 %512 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# injectionSwitch
+BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 672
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %243 "gl_FragCoord"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %255 = OpConstant %157 0.5
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %373 = OpConstant %157 1
+ %507 = OpTypePointer Function %39
+ %539 = OpConstant %157 0.100000001
+ %670 = OpConstant %6 0
+ %671 = OpConstantComposite %39 %670 %670 %670 %670 %670 %670 %670 %670 %670 %670
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %52 = OpVariable %507 Function
+ %41 = OpVariable %507 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpBranch %167
+ %167 = OpLabel
+ %508 = OpPhi %6 %166 %5 %222 %170
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %651 = OpIAdd %6 %508 %22
+ OpSelectionMerge %182 None
+ OpSwitch %508 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %185 = OpAccessChain %7 %41 %508
+ OpStore %185 %184
+ %652 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %173 = OpLabel
+ %189 = OpAccessChain %7 %41 %508
+ OpStore %189 %188
+ %653 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %174 = OpLabel
+ %192 = OpAccessChain %7 %41 %508
+ OpStore %192 %136
+ %654 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %175 = OpLabel
+ %195 = OpAccessChain %7 %41 %508
+ OpStore %195 %22
+ %655 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %176 = OpLabel
+ %198 = OpAccessChain %7 %41 %508
+ OpStore %198 %105
+ %656 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %177 = OpLabel
+ %202 = OpAccessChain %7 %41 %508
+ OpStore %202 %201
+ %657 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %178 = OpLabel
+ %206 = OpAccessChain %7 %41 %508
+ OpStore %206 %205
+ %658 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %179 = OpLabel
+ %210 = OpAccessChain %7 %41 %508
+ OpStore %210 %209
+ %659 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %180 = OpLabel
+ %214 = OpAccessChain %7 %41 %508
+ OpStore %214 %213
+ %660 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %181 = OpLabel
+ %218 = OpAccessChain %7 %41 %508
+ OpStore %218 %217
+ %661 = OpIAdd %6 %508 %22
+ OpBranch %182
+ %182 = OpLabel
+ %222 = OpPhi %6 %651 %168 %652 %172 %653 %173 %654 %174 %655 %175 %656 %176 %657 %177 %658 %178 %659 %179 %660 %180 %661 %181
+ OpBranch %170
+ %170 = OpLabel
+ %224 = OpSLessThan %31 %222 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpBranch %226
+ %226 = OpLabel
+ %510 = OpPhi %6 %105 %169 %239 %227
+ %232 = OpSLessThan %31 %510 %74
+ OpLoopMerge %228 %227 None
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %235 = OpAccessChain %7 %41 %510
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %7 %52 %510
+ OpStore %237 %236
+ %239 = OpIAdd %6 %510 %22
+ OpBranch %226
+ %228 = OpLabel
+ OpBranch %389
+ %389 = OpLabel
+ %511 = OpPhi %6 %22 %228 %426 %424
+ %393 = OpSLessThanEqual %31 %511 %107
+ OpLoopMerge %427 %424 None
+ OpBranchConditional %393 %394 %427
+ %394 = OpLabel
+ OpBranch %396
+ %396 = OpLabel
+ %519 = OpPhi %6 %105 %394 %410 %418
+ %400 = OpSLessThan %31 %519 %107
+ OpLoopMerge %423 %418 None
+ OpBranchConditional %400 %401 %423
+ %401 = OpLabel
+ %405 = OpIAdd %6 %519 %511
+ %406 = OpISub %6 %405 %22
+ %409 = OpIMul %6 %136 %511
+ %410 = OpIAdd %6 %519 %409
+ %411 = OpISub %6 %410 %22
+ %413 = OpExtInst %6 %1 SMin %411 %107
+ OpBranch %437
+ %437 = OpLabel
+ %532 = OpPhi %6 %519 %401 %456 %471
+ %522 = OpPhi %6 %405 %401 %534 %471
+ %521 = OpPhi %6 %519 %401 %533 %471
+ %441 = OpSLessThanEqual %31 %521 %406
+ %444 = OpSLessThanEqual %31 %522 %413
+ %445 = OpLogicalAnd %31 %441 %444
+ OpLoopMerge %472 %471 None
+ OpBranchConditional %445 %446 %472
+ %446 = OpLabel
+ %448 = OpAccessChain %7 %41 %521
+ %449 = OpLoad %6 %448
+ %451 = OpAccessChain %7 %41 %522
+ %452 = OpLoad %6 %451
+ %453 = OpSLessThan %31 %449 %452
+ %456 = OpIAdd %6 %532 %22
+ OpSelectionMerge %470 None
+ OpBranchConditional %453 %454 %462
+ %454 = OpLabel
+ %458 = OpIAdd %6 %521 %22
+ %460 = OpLoad %6 %448
+ %461 = OpAccessChain %7 %52 %532
+ OpStore %461 %460
+ OpBranch %470
+ %462 = OpLabel
+ %466 = OpIAdd %6 %522 %22
+ %468 = OpLoad %6 %451
+ %469 = OpAccessChain %7 %52 %532
+ OpStore %469 %468
+ OpBranch %470
+ %470 = OpLabel
+ %534 = OpPhi %6 %522 %454 %466 %462
+ %533 = OpPhi %6 %458 %454 %521 %462
+ OpBranch %471
+ %471 = OpLabel
+ OpBranch %437
+ %472 = OpLabel
+ OpBranch %473
+ %473 = OpLabel
+ %531 = OpPhi %6 %532 %472 %483 %481
+ %523 = OpPhi %6 %521 %472 %485 %481
+ %476 = OpSLessThan %31 %523 %74
+ %479 = OpSLessThanEqual %31 %523 %406
+ %480 = OpLogicalAnd %31 %476 %479
+ OpLoopMerge %490 %481 None
+ OpBranchConditional %480 %481 %490
+ %481 = OpLabel
+ %483 = OpIAdd %6 %531 %22
+ %485 = OpIAdd %6 %523 %22
+ %486 = OpAccessChain %7 %41 %523
+ %487 = OpLoad %6 %486
+ %488 = OpAccessChain %7 %52 %531
+ OpStore %488 %487
+ OpBranch %473
+ %490 = OpLabel
+ OpBranch %492
+ %492 = OpLabel
+ %524 = OpPhi %6 %519 %490 %505 %497
+ %496 = OpSLessThanEqual %31 %524 %413
+ OpLoopMerge %506 %497 None
+ OpBranchConditional %496 %497 %506
+ %497 = OpLabel
+ %500 = OpAccessChain %7 %52 %524
+ %501 = OpLoad %6 %500
+ %502 = OpAccessChain %7 %41 %524
+ OpStore %502 %501
+ %505 = OpIAdd %6 %524 %22
+ OpBranch %492
+ %506 = OpLabel
+ OpBranch %418
+ %418 = OpLabel
+ OpBranch %396
+ %423 = OpLabel
+ OpBranch %424
+ %424 = OpLabel
+ %426 = OpIMul %6 %136 %511
+ OpBranch %389
+ %427 = OpLabel
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %7 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFMul %157 %258 %539
+ %261 = OpFAdd %157 %255 %260
+ OpBranch %252
+ %262 = OpLabel
+ %267 = OpSLessThan %31 %248 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %7 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFMul %157 %272 %539
+ %274 = OpFAdd %157 %255 %273
+ OpBranch %269
+ %275 = OpLabel
+ %280 = OpSLessThan %31 %248 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %7 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFMul %157 %285 %539
+ %287 = OpFAdd %157 %255 %286
+ OpBranch %282
+ %288 = OpLabel
+ %293 = OpSLessThan %31 %248 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %7 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFMul %157 %298 %539
+ %300 = OpFAdd %157 %255 %299
+ OpBranch %295
+ %301 = OpLabel
+ %306 = OpSLessThan %31 %248 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %315 = OpSLessThan %31 %248 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %7 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFMul %157 %321 %539
+ %323 = OpFAdd %157 %255 %322
+ OpBranch %317
+ %324 = OpLabel
+ %329 = OpSLessThan %31 %248 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %7 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFMul %157 %335 %539
+ %337 = OpFAdd %157 %255 %336
+ OpBranch %331
+ %338 = OpLabel
+ %343 = OpSLessThan %31 %248 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %7 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFMul %157 %349 %539
+ %351 = OpFAdd %157 %255 %350
+ OpBranch %345
+ %352 = OpLabel
+ %357 = OpSLessThan %31 %248 %356
+ OpSelectionMerge %358 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %7 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFMul %157 %363 %539
+ %365 = OpFAdd %157 %255 %364
+ OpBranch %345
+ %366 = OpLabel
+ OpKill
+ %345 = OpLabel
+ %518 = OpPhi %157 %351 %344 %365 %358
+ OpBranch %331
+ %331 = OpLabel
+ %517 = OpPhi %157 %337 %330 %518 %345
+ OpBranch %317
+ %317 = OpLabel
+ %516 = OpPhi %157 %323 %316 %517 %331
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ %515 = OpPhi %157 %300 %294 %516 %308
+ OpBranch %282
+ %282 = OpLabel
+ %514 = OpPhi %157 %287 %281 %515 %295
+ OpBranch %269
+ %269 = OpLabel
+ %513 = OpPhi %157 %274 %268 %514 %282
+ OpBranch %252
+ %252 = OpLabel
+ %512 = OpPhi %157 %261 %251 %513 %269
+ %377 = OpCompositeConstruct %241 %512 %512 %512 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# injectionSwitch
+BUFFER variant_2_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Shaders diff: selection %25 flattened; dead continues
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 378
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "merge(i1;i1;i1;"
+ OpName %9 "from"
+ OpName %10 "mid"
+ OpName %11 "to"
+ OpName %14 "mergeSort("
+ OpName %16 "k"
+ OpName %18 "i"
+ OpName %20 "j"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %87 "i"
+ OpName %104 "low"
+ OpName %106 "high"
+ OpName %108 "m"
+ OpName %117 "i"
+ OpName %127 "from"
+ OpName %129 "mid"
+ OpName %134 "to"
+ OpName %143 "param"
+ OpName %145 "param"
+ OpName %147 "param"
+ OpName %156 "i"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %225 "j"
+ OpName %243 "gl_FragCoord"
+ OpName %254 "grey"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7 %7
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %40 = OpTypePointer Private %39
+ %41 = OpVariable %40 Private
+ %43 = OpTypePointer Private %6
+ %52 = OpVariable %40 Private
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %253 = OpTypePointer Function %157
+ %255 = OpConstant %157 0.5
+ %259 = OpConstant %157 10
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %371 = OpTypeVector %157 3
+ %373 = OpConstant %157 1
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %156 = OpVariable %7 Function
+ %225 = OpVariable %7 Function
+ %254 = OpVariable %253 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpStore %156 %166
+ OpBranch %167
+ %167 = OpLabel
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %171 = OpLoad %6 %156
+ OpSelectionMerge %182 None
+ OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %183 = OpLoad %6 %156
+ %185 = OpAccessChain %43 %41 %183
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %187 = OpLoad %6 %156
+ %189 = OpAccessChain %43 %41 %187
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %191 = OpLoad %6 %156
+ %192 = OpAccessChain %43 %41 %191
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %194 = OpLoad %6 %156
+ %195 = OpAccessChain %43 %41 %194
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %197 = OpLoad %6 %156
+ %198 = OpAccessChain %43 %41 %197
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %200 = OpLoad %6 %156
+ %202 = OpAccessChain %43 %41 %200
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %204 = OpLoad %6 %156
+ %206 = OpAccessChain %43 %41 %204
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %208 = OpLoad %6 %156
+ %210 = OpAccessChain %43 %41 %208
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %212 = OpLoad %6 %156
+ %214 = OpAccessChain %43 %41 %212
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %216 = OpLoad %6 %156
+ %218 = OpAccessChain %43 %41 %216
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %221 = OpLoad %6 %156
+ %222 = OpIAdd %6 %221 %22
+ OpStore %156 %222
+ OpBranch %170
+ %170 = OpLabel
+ %223 = OpLoad %6 %156
+ %224 = OpSLessThan %31 %223 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpStore %225 %105
+ OpBranch %226
+ %226 = OpLabel
+ OpLoopMerge %228 %229 None
+ OpBranch %230
+ %230 = OpLabel
+ %231 = OpLoad %6 %225
+ %232 = OpSLessThan %31 %231 %74
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %233 = OpLoad %6 %225
+ %234 = OpLoad %6 %225
+ %235 = OpAccessChain %43 %41 %234
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %43 %52 %233
+ OpStore %237 %236
+ OpBranch %229
+ %229 = OpLabel
+ %238 = OpLoad %6 %225
+ %239 = OpIAdd %6 %238 %22
+ OpStore %225 %239
+ OpBranch %226
+ %228 = OpLabel
+ %240 = OpFunctionCall %2 %14
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %43 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFDiv %157 %258 %259
+ %261 = OpFAdd %157 %255 %260
+ OpStore %254 %261
+ OpBranch %252
+ %262 = OpLabel
+ %263 = OpAccessChain %245 %243 %244
+ %264 = OpLoad %157 %263
+ %265 = OpConvertFToS %6 %264
+ %267 = OpSLessThan %31 %265 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %43 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFDiv %157 %272 %259
+ %274 = OpFAdd %157 %255 %273
+ OpStore %254 %274
+ OpBranch %269
+ %275 = OpLabel
+ %276 = OpAccessChain %245 %243 %244
+ %277 = OpLoad %157 %276
+ %278 = OpConvertFToS %6 %277
+ %280 = OpSLessThan %31 %278 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %43 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFDiv %157 %285 %259
+ %287 = OpFAdd %157 %255 %286
+ OpStore %254 %287
+ OpBranch %282
+ %288 = OpLabel
+ %289 = OpAccessChain %245 %243 %244
+ %290 = OpLoad %157 %289
+ %291 = OpConvertFToS %6 %290
+ %293 = OpSLessThan %31 %291 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %43 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFDiv %157 %298 %259
+ %300 = OpFAdd %157 %255 %299
+ OpStore %254 %300
+ OpBranch %295
+ %301 = OpLabel
+ %302 = OpAccessChain %245 %243 %244
+ %303 = OpLoad %157 %302
+ %304 = OpConvertFToS %6 %303
+ %306 = OpSLessThan %31 %304 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %311 = OpAccessChain %245 %243 %244
+ %312 = OpLoad %157 %311
+ %313 = OpConvertFToS %6 %312
+ %315 = OpSLessThan %31 %313 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %43 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFDiv %157 %321 %259
+ %323 = OpFAdd %157 %255 %322
+ OpStore %254 %323
+ OpBranch %317
+ %324 = OpLabel
+ %325 = OpAccessChain %245 %243 %244
+ %326 = OpLoad %157 %325
+ %327 = OpConvertFToS %6 %326
+ %329 = OpSLessThan %31 %327 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %43 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFDiv %157 %335 %259
+ %337 = OpFAdd %157 %255 %336
+ OpStore %254 %337
+ OpBranch %331
+ %338 = OpLabel
+ %339 = OpAccessChain %245 %243 %244
+ %340 = OpLoad %157 %339
+ %341 = OpConvertFToS %6 %340
+ %343 = OpSLessThan %31 %341 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %43 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFDiv %157 %349 %259
+ %351 = OpFAdd %157 %255 %350
+ OpStore %254 %351
+ OpBranch %345
+ %352 = OpLabel
+ %353 = OpAccessChain %245 %243 %244
+ %354 = OpLoad %157 %353
+ %355 = OpConvertFToS %6 %354
+ %357 = OpSLessThan %31 %355 %356
+ OpSelectionMerge %359 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %43 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFDiv %157 %363 %259
+ %365 = OpFAdd %157 %255 %364
+ OpStore %254 %365
+ OpBranch %359
+ %366 = OpLabel
+ OpKill
+ %359 = OpLabel
+ OpBranch %345
+ %345 = OpLabel
+ OpBranch %331
+ %331 = OpLabel
+ OpBranch %317
+ %317 = OpLabel
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ OpBranch %282
+ %282 = OpLabel
+ OpBranch %269
+ %269 = OpLabel
+ OpBranch %252
+ %252 = OpLabel
+ %370 = OpLoad %157 %254
+ %372 = OpCompositeConstruct %371 %370 %370 %370
+ %374 = OpCompositeExtract %157 %372 0
+ %375 = OpCompositeExtract %157 %372 1
+ %376 = OpCompositeExtract %157 %372 2
+ %377 = OpCompositeConstruct %241 %374 %375 %376 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %16 = OpVariable %7 Function
+ %18 = OpVariable %7 Function
+ %20 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %17 = OpLoad %6 %9
+ OpStore %16 %17
+ %19 = OpLoad %6 %9
+ OpStore %18 %19
+ %21 = OpLoad %6 %10
+ %23 = OpIAdd %6 %21 %22
+ OpStore %20 %23
+ OpBranch %24
+ %24 = OpLabel
+ OpLoopMerge %26 %27 None
+ OpBranch %28
+ %28 = OpLabel
+ %29 = OpLoad %6 %18
+ %30 = OpLoad %6 %10
+ %32 = OpSLessThanEqual %31 %29 %30
+ %33 = OpLoad %6 %20
+ %34 = OpLoad %6 %11
+ %35 = OpSLessThanEqual %31 %33 %34
+ %36 = OpLogicalAnd %31 %32 %35
+ OpBranchConditional %36 %25 %26
+ %25 = OpLabel
+ %42 = OpLoad %6 %18
+ %44 = OpAccessChain %43 %41 %42
+ %45 = OpLoad %6 %44
+ %46 = OpLoad %6 %20
+ %47 = OpAccessChain %43 %41 %46
+ %48 = OpLoad %6 %47
+ %49 = OpSLessThan %31 %45 %48
+ OpSelectionMerge %51 None
+ OpBranchConditional %49 %50 %60
+ %50 = OpLabel
+ %53 = OpLoad %6 %16
+ %54 = OpIAdd %6 %53 %22
+ OpStore %16 %54
+ %55 = OpLoad %6 %18
+ %56 = OpIAdd %6 %55 %22
+ OpStore %18 %56
+ %57 = OpAccessChain %43 %41 %55
+ %58 = OpLoad %6 %57
+ %59 = OpAccessChain %43 %52 %53
+ OpStore %59 %58
+ OpBranch %51
+ %60 = OpLabel
+ %61 = OpLoad %6 %16
+ %62 = OpIAdd %6 %61 %22
+ OpStore %16 %62
+ %63 = OpLoad %6 %20
+ %64 = OpIAdd %6 %63 %22
+ OpStore %20 %64
+ %65 = OpAccessChain %43 %41 %63
+ %66 = OpLoad %6 %65
+ %67 = OpAccessChain %43 %52 %61
+ OpStore %67 %66
+ OpBranch %51
+ %51 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %72
+ %72 = OpLabel
+ %73 = OpLoad %6 %18
+ %75 = OpSLessThan %31 %73 %74
+ %76 = OpLoad %6 %18
+ %77 = OpLoad %6 %10
+ %78 = OpSLessThanEqual %31 %76 %77
+ %79 = OpLogicalAnd %31 %75 %78
+ OpBranchConditional %79 %69 %70
+ %69 = OpLabel
+ %80 = OpLoad %6 %16
+ %81 = OpIAdd %6 %80 %22
+ OpStore %16 %81
+ %82 = OpLoad %6 %18
+ %83 = OpIAdd %6 %82 %22
+ OpStore %18 %83
+ %84 = OpAccessChain %43 %41 %82
+ %85 = OpLoad %6 %84
+ %86 = OpAccessChain %43 %52 %80
+ OpStore %86 %85
+ OpBranch %71
+ %71 = OpLabel
+ OpBranch %68
+ %70 = OpLabel
+ %88 = OpLoad %6 %9
+ OpStore %87 %88
+ OpBranch %89
+ %89 = OpLabel
+ OpLoopMerge %91 %92 None
+ OpBranch %93
+ %93 = OpLabel
+ %94 = OpLoad %6 %87
+ %95 = OpLoad %6 %11
+ %96 = OpSLessThanEqual %31 %94 %95
+ OpBranchConditional %96 %90 %91
+ %90 = OpLabel
+ %97 = OpLoad %6 %87
+ %98 = OpLoad %6 %87
+ %99 = OpAccessChain %43 %52 %98
+ %100 = OpLoad %6 %99
+ %101 = OpAccessChain %43 %41 %97
+ OpStore %101 %100
+ OpBranch %92
+ %92 = OpLabel
+ %102 = OpLoad %6 %87
+ %103 = OpIAdd %6 %102 %22
+ OpStore %87 %103
+ OpBranch %89
+ %91 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %14 = OpFunction %2 None %3
+ %15 = OpLabel
+ %104 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %108 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %127 = OpVariable %7 Function
+ %129 = OpVariable %7 Function
+ %134 = OpVariable %7 Function
+ %143 = OpVariable %7 Function
+ %145 = OpVariable %7 Function
+ %147 = OpVariable %7 Function
+ OpStore %104 %105
+ OpStore %106 %107
+ OpStore %108 %22
+ OpBranch %109
+ %109 = OpLabel
+ OpLoopMerge %111 %112 None
+ OpBranch %113
+ %113 = OpLabel
+ %114 = OpLoad %6 %108
+ %115 = OpLoad %6 %106
+ %116 = OpSLessThanEqual %31 %114 %115
+ OpBranchConditional %116 %110 %111
+ %110 = OpLabel
+ %118 = OpLoad %6 %104
+ OpStore %117 %118
+ OpBranch %119
+ %119 = OpLabel
+ OpLoopMerge %121 %122 None
+ OpBranch %123
+ %123 = OpLabel
+ %124 = OpLoad %6 %117
+ %125 = OpLoad %6 %106
+ %126 = OpSLessThan %31 %124 %125
+ OpBranchConditional %126 %120 %121
+ %120 = OpLabel
+ %128 = OpLoad %6 %117
+ OpStore %127 %128
+ %130 = OpLoad %6 %117
+ %131 = OpLoad %6 %108
+ %132 = OpIAdd %6 %130 %131
+ %133 = OpISub %6 %132 %22
+ OpStore %129 %133
+ %135 = OpLoad %6 %117
+ %137 = OpLoad %6 %108
+ %138 = OpIMul %6 %136 %137
+ %139 = OpIAdd %6 %135 %138
+ %140 = OpISub %6 %139 %22
+ %141 = OpLoad %6 %106
+ %142 = OpExtInst %6 %1 SMin %140 %141
+ OpStore %134 %142
+ %144 = OpLoad %6 %127
+ OpStore %143 %144
+ %146 = OpLoad %6 %129
+ OpStore %145 %146
+ %148 = OpLoad %6 %134
+ OpStore %147 %148
+ %149 = OpFunctionCall %2 %12 %143 %145 %147
+ OpBranch %122
+ %122 = OpLabel
+ %150 = OpLoad %6 %108
+ %151 = OpIMul %6 %136 %150
+ %152 = OpLoad %6 %117
+ %153 = OpIAdd %6 %152 %151
+ OpStore %117 %153
+ OpBranch %119
+ %121 = OpLabel
+ OpBranch %112
+ %112 = OpLabel
+ %154 = OpLoad %6 %108
+ %155 = OpIMul %6 %136 %154
+ OpStore %108 %155
+ OpBranch %109
+ %111 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# injectionSwitch
+BUFFER reference_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 648
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "merge(i1;i1;i1;"
+ OpName %9 "from"
+ OpName %10 "mid"
+ OpName %11 "to"
+ OpName %14 "mergeSort("
+ OpName %16 "k"
+ OpName %18 "i"
+ OpName %20 "j"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %87 "i"
+ OpName %104 "low"
+ OpName %106 "high"
+ OpName %108 "m"
+ OpName %117 "i"
+ OpName %127 "from"
+ OpName %129 "mid"
+ OpName %134 "to"
+ OpName %143 "param"
+ OpName %145 "param"
+ OpName %147 "param"
+ OpName %156 "i"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %225 "j"
+ OpName %243 "gl_FragCoord"
+ OpName %254 "grey"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7 %7
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %40 = OpTypePointer Private %39
+ %41 = OpVariable %40 Private
+ %43 = OpTypePointer Private %6
+ %52 = OpVariable %40 Private
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %253 = OpTypePointer Function %157
+ %255 = OpConstant %157 0.5
+ %259 = OpConstant %157 10
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %371 = OpTypeVector %157 3
+ %373 = OpConstant %157 1
+ %484 = OpConstant %6 0
+ %573 = OpConstantTrue %31
+ %574 = OpConstantFalse %31
+ %575 = OpConstant %157 0
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %156 = OpVariable %7 Function
+ %225 = OpVariable %7 Function
+ %254 = OpVariable %253 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpStore %156 %166
+ OpBranch %167
+ %167 = OpLabel
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %171 = OpLoad %6 %156
+ OpSelectionMerge %182 None
+ OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %183 = OpLoad %6 %156
+ %185 = OpAccessChain %43 %41 %183
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %187 = OpLoad %6 %156
+ %189 = OpAccessChain %43 %41 %187
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %191 = OpLoad %6 %156
+ %192 = OpAccessChain %43 %41 %191
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %194 = OpLoad %6 %156
+ %195 = OpAccessChain %43 %41 %194
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %197 = OpLoad %6 %156
+ %198 = OpAccessChain %43 %41 %197
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %200 = OpLoad %6 %156
+ %202 = OpAccessChain %43 %41 %200
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %204 = OpLoad %6 %156
+ %206 = OpAccessChain %43 %41 %204
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %208 = OpLoad %6 %156
+ %210 = OpAccessChain %43 %41 %208
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %212 = OpLoad %6 %156
+ %214 = OpAccessChain %43 %41 %212
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %216 = OpLoad %6 %156
+ %218 = OpAccessChain %43 %41 %216
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %221 = OpLoad %6 %156
+ %222 = OpIAdd %6 %221 %22
+ OpStore %156 %222
+ OpBranch %170
+ %170 = OpLabel
+ %223 = OpLoad %6 %156
+ %224 = OpSLessThan %31 %223 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpStore %225 %105
+ OpBranch %226
+ %226 = OpLabel
+ OpLoopMerge %228 %229 None
+ OpBranch %230
+ %230 = OpLabel
+ %231 = OpLoad %6 %225
+ %232 = OpSLessThan %31 %231 %74
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %233 = OpLoad %6 %225
+ %234 = OpLoad %6 %225
+ %235 = OpAccessChain %43 %41 %234
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %43 %52 %233
+ OpStore %237 %236
+ OpBranch %229
+ %229 = OpLabel
+ %238 = OpLoad %6 %225
+ %239 = OpIAdd %6 %238 %22
+ OpStore %225 %239
+ OpBranch %226
+ %228 = OpLabel
+ %240 = OpFunctionCall %2 %14
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %43 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFDiv %157 %258 %259
+ %261 = OpFAdd %157 %255 %260
+ OpStore %254 %261
+ OpBranch %252
+ %262 = OpLabel
+ %263 = OpAccessChain %245 %243 %244
+ %264 = OpLoad %157 %263
+ %265 = OpConvertFToS %6 %264
+ %267 = OpSLessThan %31 %265 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %43 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFDiv %157 %272 %259
+ %274 = OpFAdd %157 %255 %273
+ OpStore %254 %274
+ OpBranch %269
+ %275 = OpLabel
+ %276 = OpAccessChain %245 %243 %244
+ %277 = OpLoad %157 %276
+ %278 = OpConvertFToS %6 %277
+ %280 = OpSLessThan %31 %278 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %43 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFDiv %157 %285 %259
+ %287 = OpFAdd %157 %255 %286
+ OpStore %254 %287
+ OpBranch %282
+ %288 = OpLabel
+ %289 = OpAccessChain %245 %243 %244
+ %290 = OpLoad %157 %289
+ %291 = OpConvertFToS %6 %290
+ %293 = OpSLessThan %31 %291 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %43 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFDiv %157 %298 %259
+ %300 = OpFAdd %157 %255 %299
+ OpStore %254 %300
+ OpBranch %295
+ %301 = OpLabel
+ %302 = OpAccessChain %245 %243 %244
+ %303 = OpLoad %157 %302
+ %304 = OpConvertFToS %6 %303
+ %306 = OpSLessThan %31 %304 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %311 = OpAccessChain %245 %243 %244
+ %312 = OpLoad %157 %311
+ %313 = OpConvertFToS %6 %312
+ %315 = OpSLessThan %31 %313 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %43 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFDiv %157 %321 %259
+ %323 = OpFAdd %157 %255 %322
+ OpStore %254 %323
+ OpBranch %317
+ %324 = OpLabel
+ %325 = OpAccessChain %245 %243 %244
+ %326 = OpLoad %157 %325
+ %327 = OpConvertFToS %6 %326
+ %329 = OpSLessThan %31 %327 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %43 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFDiv %157 %335 %259
+ %337 = OpFAdd %157 %255 %336
+ OpStore %254 %337
+ OpBranch %331
+ %338 = OpLabel
+ %339 = OpAccessChain %245 %243 %244
+ %340 = OpLoad %157 %339
+ %341 = OpConvertFToS %6 %340
+ %343 = OpSLessThan %31 %341 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %43 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFDiv %157 %349 %259
+ %351 = OpFAdd %157 %255 %350
+ OpStore %254 %351
+ OpBranch %345
+ %352 = OpLabel
+ %353 = OpAccessChain %245 %243 %244
+ %354 = OpLoad %157 %353
+ %355 = OpConvertFToS %6 %354
+ %357 = OpSLessThan %31 %355 %356
+ OpSelectionMerge %359 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %43 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFDiv %157 %363 %259
+ %365 = OpFAdd %157 %255 %364
+ OpStore %254 %365
+ OpBranch %359
+ %366 = OpLabel
+ OpKill
+ %359 = OpLabel
+ OpBranch %345
+ %345 = OpLabel
+ OpBranch %331
+ %331 = OpLabel
+ OpBranch %317
+ %317 = OpLabel
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ OpBranch %282
+ %282 = OpLabel
+ OpBranch %269
+ %269 = OpLabel
+ OpBranch %252
+ %252 = OpLabel
+ %370 = OpLoad %157 %254
+ %372 = OpCompositeConstruct %371 %370 %370 %370
+ %374 = OpCompositeExtract %157 %372 0
+ %375 = OpCompositeExtract %157 %372 1
+ %376 = OpCompositeExtract %157 %372 2
+ %377 = OpCompositeConstruct %241 %374 %375 %376 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %16 = OpVariable %7 Function
+ %18 = OpVariable %7 Function
+ %20 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %17 = OpLoad %6 %9
+ OpStore %16 %17
+ %19 = OpLoad %6 %9
+ OpStore %18 %19
+ %21 = OpLoad %6 %10
+ %23 = OpIAdd %6 %21 %22
+ OpStore %20 %23
+ OpBranch %24
+ %24 = OpLabel
+ %646 = OpAccessChain %163 %161 %105 %105
+ %647 = OpLoad %157 %646
+ %643 = OpFOrdGreaterThanEqual %31 %373 %647
+ OpLoopMerge %26 %27 None
+ OpBranchConditional %643 %28 %27
+ %28 = OpLabel
+ %29 = OpLoad %6 %18
+ %30 = OpLoad %6 %10
+ %32 = OpSLessThanEqual %31 %29 %30
+ %33 = OpLoad %6 %20
+ %34 = OpLoad %6 %11
+ %35 = OpSLessThanEqual %31 %33 %34
+ %36 = OpLogicalAnd %31 %32 %35
+ OpBranchConditional %36 %25 %26
+ %25 = OpLabel
+ %42 = OpLoad %6 %18
+ %44 = OpAccessChain %43 %41 %42
+ %45 = OpLoad %6 %44
+ %46 = OpLoad %6 %20
+ %47 = OpAccessChain %43 %41 %46
+ %48 = OpLoad %6 %47
+ %49 = OpSLessThan %31 %45 %48
+ OpBranch %50
+ %50 = OpLabel
+ OpSelectionMerge %479 None
+ OpBranchConditional %49 %480 %482
+ %480 = OpLabel
+ %481 = OpLoad %6 %16
+ OpBranch %479
+ %482 = OpLabel
+ %483 = OpCopyObject %6 %484
+ OpBranch %479
+ %479 = OpLabel
+ %53 = OpPhi %6 %481 %480 %483 %482
+ %54 = OpIAdd %6 %53 %22
+ OpBranch %486
+ %486 = OpLabel
+ OpSelectionMerge %536 None
+ OpBranchConditional %49 %537 %536
+ %537 = OpLabel
+ OpStore %16 %54
+ %622 = OpAccessChain %163 %161 %105 %105
+ %623 = OpLoad %157 %622
+ %621 = OpFUnordGreaterThan %31 %373 %623
+ OpBranchConditional %621 %536 %27
+ %536 = OpLabel
+ OpBranch %485
+ %485 = OpLabel
+ %595 = OpAccessChain %163 %161 %105 %22
+ %596 = OpLoad %157 %595
+ %594 = OpFOrdGreaterThanEqual %31 %596 %575
+ OpBranchConditional %594 %490 %27
+ %490 = OpLabel
+ %491 = OpCopyObject %6 %484
+ OpBranch %488
+ %488 = OpLabel
+ OpSelectionMerge %538 None
+ OpBranchConditional %49 %539 %541
+ %539 = OpLabel
+ %540 = OpLoad %6 %18
+ OpBranch %538
+ %541 = OpLabel
+ %542 = OpCopyObject %6 %484
+ OpBranch %538
+ %538 = OpLabel
+ %489 = OpPhi %6 %540 %539 %542 %541
+ OpBranch %487
+ %487 = OpLabel
+ %55 = OpSelect %6 %49 %489 %491
+ %56 = OpIAdd %6 %55 %22
+ OpSelectionMerge %492 None
+ OpBranchConditional %49 %493 %492
+ %493 = OpLabel
+ OpStore %18 %56
+ OpBranch %492
+ %492 = OpLabel
+ %57 = OpAccessChain %43 %41 %55
+ OpBranch %497
+ %497 = OpLabel
+ %498 = OpCopyObject %6 %484
+ OpBranch %495
+ %495 = OpLabel
+ OpSelectionMerge %545 None
+ OpBranchConditional %49 %546 %548
+ %546 = OpLabel
+ %547 = OpLoad %6 %57
+ %598 = OpAccessChain %163 %161 %105 %22
+ %599 = OpLoad %157 %598
+ %597 = OpFUnordGreaterThan %31 %575 %599
+ OpBranchConditional %597 %27 %545
+ %548 = OpLabel
+ %549 = OpCopyObject %6 %484
+ %619 = OpAccessChain %163 %161 %105 %22
+ %620 = OpLoad %157 %619
+ %618 = OpFUnordGreaterThanEqual %31 %620 %575
+ OpBranchConditional %618 %545 %27
+ %545 = OpLabel
+ %496 = OpPhi %6 %547 %546 %549 %548
+ OpBranch %494
+ %494 = OpLabel
+ %58 = OpSelect %6 %49 %496 %498
+ %59 = OpAccessChain %43 %52 %53
+ OpSelectionMerge %499 None
+ OpBranchConditional %49 %500 %499
+ %500 = OpLabel
+ OpStore %59 %58
+ OpBranch %499
+ %499 = OpLabel
+ OpBranch %60
+ %60 = OpLabel
+ OpSelectionMerge %501 None
+ OpBranchConditional %49 %504 %502
+ %502 = OpLabel
+ %503 = OpLoad %6 %16
+ OpBranch %501
+ %504 = OpLabel
+ %505 = OpCopyObject %6 %484
+ OpBranch %501
+ %501 = OpLabel
+ %61 = OpPhi %6 %503 %502 %505 %504
+ %62 = OpIAdd %6 %61 %22
+ OpSelectionMerge %506 None
+ OpBranchConditional %49 %506 %507
+ %507 = OpLabel
+ OpStore %16 %62
+ OpBranch %506
+ %506 = OpLabel
+ %602 = OpAccessChain %163 %161 %105 %105
+ %603 = OpLoad %157 %602
+ %601 = OpFUnordGreaterThan %31 %373 %603
+ OpBranchConditional %601 %509 %27
+ %509 = OpLabel
+ OpSelectionMerge %559 None
+ OpBranchConditional %49 %562 %560
+ %560 = OpLabel
+ %561 = OpLoad %6 %20
+ OpBranch %559
+ %562 = OpLabel
+ %563 = OpCopyObject %6 %484
+ OpBranch %559
+ %559 = OpLabel
+ %510 = OpPhi %6 %561 %560 %563 %562
+ OpBranch %511
+ %511 = OpLabel
+ %512 = OpCopyObject %6 %484
+ OpBranch %508
+ %508 = OpLabel
+ %63 = OpSelect %6 %49 %512 %510
+ %64 = OpIAdd %6 %63 %22
+ OpSelectionMerge %513 None
+ OpBranchConditional %49 %513 %514
+ %514 = OpLabel
+ OpStore %20 %64
+ OpBranch %513
+ %513 = OpLabel
+ %65 = OpAccessChain %43 %41 %63
+ OpSelectionMerge %515 None
+ OpBranchConditional %49 %518 %516
+ %516 = OpLabel
+ %517 = OpLoad %6 %65
+ OpBranch %515
+ %518 = OpLabel
+ %519 = OpCopyObject %6 %484
+ OpBranch %515
+ %515 = OpLabel
+ %66 = OpPhi %6 %517 %516 %519 %518
+ %67 = OpAccessChain %43 %52 %61
+ OpSelectionMerge %520 None
+ OpBranchConditional %49 %520 %521
+ %521 = OpLabel
+ OpStore %67 %66
+ OpBranch %520
+ %520 = OpLabel
+ OpBranch %51
+ %51 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %72
+ %72 = OpLabel
+ %73 = OpLoad %6 %18
+ %75 = OpSLessThan %31 %73 %74
+ %76 = OpLoad %6 %18
+ %77 = OpLoad %6 %10
+ %78 = OpSLessThanEqual %31 %76 %77
+ %79 = OpLogicalAnd %31 %75 %78
+ OpBranchConditional %79 %69 %70
+ %69 = OpLabel
+ %80 = OpLoad %6 %16
+ %81 = OpIAdd %6 %80 %22
+ OpStore %16 %81
+ %82 = OpLoad %6 %18
+ %83 = OpIAdd %6 %82 %22
+ OpStore %18 %83
+ %84 = OpAccessChain %43 %41 %82
+ %85 = OpLoad %6 %84
+ %86 = OpAccessChain %43 %52 %80
+ OpStore %86 %85
+ OpBranch %71
+ %71 = OpLabel
+ OpBranch %68
+ %70 = OpLabel
+ %88 = OpLoad %6 %9
+ OpStore %87 %88
+ OpBranch %89
+ %89 = OpLabel
+ OpLoopMerge %91 %92 None
+ OpBranch %93
+ %93 = OpLabel
+ %94 = OpLoad %6 %87
+ %95 = OpLoad %6 %11
+ %96 = OpSLessThanEqual %31 %94 %95
+ OpBranchConditional %96 %90 %91
+ %90 = OpLabel
+ %97 = OpLoad %6 %87
+ %98 = OpLoad %6 %87
+ %99 = OpAccessChain %43 %52 %98
+ %100 = OpLoad %6 %99
+ %101 = OpAccessChain %43 %41 %97
+ OpStore %101 %100
+ OpBranch %92
+ %92 = OpLabel
+ %102 = OpLoad %6 %87
+ %103 = OpIAdd %6 %102 %22
+ OpStore %87 %103
+ OpBranch %89
+ %91 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %14 = OpFunction %2 None %3
+ %15 = OpLabel
+ %104 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %108 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %127 = OpVariable %7 Function
+ %129 = OpVariable %7 Function
+ %134 = OpVariable %7 Function
+ %143 = OpVariable %7 Function
+ %145 = OpVariable %7 Function
+ %147 = OpVariable %7 Function
+ OpStore %104 %105
+ OpStore %106 %107
+ OpStore %108 %22
+ OpBranch %109
+ %109 = OpLabel
+ OpLoopMerge %111 %112 None
+ OpBranch %113
+ %113 = OpLabel
+ %114 = OpLoad %6 %108
+ %115 = OpLoad %6 %106
+ %116 = OpSLessThanEqual %31 %114 %115
+ OpBranchConditional %116 %110 %111
+ %110 = OpLabel
+ %118 = OpLoad %6 %104
+ OpStore %117 %118
+ OpBranch %119
+ %119 = OpLabel
+ OpLoopMerge %121 %122 None
+ OpBranch %123
+ %123 = OpLabel
+ %124 = OpLoad %6 %117
+ %125 = OpLoad %6 %106
+ %126 = OpSLessThan %31 %124 %125
+ OpBranchConditional %126 %120 %121
+ %120 = OpLabel
+ %128 = OpLoad %6 %117
+ OpStore %127 %128
+ %130 = OpLoad %6 %117
+ %131 = OpLoad %6 %108
+ %132 = OpIAdd %6 %130 %131
+ %133 = OpISub %6 %132 %22
+ OpStore %129 %133
+ %135 = OpLoad %6 %117
+ %137 = OpLoad %6 %108
+ %138 = OpIMul %6 %136 %137
+ %139 = OpIAdd %6 %135 %138
+ %140 = OpISub %6 %139 %22
+ %141 = OpLoad %6 %106
+ %142 = OpExtInst %6 %1 SMin %140 %141
+ OpStore %134 %142
+ %144 = OpLoad %6 %127
+ OpStore %143 %144
+ %146 = OpLoad %6 %129
+ OpStore %145 %146
+ %148 = OpLoad %6 %134
+ OpStore %147 %148
+ %149 = OpFunctionCall %2 %12 %143 %145 %147
+ OpBranch %122
+ %122 = OpLabel
+ %150 = OpLoad %6 %108
+ %151 = OpIMul %6 %136 %150
+ %152 = OpLoad %6 %117
+ %153 = OpIAdd %6 %152 %151
+ OpStore %117 %153
+ OpBranch %119
+ %121 = OpLabel
+ OpBranch %112
+ %112 = OpLabel
+ %154 = OpLoad %6 %108
+ %155 = OpIMul %6 %136 %154
+ OpStore %108 %155
+ OpBranch %109
+ %111 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# injectionSwitch
+BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 644
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "merge(i1;i1;i1;"
+ OpName %9 "from"
+ OpName %10 "mid"
+ OpName %11 "to"
+ OpName %14 "mergeSort("
+ OpName %16 "k"
+ OpName %18 "i"
+ OpName %20 "j"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %87 "i"
+ OpName %104 "low"
+ OpName %106 "high"
+ OpName %108 "m"
+ OpName %117 "i"
+ OpName %127 "from"
+ OpName %129 "mid"
+ OpName %134 "to"
+ OpName %143 "param"
+ OpName %145 "param"
+ OpName %147 "param"
+ OpName %156 "i"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %225 "j"
+ OpName %243 "gl_FragCoord"
+ OpName %254 "grey"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7 %7
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %40 = OpTypePointer Private %39
+ %41 = OpVariable %40 Private
+ %43 = OpTypePointer Private %6
+ %52 = OpVariable %40 Private
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %253 = OpTypePointer Function %157
+ %255 = OpConstant %157 0.5
+ %259 = OpConstant %157 10
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %371 = OpTypeVector %157 3
+ %373 = OpConstant %157 1
+ %484 = OpConstant %6 0
+ %573 = OpConstantTrue %31
+ %574 = OpConstantFalse %31
+ %575 = OpConstant %157 0
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %156 = OpVariable %7 Function
+ %225 = OpVariable %7 Function
+ %254 = OpVariable %253 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpStore %156 %166
+ OpBranch %167
+ %167 = OpLabel
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %171 = OpLoad %6 %156
+ OpSelectionMerge %182 None
+ OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %183 = OpLoad %6 %156
+ %185 = OpAccessChain %43 %41 %183
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %187 = OpLoad %6 %156
+ %189 = OpAccessChain %43 %41 %187
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %191 = OpLoad %6 %156
+ %192 = OpAccessChain %43 %41 %191
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %194 = OpLoad %6 %156
+ %195 = OpAccessChain %43 %41 %194
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %197 = OpLoad %6 %156
+ %198 = OpAccessChain %43 %41 %197
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %200 = OpLoad %6 %156
+ %202 = OpAccessChain %43 %41 %200
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %204 = OpLoad %6 %156
+ %206 = OpAccessChain %43 %41 %204
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %208 = OpLoad %6 %156
+ %210 = OpAccessChain %43 %41 %208
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %212 = OpLoad %6 %156
+ %214 = OpAccessChain %43 %41 %212
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %216 = OpLoad %6 %156
+ %218 = OpAccessChain %43 %41 %216
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %221 = OpLoad %6 %156
+ %222 = OpIAdd %6 %221 %22
+ OpStore %156 %222
+ OpBranch %170
+ %170 = OpLabel
+ %223 = OpLoad %6 %156
+ %224 = OpSLessThan %31 %223 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpStore %225 %105
+ OpBranch %226
+ %226 = OpLabel
+ OpLoopMerge %228 %229 None
+ OpBranch %230
+ %230 = OpLabel
+ %231 = OpLoad %6 %225
+ %232 = OpSLessThan %31 %231 %74
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %233 = OpLoad %6 %225
+ %234 = OpLoad %6 %225
+ %235 = OpAccessChain %43 %41 %234
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %43 %52 %233
+ OpStore %237 %236
+ OpBranch %229
+ %229 = OpLabel
+ %238 = OpLoad %6 %225
+ %239 = OpIAdd %6 %238 %22
+ OpStore %225 %239
+ OpBranch %226
+ %228 = OpLabel
+ %240 = OpFunctionCall %2 %14
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %43 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFDiv %157 %258 %259
+ %261 = OpFAdd %157 %255 %260
+ OpStore %254 %261
+ OpBranch %252
+ %262 = OpLabel
+ %263 = OpAccessChain %245 %243 %244
+ %264 = OpLoad %157 %263
+ %265 = OpConvertFToS %6 %264
+ %267 = OpSLessThan %31 %265 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %43 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFDiv %157 %272 %259
+ %274 = OpFAdd %157 %255 %273
+ OpStore %254 %274
+ OpBranch %269
+ %275 = OpLabel
+ %276 = OpAccessChain %245 %243 %244
+ %277 = OpLoad %157 %276
+ %278 = OpConvertFToS %6 %277
+ %280 = OpSLessThan %31 %278 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %43 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFDiv %157 %285 %259
+ %287 = OpFAdd %157 %255 %286
+ OpStore %254 %287
+ OpBranch %282
+ %288 = OpLabel
+ %289 = OpAccessChain %245 %243 %244
+ %290 = OpLoad %157 %289
+ %291 = OpConvertFToS %6 %290
+ %293 = OpSLessThan %31 %291 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %43 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFDiv %157 %298 %259
+ %300 = OpFAdd %157 %255 %299
+ OpStore %254 %300
+ OpBranch %295
+ %301 = OpLabel
+ %302 = OpAccessChain %245 %243 %244
+ %303 = OpLoad %157 %302
+ %304 = OpConvertFToS %6 %303
+ %306 = OpSLessThan %31 %304 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %311 = OpAccessChain %245 %243 %244
+ %312 = OpLoad %157 %311
+ %313 = OpConvertFToS %6 %312
+ %315 = OpSLessThan %31 %313 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %43 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFDiv %157 %321 %259
+ %323 = OpFAdd %157 %255 %322
+ OpStore %254 %323
+ OpBranch %317
+ %324 = OpLabel
+ %325 = OpAccessChain %245 %243 %244
+ %326 = OpLoad %157 %325
+ %327 = OpConvertFToS %6 %326
+ %329 = OpSLessThan %31 %327 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %43 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFDiv %157 %335 %259
+ %337 = OpFAdd %157 %255 %336
+ OpStore %254 %337
+ OpBranch %331
+ %338 = OpLabel
+ %339 = OpAccessChain %245 %243 %244
+ %340 = OpLoad %157 %339
+ %341 = OpConvertFToS %6 %340
+ %343 = OpSLessThan %31 %341 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %43 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFDiv %157 %349 %259
+ %351 = OpFAdd %157 %255 %350
+ OpStore %254 %351
+ OpBranch %345
+ %352 = OpLabel
+ %353 = OpAccessChain %245 %243 %244
+ %354 = OpLoad %157 %353
+ %355 = OpConvertFToS %6 %354
+ %357 = OpSLessThan %31 %355 %356
+ OpSelectionMerge %359 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %43 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFDiv %157 %363 %259
+ %365 = OpFAdd %157 %255 %364
+ OpStore %254 %365
+ OpBranch %359
+ %366 = OpLabel
+ OpKill
+ %359 = OpLabel
+ OpBranch %345
+ %345 = OpLabel
+ OpBranch %331
+ %331 = OpLabel
+ OpBranch %317
+ %317 = OpLabel
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ OpBranch %282
+ %282 = OpLabel
+ OpBranch %269
+ %269 = OpLabel
+ OpBranch %252
+ %252 = OpLabel
+ %370 = OpLoad %157 %254
+ %372 = OpCompositeConstruct %371 %370 %370 %370
+ %374 = OpCompositeExtract %157 %372 0
+ %375 = OpCompositeExtract %157 %372 1
+ %376 = OpCompositeExtract %157 %372 2
+ %377 = OpCompositeConstruct %241 %374 %375 %376 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %16 = OpVariable %7 Function
+ %18 = OpVariable %7 Function
+ %20 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %17 = OpLoad %6 %9
+ OpStore %16 %17
+ %19 = OpLoad %6 %9
+ OpStore %18 %19
+ %21 = OpLoad %6 %10
+ %23 = OpIAdd %6 %21 %22
+ OpStore %20 %23
+ OpBranch %24
+ %24 = OpLabel
+ %643 = OpFOrdGreaterThanEqual %31 %373 %575
+ OpLoopMerge %26 %27 None
+ OpBranchConditional %643 %28 %27
+ %28 = OpLabel
+ %29 = OpLoad %6 %18
+ %30 = OpLoad %6 %10
+ %32 = OpSLessThanEqual %31 %29 %30
+ %33 = OpLoad %6 %20
+ %34 = OpLoad %6 %11
+ %35 = OpSLessThanEqual %31 %33 %34
+ %36 = OpLogicalAnd %31 %32 %35
+ OpBranchConditional %36 %25 %26
+ %25 = OpLabel
+ %42 = OpLoad %6 %18
+ %44 = OpAccessChain %43 %41 %42
+ %45 = OpLoad %6 %44
+ %46 = OpLoad %6 %20
+ %47 = OpAccessChain %43 %41 %46
+ %48 = OpLoad %6 %47
+ %49 = OpSLessThan %31 %45 %48
+ OpBranch %50
+ %50 = OpLabel
+ OpSelectionMerge %479 None
+ OpBranchConditional %49 %480 %482
+ %480 = OpLabel
+ %481 = OpLoad %6 %16
+ OpBranch %479
+ %482 = OpLabel
+ %483 = OpCopyObject %6 %484
+ OpBranch %479
+ %479 = OpLabel
+ %53 = OpPhi %6 %481 %480 %483 %482
+ %54 = OpIAdd %6 %53 %22
+ OpBranch %486
+ %486 = OpLabel
+ OpSelectionMerge %536 None
+ OpBranchConditional %49 %537 %536
+ %537 = OpLabel
+ OpStore %16 %54
+ %622 = OpAccessChain %163 %161 %105 %105
+ %623 = OpLoad %157 %622
+ %621 = OpFUnordGreaterThan %31 %373 %623
+ OpBranchConditional %621 %536 %27
+ %536 = OpLabel
+ OpBranch %485
+ %485 = OpLabel
+ %595 = OpAccessChain %163 %161 %105 %22
+ %596 = OpLoad %157 %595
+ %594 = OpFOrdGreaterThanEqual %31 %596 %575
+ OpBranchConditional %594 %490 %27
+ %490 = OpLabel
+ %491 = OpCopyObject %6 %484
+ OpBranch %488
+ %488 = OpLabel
+ OpSelectionMerge %538 None
+ OpBranchConditional %49 %539 %541
+ %539 = OpLabel
+ %540 = OpLoad %6 %18
+ OpBranch %538
+ %541 = OpLabel
+ %542 = OpCopyObject %6 %484
+ OpBranch %538
+ %538 = OpLabel
+ %489 = OpPhi %6 %540 %539 %542 %541
+ OpBranch %487
+ %487 = OpLabel
+ %55 = OpSelect %6 %49 %489 %491
+ %56 = OpIAdd %6 %55 %22
+ OpSelectionMerge %492 None
+ OpBranchConditional %49 %493 %492
+ %493 = OpLabel
+ OpStore %18 %56
+ OpBranch %492
+ %492 = OpLabel
+ %57 = OpAccessChain %43 %41 %55
+ OpBranch %497
+ %497 = OpLabel
+ %498 = OpCopyObject %6 %484
+ OpBranch %495
+ %495 = OpLabel
+ OpSelectionMerge %545 None
+ OpBranchConditional %49 %546 %548
+ %546 = OpLabel
+ %547 = OpLoad %6 %57
+ %598 = OpAccessChain %163 %161 %105 %22
+ %599 = OpLoad %157 %598
+ %597 = OpFUnordGreaterThan %31 %575 %599
+ OpBranchConditional %597 %27 %545
+ %548 = OpLabel
+ %549 = OpCopyObject %6 %484
+ %619 = OpAccessChain %163 %161 %105 %22
+ %620 = OpLoad %157 %619
+ %618 = OpFUnordGreaterThanEqual %31 %620 %575
+ OpBranchConditional %618 %545 %27
+ %545 = OpLabel
+ %496 = OpPhi %6 %547 %546 %549 %548
+ OpBranch %494
+ %494 = OpLabel
+ %58 = OpSelect %6 %49 %496 %498
+ %59 = OpAccessChain %43 %52 %53
+ OpSelectionMerge %499 None
+ OpBranchConditional %49 %500 %499
+ %500 = OpLabel
+ OpStore %59 %58
+ OpBranch %499
+ %499 = OpLabel
+ OpBranch %60
+ %60 = OpLabel
+ OpSelectionMerge %501 None
+ OpBranchConditional %49 %504 %502
+ %502 = OpLabel
+ %503 = OpLoad %6 %16
+ OpBranch %501
+ %504 = OpLabel
+ %505 = OpCopyObject %6 %484
+ OpBranch %501
+ %501 = OpLabel
+ %61 = OpPhi %6 %503 %502 %505 %504
+ %62 = OpIAdd %6 %61 %22
+ OpSelectionMerge %506 None
+ OpBranchConditional %49 %506 %507
+ %507 = OpLabel
+ OpStore %16 %62
+ OpBranch %506
+ %506 = OpLabel
+ %602 = OpAccessChain %163 %161 %105 %105
+ %603 = OpLoad %157 %602
+ %601 = OpFUnordGreaterThan %31 %373 %603
+ OpBranchConditional %601 %509 %27
+ %509 = OpLabel
+ OpSelectionMerge %559 None
+ OpBranchConditional %49 %562 %560
+ %560 = OpLabel
+ %561 = OpLoad %6 %20
+ OpBranch %559
+ %562 = OpLabel
+ %563 = OpCopyObject %6 %484
+ OpBranch %559
+ %559 = OpLabel
+ %510 = OpPhi %6 %561 %560 %563 %562
+ OpBranch %511
+ %511 = OpLabel
+ %512 = OpCopyObject %6 %484
+ OpBranch %508
+ %508 = OpLabel
+ %63 = OpSelect %6 %49 %512 %510
+ %64 = OpIAdd %6 %63 %22
+ OpSelectionMerge %513 None
+ OpBranchConditional %49 %513 %514
+ %514 = OpLabel
+ OpStore %20 %64
+ OpBranch %513
+ %513 = OpLabel
+ %65 = OpAccessChain %43 %41 %63
+ OpSelectionMerge %515 None
+ OpBranchConditional %49 %518 %516
+ %516 = OpLabel
+ %517 = OpLoad %6 %65
+ OpBranch %515
+ %518 = OpLabel
+ %519 = OpCopyObject %6 %484
+ OpBranch %515
+ %515 = OpLabel
+ %66 = OpPhi %6 %517 %516 %519 %518
+ %67 = OpAccessChain %43 %52 %61
+ OpSelectionMerge %520 None
+ OpBranchConditional %49 %520 %521
+ %521 = OpLabel
+ OpStore %67 %66
+ OpBranch %520
+ %520 = OpLabel
+ OpBranch %51
+ %51 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %72
+ %72 = OpLabel
+ %73 = OpLoad %6 %18
+ %75 = OpSLessThan %31 %73 %74
+ %76 = OpLoad %6 %18
+ %77 = OpLoad %6 %10
+ %78 = OpSLessThanEqual %31 %76 %77
+ %79 = OpLogicalAnd %31 %75 %78
+ OpBranchConditional %79 %69 %70
+ %69 = OpLabel
+ %80 = OpLoad %6 %16
+ %81 = OpIAdd %6 %80 %22
+ OpStore %16 %81
+ %82 = OpLoad %6 %18
+ %83 = OpIAdd %6 %82 %22
+ OpStore %18 %83
+ %84 = OpAccessChain %43 %41 %82
+ %85 = OpLoad %6 %84
+ %86 = OpAccessChain %43 %52 %80
+ OpStore %86 %85
+ OpBranch %71
+ %71 = OpLabel
+ OpBranch %68
+ %70 = OpLabel
+ %88 = OpLoad %6 %9
+ OpStore %87 %88
+ OpBranch %89
+ %89 = OpLabel
+ OpLoopMerge %91 %92 None
+ OpBranch %93
+ %93 = OpLabel
+ %94 = OpLoad %6 %87
+ %95 = OpLoad %6 %11
+ %96 = OpSLessThanEqual %31 %94 %95
+ OpBranchConditional %96 %90 %91
+ %90 = OpLabel
+ %97 = OpLoad %6 %87
+ %98 = OpLoad %6 %87
+ %99 = OpAccessChain %43 %52 %98
+ %100 = OpLoad %6 %99
+ %101 = OpAccessChain %43 %41 %97
+ OpStore %101 %100
+ OpBranch %92
+ %92 = OpLabel
+ %102 = OpLoad %6 %87
+ %103 = OpIAdd %6 %102 %22
+ OpStore %87 %103
+ OpBranch %89
+ %91 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %14 = OpFunction %2 None %3
+ %15 = OpLabel
+ %104 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %108 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %127 = OpVariable %7 Function
+ %129 = OpVariable %7 Function
+ %134 = OpVariable %7 Function
+ %143 = OpVariable %7 Function
+ %145 = OpVariable %7 Function
+ %147 = OpVariable %7 Function
+ OpStore %104 %105
+ OpStore %106 %107
+ OpStore %108 %22
+ OpBranch %109
+ %109 = OpLabel
+ OpLoopMerge %111 %112 None
+ OpBranch %113
+ %113 = OpLabel
+ %114 = OpLoad %6 %108
+ %115 = OpLoad %6 %106
+ %116 = OpSLessThanEqual %31 %114 %115
+ OpBranchConditional %116 %110 %111
+ %110 = OpLabel
+ %118 = OpLoad %6 %104
+ OpStore %117 %118
+ OpBranch %119
+ %119 = OpLabel
+ OpLoopMerge %121 %122 None
+ OpBranch %123
+ %123 = OpLabel
+ %124 = OpLoad %6 %117
+ %125 = OpLoad %6 %106
+ %126 = OpSLessThan %31 %124 %125
+ OpBranchConditional %126 %120 %121
+ %120 = OpLabel
+ %128 = OpLoad %6 %117
+ OpStore %127 %128
+ %130 = OpLoad %6 %117
+ %131 = OpLoad %6 %108
+ %132 = OpIAdd %6 %130 %131
+ %133 = OpISub %6 %132 %22
+ OpStore %129 %133
+ %135 = OpLoad %6 %117
+ %137 = OpLoad %6 %108
+ %138 = OpIMul %6 %136 %137
+ %139 = OpIAdd %6 %135 %138
+ %140 = OpISub %6 %139 %22
+ %141 = OpLoad %6 %106
+ %142 = OpExtInst %6 %1 SMin %140 %141
+ OpStore %134 %142
+ %144 = OpLoad %6 %127
+ OpStore %143 %144
+ %146 = OpLoad %6 %129
+ OpStore %145 %146
+ %148 = OpLoad %6 %134
+ OpStore %147 %148
+ %149 = OpFunctionCall %2 %12 %143 %145 %147
+ OpBranch %122
+ %122 = OpLabel
+ %150 = OpLoad %6 %108
+ %151 = OpIMul %6 %136 %150
+ %152 = OpLoad %6 %117
+ %153 = OpIAdd %6 %152 %151
+ OpStore %117 %153
+ OpBranch %119
+ %121 = OpLabel
+ OpBranch %112
+ %112 = OpLabel
+ %154 = OpLoad %6 %108
+ %155 = OpIMul %6 %136 %154
+ OpStore %108 %155
+ OpBranch %109
+ %111 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# injectionSwitch
+BUFFER variant_2_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders diff: mutated var
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 378
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "merge(i1;i1;i1;"
+ OpName %9 "from"
+ OpName %10 "mid"
+ OpName %11 "to"
+ OpName %14 "mergeSort("
+ OpName %16 "k"
+ OpName %18 "i"
+ OpName %20 "j"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %87 "i"
+ OpName %104 "low"
+ OpName %106 "high"
+ OpName %108 "m"
+ OpName %117 "i"
+ OpName %127 "from"
+ OpName %129 "mid"
+ OpName %134 "to"
+ OpName %143 "param"
+ OpName %145 "param"
+ OpName %147 "param"
+ OpName %156 "i"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %225 "j"
+ OpName %243 "gl_FragCoord"
+ OpName %254 "grey"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7 %7
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %40 = OpTypePointer Private %39
+ %41 = OpVariable %40 Private
+ %43 = OpTypePointer Private %6
+ %52 = OpVariable %40 Private
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %253 = OpTypePointer Function %157
+ %255 = OpConstant %157 0.5
+ %259 = OpConstant %157 10
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %371 = OpTypeVector %157 3
+ %373 = OpConstant %157 1
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %156 = OpVariable %7 Function
+ %225 = OpVariable %7 Function
+ %254 = OpVariable %253 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpStore %156 %166
+ OpBranch %167
+ %167 = OpLabel
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %171 = OpLoad %6 %156
+ OpSelectionMerge %182 None
+ OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %183 = OpLoad %6 %156
+ %185 = OpAccessChain %43 %41 %183
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %187 = OpLoad %6 %156
+ %189 = OpAccessChain %43 %41 %187
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %191 = OpLoad %6 %156
+ %192 = OpAccessChain %43 %41 %191
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %194 = OpLoad %6 %156
+ %195 = OpAccessChain %43 %41 %194
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %197 = OpLoad %6 %156
+ %198 = OpAccessChain %43 %41 %197
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %200 = OpLoad %6 %156
+ %202 = OpAccessChain %43 %41 %200
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %204 = OpLoad %6 %156
+ %206 = OpAccessChain %43 %41 %204
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %208 = OpLoad %6 %156
+ %210 = OpAccessChain %43 %41 %208
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %212 = OpLoad %6 %156
+ %214 = OpAccessChain %43 %41 %212
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %216 = OpLoad %6 %156
+ %218 = OpAccessChain %43 %41 %216
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %221 = OpLoad %6 %156
+ %222 = OpIAdd %6 %221 %22
+ OpStore %156 %222
+ OpBranch %170
+ %170 = OpLabel
+ %223 = OpLoad %6 %156
+ %224 = OpSLessThan %31 %223 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpStore %225 %105
+ OpBranch %226
+ %226 = OpLabel
+ OpLoopMerge %228 %229 None
+ OpBranch %230
+ %230 = OpLabel
+ %231 = OpLoad %6 %225
+ %232 = OpSLessThan %31 %231 %74
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %233 = OpLoad %6 %225
+ %234 = OpLoad %6 %225
+ %235 = OpAccessChain %43 %41 %234
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %43 %52 %233
+ OpStore %237 %236
+ OpBranch %229
+ %229 = OpLabel
+ %238 = OpLoad %6 %225
+ %239 = OpIAdd %6 %238 %22
+ OpStore %225 %239
+ OpBranch %226
+ %228 = OpLabel
+ %240 = OpFunctionCall %2 %14
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %43 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFDiv %157 %258 %259
+ %261 = OpFAdd %157 %255 %260
+ OpStore %254 %261
+ OpBranch %252
+ %262 = OpLabel
+ %263 = OpAccessChain %245 %243 %244
+ %264 = OpLoad %157 %263
+ %265 = OpConvertFToS %6 %264
+ %267 = OpSLessThan %31 %265 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %43 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFDiv %157 %272 %259
+ %274 = OpFAdd %157 %255 %273
+ OpStore %254 %274
+ OpBranch %269
+ %275 = OpLabel
+ %276 = OpAccessChain %245 %243 %244
+ %277 = OpLoad %157 %276
+ %278 = OpConvertFToS %6 %277
+ %280 = OpSLessThan %31 %278 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %43 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFDiv %157 %285 %259
+ %287 = OpFAdd %157 %255 %286
+ OpStore %254 %287
+ OpBranch %282
+ %288 = OpLabel
+ %289 = OpAccessChain %245 %243 %244
+ %290 = OpLoad %157 %289
+ %291 = OpConvertFToS %6 %290
+ %293 = OpSLessThan %31 %291 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %43 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFDiv %157 %298 %259
+ %300 = OpFAdd %157 %255 %299
+ OpStore %254 %300
+ OpBranch %295
+ %301 = OpLabel
+ %302 = OpAccessChain %245 %243 %244
+ %303 = OpLoad %157 %302
+ %304 = OpConvertFToS %6 %303
+ %306 = OpSLessThan %31 %304 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %311 = OpAccessChain %245 %243 %244
+ %312 = OpLoad %157 %311
+ %313 = OpConvertFToS %6 %312
+ %315 = OpSLessThan %31 %313 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %43 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFDiv %157 %321 %259
+ %323 = OpFAdd %157 %255 %322
+ OpStore %254 %323
+ OpBranch %317
+ %324 = OpLabel
+ %325 = OpAccessChain %245 %243 %244
+ %326 = OpLoad %157 %325
+ %327 = OpConvertFToS %6 %326
+ %329 = OpSLessThan %31 %327 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %43 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFDiv %157 %335 %259
+ %337 = OpFAdd %157 %255 %336
+ OpStore %254 %337
+ OpBranch %331
+ %338 = OpLabel
+ %339 = OpAccessChain %245 %243 %244
+ %340 = OpLoad %157 %339
+ %341 = OpConvertFToS %6 %340
+ %343 = OpSLessThan %31 %341 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %43 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFDiv %157 %349 %259
+ %351 = OpFAdd %157 %255 %350
+ OpStore %254 %351
+ OpBranch %345
+ %352 = OpLabel
+ %353 = OpAccessChain %245 %243 %244
+ %354 = OpLoad %157 %353
+ %355 = OpConvertFToS %6 %354
+ %357 = OpSLessThan %31 %355 %356
+ OpSelectionMerge %359 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %43 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFDiv %157 %363 %259
+ %365 = OpFAdd %157 %255 %364
+ OpStore %254 %365
+ OpBranch %359
+ %366 = OpLabel
+ OpKill
+ %359 = OpLabel
+ OpBranch %345
+ %345 = OpLabel
+ OpBranch %331
+ %331 = OpLabel
+ OpBranch %317
+ %317 = OpLabel
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ OpBranch %282
+ %282 = OpLabel
+ OpBranch %269
+ %269 = OpLabel
+ OpBranch %252
+ %252 = OpLabel
+ %370 = OpLoad %157 %254
+ %372 = OpCompositeConstruct %371 %370 %370 %370
+ %374 = OpCompositeExtract %157 %372 0
+ %375 = OpCompositeExtract %157 %372 1
+ %376 = OpCompositeExtract %157 %372 2
+ %377 = OpCompositeConstruct %241 %374 %375 %376 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %16 = OpVariable %7 Function
+ %18 = OpVariable %7 Function
+ %20 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %17 = OpLoad %6 %9
+ OpStore %16 %17
+ %19 = OpLoad %6 %9
+ OpStore %18 %19
+ %21 = OpLoad %6 %10
+ %23 = OpIAdd %6 %21 %22
+ OpStore %20 %23
+ OpBranch %24
+ %24 = OpLabel
+ OpLoopMerge %26 %27 None
+ OpBranch %28
+ %28 = OpLabel
+ %29 = OpLoad %6 %18
+ %30 = OpLoad %6 %10
+ %32 = OpSLessThanEqual %31 %29 %30
+ %33 = OpLoad %6 %20
+ %34 = OpLoad %6 %11
+ %35 = OpSLessThanEqual %31 %33 %34
+ %36 = OpLogicalAnd %31 %32 %35
+ OpBranchConditional %36 %25 %26
+ %25 = OpLabel
+ %42 = OpLoad %6 %18
+ %44 = OpAccessChain %43 %41 %42
+ %45 = OpLoad %6 %44
+ %46 = OpLoad %6 %20
+ %47 = OpAccessChain %43 %41 %46
+ %48 = OpLoad %6 %47
+ %49 = OpSLessThan %31 %45 %48
+ OpSelectionMerge %51 None
+ OpBranchConditional %49 %50 %60
+ %50 = OpLabel
+ %53 = OpLoad %6 %16
+ %54 = OpIAdd %6 %53 %22
+ OpStore %16 %54
+ %55 = OpLoad %6 %18
+ %56 = OpIAdd %6 %55 %22
+ OpStore %18 %56
+ %57 = OpAccessChain %43 %41 %55
+ %58 = OpLoad %6 %57
+ %59 = OpAccessChain %43 %52 %53
+ OpStore %59 %58
+ OpBranch %51
+ %60 = OpLabel
+ %61 = OpLoad %6 %16
+ %62 = OpIAdd %6 %61 %22
+ OpStore %16 %62
+ %63 = OpLoad %6 %20
+ %64 = OpIAdd %6 %63 %22
+ OpStore %20 %64
+ %65 = OpAccessChain %43 %41 %63
+ %66 = OpLoad %6 %65
+ %67 = OpAccessChain %43 %52 %61
+ OpStore %67 %66
+ OpBranch %51
+ %51 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %72
+ %72 = OpLabel
+ %73 = OpLoad %6 %18
+ %75 = OpSLessThan %31 %73 %74
+ %76 = OpLoad %6 %18
+ %77 = OpLoad %6 %10
+ %78 = OpSLessThanEqual %31 %76 %77
+ %79 = OpLogicalAnd %31 %75 %78
+ OpBranchConditional %79 %69 %70
+ %69 = OpLabel
+ %80 = OpLoad %6 %16
+ %81 = OpIAdd %6 %80 %22
+ OpStore %16 %81
+ %82 = OpLoad %6 %18
+ %83 = OpIAdd %6 %82 %22
+ OpStore %18 %83
+ %84 = OpAccessChain %43 %41 %82
+ %85 = OpLoad %6 %84
+ %86 = OpAccessChain %43 %52 %80
+ OpStore %86 %85
+ OpBranch %71
+ %71 = OpLabel
+ OpBranch %68
+ %70 = OpLabel
+ %88 = OpLoad %6 %9
+ OpStore %87 %88
+ OpBranch %89
+ %89 = OpLabel
+ OpLoopMerge %91 %92 None
+ OpBranch %93
+ %93 = OpLabel
+ %94 = OpLoad %6 %87
+ %95 = OpLoad %6 %11
+ %96 = OpSLessThanEqual %31 %94 %95
+ OpBranchConditional %96 %90 %91
+ %90 = OpLabel
+ %97 = OpLoad %6 %87
+ %98 = OpLoad %6 %87
+ %99 = OpAccessChain %43 %52 %98
+ %100 = OpLoad %6 %99
+ %101 = OpAccessChain %43 %41 %97
+ OpStore %101 %100
+ OpBranch %92
+ %92 = OpLabel
+ %102 = OpLoad %6 %87
+ %103 = OpIAdd %6 %102 %22
+ OpStore %87 %103
+ OpBranch %89
+ %91 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %14 = OpFunction %2 None %3
+ %15 = OpLabel
+ %104 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %108 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %127 = OpVariable %7 Function
+ %129 = OpVariable %7 Function
+ %134 = OpVariable %7 Function
+ %143 = OpVariable %7 Function
+ %145 = OpVariable %7 Function
+ %147 = OpVariable %7 Function
+ OpStore %104 %105
+ OpStore %106 %107
+ OpStore %108 %22
+ OpBranch %109
+ %109 = OpLabel
+ OpLoopMerge %111 %112 None
+ OpBranch %113
+ %113 = OpLabel
+ %114 = OpLoad %6 %108
+ %115 = OpLoad %6 %106
+ %116 = OpSLessThanEqual %31 %114 %115
+ OpBranchConditional %116 %110 %111
+ %110 = OpLabel
+ %118 = OpLoad %6 %104
+ OpStore %117 %118
+ OpBranch %119
+ %119 = OpLabel
+ OpLoopMerge %121 %122 None
+ OpBranch %123
+ %123 = OpLabel
+ %124 = OpLoad %6 %117
+ %125 = OpLoad %6 %106
+ %126 = OpSLessThan %31 %124 %125
+ OpBranchConditional %126 %120 %121
+ %120 = OpLabel
+ %128 = OpLoad %6 %117
+ OpStore %127 %128
+ %130 = OpLoad %6 %117
+ %131 = OpLoad %6 %108
+ %132 = OpIAdd %6 %130 %131
+ %133 = OpISub %6 %132 %22
+ OpStore %129 %133
+ %135 = OpLoad %6 %117
+ %137 = OpLoad %6 %108
+ %138 = OpIMul %6 %136 %137
+ %139 = OpIAdd %6 %135 %138
+ %140 = OpISub %6 %139 %22
+ %141 = OpLoad %6 %106
+ %142 = OpExtInst %6 %1 SMin %140 %141
+ OpStore %134 %142
+ %144 = OpLoad %6 %127
+ OpStore %143 %144
+ %146 = OpLoad %6 %129
+ OpStore %145 %146
+ %148 = OpLoad %6 %134
+ OpStore %147 %148
+ %149 = OpFunctionCall %2 %12 %143 %145 %147
+ OpBranch %122
+ %122 = OpLabel
+ %150 = OpLoad %6 %108
+ %151 = OpIMul %6 %136 %150
+ %152 = OpLoad %6 %117
+ %153 = OpIAdd %6 %152 %151
+ OpStore %117 %153
+ OpBranch %119
+ %121 = OpLabel
+ OpBranch %112
+ %112 = OpLabel
+ %154 = OpLoad %6 %108
+ %155 = OpIMul %6 %136 %154
+ OpStore %108 %155
+ OpBranch %109
+ %111 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# injectionSwitch
+BUFFER reference_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 679
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "merge(i1;i1;i1;"
+ OpName %9 "from"
+ OpName %10 "mid"
+ OpName %11 "to"
+ OpName %14 "mergeSort("
+ OpName %16 "k"
+ OpName %18 "i"
+ OpName %20 "j"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %87 "i"
+ OpName %104 "low"
+ OpName %106 "high"
+ OpName %108 "m"
+ OpName %117 "i"
+ OpName %127 "from"
+ OpName %129 "mid"
+ OpName %134 "to"
+ OpName %143 "param"
+ OpName %145 "param"
+ OpName %147 "param"
+ OpName %156 "i"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %225 "j"
+ OpName %243 "gl_FragCoord"
+ OpName %254 "grey"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7 %7
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %40 = OpTypePointer Private %39
+ %41 = OpVariable %40 Private
+ %43 = OpTypePointer Private %6
+ %52 = OpVariable %40 Private
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %253 = OpTypePointer Function %157
+ %255 = OpConstant %157 0.5
+ %259 = OpConstant %157 10
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %371 = OpTypeVector %157 3
+ %373 = OpConstant %157 1
+ %637 = OpConstant %6 0
+ %638 = OpConstantComposite %39 %637 %637 %637 %637 %637 %637 %637 %637 %637 %637
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %488 = OpVariable %7 Function
+ %487 = OpVariable %7 Function
+ %486 = OpVariable %7 Function
+ %485 = OpVariable %7 Function
+ %484 = OpVariable %7 Function
+ %483 = OpVariable %7 Function
+ %482 = OpVariable %7 Function
+ %481 = OpVariable %7 Function
+ %480 = OpVariable %7 Function
+ %479 = OpVariable %7 Function
+ %156 = OpVariable %7 Function
+ %225 = OpVariable %7 Function
+ %254 = OpVariable %253 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpStore %156 %166
+ OpBranch %167
+ %167 = OpLabel
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %171 = OpLoad %6 %156
+ OpSelectionMerge %182 None
+ OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %183 = OpLoad %6 %156
+ %185 = OpAccessChain %43 %41 %183
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %187 = OpLoad %6 %156
+ %189 = OpAccessChain %43 %41 %187
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %191 = OpLoad %6 %156
+ %192 = OpAccessChain %43 %41 %191
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %194 = OpLoad %6 %156
+ %195 = OpAccessChain %43 %41 %194
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %197 = OpLoad %6 %156
+ %198 = OpAccessChain %43 %41 %197
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %200 = OpLoad %6 %156
+ %202 = OpAccessChain %43 %41 %200
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %204 = OpLoad %6 %156
+ %206 = OpAccessChain %43 %41 %204
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %208 = OpLoad %6 %156
+ %210 = OpAccessChain %43 %41 %208
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %212 = OpLoad %6 %156
+ %214 = OpAccessChain %43 %41 %212
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %216 = OpLoad %6 %156
+ %218 = OpAccessChain %43 %41 %216
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %221 = OpLoad %6 %156
+ %222 = OpIAdd %6 %221 %22
+ OpStore %156 %222
+ OpBranch %170
+ %170 = OpLabel
+ %223 = OpLoad %6 %156
+ %224 = OpSLessThan %31 %223 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpStore %225 %105
+ OpBranch %226
+ %226 = OpLabel
+ OpLoopMerge %228 %229 None
+ OpBranch %230
+ %230 = OpLabel
+ %231 = OpLoad %6 %225
+ %232 = OpSLessThan %31 %231 %74
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %233 = OpLoad %6 %225
+ %234 = OpLoad %6 %225
+ %235 = OpAccessChain %43 %41 %234
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %43 %52 %233
+ OpStore %237 %236
+ OpBranch %229
+ %229 = OpLabel
+ %238 = OpLoad %6 %225
+ %239 = OpIAdd %6 %238 %22
+ OpStore %225 %239
+ OpBranch %226
+ %228 = OpLabel
+ OpStore %479 %105
+ OpStore %480 %107
+ OpStore %481 %22
+ OpBranch %489
+ %489 = OpLabel
+ OpLoopMerge %527 %524 None
+ OpBranch %490
+ %490 = OpLabel
+ %491 = OpLoad %6 %481
+ %492 = OpLoad %6 %480
+ %493 = OpSLessThanEqual %31 %491 %492
+ OpBranchConditional %493 %494 %527
+ %494 = OpLabel
+ %495 = OpLoad %6 %479
+ OpStore %482 %495
+ OpBranch %496
+ %496 = OpLabel
+ OpLoopMerge %523 %518 None
+ OpBranch %497
+ %497 = OpLabel
+ %498 = OpLoad %6 %482
+ %499 = OpLoad %6 %480
+ %500 = OpSLessThan %31 %498 %499
+ OpBranchConditional %500 %501 %523
+ %501 = OpLabel
+ %502 = OpLoad %6 %482
+ OpStore %483 %502
+ %503 = OpLoad %6 %482
+ %504 = OpLoad %6 %481
+ %505 = OpIAdd %6 %503 %504
+ %678 = OpLoad %39 %41
+ OpStore %41 %638
+ OpStore %41 %678
+ %506 = OpISub %6 %505 %22
+ OpStore %484 %506
+ %507 = OpLoad %6 %482
+ %508 = OpLoad %6 %481
+ %509 = OpIMul %6 %136 %508
+ %510 = OpIAdd %6 %507 %509
+ %511 = OpISub %6 %510 %22
+ %512 = OpLoad %6 %480
+ %513 = OpExtInst %6 %1 SMin %511 %512
+ OpStore %485 %513
+ %514 = OpLoad %6 %483
+ OpStore %486 %514
+ %515 = OpLoad %6 %484
+ OpStore %487 %515
+ %516 = OpLoad %6 %485
+ OpStore %488 %516
+ %517 = OpFunctionCall %2 %12 %486 %487 %488
+ OpBranch %518
+ %518 = OpLabel
+ %519 = OpLoad %6 %481
+ %520 = OpIMul %6 %136 %519
+ %521 = OpLoad %6 %482
+ %522 = OpIAdd %6 %521 %520
+ OpStore %482 %522
+ OpBranch %496
+ %523 = OpLabel
+ OpBranch %524
+ %524 = OpLabel
+ %525 = OpLoad %6 %481
+ %526 = OpIMul %6 %136 %525
+ OpStore %481 %526
+ OpBranch %489
+ %527 = OpLabel
+ OpBranch %478
+ %478 = OpLabel
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %43 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFDiv %157 %258 %259
+ %261 = OpFAdd %157 %255 %260
+ OpStore %254 %261
+ OpBranch %252
+ %262 = OpLabel
+ %263 = OpAccessChain %245 %243 %244
+ %264 = OpLoad %157 %263
+ %265 = OpConvertFToS %6 %264
+ %267 = OpSLessThan %31 %265 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %43 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFDiv %157 %272 %259
+ %274 = OpFAdd %157 %255 %273
+ OpStore %254 %274
+ OpBranch %269
+ %275 = OpLabel
+ %276 = OpAccessChain %245 %243 %244
+ %277 = OpLoad %157 %276
+ %278 = OpConvertFToS %6 %277
+ %280 = OpSLessThan %31 %278 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %43 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFDiv %157 %285 %259
+ %287 = OpFAdd %157 %255 %286
+ OpStore %254 %287
+ OpBranch %282
+ %288 = OpLabel
+ %289 = OpAccessChain %245 %243 %244
+ %290 = OpLoad %157 %289
+ %291 = OpConvertFToS %6 %290
+ %293 = OpSLessThan %31 %291 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %43 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFDiv %157 %298 %259
+ %300 = OpFAdd %157 %255 %299
+ OpStore %254 %300
+ OpBranch %295
+ %301 = OpLabel
+ %302 = OpAccessChain %245 %243 %244
+ %303 = OpLoad %157 %302
+ %304 = OpConvertFToS %6 %303
+ %306 = OpSLessThan %31 %304 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %311 = OpAccessChain %245 %243 %244
+ %312 = OpLoad %157 %311
+ %313 = OpConvertFToS %6 %312
+ %315 = OpSLessThan %31 %313 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %43 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFDiv %157 %321 %259
+ %323 = OpFAdd %157 %255 %322
+ OpStore %254 %323
+ OpBranch %317
+ %324 = OpLabel
+ %325 = OpAccessChain %245 %243 %244
+ %326 = OpLoad %157 %325
+ %327 = OpConvertFToS %6 %326
+ %329 = OpSLessThan %31 %327 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %43 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFDiv %157 %335 %259
+ %337 = OpFAdd %157 %255 %336
+ OpStore %254 %337
+ OpBranch %331
+ %338 = OpLabel
+ %339 = OpAccessChain %245 %243 %244
+ %340 = OpLoad %157 %339
+ %341 = OpConvertFToS %6 %340
+ %343 = OpSLessThan %31 %341 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %43 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFDiv %157 %349 %259
+ %351 = OpFAdd %157 %255 %350
+ OpStore %254 %351
+ OpBranch %345
+ %352 = OpLabel
+ %353 = OpAccessChain %245 %243 %244
+ %354 = OpLoad %157 %353
+ %355 = OpConvertFToS %6 %354
+ %357 = OpSLessThan %31 %355 %356
+ OpSelectionMerge %359 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %43 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFDiv %157 %363 %259
+ %365 = OpFAdd %157 %255 %364
+ OpStore %254 %365
+ OpBranch %359
+ %366 = OpLabel
+ OpKill
+ %359 = OpLabel
+ OpBranch %345
+ %345 = OpLabel
+ OpBranch %331
+ %331 = OpLabel
+ OpBranch %317
+ %317 = OpLabel
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ OpBranch %282
+ %282 = OpLabel
+ OpBranch %269
+ %269 = OpLabel
+ OpBranch %252
+ %252 = OpLabel
+ %370 = OpLoad %157 %254
+ %372 = OpCompositeConstruct %371 %370 %370 %370
+ %374 = OpCompositeExtract %157 %372 0
+ %375 = OpCompositeExtract %157 %372 1
+ %376 = OpCompositeExtract %157 %372 2
+ %377 = OpCompositeConstruct %241 %374 %375 %376 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %16 = OpVariable %7 Function
+ %18 = OpVariable %7 Function
+ %20 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %17 = OpLoad %6 %9
+ OpStore %16 %17
+ %19 = OpLoad %6 %9
+ OpStore %18 %19
+ %21 = OpLoad %6 %10
+ %23 = OpIAdd %6 %21 %22
+ OpStore %20 %23
+ OpBranch %24
+ %24 = OpLabel
+ OpLoopMerge %26 %27 None
+ OpBranch %28
+ %28 = OpLabel
+ %29 = OpLoad %6 %18
+ %30 = OpLoad %6 %10
+ %32 = OpSLessThanEqual %31 %29 %30
+ %33 = OpLoad %6 %20
+ %34 = OpLoad %6 %11
+ %35 = OpSLessThanEqual %31 %33 %34
+ %36 = OpLogicalAnd %31 %32 %35
+ OpBranchConditional %36 %25 %26
+ %25 = OpLabel
+ %42 = OpLoad %6 %18
+ %44 = OpAccessChain %43 %41 %42
+ %45 = OpLoad %6 %44
+ %46 = OpLoad %6 %20
+ %47 = OpAccessChain %43 %41 %46
+ %48 = OpLoad %6 %47
+ %49 = OpSLessThan %31 %45 %48
+ OpSelectionMerge %51 None
+ OpBranchConditional %49 %50 %60
+ %50 = OpLabel
+ %53 = OpLoad %6 %16
+ %54 = OpIAdd %6 %53 %22
+ OpStore %16 %54
+ %55 = OpLoad %6 %18
+ %56 = OpIAdd %6 %55 %22
+ OpStore %18 %56
+ %57 = OpAccessChain %43 %41 %55
+ %58 = OpLoad %6 %57
+ %59 = OpAccessChain %43 %52 %53
+ OpStore %59 %58
+ OpBranch %51
+ %60 = OpLabel
+ %61 = OpLoad %6 %16
+ %62 = OpIAdd %6 %61 %22
+ OpStore %16 %62
+ %63 = OpLoad %6 %20
+ %64 = OpIAdd %6 %63 %22
+ OpStore %20 %64
+ %65 = OpAccessChain %43 %41 %63
+ %66 = OpLoad %6 %65
+ %67 = OpAccessChain %43 %52 %61
+ OpStore %67 %66
+ OpBranch %51
+ %51 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %72
+ %72 = OpLabel
+ %73 = OpLoad %6 %18
+ %75 = OpSLessThan %31 %73 %74
+ %76 = OpLoad %6 %18
+ %77 = OpLoad %6 %10
+ %78 = OpSLessThanEqual %31 %76 %77
+ %79 = OpLogicalAnd %31 %75 %78
+ OpBranchConditional %79 %69 %70
+ %69 = OpLabel
+ %80 = OpLoad %6 %16
+ %81 = OpIAdd %6 %80 %22
+ OpStore %16 %81
+ %82 = OpLoad %6 %18
+ %83 = OpIAdd %6 %82 %22
+ OpStore %18 %83
+ %84 = OpAccessChain %43 %41 %82
+ %85 = OpLoad %6 %84
+ %86 = OpAccessChain %43 %52 %80
+ OpStore %86 %85
+ OpBranch %71
+ %71 = OpLabel
+ OpBranch %68
+ %70 = OpLabel
+ %88 = OpLoad %6 %9
+ OpStore %87 %88
+ OpBranch %89
+ %89 = OpLabel
+ OpLoopMerge %91 %92 None
+ OpBranch %93
+ %93 = OpLabel
+ %94 = OpLoad %6 %87
+ %95 = OpLoad %6 %11
+ %96 = OpSLessThanEqual %31 %94 %95
+ OpBranchConditional %96 %90 %91
+ %90 = OpLabel
+ %97 = OpLoad %6 %87
+ %98 = OpLoad %6 %87
+ %99 = OpAccessChain %43 %52 %98
+ %100 = OpLoad %6 %99
+ %101 = OpAccessChain %43 %41 %97
+ OpStore %101 %100
+ OpBranch %92
+ %92 = OpLabel
+ %102 = OpLoad %6 %87
+ %103 = OpIAdd %6 %102 %22
+ OpStore %87 %103
+ OpBranch %89
+ %91 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %14 = OpFunction %2 None %3
+ %15 = OpLabel
+ %104 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %108 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %127 = OpVariable %7 Function
+ %129 = OpVariable %7 Function
+ %134 = OpVariable %7 Function
+ %143 = OpVariable %7 Function
+ %145 = OpVariable %7 Function
+ %147 = OpVariable %7 Function
+ OpStore %104 %105
+ OpStore %106 %107
+ OpStore %108 %22
+ OpBranch %109
+ %109 = OpLabel
+ OpLoopMerge %111 %112 None
+ OpBranch %113
+ %113 = OpLabel
+ %114 = OpLoad %6 %108
+ %115 = OpLoad %6 %106
+ %116 = OpSLessThanEqual %31 %114 %115
+ OpBranchConditional %116 %110 %111
+ %110 = OpLabel
+ %118 = OpLoad %6 %104
+ OpStore %117 %118
+ OpBranch %119
+ %119 = OpLabel
+ OpLoopMerge %121 %122 None
+ OpBranch %123
+ %123 = OpLabel
+ %124 = OpLoad %6 %117
+ %125 = OpLoad %6 %106
+ %126 = OpSLessThan %31 %124 %125
+ OpBranchConditional %126 %120 %121
+ %120 = OpLabel
+ %128 = OpLoad %6 %117
+ OpStore %127 %128
+ %130 = OpLoad %6 %117
+ %131 = OpLoad %6 %108
+ %132 = OpIAdd %6 %130 %131
+ %133 = OpISub %6 %132 %22
+ OpStore %129 %133
+ %135 = OpLoad %6 %117
+ %137 = OpLoad %6 %108
+ %138 = OpIMul %6 %136 %137
+ %139 = OpIAdd %6 %135 %138
+ %140 = OpISub %6 %139 %22
+ %141 = OpLoad %6 %106
+ %142 = OpExtInst %6 %1 SMin %140 %141
+ OpStore %134 %142
+ %144 = OpLoad %6 %127
+ OpStore %143 %144
+ %146 = OpLoad %6 %129
+ OpStore %145 %146
+ %148 = OpLoad %6 %134
+ OpStore %147 %148
+ %149 = OpFunctionCall %2 %12 %143 %145 %147
+ OpBranch %122
+ %122 = OpLabel
+ %150 = OpLoad %6 %108
+ %151 = OpIMul %6 %136 %150
+ %152 = OpLoad %6 %117
+ %153 = OpIAdd %6 %152 %151
+ OpStore %117 %153
+ OpBranch %119
+ %121 = OpLabel
+ OpBranch %112
+ %112 = OpLabel
+ %154 = OpLoad %6 %108
+ %155 = OpIMul %6 %136 %154
+ OpStore %108 %155
+ OpBranch %109
+ %111 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# injectionSwitch
+BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 639
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %243 %369
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "merge(i1;i1;i1;"
+ OpName %9 "from"
+ OpName %10 "mid"
+ OpName %11 "to"
+ OpName %14 "mergeSort("
+ OpName %16 "k"
+ OpName %18 "i"
+ OpName %20 "j"
+ OpName %41 "data"
+ OpName %52 "temp"
+ OpName %87 "i"
+ OpName %104 "low"
+ OpName %106 "high"
+ OpName %108 "m"
+ OpName %117 "i"
+ OpName %127 "from"
+ OpName %129 "mid"
+ OpName %134 "to"
+ OpName %143 "param"
+ OpName %145 "param"
+ OpName %147 "param"
+ OpName %156 "i"
+ OpName %159 "buf0"
+ OpMemberName %159 0 "injectionSwitch"
+ OpName %161 ""
+ OpName %225 "j"
+ OpName %243 "gl_FragCoord"
+ OpName %254 "grey"
+ OpName %369 "_GLF_color"
+ OpMemberDecorate %159 0 Offset 0
+ OpDecorate %159 Block
+ OpDecorate %161 DescriptorSet 0
+ OpDecorate %161 Binding 0
+ OpDecorate %243 BuiltIn FragCoord
+ OpDecorate %369 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7 %7
+ %22 = OpConstant %6 1
+ %31 = OpTypeBool
+ %37 = OpTypeInt 32 0
+ %38 = OpConstant %37 10
+ %39 = OpTypeArray %6 %38
+ %40 = OpTypePointer Private %39
+ %41 = OpVariable %40 Private
+ %43 = OpTypePointer Private %6
+ %52 = OpVariable %40 Private
+ %74 = OpConstant %6 10
+ %105 = OpConstant %6 0
+ %107 = OpConstant %6 9
+ %136 = OpConstant %6 2
+ %157 = OpTypeFloat 32
+ %158 = OpTypeVector %157 2
+ %159 = OpTypeStruct %158
+ %160 = OpTypePointer Uniform %159
+ %161 = OpVariable %160 Uniform
+ %162 = OpConstant %37 0
+ %163 = OpTypePointer Uniform %157
+ %184 = OpConstant %6 4
+ %188 = OpConstant %6 3
+ %201 = OpConstant %6 -1
+ %205 = OpConstant %6 -2
+ %209 = OpConstant %6 -3
+ %213 = OpConstant %6 -4
+ %217 = OpConstant %6 -5
+ %241 = OpTypeVector %157 4
+ %242 = OpTypePointer Input %241
+ %243 = OpVariable %242 Input
+ %244 = OpConstant %37 1
+ %245 = OpTypePointer Input %157
+ %249 = OpConstant %6 30
+ %253 = OpTypePointer Function %157
+ %255 = OpConstant %157 0.5
+ %259 = OpConstant %157 10
+ %266 = OpConstant %6 60
+ %279 = OpConstant %6 90
+ %292 = OpConstant %6 120
+ %305 = OpConstant %6 150
+ %314 = OpConstant %6 180
+ %318 = OpConstant %6 5
+ %328 = OpConstant %6 210
+ %332 = OpConstant %6 6
+ %342 = OpConstant %6 240
+ %346 = OpConstant %6 7
+ %356 = OpConstant %6 270
+ %360 = OpConstant %6 8
+ %368 = OpTypePointer Output %241
+ %369 = OpVariable %368 Output
+ %371 = OpTypeVector %157 3
+ %373 = OpConstant %157 1
+ %637 = OpConstant %6 0
+ %638 = OpConstantComposite %39 %637 %637 %637 %637 %637 %637 %637 %637 %637 %637
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %488 = OpVariable %7 Function
+ %487 = OpVariable %7 Function
+ %486 = OpVariable %7 Function
+ %485 = OpVariable %7 Function
+ %484 = OpVariable %7 Function
+ %483 = OpVariable %7 Function
+ %482 = OpVariable %7 Function
+ %481 = OpVariable %7 Function
+ %480 = OpVariable %7 Function
+ %479 = OpVariable %7 Function
+ %156 = OpVariable %7 Function
+ %225 = OpVariable %7 Function
+ %254 = OpVariable %253 Function
+ %164 = OpAccessChain %163 %161 %105 %162
+ %165 = OpLoad %157 %164
+ %166 = OpConvertFToS %6 %165
+ OpStore %156 %166
+ OpBranch %167
+ %167 = OpLabel
+ OpLoopMerge %169 %170 None
+ OpBranch %168
+ %168 = OpLabel
+ %171 = OpLoad %6 %156
+ OpSelectionMerge %182 None
+ OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181
+ %172 = OpLabel
+ %183 = OpLoad %6 %156
+ %185 = OpAccessChain %43 %41 %183
+ OpStore %185 %184
+ OpBranch %182
+ %173 = OpLabel
+ %187 = OpLoad %6 %156
+ %189 = OpAccessChain %43 %41 %187
+ OpStore %189 %188
+ OpBranch %182
+ %174 = OpLabel
+ %191 = OpLoad %6 %156
+ %192 = OpAccessChain %43 %41 %191
+ OpStore %192 %136
+ OpBranch %182
+ %175 = OpLabel
+ %194 = OpLoad %6 %156
+ %195 = OpAccessChain %43 %41 %194
+ OpStore %195 %22
+ OpBranch %182
+ %176 = OpLabel
+ %197 = OpLoad %6 %156
+ %198 = OpAccessChain %43 %41 %197
+ OpStore %198 %105
+ OpBranch %182
+ %177 = OpLabel
+ %200 = OpLoad %6 %156
+ %202 = OpAccessChain %43 %41 %200
+ OpStore %202 %201
+ OpBranch %182
+ %178 = OpLabel
+ %204 = OpLoad %6 %156
+ %206 = OpAccessChain %43 %41 %204
+ OpStore %206 %205
+ OpBranch %182
+ %179 = OpLabel
+ %208 = OpLoad %6 %156
+ %210 = OpAccessChain %43 %41 %208
+ OpStore %210 %209
+ OpBranch %182
+ %180 = OpLabel
+ %212 = OpLoad %6 %156
+ %214 = OpAccessChain %43 %41 %212
+ OpStore %214 %213
+ OpBranch %182
+ %181 = OpLabel
+ %216 = OpLoad %6 %156
+ %218 = OpAccessChain %43 %41 %216
+ OpStore %218 %217
+ OpBranch %182
+ %182 = OpLabel
+ %221 = OpLoad %6 %156
+ %222 = OpIAdd %6 %221 %22
+ OpStore %156 %222
+ OpBranch %170
+ %170 = OpLabel
+ %223 = OpLoad %6 %156
+ %224 = OpSLessThan %31 %223 %74
+ OpBranchConditional %224 %167 %169
+ %169 = OpLabel
+ OpStore %225 %105
+ OpBranch %226
+ %226 = OpLabel
+ OpLoopMerge %228 %229 None
+ OpBranch %230
+ %230 = OpLabel
+ %231 = OpLoad %6 %225
+ %232 = OpSLessThan %31 %231 %74
+ OpBranchConditional %232 %227 %228
+ %227 = OpLabel
+ %233 = OpLoad %6 %225
+ %234 = OpLoad %6 %225
+ %235 = OpAccessChain %43 %41 %234
+ %236 = OpLoad %6 %235
+ %237 = OpAccessChain %43 %52 %233
+ OpStore %237 %236
+ OpBranch %229
+ %229 = OpLabel
+ %238 = OpLoad %6 %225
+ %239 = OpIAdd %6 %238 %22
+ OpStore %225 %239
+ OpBranch %226
+ %228 = OpLabel
+ OpStore %479 %105
+ OpStore %480 %107
+ OpStore %481 %22
+ OpBranch %489
+ %489 = OpLabel
+ OpLoopMerge %527 %524 None
+ OpBranch %490
+ %490 = OpLabel
+ %491 = OpLoad %6 %481
+ %492 = OpLoad %6 %480
+ %493 = OpSLessThanEqual %31 %491 %492
+ OpBranchConditional %493 %494 %527
+ %494 = OpLabel
+ %495 = OpLoad %6 %479
+ OpStore %482 %495
+ OpBranch %496
+ %496 = OpLabel
+ OpLoopMerge %523 %518 None
+ OpBranch %497
+ %497 = OpLabel
+ %498 = OpLoad %6 %482
+ %499 = OpLoad %6 %480
+ %500 = OpSLessThan %31 %498 %499
+ OpBranchConditional %500 %501 %523
+ %501 = OpLabel
+ %502 = OpLoad %6 %482
+ OpStore %483 %502
+ %503 = OpLoad %6 %482
+ %504 = OpLoad %6 %481
+ %505 = OpIAdd %6 %503 %504
+ %506 = OpISub %6 %505 %22
+ OpStore %484 %506
+ %507 = OpLoad %6 %482
+ %508 = OpLoad %6 %481
+ %509 = OpIMul %6 %136 %508
+ %510 = OpIAdd %6 %507 %509
+ %511 = OpISub %6 %510 %22
+ %512 = OpLoad %6 %480
+ %513 = OpExtInst %6 %1 SMin %511 %512
+ OpStore %485 %513
+ %514 = OpLoad %6 %483
+ OpStore %486 %514
+ %515 = OpLoad %6 %484
+ OpStore %487 %515
+ %516 = OpLoad %6 %485
+ OpStore %488 %516
+ %517 = OpFunctionCall %2 %12 %486 %487 %488
+ OpBranch %518
+ %518 = OpLabel
+ %519 = OpLoad %6 %481
+ %520 = OpIMul %6 %136 %519
+ %521 = OpLoad %6 %482
+ %522 = OpIAdd %6 %521 %520
+ OpStore %482 %522
+ OpBranch %496
+ %523 = OpLabel
+ OpBranch %524
+ %524 = OpLabel
+ %525 = OpLoad %6 %481
+ %526 = OpIMul %6 %136 %525
+ OpStore %481 %526
+ OpBranch %489
+ %527 = OpLabel
+ OpBranch %478
+ %478 = OpLabel
+ %246 = OpAccessChain %245 %243 %244
+ %247 = OpLoad %157 %246
+ %248 = OpConvertFToS %6 %247
+ %250 = OpSLessThan %31 %248 %249
+ OpSelectionMerge %252 None
+ OpBranchConditional %250 %251 %262
+ %251 = OpLabel
+ %256 = OpAccessChain %43 %41 %105
+ %257 = OpLoad %6 %256
+ %258 = OpConvertSToF %157 %257
+ %260 = OpFDiv %157 %258 %259
+ %261 = OpFAdd %157 %255 %260
+ OpStore %254 %261
+ OpBranch %252
+ %262 = OpLabel
+ %263 = OpAccessChain %245 %243 %244
+ %264 = OpLoad %157 %263
+ %265 = OpConvertFToS %6 %264
+ %267 = OpSLessThan %31 %265 %266
+ OpSelectionMerge %269 None
+ OpBranchConditional %267 %268 %275
+ %268 = OpLabel
+ %270 = OpAccessChain %43 %41 %22
+ %271 = OpLoad %6 %270
+ %272 = OpConvertSToF %157 %271
+ %273 = OpFDiv %157 %272 %259
+ %274 = OpFAdd %157 %255 %273
+ OpStore %254 %274
+ OpBranch %269
+ %275 = OpLabel
+ %276 = OpAccessChain %245 %243 %244
+ %277 = OpLoad %157 %276
+ %278 = OpConvertFToS %6 %277
+ %280 = OpSLessThan %31 %278 %279
+ OpSelectionMerge %282 None
+ OpBranchConditional %280 %281 %288
+ %281 = OpLabel
+ %283 = OpAccessChain %43 %41 %136
+ %284 = OpLoad %6 %283
+ %285 = OpConvertSToF %157 %284
+ %286 = OpFDiv %157 %285 %259
+ %287 = OpFAdd %157 %255 %286
+ OpStore %254 %287
+ OpBranch %282
+ %288 = OpLabel
+ %289 = OpAccessChain %245 %243 %244
+ %290 = OpLoad %157 %289
+ %291 = OpConvertFToS %6 %290
+ %293 = OpSLessThan %31 %291 %292
+ OpSelectionMerge %295 None
+ OpBranchConditional %293 %294 %301
+ %294 = OpLabel
+ %296 = OpAccessChain %43 %41 %188
+ %297 = OpLoad %6 %296
+ %298 = OpConvertSToF %157 %297
+ %299 = OpFDiv %157 %298 %259
+ %300 = OpFAdd %157 %255 %299
+ OpStore %254 %300
+ OpBranch %295
+ %301 = OpLabel
+ %302 = OpAccessChain %245 %243 %244
+ %303 = OpLoad %157 %302
+ %304 = OpConvertFToS %6 %303
+ %306 = OpSLessThan %31 %304 %305
+ OpSelectionMerge %308 None
+ OpBranchConditional %306 %307 %310
+ %307 = OpLabel
+ OpKill
+ %310 = OpLabel
+ %311 = OpAccessChain %245 %243 %244
+ %312 = OpLoad %157 %311
+ %313 = OpConvertFToS %6 %312
+ %315 = OpSLessThan %31 %313 %314
+ OpSelectionMerge %317 None
+ OpBranchConditional %315 %316 %324
+ %316 = OpLabel
+ %319 = OpAccessChain %43 %41 %318
+ %320 = OpLoad %6 %319
+ %321 = OpConvertSToF %157 %320
+ %322 = OpFDiv %157 %321 %259
+ %323 = OpFAdd %157 %255 %322
+ OpStore %254 %323
+ OpBranch %317
+ %324 = OpLabel
+ %325 = OpAccessChain %245 %243 %244
+ %326 = OpLoad %157 %325
+ %327 = OpConvertFToS %6 %326
+ %329 = OpSLessThan %31 %327 %328
+ OpSelectionMerge %331 None
+ OpBranchConditional %329 %330 %338
+ %330 = OpLabel
+ %333 = OpAccessChain %43 %41 %332
+ %334 = OpLoad %6 %333
+ %335 = OpConvertSToF %157 %334
+ %336 = OpFDiv %157 %335 %259
+ %337 = OpFAdd %157 %255 %336
+ OpStore %254 %337
+ OpBranch %331
+ %338 = OpLabel
+ %339 = OpAccessChain %245 %243 %244
+ %340 = OpLoad %157 %339
+ %341 = OpConvertFToS %6 %340
+ %343 = OpSLessThan %31 %341 %342
+ OpSelectionMerge %345 None
+ OpBranchConditional %343 %344 %352
+ %344 = OpLabel
+ %347 = OpAccessChain %43 %41 %346
+ %348 = OpLoad %6 %347
+ %349 = OpConvertSToF %157 %348
+ %350 = OpFDiv %157 %349 %259
+ %351 = OpFAdd %157 %255 %350
+ OpStore %254 %351
+ OpBranch %345
+ %352 = OpLabel
+ %353 = OpAccessChain %245 %243 %244
+ %354 = OpLoad %157 %353
+ %355 = OpConvertFToS %6 %354
+ %357 = OpSLessThan %31 %355 %356
+ OpSelectionMerge %359 None
+ OpBranchConditional %357 %358 %366
+ %358 = OpLabel
+ %361 = OpAccessChain %43 %41 %360
+ %362 = OpLoad %6 %361
+ %363 = OpConvertSToF %157 %362
+ %364 = OpFDiv %157 %363 %259
+ %365 = OpFAdd %157 %255 %364
+ OpStore %254 %365
+ OpBranch %359
+ %366 = OpLabel
+ OpKill
+ %359 = OpLabel
+ OpBranch %345
+ %345 = OpLabel
+ OpBranch %331
+ %331 = OpLabel
+ OpBranch %317
+ %317 = OpLabel
+ OpBranch %308
+ %308 = OpLabel
+ OpBranch %295
+ %295 = OpLabel
+ OpBranch %282
+ %282 = OpLabel
+ OpBranch %269
+ %269 = OpLabel
+ OpBranch %252
+ %252 = OpLabel
+ %370 = OpLoad %157 %254
+ %372 = OpCompositeConstruct %371 %370 %370 %370
+ %374 = OpCompositeExtract %157 %372 0
+ %375 = OpCompositeExtract %157 %372 1
+ %376 = OpCompositeExtract %157 %372 2
+ %377 = OpCompositeConstruct %241 %374 %375 %376 %373
+ OpStore %369 %377
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %16 = OpVariable %7 Function
+ %18 = OpVariable %7 Function
+ %20 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %17 = OpLoad %6 %9
+ OpStore %16 %17
+ %19 = OpLoad %6 %9
+ OpStore %18 %19
+ %21 = OpLoad %6 %10
+ %23 = OpIAdd %6 %21 %22
+ OpStore %20 %23
+ OpBranch %24
+ %24 = OpLabel
+ OpLoopMerge %26 %27 None
+ OpBranch %28
+ %28 = OpLabel
+ %29 = OpLoad %6 %18
+ %30 = OpLoad %6 %10
+ %32 = OpSLessThanEqual %31 %29 %30
+ %33 = OpLoad %6 %20
+ %34 = OpLoad %6 %11
+ %35 = OpSLessThanEqual %31 %33 %34
+ %36 = OpLogicalAnd %31 %32 %35
+ OpBranchConditional %36 %25 %26
+ %25 = OpLabel
+ %42 = OpLoad %6 %18
+ %44 = OpAccessChain %43 %41 %42
+ %45 = OpLoad %6 %44
+ %46 = OpLoad %6 %20
+ %47 = OpAccessChain %43 %41 %46
+ %48 = OpLoad %6 %47
+ %49 = OpSLessThan %31 %45 %48
+ OpSelectionMerge %51 None
+ OpBranchConditional %49 %50 %60
+ %50 = OpLabel
+ %53 = OpLoad %6 %16
+ %54 = OpIAdd %6 %53 %22
+ OpStore %16 %54
+ %55 = OpLoad %6 %18
+ %56 = OpIAdd %6 %55 %22
+ OpStore %18 %56
+ %57 = OpAccessChain %43 %41 %55
+ %58 = OpLoad %6 %57
+ %59 = OpAccessChain %43 %52 %53
+ OpStore %59 %58
+ OpBranch %51
+ %60 = OpLabel
+ %61 = OpLoad %6 %16
+ %62 = OpIAdd %6 %61 %22
+ OpStore %16 %62
+ %63 = OpLoad %6 %20
+ %64 = OpIAdd %6 %63 %22
+ OpStore %20 %64
+ %65 = OpAccessChain %43 %41 %63
+ %66 = OpLoad %6 %65
+ %67 = OpAccessChain %43 %52 %61
+ OpStore %67 %66
+ OpBranch %51
+ %51 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ OpLoopMerge %70 %71 None
+ OpBranch %72
+ %72 = OpLabel
+ %73 = OpLoad %6 %18
+ %75 = OpSLessThan %31 %73 %74
+ %76 = OpLoad %6 %18
+ %77 = OpLoad %6 %10
+ %78 = OpSLessThanEqual %31 %76 %77
+ %79 = OpLogicalAnd %31 %75 %78
+ OpBranchConditional %79 %69 %70
+ %69 = OpLabel
+ %80 = OpLoad %6 %16
+ %81 = OpIAdd %6 %80 %22
+ OpStore %16 %81
+ %82 = OpLoad %6 %18
+ %83 = OpIAdd %6 %82 %22
+ OpStore %18 %83
+ %84 = OpAccessChain %43 %41 %82
+ %85 = OpLoad %6 %84
+ %86 = OpAccessChain %43 %52 %80
+ OpStore %86 %85
+ OpBranch %71
+ %71 = OpLabel
+ OpBranch %68
+ %70 = OpLabel
+ %88 = OpLoad %6 %9
+ OpStore %87 %88
+ OpBranch %89
+ %89 = OpLabel
+ OpLoopMerge %91 %92 None
+ OpBranch %93
+ %93 = OpLabel
+ %94 = OpLoad %6 %87
+ %95 = OpLoad %6 %11
+ %96 = OpSLessThanEqual %31 %94 %95
+ OpBranchConditional %96 %90 %91
+ %90 = OpLabel
+ %97 = OpLoad %6 %87
+ %98 = OpLoad %6 %87
+ %99 = OpAccessChain %43 %52 %98
+ %100 = OpLoad %6 %99
+ %101 = OpAccessChain %43 %41 %97
+ OpStore %101 %100
+ OpBranch %92
+ %92 = OpLabel
+ %102 = OpLoad %6 %87
+ %103 = OpIAdd %6 %102 %22
+ OpStore %87 %103
+ OpBranch %89
+ %91 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %14 = OpFunction %2 None %3
+ %15 = OpLabel
+ %104 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %108 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %127 = OpVariable %7 Function
+ %129 = OpVariable %7 Function
+ %134 = OpVariable %7 Function
+ %143 = OpVariable %7 Function
+ %145 = OpVariable %7 Function
+ %147 = OpVariable %7 Function
+ OpStore %104 %105
+ OpStore %106 %107
+ OpStore %108 %22
+ OpBranch %109
+ %109 = OpLabel
+ OpLoopMerge %111 %112 None
+ OpBranch %113
+ %113 = OpLabel
+ %114 = OpLoad %6 %108
+ %115 = OpLoad %6 %106
+ %116 = OpSLessThanEqual %31 %114 %115
+ OpBranchConditional %116 %110 %111
+ %110 = OpLabel
+ %118 = OpLoad %6 %104
+ OpStore %117 %118
+ OpBranch %119
+ %119 = OpLabel
+ OpLoopMerge %121 %122 None
+ OpBranch %123
+ %123 = OpLabel
+ %124 = OpLoad %6 %117
+ %125 = OpLoad %6 %106
+ %126 = OpSLessThan %31 %124 %125
+ OpBranchConditional %126 %120 %121
+ %120 = OpLabel
+ %128 = OpLoad %6 %117
+ OpStore %127 %128
+ %130 = OpLoad %6 %117
+ %131 = OpLoad %6 %108
+ %132 = OpIAdd %6 %130 %131
+ %133 = OpISub %6 %132 %22
+ OpStore %129 %133
+ %135 = OpLoad %6 %117
+ %137 = OpLoad %6 %108
+ %138 = OpIMul %6 %136 %137
+ %139 = OpIAdd %6 %135 %138
+ %140 = OpISub %6 %139 %22
+ %141 = OpLoad %6 %106
+ %142 = OpExtInst %6 %1 SMin %140 %141
+ OpStore %134 %142
+ %144 = OpLoad %6 %127
+ OpStore %143 %144
+ %146 = OpLoad %6 %129
+ OpStore %145 %146
+ %148 = OpLoad %6 %134
+ OpStore %147 %148
+ %149 = OpFunctionCall %2 %12 %143 %145 %147
+ OpBranch %122
+ %122 = OpLabel
+ %150 = OpLoad %6 %108
+ %151 = OpIMul %6 %136 %150
+ %152 = OpLoad %6 %117
+ %153 = OpIAdd %6 %152 %151
+ OpStore %117 %153
+ OpBranch %119
+ %121 = OpLabel
+ OpBranch %112
+ %112 = OpLabel
+ %154 = OpLoad %6 %108
+ %155 = OpIMul %6 %136 %154
+ OpStore %108 %155
+ OpBranch %109
+ %111 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# injectionSwitch
+BUFFER variant_2_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Two shaders with diff: variable mutated
+
+# The test renders two images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 230
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %53 %138
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %53 "gl_FragCoord"
+ OpName %56 "buf0"
+ OpMemberName %56 0 "resolution"
+ OpName %58 ""
+ OpName %138 "_GLF_color"
+ OpName %163 "indexable"
+ OpDecorate %53 BuiltIn FragCoord
+ OpMemberDecorate %56 0 Offset 0
+ OpDecorate %56 Block
+ OpDecorate %58 DescriptorSet 0
+ OpDecorate %58 Binding 0
+ OpDecorate %138 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %13 = OpTypeInt 32 0
+ %18 = OpConstant %6 0
+ %19 = OpTypeBool
+ %26 = OpConstant %6 1
+ %38 = OpConstant %6 2
+ %47 = OpTypeFloat 32
+ %48 = OpTypeVector %47 2
+ %51 = OpTypeVector %47 4
+ %52 = OpTypePointer Input %51
+ %53 = OpVariable %52 Input
+ %56 = OpTypeStruct %48
+ %57 = OpTypePointer Uniform %56
+ %58 = OpVariable %57 Uniform
+ %59 = OpTypePointer Uniform %48
+ %67 = OpConstant %47 8
+ %78 = OpConstant %6 5
+ %82 = OpConstant %6 10
+ %95 = OpConstant %6 8
+ %107 = OpConstant %6 100
+ %130 = OpConstant %6 15
+ %132 = OpConstant %6 16
+ %137 = OpTypePointer Output %51
+ %138 = OpVariable %137 Output
+ %139 = OpConstant %13 16
+ %140 = OpTypeArray %51 %139
+ %141 = OpConstant %47 0
+ %142 = OpConstant %47 1
+ %143 = OpConstantComposite %51 %141 %141 %141 %142
+ %144 = OpConstant %47 0.5
+ %145 = OpConstantComposite %51 %144 %141 %141 %142
+ %146 = OpConstantComposite %51 %141 %144 %141 %142
+ %147 = OpConstantComposite %51 %144 %144 %141 %142
+ %148 = OpConstantComposite %51 %141 %141 %144 %142
+ %149 = OpConstantComposite %51 %144 %141 %144 %142
+ %150 = OpConstantComposite %51 %141 %144 %144 %142
+ %151 = OpConstantComposite %51 %144 %144 %144 %142
+ %152 = OpConstantComposite %51 %142 %141 %141 %142
+ %153 = OpConstantComposite %51 %141 %142 %141 %142
+ %154 = OpConstantComposite %51 %142 %142 %141 %142
+ %155 = OpConstantComposite %51 %141 %141 %142 %142
+ %156 = OpConstantComposite %51 %142 %141 %142 %142
+ %157 = OpConstantComposite %51 %141 %142 %142 %142
+ %158 = OpConstantComposite %51 %142 %142 %142 %142
+ %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158
+ %162 = OpTypePointer Function %140
+ %164 = OpTypePointer Function %51
+ %229 = OpUndef %7
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %163 = OpVariable %162 Function
+ %54 = OpLoad %51 %53
+ %55 = OpVectorShuffle %48 %54 %54 0 1
+ %60 = OpAccessChain %59 %58 %18
+ %61 = OpLoad %48 %60
+ %62 = OpFDiv %48 %55 %61
+ %66 = OpCompositeExtract %47 %62 0
+ %68 = OpFMul %47 %66 %67
+ %69 = OpConvertFToS %6 %68
+ %71 = OpCompositeExtract %47 %62 1
+ %72 = OpFMul %47 %71 %67
+ %73 = OpConvertFToS %6 %72
+ %79 = OpBitwiseAnd %6 %69 %78
+ %83 = OpBitwiseAnd %6 %73 %82
+ %84 = OpBitwiseOr %6 %79 %83
+ %88 = OpBitwiseAnd %6 %73 %78
+ %91 = OpBitwiseAnd %6 %69 %82
+ %92 = OpBitwiseOr %6 %88 %91
+ %96 = OpIMul %6 %84 %95
+ %98 = OpIAdd %6 %96 %92
+ %99 = OpCompositeConstruct %7 %98 %18
+ OpBranch %101
+ %101 = OpLabel
+ %221 = OpPhi %7 %99 %5 %210 %104
+ %220 = OpPhi %6 %18 %5 %113 %104
+ %108 = OpSLessThan %19 %220 %107
+ OpLoopMerge %103 %104 None
+ OpBranchConditional %108 %102 %103
+ %102 = OpLabel
+ %170 = OpCompositeExtract %6 %221 0
+ %171 = OpSGreaterThan %19 %170 %18
+ OpSelectionMerge %176 None
+ OpBranchConditional %171 %172 %176
+ %172 = OpLabel
+ %174 = OpCompositeExtract %6 %221 1
+ %175 = OpISub %6 %174 %26
+ %202 = OpCompositeInsert %7 %175 %221 1
+ OpBranch %176
+ %176 = OpLabel
+ %224 = OpPhi %7 %221 %102 %202 %172
+ %178 = OpCompositeExtract %6 %224 0
+ %179 = OpSLessThan %19 %178 %18
+ OpSelectionMerge %184 None
+ OpBranchConditional %179 %180 %184
+ %180 = OpLabel
+ %182 = OpCompositeExtract %6 %224 1
+ %183 = OpIAdd %6 %182 %26
+ %206 = OpCompositeInsert %7 %183 %224 1
+ OpBranch %184
+ %184 = OpLabel
+ %225 = OpPhi %7 %224 %176 %206 %180
+ %186 = OpCompositeExtract %6 %225 1
+ %187 = OpSDiv %6 %186 %38
+ %189 = OpCompositeExtract %6 %225 0
+ %190 = OpIAdd %6 %189 %187
+ %210 = OpCompositeInsert %7 %190 %225 0
+ OpBranch %104
+ %104 = OpLabel
+ %113 = OpIAdd %6 %220 %26
+ OpBranch %101
+ %103 = OpLabel
+ %115 = OpCompositeExtract %6 %221 0
+ %116 = OpSLessThan %19 %115 %18
+ OpSelectionMerge %118 None
+ OpBranchConditional %116 %117 %118
+ %117 = OpLabel
+ %121 = OpSNegate %6 %115
+ %214 = OpCompositeInsert %7 %121 %229 0
+ OpBranch %118
+ %118 = OpLabel
+ %223 = OpPhi %7 %221 %103 %214 %117
+ OpBranch %123
+ %123 = OpLabel
+ %222 = OpPhi %7 %223 %118 %218 %124
+ %129 = OpCompositeExtract %6 %222 0
+ %131 = OpSGreaterThan %19 %129 %130
+ OpLoopMerge %125 %124 None
+ OpBranchConditional %131 %124 %125
+ %124 = OpLabel
+ %135 = OpISub %6 %129 %132
+ %218 = OpCompositeInsert %7 %135 %229 0
+ OpBranch %123
+ %125 = OpLabel
+ OpStore %163 %159
+ %165 = OpAccessChain %164 %163 %129
+ %166 = OpLoad %51 %165
+ OpStore %138 %166
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 399
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %53 %138
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %53 "gl_FragCoord"
+ OpName %56 "buf0"
+ OpMemberName %56 0 "resolution"
+ OpName %58 ""
+ OpName %138 "_GLF_color"
+ OpName %163 "indexable"
+ OpDecorate %53 BuiltIn FragCoord
+ OpMemberDecorate %56 0 Offset 0
+ OpDecorate %56 Block
+ OpDecorate %58 DescriptorSet 0
+ OpDecorate %58 Binding 0
+ OpDecorate %138 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %13 = OpTypeInt 32 0
+ %18 = OpConstant %6 0
+ %19 = OpTypeBool
+ %26 = OpConstant %6 1
+ %38 = OpConstant %6 2
+ %47 = OpTypeFloat 32
+ %48 = OpTypeVector %47 2
+ %51 = OpTypeVector %47 4
+ %52 = OpTypePointer Input %51
+ %53 = OpVariable %52 Input
+ %56 = OpTypeStruct %48
+ %57 = OpTypePointer Uniform %56
+ %58 = OpVariable %57 Uniform
+ %59 = OpTypePointer Uniform %48
+ %67 = OpConstant %47 8
+ %78 = OpConstant %6 5
+ %82 = OpConstant %6 10
+ %95 = OpConstant %6 8
+ %107 = OpConstant %6 100
+ %130 = OpConstant %6 15
+ %132 = OpConstant %6 16
+ %137 = OpTypePointer Output %51
+ %138 = OpVariable %137 Output
+ %139 = OpConstant %13 16
+ %140 = OpTypeArray %51 %139
+ %141 = OpConstant %47 0
+ %142 = OpConstant %47 1
+ %143 = OpConstantComposite %51 %141 %141 %141 %142
+ %144 = OpConstant %47 0.5
+ %145 = OpConstantComposite %51 %144 %141 %141 %142
+ %146 = OpConstantComposite %51 %141 %144 %141 %142
+ %147 = OpConstantComposite %51 %144 %144 %141 %142
+ %148 = OpConstantComposite %51 %141 %141 %144 %142
+ %149 = OpConstantComposite %51 %144 %141 %144 %142
+ %150 = OpConstantComposite %51 %141 %144 %144 %142
+ %151 = OpConstantComposite %51 %144 %144 %144 %142
+ %152 = OpConstantComposite %51 %142 %141 %141 %142
+ %153 = OpConstantComposite %51 %141 %142 %141 %142
+ %154 = OpConstantComposite %51 %142 %142 %141 %142
+ %155 = OpConstantComposite %51 %141 %141 %142 %142
+ %156 = OpConstantComposite %51 %142 %141 %142 %142
+ %157 = OpConstantComposite %51 %141 %142 %142 %142
+ %158 = OpConstantComposite %51 %142 %142 %142 %142
+ %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158
+ %162 = OpTypePointer Function %140
+ %164 = OpTypePointer Function %51
+ %229 = OpUndef %7
+ %354 = OpConstant %47 0
+ %355 = OpConstantComposite %51 %354 %354 %354 %354
+ %356 = OpConstantComposite %140 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355 %355
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %163 = OpVariable %162 Function
+ %54 = OpLoad %51 %53
+ %55 = OpVectorShuffle %48 %54 %54 0 1
+ %60 = OpAccessChain %59 %58 %18
+ %61 = OpLoad %48 %60
+ %62 = OpFDiv %48 %55 %61
+ %66 = OpCompositeExtract %47 %62 0
+ %68 = OpFMul %47 %66 %67
+ %69 = OpConvertFToS %6 %68
+ %71 = OpCompositeExtract %47 %62 1
+ %72 = OpFMul %47 %71 %67
+ %73 = OpConvertFToS %6 %72
+ %79 = OpBitwiseAnd %6 %69 %78
+ %83 = OpBitwiseAnd %6 %73 %82
+ %84 = OpBitwiseOr %6 %79 %83
+ %88 = OpBitwiseAnd %6 %73 %78
+ %91 = OpBitwiseAnd %6 %69 %82
+ %92 = OpBitwiseOr %6 %88 %91
+ %96 = OpIMul %6 %84 %95
+ %98 = OpIAdd %6 %96 %92
+ %99 = OpCompositeConstruct %7 %98 %18
+ OpBranch %101
+ %101 = OpLabel
+ %221 = OpPhi %7 %99 %5 %210 %104
+ %220 = OpPhi %6 %18 %5 %113 %104
+ %108 = OpSLessThan %19 %220 %107
+ OpLoopMerge %103 %104 None
+ OpBranchConditional %108 %102 %103
+ %102 = OpLabel
+ %170 = OpCompositeExtract %6 %221 0
+ %171 = OpSGreaterThan %19 %170 %18
+ OpSelectionMerge %176 None
+ OpBranchConditional %171 %172 %176
+ %172 = OpLabel
+ %174 = OpCompositeExtract %6 %221 1
+ %175 = OpISub %6 %174 %26
+ %202 = OpCompositeInsert %7 %175 %221 1
+ OpBranch %176
+ %176 = OpLabel
+ %224 = OpPhi %7 %221 %102 %202 %172
+ %178 = OpCompositeExtract %6 %224 0
+ %179 = OpSLessThan %19 %178 %18
+ OpSelectionMerge %184 None
+ OpBranchConditional %179 %180 %184
+ %180 = OpLabel
+ %182 = OpCompositeExtract %6 %224 1
+ %183 = OpIAdd %6 %182 %26
+ %206 = OpCompositeInsert %7 %183 %224 1
+ OpBranch %184
+ %184 = OpLabel
+ %225 = OpPhi %7 %224 %176 %206 %180
+ %186 = OpCompositeExtract %6 %225 1
+ %187 = OpSDiv %6 %186 %38
+ %189 = OpCompositeExtract %6 %225 0
+ %190 = OpIAdd %6 %189 %187
+ %210 = OpCompositeInsert %7 %190 %225 0
+ OpBranch %104
+ %104 = OpLabel
+ %113 = OpIAdd %6 %220 %26
+ OpBranch %101
+ %103 = OpLabel
+ %115 = OpCompositeExtract %6 %221 0
+ %116 = OpSLessThan %19 %115 %18
+ OpSelectionMerge %118 None
+ OpBranchConditional %116 %117 %118
+ %117 = OpLabel
+ %121 = OpSNegate %6 %115
+ %214 = OpCompositeInsert %7 %121 %229 0
+ OpBranch %118
+ %118 = OpLabel
+ %223 = OpPhi %7 %221 %103 %214 %117
+ OpBranch %123
+ %123 = OpLabel
+ %222 = OpPhi %7 %223 %118 %218 %124
+ %129 = OpCompositeExtract %6 %222 0
+ %131 = OpSGreaterThan %19 %129 %130
+ OpLoopMerge %125 %124 None
+ OpBranchConditional %131 %124 %125
+ %124 = OpLabel
+ %135 = OpISub %6 %129 %132
+ %218 = OpCompositeInsert %7 %135 %229 0
+ OpBranch %123
+ %125 = OpLabel
+ OpStore %163 %159
+ %398 = OpLoad %140 %163
+ OpStore %163 %356
+ OpStore %163 %398
+ %165 = OpAccessChain %164 %163 %129
+ %166 = OpLoad %51 %165
+ OpStore %138 %166
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders with diff: added mutate pointer
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 229
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %53 %138
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %53 "gl_FragCoord"
+ OpName %56 "buf0"
+ OpMemberName %56 0 "resolution"
+ OpName %58 ""
+ OpName %138 "_GLF_color"
+ OpName %163 "indexable"
+ OpDecorate %53 BuiltIn FragCoord
+ OpMemberDecorate %56 0 Offset 0
+ OpDecorate %56 Block
+ OpDecorate %58 DescriptorSet 0
+ OpDecorate %58 Binding 0
+ OpDecorate %138 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %13 = OpTypeInt 32 0
+ %18 = OpConstant %6 0
+ %19 = OpTypeBool
+ %26 = OpConstant %6 1
+ %38 = OpConstant %6 2
+ %47 = OpTypeFloat 32
+ %48 = OpTypeVector %47 2
+ %51 = OpTypeVector %47 4
+ %52 = OpTypePointer Input %51
+ %53 = OpVariable %52 Input
+ %56 = OpTypeStruct %48
+ %57 = OpTypePointer Uniform %56
+ %58 = OpVariable %57 Uniform
+ %59 = OpTypePointer Uniform %48
+ %67 = OpConstant %47 8
+ %78 = OpConstant %6 5
+ %82 = OpConstant %6 10
+ %95 = OpConstant %6 8
+ %107 = OpConstant %6 100
+ %130 = OpConstant %6 15
+ %132 = OpConstant %6 16
+ %137 = OpTypePointer Output %51
+ %138 = OpVariable %137 Output
+ %139 = OpConstant %13 16
+ %140 = OpTypeArray %51 %139
+ %141 = OpConstant %47 0
+ %142 = OpConstant %47 1
+ %143 = OpConstantComposite %51 %141 %141 %141 %142
+ %144 = OpConstant %47 0.5
+ %145 = OpConstantComposite %51 %144 %141 %141 %142
+ %146 = OpConstantComposite %51 %141 %144 %141 %142
+ %147 = OpConstantComposite %51 %144 %144 %141 %142
+ %148 = OpConstantComposite %51 %141 %141 %144 %142
+ %149 = OpConstantComposite %51 %144 %141 %144 %142
+ %150 = OpConstantComposite %51 %141 %144 %144 %142
+ %151 = OpConstantComposite %51 %144 %144 %144 %142
+ %152 = OpConstantComposite %51 %142 %141 %141 %142
+ %153 = OpConstantComposite %51 %141 %142 %141 %142
+ %154 = OpConstantComposite %51 %142 %142 %141 %142
+ %155 = OpConstantComposite %51 %141 %141 %142 %142
+ %156 = OpConstantComposite %51 %142 %141 %142 %142
+ %157 = OpConstantComposite %51 %141 %142 %142 %142
+ %158 = OpConstantComposite %51 %142 %142 %142 %142
+ %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158
+ %162 = OpTypePointer Function %140
+ %164 = OpTypePointer Function %51
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %163 = OpVariable %162 Function
+ %54 = OpLoad %51 %53
+ %55 = OpVectorShuffle %48 %54 %54 0 1
+ %60 = OpAccessChain %59 %58 %18
+ %61 = OpLoad %48 %60
+ %62 = OpFDiv %48 %55 %61
+ %66 = OpCompositeExtract %47 %62 0
+ %68 = OpFMul %47 %66 %67
+ %69 = OpConvertFToS %6 %68
+ %71 = OpCompositeExtract %47 %62 1
+ %72 = OpFMul %47 %71 %67
+ %73 = OpConvertFToS %6 %72
+ %79 = OpBitwiseAnd %6 %69 %78
+ %83 = OpBitwiseAnd %6 %73 %82
+ %84 = OpBitwiseOr %6 %79 %83
+ %88 = OpBitwiseAnd %6 %73 %78
+ %91 = OpBitwiseAnd %6 %69 %82
+ %92 = OpBitwiseOr %6 %88 %91
+ %96 = OpIMul %6 %84 %95
+ %98 = OpIAdd %6 %96 %92
+ %99 = OpCompositeConstruct %7 %98 %18
+ OpBranch %101
+ %101 = OpLabel
+ %224 = OpPhi %7 %99 %5 %214 %104
+ %193 = OpPhi %6 %18 %5 %113 %104
+ %108 = OpSLessThan %19 %193 %107
+ OpLoopMerge %103 %104 None
+ OpBranchConditional %108 %102 %103
+ %102 = OpLabel
+ %170 = OpCompositeExtract %6 %224 0
+ %171 = OpSGreaterThan %19 %170 %18
+ OpSelectionMerge %176 None
+ OpBranchConditional %171 %172 %176
+ %172 = OpLabel
+ %174 = OpCompositeExtract %6 %224 1
+ %175 = OpISub %6 %174 %26
+ %206 = OpCompositeInsert %7 %175 %224 1
+ OpBranch %176
+ %176 = OpLabel
+ %227 = OpPhi %7 %224 %102 %206 %172
+ %178 = OpCompositeExtract %6 %227 0
+ %179 = OpSLessThan %19 %178 %18
+ OpSelectionMerge %184 None
+ OpBranchConditional %179 %180 %184
+ %180 = OpLabel
+ %182 = OpCompositeExtract %6 %227 1
+ %183 = OpIAdd %6 %182 %26
+ %210 = OpCompositeInsert %7 %183 %227 1
+ OpBranch %184
+ %184 = OpLabel
+ %228 = OpPhi %7 %227 %176 %210 %180
+ %186 = OpCompositeExtract %6 %228 1
+ %187 = OpSDiv %6 %186 %38
+ %189 = OpCompositeExtract %6 %228 0
+ %190 = OpIAdd %6 %189 %187
+ %214 = OpCompositeInsert %7 %190 %228 0
+ OpBranch %104
+ %104 = OpLabel
+ %113 = OpIAdd %6 %193 %26
+ OpBranch %101
+ %103 = OpLabel
+ %115 = OpCompositeExtract %6 %224 0
+ %116 = OpSLessThan %19 %115 %18
+ OpSelectionMerge %118 None
+ OpBranchConditional %116 %117 %118
+ %117 = OpLabel
+ %121 = OpSNegate %6 %115
+ %218 = OpCompositeInsert %7 %121 %224 0
+ OpBranch %118
+ %118 = OpLabel
+ %226 = OpPhi %7 %224 %103 %218 %117
+ OpBranch %123
+ %123 = OpLabel
+ %225 = OpPhi %7 %226 %118 %222 %124
+ %129 = OpCompositeExtract %6 %225 0
+ %131 = OpSGreaterThan %19 %129 %130
+ OpLoopMerge %125 %124 None
+ OpBranchConditional %131 %124 %125
+ %124 = OpLabel
+ %135 = OpISub %6 %129 %132
+ %222 = OpCompositeInsert %7 %135 %225 0
+ OpBranch %123
+ %125 = OpLabel
+ OpStore %163 %159
+ %165 = OpAccessChain %164 %163 %129
+ %166 = OpLoad %51 %165
+ OpStore %138 %166
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 549
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %53 %138
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %53 "gl_FragCoord"
+ OpName %56 "buf0"
+ OpMemberName %56 0 "resolution"
+ OpName %58 ""
+ OpName %138 "_GLF_color"
+ OpName %163 "indexable"
+ OpDecorate %53 BuiltIn FragCoord
+ OpMemberDecorate %56 0 Offset 0
+ OpDecorate %56 Block
+ OpDecorate %58 DescriptorSet 0
+ OpDecorate %58 Binding 0
+ OpDecorate %138 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %13 = OpTypeInt 32 0
+ %18 = OpConstant %6 0
+ %19 = OpTypeBool
+ %26 = OpConstant %6 1
+ %38 = OpConstant %6 2
+ %47 = OpTypeFloat 32
+ %48 = OpTypeVector %47 2
+ %51 = OpTypeVector %47 4
+ %52 = OpTypePointer Input %51
+ %53 = OpVariable %52 Input
+ %56 = OpTypeStruct %48
+ %57 = OpTypePointer Uniform %56
+ %58 = OpVariable %57 Uniform
+ %59 = OpTypePointer Uniform %48
+ %67 = OpConstant %47 8
+ %78 = OpConstant %6 5
+ %82 = OpConstant %6 10
+ %95 = OpConstant %6 8
+ %107 = OpConstant %6 100
+ %130 = OpConstant %6 15
+ %132 = OpConstant %6 16
+ %137 = OpTypePointer Output %51
+ %138 = OpVariable %137 Output
+ %139 = OpConstant %13 16
+ %140 = OpTypeArray %51 %139
+ %141 = OpConstant %47 0
+ %142 = OpConstant %47 1
+ %143 = OpConstantComposite %51 %141 %141 %141 %142
+ %144 = OpConstant %47 0.5
+ %145 = OpConstantComposite %51 %144 %141 %141 %142
+ %146 = OpConstantComposite %51 %141 %144 %141 %142
+ %147 = OpConstantComposite %51 %144 %144 %141 %142
+ %148 = OpConstantComposite %51 %141 %141 %144 %142
+ %149 = OpConstantComposite %51 %144 %141 %144 %142
+ %150 = OpConstantComposite %51 %141 %144 %144 %142
+ %151 = OpConstantComposite %51 %144 %144 %144 %142
+ %152 = OpConstantComposite %51 %142 %141 %141 %142
+ %153 = OpConstantComposite %51 %141 %142 %141 %142
+ %154 = OpConstantComposite %51 %142 %142 %141 %142
+ %155 = OpConstantComposite %51 %141 %141 %142 %142
+ %156 = OpConstantComposite %51 %142 %141 %142 %142
+ %157 = OpConstantComposite %51 %141 %142 %142 %142
+ %158 = OpConstantComposite %51 %142 %142 %142 %142
+ %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158
+ %162 = OpTypePointer Function %140
+ %164 = OpTypePointer Function %51
+ %440 = OpConstant %47 0
+ %441 = OpConstantComposite %51 %440 %440 %440 %440
+ %442 = OpConstantComposite %140 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %163 = OpVariable %162 Function
+ %54 = OpLoad %51 %53
+ %55 = OpVectorShuffle %48 %54 %54 0 1
+ %60 = OpAccessChain %59 %58 %18
+ %61 = OpLoad %48 %60
+ %62 = OpFDiv %48 %55 %61
+ %66 = OpCompositeExtract %47 %62 0
+ %68 = OpFMul %47 %66 %67
+ %69 = OpConvertFToS %6 %68
+ %330 = OpAccessChain %162 %163
+ %71 = OpCompositeExtract %47 %62 1
+ %72 = OpFMul %47 %71 %67
+ %73 = OpConvertFToS %6 %72
+ %79 = OpBitwiseAnd %6 %69 %78
+ %83 = OpBitwiseAnd %6 %73 %82
+ %84 = OpBitwiseOr %6 %79 %83
+ %88 = OpBitwiseAnd %6 %73 %78
+ %91 = OpBitwiseAnd %6 %69 %82
+ %92 = OpBitwiseOr %6 %88 %91
+ %96 = OpIMul %6 %84 %95
+ %98 = OpIAdd %6 %96 %92
+ %99 = OpCompositeConstruct %7 %98 %18
+ OpBranch %101
+ %101 = OpLabel
+ %224 = OpPhi %7 %99 %5 %214 %104
+ %193 = OpPhi %6 %18 %5 %113 %104
+ %108 = OpSLessThan %19 %193 %107
+ OpLoopMerge %103 %104 None
+ OpBranchConditional %108 %102 %103
+ %102 = OpLabel
+ %170 = OpCompositeExtract %6 %224 0
+ %171 = OpSGreaterThan %19 %170 %18
+ OpSelectionMerge %176 None
+ OpBranchConditional %171 %172 %176
+ %172 = OpLabel
+ %174 = OpCompositeExtract %6 %224 1
+ %175 = OpISub %6 %174 %26
+ %206 = OpCompositeInsert %7 %175 %224 1
+ OpBranch %176
+ %176 = OpLabel
+ %227 = OpPhi %7 %224 %102 %206 %172
+ %178 = OpCompositeExtract %6 %227 0
+ %179 = OpSLessThan %19 %178 %18
+ OpSelectionMerge %184 None
+ OpBranchConditional %179 %180 %184
+ %180 = OpLabel
+ %182 = OpCompositeExtract %6 %227 1
+ %183 = OpIAdd %6 %182 %26
+ %210 = OpCompositeInsert %7 %183 %227 1
+ OpBranch %184
+ %184 = OpLabel
+ %228 = OpPhi %7 %227 %176 %210 %180
+ %186 = OpCompositeExtract %6 %228 1
+ %187 = OpSDiv %6 %186 %38
+ %189 = OpCompositeExtract %6 %228 0
+ %190 = OpIAdd %6 %189 %187
+ %214 = OpCompositeInsert %7 %190 %228 0
+ OpBranch %104
+ %104 = OpLabel
+ %113 = OpIAdd %6 %193 %26
+ OpBranch %101
+ %103 = OpLabel
+ %115 = OpCompositeExtract %6 %224 0
+ %116 = OpSLessThan %19 %115 %18
+ OpSelectionMerge %118 None
+ OpBranchConditional %116 %117 %118
+ %117 = OpLabel
+ %121 = OpSNegate %6 %115
+ %218 = OpCompositeInsert %7 %121 %224 0
+ OpBranch %118
+ %118 = OpLabel
+ %226 = OpPhi %7 %224 %103 %218 %117
+ OpBranch %123
+ %123 = OpLabel
+ %225 = OpPhi %7 %226 %118 %222 %124
+ %129 = OpCompositeExtract %6 %225 0
+ %131 = OpSGreaterThan %19 %129 %130
+ OpLoopMerge %125 %124 None
+ OpBranchConditional %131 %124 %125
+ %124 = OpLabel
+ %135 = OpISub %6 %129 %132
+ %222 = OpCompositeInsert %7 %135 %225 0
+ OpBranch %123
+ %125 = OpLabel
+ OpStore %163 %159
+ %165 = OpAccessChain %164 %163 %129
+ %548 = OpLoad %140 %330
+ OpStore %330 %442
+ OpStore %330 %548
+ %166 = OpLoad %51 %165
+ OpStore %138 %166
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 443
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %53 %138
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %53 "gl_FragCoord"
+ OpName %56 "buf0"
+ OpMemberName %56 0 "resolution"
+ OpName %58 ""
+ OpName %138 "_GLF_color"
+ OpName %163 "indexable"
+ OpDecorate %53 BuiltIn FragCoord
+ OpMemberDecorate %56 0 Offset 0
+ OpDecorate %56 Block
+ OpDecorate %58 DescriptorSet 0
+ OpDecorate %58 Binding 0
+ OpDecorate %138 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %13 = OpTypeInt 32 0
+ %18 = OpConstant %6 0
+ %19 = OpTypeBool
+ %26 = OpConstant %6 1
+ %38 = OpConstant %6 2
+ %47 = OpTypeFloat 32
+ %48 = OpTypeVector %47 2
+ %51 = OpTypeVector %47 4
+ %52 = OpTypePointer Input %51
+ %53 = OpVariable %52 Input
+ %56 = OpTypeStruct %48
+ %57 = OpTypePointer Uniform %56
+ %58 = OpVariable %57 Uniform
+ %59 = OpTypePointer Uniform %48
+ %67 = OpConstant %47 8
+ %78 = OpConstant %6 5
+ %82 = OpConstant %6 10
+ %95 = OpConstant %6 8
+ %107 = OpConstant %6 100
+ %130 = OpConstant %6 15
+ %132 = OpConstant %6 16
+ %137 = OpTypePointer Output %51
+ %138 = OpVariable %137 Output
+ %139 = OpConstant %13 16
+ %140 = OpTypeArray %51 %139
+ %141 = OpConstant %47 0
+ %142 = OpConstant %47 1
+ %143 = OpConstantComposite %51 %141 %141 %141 %142
+ %144 = OpConstant %47 0.5
+ %145 = OpConstantComposite %51 %144 %141 %141 %142
+ %146 = OpConstantComposite %51 %141 %144 %141 %142
+ %147 = OpConstantComposite %51 %144 %144 %141 %142
+ %148 = OpConstantComposite %51 %141 %141 %144 %142
+ %149 = OpConstantComposite %51 %144 %141 %144 %142
+ %150 = OpConstantComposite %51 %141 %144 %144 %142
+ %151 = OpConstantComposite %51 %144 %144 %144 %142
+ %152 = OpConstantComposite %51 %142 %141 %141 %142
+ %153 = OpConstantComposite %51 %141 %142 %141 %142
+ %154 = OpConstantComposite %51 %142 %142 %141 %142
+ %155 = OpConstantComposite %51 %141 %141 %142 %142
+ %156 = OpConstantComposite %51 %142 %141 %142 %142
+ %157 = OpConstantComposite %51 %141 %142 %142 %142
+ %158 = OpConstantComposite %51 %142 %142 %142 %142
+ %159 = OpConstantComposite %140 %143 %145 %146 %147 %148 %149 %150 %151 %143 %152 %153 %154 %155 %156 %157 %158
+ %162 = OpTypePointer Function %140
+ %164 = OpTypePointer Function %51
+ %440 = OpConstant %47 0
+ %441 = OpConstantComposite %51 %440 %440 %440 %440
+ %442 = OpConstantComposite %140 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441 %441
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %163 = OpVariable %162 Function
+ %54 = OpLoad %51 %53
+ %55 = OpVectorShuffle %48 %54 %54 0 1
+ %60 = OpAccessChain %59 %58 %18
+ %61 = OpLoad %48 %60
+ %62 = OpFDiv %48 %55 %61
+ %66 = OpCompositeExtract %47 %62 0
+ %68 = OpFMul %47 %66 %67
+ %69 = OpConvertFToS %6 %68
+ %330 = OpAccessChain %162 %163
+ %71 = OpCompositeExtract %47 %62 1
+ %72 = OpFMul %47 %71 %67
+ %73 = OpConvertFToS %6 %72
+ %79 = OpBitwiseAnd %6 %69 %78
+ %83 = OpBitwiseAnd %6 %73 %82
+ %84 = OpBitwiseOr %6 %79 %83
+ %88 = OpBitwiseAnd %6 %73 %78
+ %91 = OpBitwiseAnd %6 %69 %82
+ %92 = OpBitwiseOr %6 %88 %91
+ %96 = OpIMul %6 %84 %95
+ %98 = OpIAdd %6 %96 %92
+ %99 = OpCompositeConstruct %7 %98 %18
+ OpBranch %101
+ %101 = OpLabel
+ %224 = OpPhi %7 %99 %5 %214 %104
+ %193 = OpPhi %6 %18 %5 %113 %104
+ %108 = OpSLessThan %19 %193 %107
+ OpLoopMerge %103 %104 None
+ OpBranchConditional %108 %102 %103
+ %102 = OpLabel
+ %170 = OpCompositeExtract %6 %224 0
+ %171 = OpSGreaterThan %19 %170 %18
+ OpSelectionMerge %176 None
+ OpBranchConditional %171 %172 %176
+ %172 = OpLabel
+ %174 = OpCompositeExtract %6 %224 1
+ %175 = OpISub %6 %174 %26
+ %206 = OpCompositeInsert %7 %175 %224 1
+ OpBranch %176
+ %176 = OpLabel
+ %227 = OpPhi %7 %224 %102 %206 %172
+ %178 = OpCompositeExtract %6 %227 0
+ %179 = OpSLessThan %19 %178 %18
+ OpSelectionMerge %184 None
+ OpBranchConditional %179 %180 %184
+ %180 = OpLabel
+ %182 = OpCompositeExtract %6 %227 1
+ %183 = OpIAdd %6 %182 %26
+ %210 = OpCompositeInsert %7 %183 %227 1
+ OpBranch %184
+ %184 = OpLabel
+ %228 = OpPhi %7 %227 %176 %210 %180
+ %186 = OpCompositeExtract %6 %228 1
+ %187 = OpSDiv %6 %186 %38
+ %189 = OpCompositeExtract %6 %228 0
+ %190 = OpIAdd %6 %189 %187
+ %214 = OpCompositeInsert %7 %190 %228 0
+ OpBranch %104
+ %104 = OpLabel
+ %113 = OpIAdd %6 %193 %26
+ OpBranch %101
+ %103 = OpLabel
+ %115 = OpCompositeExtract %6 %224 0
+ %116 = OpSLessThan %19 %115 %18
+ OpSelectionMerge %118 None
+ OpBranchConditional %116 %117 %118
+ %117 = OpLabel
+ %121 = OpSNegate %6 %115
+ %218 = OpCompositeInsert %7 %121 %224 0
+ OpBranch %118
+ %118 = OpLabel
+ %226 = OpPhi %7 %224 %103 %218 %117
+ OpBranch %123
+ %123 = OpLabel
+ %225 = OpPhi %7 %226 %118 %222 %124
+ %129 = OpCompositeExtract %6 %225 0
+ %131 = OpSGreaterThan %19 %129 %130
+ OpLoopMerge %125 %124 None
+ OpBranchConditional %131 %124 %125
+ %124 = OpLabel
+ %135 = OpISub %6 %129 %132
+ %222 = OpCompositeInsert %7 %135 %225 0
+ OpBranch %123
+ %125 = OpLabel
+ OpStore %163 %159
+ %165 = OpAccessChain %164 %163 %129
+ %166 = OpLoad %51 %165
+ OpStore %138 %166
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# resolution
+BUFFER variant_2_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders diff: OpSelect -> OpPhi
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 366
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %246 %268
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %246 "gl_FragCoord"
+ OpName %249 "buf0"
+ OpMemberName %249 0 "resolution"
+ OpName %251 ""
+ OpName %268 "_GLF_color"
+ OpDecorate %246 BuiltIn FragCoord
+ OpMemberDecorate %249 0 Offset 0
+ OpDecorate %249 Block
+ OpDecorate %251 DescriptorSet 0
+ OpDecorate %251 Binding 0
+ OpDecorate %268 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %9 = OpTypeFloat 32
+ %10 = OpTypeVector %9 4
+ %20 = OpTypeInt 32 0
+ %22 = OpTypePointer Function %6
+ %25 = OpConstant %6 256
+ %26 = OpTypeBool
+ %28 = OpConstant %20 0
+ %31 = OpConstant %20 256
+ %32 = OpTypeArray %6 %31
+ %33 = OpConstant %6 115
+ %34 = OpConstant %6 133
+ %35 = OpConstant %6 150
+ %36 = OpConstant %6 164
+ %37 = OpConstant %6 176
+ %38 = OpConstant %6 184
+ %39 = OpConstant %6 190
+ %40 = OpConstant %6 192
+ %41 = OpConstant %6 191
+ %42 = OpConstant %6 187
+ %43 = OpConstant %6 181
+ %44 = OpConstant %6 172
+ %45 = OpConstant %6 163
+ %46 = OpConstant %6 153
+ %47 = OpConstant %6 143
+ %48 = OpConstant %6 134
+ %49 = OpConstant %6 126
+ %50 = OpConstant %6 120
+ %51 = OpConstant %6 116
+ %52 = OpConstant %6 114
+ %53 = OpConstant %6 117
+ %54 = OpConstant %6 121
+ %55 = OpConstant %6 127
+ %56 = OpConstant %6 141
+ %57 = OpConstant %6 148
+ %58 = OpConstant %6 154
+ %59 = OpConstant %6 159
+ %60 = OpConstant %6 162
+ %61 = OpConstant %6 161
+ %62 = OpConstant %6 157
+ %63 = OpConstant %6 151
+ %64 = OpConstant %6 124
+ %65 = OpConstant %6 113
+ %66 = OpConstant %6 103
+ %67 = OpConstant %6 94
+ %68 = OpConstant %6 87
+ %69 = OpConstant %6 82
+ %70 = OpConstant %6 79
+ %71 = OpConstant %6 80
+ %72 = OpConstant %6 84
+ %73 = OpConstant %6 91
+ %74 = OpConstant %6 101
+ %75 = OpConstant %6 130
+ %76 = OpConstant %6 146
+ %77 = OpConstant %6 182
+ %78 = OpConstant %6 199
+ %79 = OpConstant %6 215
+ %80 = OpConstant %6 229
+ %81 = OpConstant %6 240
+ %82 = OpConstant %6 249
+ %83 = OpConstant %6 254
+ %84 = OpConstant %6 250
+ %85 = OpConstant %6 243
+ %86 = OpConstant %6 233
+ %87 = OpConstant %6 223
+ %88 = OpConstant %6 212
+ %89 = OpConstant %6 200
+ %90 = OpConstant %6 180
+ %91 = OpConstant %6 166
+ %92 = OpConstant %6 169
+ %93 = OpConstant %6 174
+ %94 = OpConstant %6 179
+ %95 = OpConstant %6 185
+ %96 = OpConstant %6 193
+ %97 = OpConstant %6 195
+ %98 = OpConstant %6 188
+ %99 = OpConstant %6 171
+ %100 = OpConstant %6 149
+ %101 = OpConstant %6 137
+ %102 = OpConstant %6 125
+ %103 = OpConstant %6 105
+ %104 = OpConstant %6 97
+ %105 = OpConstant %6 93
+ %106 = OpConstant %6 98
+ %107 = OpConstant %6 106
+ %108 = OpConstant %6 145
+ %109 = OpConstant %6 177
+ %110 = OpConstant %6 208
+ %111 = OpConstant %6 221
+ %112 = OpConstant %6 231
+ %113 = OpConstant %6 239
+ %114 = OpConstant %6 244
+ %115 = OpConstant %6 242
+ %116 = OpConstant %6 236
+ %117 = OpConstant %6 228
+ %118 = OpConstant %6 218
+ %119 = OpConstant %6 207
+ %120 = OpConstant %6 194
+ %121 = OpConstant %6 158
+ %122 = OpConstant %6 135
+ %123 = OpConstant %6 132
+ %124 = OpConstant %6 131
+ %125 = OpConstant %6 138
+ %126 = OpConstant %6 147
+ %127 = OpConstant %6 155
+ %128 = OpConstant %6 152
+ %129 = OpConstant %6 139
+ %130 = OpConstant %6 129
+ %131 = OpConstant %6 118
+ %132 = OpConstant %6 68
+ %133 = OpConstant %6 58
+ %134 = OpConstant %6 49
+ %135 = OpConstant %6 43
+ %136 = OpConstant %6 40
+ %137 = OpConstant %6 41
+ %138 = OpConstant %6 44
+ %139 = OpConstant %6 51
+ %140 = OpConstant %6 61
+ %141 = OpConstant %6 73
+ %142 = OpConstant %6 119
+ %143 = OpConstant %6 173
+ %144 = OpConstant %6 186
+ %145 = OpConstant %6 128
+ %146 = OpConstant %6 104
+ %147 = OpConstant %6 86
+ %148 = OpConstant %6 81
+ %149 = OpConstant %6 77
+ %150 = OpConstant %6 76
+ %151 = OpConstant %6 89
+ %152 = OpConstant %6 102
+ %153 = OpConstant %6 92
+ %154 = OpConstant %6 83
+ %155 = OpConstant %6 62
+ %156 = OpConstant %6 50
+ %157 = OpConstant %6 38
+ %158 = OpConstant %6 26
+ %159 = OpConstant %6 16
+ %160 = OpConstant %6 8
+ %161 = OpConstant %6 2
+ %162 = OpConstant %6 0
+ %163 = OpConstant %6 4
+ %164 = OpConstant %6 11
+ %165 = OpConstant %6 21
+ %166 = OpConstant %6 33
+ %167 = OpConstant %6 48
+ %168 = OpConstant %6 64
+ %169 = OpConstant %6 144
+ %170 = OpConstant %6 123
+ %171 = OpConstant %6 112
+ %172 = OpConstant %6 100
+ %173 = OpConstant %6 90
+ %174 = OpConstant %6 65
+ %175 = OpConstant %6 67
+ %176 = OpConstant %6 70
+ %177 = OpConstant %6 75
+ %178 = OpConstant %6 95
+ %179 = OpConstant %6 88
+ %180 = OpConstant %6 69
+ %181 = OpConstant %6 47
+ %182 = OpConstant %6 36
+ %183 = OpConstant %6 18
+ %184 = OpConstant %6 13
+ %185 = OpConstant %6 15
+ %186 = OpConstant %6 22
+ %187 = OpConstant %6 32
+ %188 = OpConstant %6 45
+ %189 = OpConstant %6 60
+ %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
+ %193 = OpTypePointer Function %32
+ %215 = OpConstant %9 15
+ %231 = OpConstant %9 1
+ %236 = OpConstant %6 1
+ %238 = OpConstant %9 0
+ %239 = OpConstantComposite %10 %238 %238 %238 %231
+ %242 = OpTypeVector %9 2
+ %245 = OpTypePointer Input %10
+ %246 = OpVariable %245 Input
+ %249 = OpTypeStruct %242
+ %250 = OpTypePointer Uniform %249
+ %251 = OpVariable %250 Uniform
+ %252 = OpTypePointer Uniform %242
+ %259 = OpConstant %9 256
+ %267 = OpTypePointer Output %10
+ %268 = OpVariable %267 Output
+ %277 = OpConstantFalse %26
+ %280 = OpConstantTrue %26
+ %363 = OpUndef %10
+ %365 = OpConstant %9 0.0666666701
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %285 = OpVariable %193 Function
+ %286 = OpVariable %193 Function
+ %288 = OpVariable %193 Function
+ %247 = OpLoad %10 %246
+ %248 = OpVectorShuffle %242 %247 %247 0 1
+ %253 = OpAccessChain %252 %251 %162
+ %254 = OpLoad %242 %253
+ %255 = OpFDiv %242 %248 %254
+ %258 = OpCompositeExtract %9 %255 0
+ %260 = OpFMul %9 %258 %259
+ %261 = OpConvertFToS %6 %260
+ %263 = OpCompositeExtract %9 %255 1
+ %264 = OpFMul %9 %263 %259
+ %265 = OpConvertFToS %6 %264
+ %266 = OpCompositeConstruct %7 %261 %265
+ OpSelectionMerge %341 None
+ OpSwitch %28 %291
+ %291 = OpLabel
+ OpBranch %292
+ %292 = OpLabel
+ %355 = OpPhi %7 %266 %291 %354 %337
+ %295 = OpCompositeExtract %6 %355 1
+ %296 = OpINotEqual %26 %295 %25
+ OpLoopMerge %338 %337 None
+ OpBranchConditional %296 %297 %338
+ %297 = OpLabel
+ %299 = OpCompositeExtract %6 %355 0
+ OpStore %285 %190
+ %302 = OpAccessChain %22 %285 %295
+ %303 = OpLoad %6 %302
+ %304 = OpIAdd %6 %303 %185
+ %305 = OpSLessThan %26 %299 %304
+ OpSelectionMerge %315 None
+ OpBranchConditional %305 %306 %315
+ %306 = OpLabel
+ OpStore %286 %190
+ %311 = OpAccessChain %22 %286 %295
+ %312 = OpLoad %6 %311
+ %313 = OpISub %6 %312 %185
+ %314 = OpSGreaterThan %26 %299 %313
+ OpBranch %315
+ %315 = OpLabel
+ %316 = OpPhi %26 %305 %297 %314 %306
+ OpSelectionMerge %333 None
+ OpBranchConditional %316 %317 %333
+ %317 = OpLabel
+ OpStore %288 %190
+ %322 = OpAccessChain %22 %288 %295
+ %323 = OpLoad %6 %322
+ %324 = OpISub %6 %299 %323
+ %325 = OpConvertSToF %9 %324
+ %326 = OpExtInst %9 %1 FAbs %325
+ %327 = OpFSub %9 %215 %326
+ %328 = OpFMul %9 %327 %365
+ %332 = OpCompositeConstruct %10 %328 %328 %328 %231
+ OpBranch %338
+ %333 = OpLabel
+ %336 = OpIAdd %6 %295 %236
+ %354 = OpCompositeInsert %7 %336 %355 1
+ OpBranch %337
+ %337 = OpLabel
+ OpBranch %292
+ %338 = OpLabel
+ %361 = OpPhi %10 %363 %292 %332 %317
+ %357 = OpPhi %26 %277 %292 %280 %317
+ OpSelectionMerge %340 None
+ OpBranchConditional %357 %341 %340
+ %340 = OpLabel
+ OpBranch %341
+ %341 = OpLabel
+ %360 = OpPhi %10 %361 %338 %239 %340
+ OpStore %268 %360
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 534
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %246 %268
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %246 "gl_FragCoord"
+ OpName %249 "buf0"
+ OpMemberName %249 0 "resolution"
+ OpName %251 ""
+ OpName %268 "_GLF_color"
+ OpDecorate %246 BuiltIn FragCoord
+ OpMemberDecorate %249 0 Offset 0
+ OpDecorate %249 Block
+ OpDecorate %251 DescriptorSet 0
+ OpDecorate %251 Binding 0
+ OpDecorate %268 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %9 = OpTypeFloat 32
+ %10 = OpTypeVector %9 4
+ %20 = OpTypeInt 32 0
+ %22 = OpTypePointer Function %6
+ %25 = OpConstant %6 256
+ %26 = OpTypeBool
+ %28 = OpConstant %20 0
+ %31 = OpConstant %20 256
+ %32 = OpTypeArray %6 %31
+ %33 = OpConstant %6 115
+ %34 = OpConstant %6 133
+ %35 = OpConstant %6 150
+ %36 = OpConstant %6 164
+ %37 = OpConstant %6 176
+ %38 = OpConstant %6 184
+ %39 = OpConstant %6 190
+ %40 = OpConstant %6 192
+ %41 = OpConstant %6 191
+ %42 = OpConstant %6 187
+ %43 = OpConstant %6 181
+ %44 = OpConstant %6 172
+ %45 = OpConstant %6 163
+ %46 = OpConstant %6 153
+ %47 = OpConstant %6 143
+ %48 = OpConstant %6 134
+ %49 = OpConstant %6 126
+ %50 = OpConstant %6 120
+ %51 = OpConstant %6 116
+ %52 = OpConstant %6 114
+ %53 = OpConstant %6 117
+ %54 = OpConstant %6 121
+ %55 = OpConstant %6 127
+ %56 = OpConstant %6 141
+ %57 = OpConstant %6 148
+ %58 = OpConstant %6 154
+ %59 = OpConstant %6 159
+ %60 = OpConstant %6 162
+ %61 = OpConstant %6 161
+ %62 = OpConstant %6 157
+ %63 = OpConstant %6 151
+ %64 = OpConstant %6 124
+ %65 = OpConstant %6 113
+ %66 = OpConstant %6 103
+ %67 = OpConstant %6 94
+ %68 = OpConstant %6 87
+ %69 = OpConstant %6 82
+ %70 = OpConstant %6 79
+ %71 = OpConstant %6 80
+ %72 = OpConstant %6 84
+ %73 = OpConstant %6 91
+ %74 = OpConstant %6 101
+ %75 = OpConstant %6 130
+ %76 = OpConstant %6 146
+ %77 = OpConstant %6 182
+ %78 = OpConstant %6 199
+ %79 = OpConstant %6 215
+ %80 = OpConstant %6 229
+ %81 = OpConstant %6 240
+ %82 = OpConstant %6 249
+ %83 = OpConstant %6 254
+ %84 = OpConstant %6 250
+ %85 = OpConstant %6 243
+ %86 = OpConstant %6 233
+ %87 = OpConstant %6 223
+ %88 = OpConstant %6 212
+ %89 = OpConstant %6 200
+ %90 = OpConstant %6 180
+ %91 = OpConstant %6 166
+ %92 = OpConstant %6 169
+ %93 = OpConstant %6 174
+ %94 = OpConstant %6 179
+ %95 = OpConstant %6 185
+ %96 = OpConstant %6 193
+ %97 = OpConstant %6 195
+ %98 = OpConstant %6 188
+ %99 = OpConstant %6 171
+ %100 = OpConstant %6 149
+ %101 = OpConstant %6 137
+ %102 = OpConstant %6 125
+ %103 = OpConstant %6 105
+ %104 = OpConstant %6 97
+ %105 = OpConstant %6 93
+ %106 = OpConstant %6 98
+ %107 = OpConstant %6 106
+ %108 = OpConstant %6 145
+ %109 = OpConstant %6 177
+ %110 = OpConstant %6 208
+ %111 = OpConstant %6 221
+ %112 = OpConstant %6 231
+ %113 = OpConstant %6 239
+ %114 = OpConstant %6 244
+ %115 = OpConstant %6 242
+ %116 = OpConstant %6 236
+ %117 = OpConstant %6 228
+ %118 = OpConstant %6 218
+ %119 = OpConstant %6 207
+ %120 = OpConstant %6 194
+ %121 = OpConstant %6 158
+ %122 = OpConstant %6 135
+ %123 = OpConstant %6 132
+ %124 = OpConstant %6 131
+ %125 = OpConstant %6 138
+ %126 = OpConstant %6 147
+ %127 = OpConstant %6 155
+ %128 = OpConstant %6 152
+ %129 = OpConstant %6 139
+ %130 = OpConstant %6 129
+ %131 = OpConstant %6 118
+ %132 = OpConstant %6 68
+ %133 = OpConstant %6 58
+ %134 = OpConstant %6 49
+ %135 = OpConstant %6 43
+ %136 = OpConstant %6 40
+ %137 = OpConstant %6 41
+ %138 = OpConstant %6 44
+ %139 = OpConstant %6 51
+ %140 = OpConstant %6 61
+ %141 = OpConstant %6 73
+ %142 = OpConstant %6 119
+ %143 = OpConstant %6 173
+ %144 = OpConstant %6 186
+ %145 = OpConstant %6 128
+ %146 = OpConstant %6 104
+ %147 = OpConstant %6 86
+ %148 = OpConstant %6 81
+ %149 = OpConstant %6 77
+ %150 = OpConstant %6 76
+ %151 = OpConstant %6 89
+ %152 = OpConstant %6 102
+ %153 = OpConstant %6 92
+ %154 = OpConstant %6 83
+ %155 = OpConstant %6 62
+ %156 = OpConstant %6 50
+ %157 = OpConstant %6 38
+ %158 = OpConstant %6 26
+ %159 = OpConstant %6 16
+ %160 = OpConstant %6 8
+ %161 = OpConstant %6 2
+ %162 = OpConstant %6 0
+ %163 = OpConstant %6 4
+ %164 = OpConstant %6 11
+ %165 = OpConstant %6 21
+ %166 = OpConstant %6 33
+ %167 = OpConstant %6 48
+ %168 = OpConstant %6 64
+ %169 = OpConstant %6 144
+ %170 = OpConstant %6 123
+ %171 = OpConstant %6 112
+ %172 = OpConstant %6 100
+ %173 = OpConstant %6 90
+ %174 = OpConstant %6 65
+ %175 = OpConstant %6 67
+ %176 = OpConstant %6 70
+ %177 = OpConstant %6 75
+ %178 = OpConstant %6 95
+ %179 = OpConstant %6 88
+ %180 = OpConstant %6 69
+ %181 = OpConstant %6 47
+ %182 = OpConstant %6 36
+ %183 = OpConstant %6 18
+ %184 = OpConstant %6 13
+ %185 = OpConstant %6 15
+ %186 = OpConstant %6 22
+ %187 = OpConstant %6 32
+ %188 = OpConstant %6 45
+ %189 = OpConstant %6 60
+ %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
+ %193 = OpTypePointer Function %32
+ %215 = OpConstant %9 15
+ %231 = OpConstant %9 1
+ %236 = OpConstant %6 1
+ %238 = OpConstant %9 0
+ %239 = OpConstantComposite %10 %238 %238 %238 %231
+ %242 = OpTypeVector %9 2
+ %245 = OpTypePointer Input %10
+ %246 = OpVariable %245 Input
+ %249 = OpTypeStruct %242
+ %250 = OpTypePointer Uniform %249
+ %251 = OpVariable %250 Uniform
+ %252 = OpTypePointer Uniform %242
+ %259 = OpConstant %9 256
+ %267 = OpTypePointer Output %10
+ %268 = OpVariable %267 Output
+ %277 = OpConstantFalse %26
+ %280 = OpConstantTrue %26
+ %363 = OpUndef %10
+ %365 = OpConstant %9 0.0666666701
+ %523 = OpConstant %6 0
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %285 = OpVariable %193 Function
+ %286 = OpVariable %193 Function
+ %288 = OpVariable %193 Function
+ %247 = OpLoad %10 %246
+ %248 = OpVectorShuffle %242 %247 %247 0 1
+ %253 = OpAccessChain %252 %251 %162
+ %254 = OpLoad %242 %253
+ %255 = OpFDiv %242 %248 %254
+ %258 = OpCompositeExtract %9 %255 0
+ %260 = OpFMul %9 %258 %259
+ %261 = OpConvertFToS %6 %260
+ %263 = OpCompositeExtract %9 %255 1
+ %264 = OpFMul %9 %263 %259
+ %265 = OpConvertFToS %6 %264
+ %266 = OpCompositeConstruct %7 %261 %265
+ OpSelectionMerge %341 None
+ OpSwitch %28 %291
+ %291 = OpLabel
+ OpBranch %292
+ %292 = OpLabel
+ %355 = OpPhi %7 %266 %291 %354 %337
+ %295 = OpCompositeExtract %6 %355 1
+ %296 = OpINotEqual %26 %295 %25
+ OpLoopMerge %338 %337 None
+ OpBranchConditional %296 %297 %338
+ %297 = OpLabel
+ %299 = OpCompositeExtract %6 %355 0
+ OpStore %285 %190
+ %302 = OpAccessChain %22 %285 %295
+ %303 = OpLoad %6 %302
+ %304 = OpIAdd %6 %303 %185
+ %305 = OpSLessThan %26 %299 %304
+ OpBranch %306
+ %306 = OpLabel
+ OpSelectionMerge %516 None
+ OpBranchConditional %305 %517 %516
+ %517 = OpLabel
+ OpStore %286 %190
+ OpBranch %516
+ %516 = OpLabel
+ %311 = OpAccessChain %22 %286 %295
+ OpSelectionMerge %518 None
+ OpBranchConditional %305 %519 %521
+ %519 = OpLabel
+ %520 = OpLoad %6 %311
+ OpBranch %518
+ %521 = OpLabel
+ %522 = OpCopyObject %6 %523
+ OpBranch %518
+ %518 = OpLabel
+ %312 = OpPhi %6 %520 %519 %522 %521
+ %313 = OpISub %6 %312 %185
+ %314 = OpSGreaterThan %26 %299 %313
+ OpSelectionMerge %315 None
+ OpBranchConditional %305 %532 %533
+ %532 = OpLabel
+ OpBranch %315
+ %533 = OpLabel
+ OpBranch %315
+ %315 = OpLabel
+ %316 = OpPhi %26 %314 %532 %305 %533
+ OpSelectionMerge %333 None
+ OpBranchConditional %316 %317 %333
+ %317 = OpLabel
+ OpStore %288 %190
+ %322 = OpAccessChain %22 %288 %295
+ %323 = OpLoad %6 %322
+ %324 = OpISub %6 %299 %323
+ %325 = OpConvertSToF %9 %324
+ %326 = OpExtInst %9 %1 FAbs %325
+ %327 = OpFSub %9 %215 %326
+ %328 = OpFMul %9 %327 %365
+ %332 = OpCompositeConstruct %10 %328 %328 %328 %231
+ OpBranch %338
+ %333 = OpLabel
+ %336 = OpIAdd %6 %295 %236
+ %354 = OpCompositeInsert %7 %336 %355 1
+ OpBranch %337
+ %337 = OpLabel
+ OpBranch %292
+ %338 = OpLabel
+ %361 = OpPhi %10 %363 %292 %332 %317
+ %357 = OpPhi %26 %277 %292 %280 %317
+ OpSelectionMerge %340 None
+ OpBranchConditional %357 %341 %340
+ %340 = OpLabel
+ OpBranch %341
+ %341 = OpLabel
+ %360 = OpPhi %10 %361 %338 %239 %340
+ OpStore %268 %360
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 524
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %246 %268
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %246 "gl_FragCoord"
+ OpName %249 "buf0"
+ OpMemberName %249 0 "resolution"
+ OpName %251 ""
+ OpName %268 "_GLF_color"
+ OpDecorate %246 BuiltIn FragCoord
+ OpMemberDecorate %249 0 Offset 0
+ OpDecorate %249 Block
+ OpDecorate %251 DescriptorSet 0
+ OpDecorate %251 Binding 0
+ OpDecorate %268 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypeVector %6 2
+ %9 = OpTypeFloat 32
+ %10 = OpTypeVector %9 4
+ %20 = OpTypeInt 32 0
+ %22 = OpTypePointer Function %6
+ %25 = OpConstant %6 256
+ %26 = OpTypeBool
+ %28 = OpConstant %20 0
+ %31 = OpConstant %20 256
+ %32 = OpTypeArray %6 %31
+ %33 = OpConstant %6 115
+ %34 = OpConstant %6 133
+ %35 = OpConstant %6 150
+ %36 = OpConstant %6 164
+ %37 = OpConstant %6 176
+ %38 = OpConstant %6 184
+ %39 = OpConstant %6 190
+ %40 = OpConstant %6 192
+ %41 = OpConstant %6 191
+ %42 = OpConstant %6 187
+ %43 = OpConstant %6 181
+ %44 = OpConstant %6 172
+ %45 = OpConstant %6 163
+ %46 = OpConstant %6 153
+ %47 = OpConstant %6 143
+ %48 = OpConstant %6 134
+ %49 = OpConstant %6 126
+ %50 = OpConstant %6 120
+ %51 = OpConstant %6 116
+ %52 = OpConstant %6 114
+ %53 = OpConstant %6 117
+ %54 = OpConstant %6 121
+ %55 = OpConstant %6 127
+ %56 = OpConstant %6 141
+ %57 = OpConstant %6 148
+ %58 = OpConstant %6 154
+ %59 = OpConstant %6 159
+ %60 = OpConstant %6 162
+ %61 = OpConstant %6 161
+ %62 = OpConstant %6 157
+ %63 = OpConstant %6 151
+ %64 = OpConstant %6 124
+ %65 = OpConstant %6 113
+ %66 = OpConstant %6 103
+ %67 = OpConstant %6 94
+ %68 = OpConstant %6 87
+ %69 = OpConstant %6 82
+ %70 = OpConstant %6 79
+ %71 = OpConstant %6 80
+ %72 = OpConstant %6 84
+ %73 = OpConstant %6 91
+ %74 = OpConstant %6 101
+ %75 = OpConstant %6 130
+ %76 = OpConstant %6 146
+ %77 = OpConstant %6 182
+ %78 = OpConstant %6 199
+ %79 = OpConstant %6 215
+ %80 = OpConstant %6 229
+ %81 = OpConstant %6 240
+ %82 = OpConstant %6 249
+ %83 = OpConstant %6 254
+ %84 = OpConstant %6 250
+ %85 = OpConstant %6 243
+ %86 = OpConstant %6 233
+ %87 = OpConstant %6 223
+ %88 = OpConstant %6 212
+ %89 = OpConstant %6 200
+ %90 = OpConstant %6 180
+ %91 = OpConstant %6 166
+ %92 = OpConstant %6 169
+ %93 = OpConstant %6 174
+ %94 = OpConstant %6 179
+ %95 = OpConstant %6 185
+ %96 = OpConstant %6 193
+ %97 = OpConstant %6 195
+ %98 = OpConstant %6 188
+ %99 = OpConstant %6 171
+ %100 = OpConstant %6 149
+ %101 = OpConstant %6 137
+ %102 = OpConstant %6 125
+ %103 = OpConstant %6 105
+ %104 = OpConstant %6 97
+ %105 = OpConstant %6 93
+ %106 = OpConstant %6 98
+ %107 = OpConstant %6 106
+ %108 = OpConstant %6 145
+ %109 = OpConstant %6 177
+ %110 = OpConstant %6 208
+ %111 = OpConstant %6 221
+ %112 = OpConstant %6 231
+ %113 = OpConstant %6 239
+ %114 = OpConstant %6 244
+ %115 = OpConstant %6 242
+ %116 = OpConstant %6 236
+ %117 = OpConstant %6 228
+ %118 = OpConstant %6 218
+ %119 = OpConstant %6 207
+ %120 = OpConstant %6 194
+ %121 = OpConstant %6 158
+ %122 = OpConstant %6 135
+ %123 = OpConstant %6 132
+ %124 = OpConstant %6 131
+ %125 = OpConstant %6 138
+ %126 = OpConstant %6 147
+ %127 = OpConstant %6 155
+ %128 = OpConstant %6 152
+ %129 = OpConstant %6 139
+ %130 = OpConstant %6 129
+ %131 = OpConstant %6 118
+ %132 = OpConstant %6 68
+ %133 = OpConstant %6 58
+ %134 = OpConstant %6 49
+ %135 = OpConstant %6 43
+ %136 = OpConstant %6 40
+ %137 = OpConstant %6 41
+ %138 = OpConstant %6 44
+ %139 = OpConstant %6 51
+ %140 = OpConstant %6 61
+ %141 = OpConstant %6 73
+ %142 = OpConstant %6 119
+ %143 = OpConstant %6 173
+ %144 = OpConstant %6 186
+ %145 = OpConstant %6 128
+ %146 = OpConstant %6 104
+ %147 = OpConstant %6 86
+ %148 = OpConstant %6 81
+ %149 = OpConstant %6 77
+ %150 = OpConstant %6 76
+ %151 = OpConstant %6 89
+ %152 = OpConstant %6 102
+ %153 = OpConstant %6 92
+ %154 = OpConstant %6 83
+ %155 = OpConstant %6 62
+ %156 = OpConstant %6 50
+ %157 = OpConstant %6 38
+ %158 = OpConstant %6 26
+ %159 = OpConstant %6 16
+ %160 = OpConstant %6 8
+ %161 = OpConstant %6 2
+ %162 = OpConstant %6 0
+ %163 = OpConstant %6 4
+ %164 = OpConstant %6 11
+ %165 = OpConstant %6 21
+ %166 = OpConstant %6 33
+ %167 = OpConstant %6 48
+ %168 = OpConstant %6 64
+ %169 = OpConstant %6 144
+ %170 = OpConstant %6 123
+ %171 = OpConstant %6 112
+ %172 = OpConstant %6 100
+ %173 = OpConstant %6 90
+ %174 = OpConstant %6 65
+ %175 = OpConstant %6 67
+ %176 = OpConstant %6 70
+ %177 = OpConstant %6 75
+ %178 = OpConstant %6 95
+ %179 = OpConstant %6 88
+ %180 = OpConstant %6 69
+ %181 = OpConstant %6 47
+ %182 = OpConstant %6 36
+ %183 = OpConstant %6 18
+ %184 = OpConstant %6 13
+ %185 = OpConstant %6 15
+ %186 = OpConstant %6 22
+ %187 = OpConstant %6 32
+ %188 = OpConstant %6 45
+ %189 = OpConstant %6 60
+ %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
+ %193 = OpTypePointer Function %32
+ %215 = OpConstant %9 15
+ %231 = OpConstant %9 1
+ %236 = OpConstant %6 1
+ %238 = OpConstant %9 0
+ %239 = OpConstantComposite %10 %238 %238 %238 %231
+ %242 = OpTypeVector %9 2
+ %245 = OpTypePointer Input %10
+ %246 = OpVariable %245 Input
+ %249 = OpTypeStruct %242
+ %250 = OpTypePointer Uniform %249
+ %251 = OpVariable %250 Uniform
+ %252 = OpTypePointer Uniform %242
+ %259 = OpConstant %9 256
+ %267 = OpTypePointer Output %10
+ %268 = OpVariable %267 Output
+ %277 = OpConstantFalse %26
+ %280 = OpConstantTrue %26
+ %363 = OpUndef %10
+ %365 = OpConstant %9 0.0666666701
+ %523 = OpConstant %6 0
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %285 = OpVariable %193 Function
+ %286 = OpVariable %193 Function
+ %288 = OpVariable %193 Function
+ %247 = OpLoad %10 %246
+ %248 = OpVectorShuffle %242 %247 %247 0 1
+ %253 = OpAccessChain %252 %251 %162
+ %254 = OpLoad %242 %253
+ %255 = OpFDiv %242 %248 %254
+ %258 = OpCompositeExtract %9 %255 0
+ %260 = OpFMul %9 %258 %259
+ %261 = OpConvertFToS %6 %260
+ %263 = OpCompositeExtract %9 %255 1
+ %264 = OpFMul %9 %263 %259
+ %265 = OpConvertFToS %6 %264
+ %266 = OpCompositeConstruct %7 %261 %265
+ OpSelectionMerge %341 None
+ OpSwitch %28 %291
+ %291 = OpLabel
+ OpBranch %292
+ %292 = OpLabel
+ %355 = OpPhi %7 %266 %291 %354 %337
+ %295 = OpCompositeExtract %6 %355 1
+ %296 = OpINotEqual %26 %295 %25
+ OpLoopMerge %338 %337 None
+ OpBranchConditional %296 %297 %338
+ %297 = OpLabel
+ %299 = OpCompositeExtract %6 %355 0
+ OpStore %285 %190
+ %302 = OpAccessChain %22 %285 %295
+ %303 = OpLoad %6 %302
+ %304 = OpIAdd %6 %303 %185
+ %305 = OpSLessThan %26 %299 %304
+ OpBranch %306
+ %306 = OpLabel
+ OpSelectionMerge %516 None
+ OpBranchConditional %305 %517 %516
+ %517 = OpLabel
+ OpStore %286 %190
+ OpBranch %516
+ %516 = OpLabel
+ %311 = OpAccessChain %22 %286 %295
+ OpSelectionMerge %518 None
+ OpBranchConditional %305 %519 %521
+ %519 = OpLabel
+ %520 = OpLoad %6 %311
+ OpBranch %518
+ %521 = OpLabel
+ %522 = OpCopyObject %6 %523
+ OpBranch %518
+ %518 = OpLabel
+ %312 = OpPhi %6 %520 %519 %522 %521
+ %313 = OpISub %6 %312 %185
+ %314 = OpSGreaterThan %26 %299 %313
+ OpBranch %315
+ %315 = OpLabel
+ %316 = OpSelect %26 %305 %314 %305
+ OpSelectionMerge %333 None
+ OpBranchConditional %316 %317 %333
+ %317 = OpLabel
+ OpStore %288 %190
+ %322 = OpAccessChain %22 %288 %295
+ %323 = OpLoad %6 %322
+ %324 = OpISub %6 %299 %323
+ %325 = OpConvertSToF %9 %324
+ %326 = OpExtInst %9 %1 FAbs %325
+ %327 = OpFSub %9 %215 %326
+ %328 = OpFMul %9 %327 %365
+ %332 = OpCompositeConstruct %10 %328 %328 %328 %231
+ OpBranch %338
+ %333 = OpLabel
+ %336 = OpIAdd %6 %295 %236
+ %354 = OpCompositeInsert %7 %336 %355 1
+ OpBranch %337
+ %337 = OpLabel
+ OpBranch %292
+ %338 = OpLabel
+ %361 = OpPhi %10 %363 %292 %332 %317
+ %357 = OpPhi %26 %277 %292 %280 %317
+ OpSelectionMerge %340 None
+ OpBranchConditional %357 %341 %340
+ %340 = OpLabel
+ OpBranch %341
+ %341 = OpLabel
+ %360 = OpPhi %10 %361 %338 %239 %340
+ OpStore %268 %360
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# resolution
+BUFFER variant_2_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Two shaders with diff: added mat3x3 func param
+
+# The test renders two images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 331
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %183 %324
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %11 "swap(i1;i1;"
+ OpName %9 "i"
+ OpName %10 "j"
+ OpName %16 "performPartition(i1;i1;"
+ OpName %14 "l"
+ OpName %15 "h"
+ OpName %18 "quicksort("
+ OpName %20 "temp"
+ OpName %24 "QuicksortObject"
+ OpMemberName %24 0 "numbers"
+ OpName %26 "obj"
+ OpName %40 "pivot"
+ OpName %44 "i"
+ OpName %48 "j"
+ OpName %69 "param"
+ OpName %71 "param"
+ OpName %78 "param"
+ OpName %80 "param"
+ OpName %86 "l"
+ OpName %87 "h"
+ OpName %89 "top"
+ OpName %92 "stack"
+ OpName %116 "p"
+ OpName %117 "param"
+ OpName %119 "param"
+ OpName %152 "i"
+ OpName %180 "uv"
+ OpName %183 "gl_FragCoord"
+ OpName %186 "buf0"
+ OpMemberName %186 0 "resolution"
+ OpName %188 ""
+ OpName %195 "color"
+ OpName %324 "_GLF_color"
+ OpDecorate %183 BuiltIn FragCoord
+ OpMemberDecorate %186 0 Offset 0
+ OpDecorate %186 Block
+ OpDecorate %188 DescriptorSet 0
+ OpDecorate %188 Binding 0
+ OpDecorate %324 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeFunction %2 %7 %7
+ %13 = OpTypeFunction %6 %7 %7
+ %21 = OpTypeInt 32 0
+ %22 = OpConstant %21 10
+ %23 = OpTypeArray %6 %22
+ %24 = OpTypeStruct %23
+ %25 = OpTypePointer Private %24
+ %26 = OpVariable %25 Private
+ %27 = OpConstant %6 0
+ %29 = OpTypePointer Private %6
+ %46 = OpConstant %6 1
+ %58 = OpTypeBool
+ %88 = OpConstant %6 9
+ %90 = OpConstant %6 -1
+ %91 = OpTypePointer Function %23
+ %159 = OpConstant %6 10
+ %177 = OpTypeFloat 32
+ %178 = OpTypeVector %177 2
+ %179 = OpTypePointer Function %178
+ %181 = OpTypeVector %177 4
+ %182 = OpTypePointer Input %181
+ %183 = OpVariable %182 Input
+ %186 = OpTypeStruct %178
+ %187 = OpTypePointer Uniform %186
+ %188 = OpVariable %187 Uniform
+ %189 = OpTypePointer Uniform %178
+ %193 = OpTypeVector %177 3
+ %194 = OpTypePointer Function %193
+ %196 = OpConstant %177 1
+ %197 = OpConstant %177 2
+ %198 = OpConstant %177 3
+ %199 = OpConstantComposite %193 %196 %197 %198
+ %203 = OpConstant %21 0
+ %204 = OpTypePointer Function %177
+ %211 = OpConstant %177 0.25
+ %224 = OpConstant %177 0.5
+ %228 = OpConstant %6 2
+ %232 = OpConstant %21 1
+ %239 = OpConstant %177 0.75
+ %243 = OpConstant %6 3
+ %247 = OpConstant %21 2
+ %252 = OpConstant %6 4
+ %265 = OpConstant %6 5
+ %278 = OpConstant %6 6
+ %291 = OpConstant %6 7
+ %299 = OpConstant %6 8
+ %323 = OpTypePointer Output %181
+ %324 = OpVariable %323 Output
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %152 = OpVariable %7 Function
+ %180 = OpVariable %179 Function
+ %195 = OpVariable %194 Function
+ OpStore %152 %27
+ OpBranch %153
+ %153 = OpLabel
+ OpLoopMerge %155 %156 None
+ OpBranch %157
+ %157 = OpLabel
+ %158 = OpLoad %6 %152
+ %160 = OpSLessThan %58 %158 %159
+ OpBranchConditional %160 %154 %155
+ %154 = OpLabel
+ %161 = OpLoad %6 %152
+ %162 = OpLoad %6 %152
+ %163 = OpISub %6 %159 %162
+ %164 = OpAccessChain %29 %26 %27 %161
+ OpStore %164 %163
+ %165 = OpLoad %6 %152
+ %166 = OpLoad %6 %152
+ %167 = OpAccessChain %29 %26 %27 %166
+ %168 = OpLoad %6 %167
+ %169 = OpLoad %6 %152
+ %170 = OpAccessChain %29 %26 %27 %169
+ %171 = OpLoad %6 %170
+ %172 = OpIMul %6 %168 %171
+ %173 = OpAccessChain %29 %26 %27 %165
+ OpStore %173 %172
+ OpBranch %156
+ %156 = OpLabel
+ %174 = OpLoad %6 %152
+ %175 = OpIAdd %6 %174 %46
+ OpStore %152 %175
+ OpBranch %153
+ %155 = OpLabel
+ %176 = OpFunctionCall %2 %18
+ %184 = OpLoad %181 %183
+ %185 = OpVectorShuffle %178 %184 %184 0 1
+ %190 = OpAccessChain %189 %188 %27
+ %191 = OpLoad %178 %190
+ %192 = OpFDiv %178 %185 %191
+ OpStore %180 %192
+ OpStore %195 %199
+ %200 = OpAccessChain %29 %26 %27 %27
+ %201 = OpLoad %6 %200
+ %202 = OpConvertSToF %177 %201
+ %205 = OpAccessChain %204 %195 %203
+ %206 = OpLoad %177 %205
+ %207 = OpFAdd %177 %206 %202
+ %208 = OpAccessChain %204 %195 %203
+ OpStore %208 %207
+ %209 = OpAccessChain %204 %180 %203
+ %210 = OpLoad %177 %209
+ %212 = OpFOrdGreaterThan %58 %210 %211
+ OpSelectionMerge %214 None
+ OpBranchConditional %212 %213 %214
+ %213 = OpLabel
+ %215 = OpAccessChain %29 %26 %27 %46
+ %216 = OpLoad %6 %215
+ %217 = OpConvertSToF %177 %216
+ %218 = OpAccessChain %204 %195 %203
+ %219 = OpLoad %177 %218
+ %220 = OpFAdd %177 %219 %217
+ %221 = OpAccessChain %204 %195 %203
+ OpStore %221 %220
+ OpBranch %214
+ %214 = OpLabel
+ %222 = OpAccessChain %204 %180 %203
+ %223 = OpLoad %177 %222
+ %225 = OpFOrdGreaterThan %58 %223 %224
+ OpSelectionMerge %227 None
+ OpBranchConditional %225 %226 %227
+ %226 = OpLabel
+ %229 = OpAccessChain %29 %26 %27 %228
+ %230 = OpLoad %6 %229
+ %231 = OpConvertSToF %177 %230
+ %233 = OpAccessChain %204 %195 %232
+ %234 = OpLoad %177 %233
+ %235 = OpFAdd %177 %234 %231
+ %236 = OpAccessChain %204 %195 %232
+ OpStore %236 %235
+ OpBranch %227
+ %227 = OpLabel
+ %237 = OpAccessChain %204 %180 %203
+ %238 = OpLoad %177 %237
+ %240 = OpFOrdGreaterThan %58 %238 %239
+ OpSelectionMerge %242 None
+ OpBranchConditional %240 %241 %242
+ %241 = OpLabel
+ %244 = OpAccessChain %29 %26 %27 %243
+ %245 = OpLoad %6 %244
+ %246 = OpConvertSToF %177 %245
+ %248 = OpAccessChain %204 %195 %247
+ %249 = OpLoad %177 %248
+ %250 = OpFAdd %177 %249 %246
+ %251 = OpAccessChain %204 %195 %247
+ OpStore %251 %250
+ OpBranch %242
+ %242 = OpLabel
+ %253 = OpAccessChain %29 %26 %27 %252
+ %254 = OpLoad %6 %253
+ %255 = OpConvertSToF %177 %254
+ %256 = OpAccessChain %204 %195 %232
+ %257 = OpLoad %177 %256
+ %258 = OpFAdd %177 %257 %255
+ %259 = OpAccessChain %204 %195 %232
+ OpStore %259 %258
+ %260 = OpAccessChain %204 %180 %232
+ %261 = OpLoad %177 %260
+ %262 = OpFOrdGreaterThan %58 %261 %211
+ OpSelectionMerge %264 None
+ OpBranchConditional %262 %263 %264
+ %263 = OpLabel
+ %266 = OpAccessChain %29 %26 %27 %265
+ %267 = OpLoad %6 %266
+ %268 = OpConvertSToF %177 %267
+ %269 = OpAccessChain %204 %195 %203
+ %270 = OpLoad %177 %269
+ %271 = OpFAdd %177 %270 %268
+ %272 = OpAccessChain %204 %195 %203
+ OpStore %272 %271
+ OpBranch %264
+ %264 = OpLabel
+ %273 = OpAccessChain %204 %180 %232
+ %274 = OpLoad %177 %273
+ %275 = OpFOrdGreaterThan %58 %274 %224
+ OpSelectionMerge %277 None
+ OpBranchConditional %275 %276 %277
+ %276 = OpLabel
+ %279 = OpAccessChain %29 %26 %27 %278
+ %280 = OpLoad %6 %279
+ %281 = OpConvertSToF %177 %280
+ %282 = OpAccessChain %204 %195 %232
+ %283 = OpLoad %177 %282
+ %284 = OpFAdd %177 %283 %281
+ %285 = OpAccessChain %204 %195 %232
+ OpStore %285 %284
+ OpBranch %277
+ %277 = OpLabel
+ %286 = OpAccessChain %204 %180 %232
+ %287 = OpLoad %177 %286
+ %288 = OpFOrdGreaterThan %58 %287 %239
+ OpSelectionMerge %290 None
+ OpBranchConditional %288 %289 %290
+ %289 = OpLabel
+ %292 = OpAccessChain %29 %26 %27 %291
+ %293 = OpLoad %6 %292
+ %294 = OpConvertSToF %177 %293
+ %295 = OpAccessChain %204 %195 %247
+ %296 = OpLoad %177 %295
+ %297 = OpFAdd %177 %296 %294
+ %298 = OpAccessChain %204 %195 %247
+ OpStore %298 %297
+ OpBranch %290
+ %290 = OpLabel
+ %300 = OpAccessChain %29 %26 %27 %299
+ %301 = OpLoad %6 %300
+ %302 = OpConvertSToF %177 %301
+ %303 = OpAccessChain %204 %195 %247
+ %304 = OpLoad %177 %303
+ %305 = OpFAdd %177 %304 %302
+ %306 = OpAccessChain %204 %195 %247
+ OpStore %306 %305
+ %307 = OpAccessChain %204 %180 %203
+ %308 = OpLoad %177 %307
+ %309 = OpAccessChain %204 %180 %232
+ %310 = OpLoad %177 %309
+ %311 = OpFSub %177 %308 %310
+ %312 = OpExtInst %177 %1 FAbs %311
+ %313 = OpFOrdLessThan %58 %312 %211
+ OpSelectionMerge %315 None
+ OpBranchConditional %313 %314 %315
+ %314 = OpLabel
+ %316 = OpAccessChain %29 %26 %27 %88
+ %317 = OpLoad %6 %316
+ %318 = OpConvertSToF %177 %317
+ %319 = OpAccessChain %204 %195 %203
+ %320 = OpLoad %177 %319
+ %321 = OpFAdd %177 %320 %318
+ %322 = OpAccessChain %204 %195 %203
+ OpStore %322 %321
+ OpBranch %315
+ %315 = OpLabel
+ %325 = OpLoad %193 %195
+ %326 = OpExtInst %193 %1 Normalize %325
+ %327 = OpCompositeExtract %177 %326 0
+ %328 = OpCompositeExtract %177 %326 1
+ %329 = OpCompositeExtract %177 %326 2
+ %330 = OpCompositeConstruct %181 %327 %328 %329 %196
+ OpStore %324 %330
+ OpReturn
+ OpFunctionEnd
+ %11 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %12 = OpLabel
+ %20 = OpVariable %7 Function
+ %28 = OpLoad %6 %9
+ %30 = OpAccessChain %29 %26 %27 %28
+ %31 = OpLoad %6 %30
+ OpStore %20 %31
+ %32 = OpLoad %6 %9
+ %33 = OpLoad %6 %10
+ %34 = OpAccessChain %29 %26 %27 %33
+ %35 = OpLoad %6 %34
+ %36 = OpAccessChain %29 %26 %27 %32
+ OpStore %36 %35
+ %37 = OpLoad %6 %10
+ %38 = OpLoad %6 %20
+ %39 = OpAccessChain %29 %26 %27 %37
+ OpStore %39 %38
+ OpReturn
+ OpFunctionEnd
+ %16 = OpFunction %6 None %13
+ %14 = OpFunctionParameter %7
+ %15 = OpFunctionParameter %7
+ %17 = OpLabel
+ %40 = OpVariable %7 Function
+ %44 = OpVariable %7 Function
+ %48 = OpVariable %7 Function
+ %69 = OpVariable %7 Function
+ %71 = OpVariable %7 Function
+ %78 = OpVariable %7 Function
+ %80 = OpVariable %7 Function
+ %41 = OpLoad %6 %15
+ %42 = OpAccessChain %29 %26 %27 %41
+ %43 = OpLoad %6 %42
+ OpStore %40 %43
+ %45 = OpLoad %6 %14
+ %47 = OpISub %6 %45 %46
+ OpStore %44 %47
+ %49 = OpLoad %6 %14
+ OpStore %48 %49
+ OpBranch %50
+ %50 = OpLabel
+ OpLoopMerge %52 %53 None
+ OpBranch %54
+ %54 = OpLabel
+ %55 = OpLoad %6 %48
+ %56 = OpLoad %6 %15
+ %57 = OpISub %6 %56 %46
+ %59 = OpSLessThanEqual %58 %55 %57
+ OpBranchConditional %59 %51 %52
+ %51 = OpLabel
+ %60 = OpLoad %6 %48
+ %61 = OpAccessChain %29 %26 %27 %60
+ %62 = OpLoad %6 %61
+ %63 = OpLoad %6 %40
+ %64 = OpSLessThanEqual %58 %62 %63
+ OpSelectionMerge %66 None
+ OpBranchConditional %64 %65 %66
+ %65 = OpLabel
+ %67 = OpLoad %6 %44
+ %68 = OpIAdd %6 %67 %46
+ OpStore %44 %68
+ %70 = OpLoad %6 %44
+ OpStore %69 %70
+ %72 = OpLoad %6 %48
+ OpStore %71 %72
+ %73 = OpFunctionCall %2 %11 %69 %71
+ OpBranch %66
+ %66 = OpLabel
+ OpBranch %53
+ %53 = OpLabel
+ %74 = OpLoad %6 %48
+ %75 = OpIAdd %6 %74 %46
+ OpStore %48 %75
+ OpBranch %50
+ %52 = OpLabel
+ %76 = OpLoad %6 %44
+ %77 = OpIAdd %6 %76 %46
+ OpStore %44 %77
+ %79 = OpLoad %6 %44
+ OpStore %78 %79
+ %81 = OpLoad %6 %15
+ OpStore %80 %81
+ %82 = OpFunctionCall %2 %11 %78 %80
+ %83 = OpLoad %6 %44
+ OpReturnValue %83
+ OpFunctionEnd
+ %18 = OpFunction %2 None %3
+ %19 = OpLabel
+ %86 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %89 = OpVariable %7 Function
+ %92 = OpVariable %91 Function
+ %116 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %119 = OpVariable %7 Function
+ OpStore %86 %27
+ OpStore %87 %88
+ OpStore %89 %90
+ %93 = OpLoad %6 %89
+ %94 = OpIAdd %6 %93 %46
+ OpStore %89 %94
+ %95 = OpLoad %6 %86
+ %96 = OpAccessChain %7 %92 %94
+ OpStore %96 %95
+ %97 = OpLoad %6 %89
+ %98 = OpIAdd %6 %97 %46
+ OpStore %89 %98
+ %99 = OpLoad %6 %87
+ %100 = OpAccessChain %7 %92 %98
+ OpStore %100 %99
+ OpBranch %101
+ %101 = OpLabel
+ OpLoopMerge %103 %104 None
+ OpBranch %105
+ %105 = OpLabel
+ %106 = OpLoad %6 %89
+ %107 = OpSGreaterThanEqual %58 %106 %27
+ OpBranchConditional %107 %102 %103
+ %102 = OpLabel
+ %108 = OpLoad %6 %89
+ %109 = OpISub %6 %108 %46
+ OpStore %89 %109
+ %110 = OpAccessChain %7 %92 %108
+ %111 = OpLoad %6 %110
+ OpStore %87 %111
+ %112 = OpLoad %6 %89
+ %113 = OpISub %6 %112 %46
+ OpStore %89 %113
+ %114 = OpAccessChain %7 %92 %112
+ %115 = OpLoad %6 %114
+ OpStore %86 %115
+ %118 = OpLoad %6 %86
+ OpStore %117 %118
+ %120 = OpLoad %6 %87
+ OpStore %119 %120
+ %121 = OpFunctionCall %6 %16 %117 %119
+ OpStore %116 %121
+ %122 = OpLoad %6 %116
+ %123 = OpISub %6 %122 %46
+ %124 = OpLoad %6 %86
+ %125 = OpSGreaterThan %58 %123 %124
+ OpSelectionMerge %127 None
+ OpBranchConditional %125 %126 %127
+ %126 = OpLabel
+ %128 = OpLoad %6 %89
+ %129 = OpIAdd %6 %128 %46
+ OpStore %89 %129
+ %130 = OpLoad %6 %86
+ %131 = OpAccessChain %7 %92 %129
+ OpStore %131 %130
+ %132 = OpLoad %6 %89
+ %133 = OpIAdd %6 %132 %46
+ OpStore %89 %133
+ %134 = OpLoad %6 %116
+ %135 = OpISub %6 %134 %46
+ %136 = OpAccessChain %7 %92 %133
+ OpStore %136 %135
+ OpBranch %127
+ %127 = OpLabel
+ %137 = OpLoad %6 %116
+ %138 = OpIAdd %6 %137 %46
+ %139 = OpLoad %6 %87
+ %140 = OpSLessThan %58 %138 %139
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %143 = OpLoad %6 %89
+ %144 = OpIAdd %6 %143 %46
+ OpStore %89 %144
+ %145 = OpLoad %6 %116
+ %146 = OpIAdd %6 %145 %46
+ %147 = OpAccessChain %7 %92 %144
+ OpStore %147 %146
+ %148 = OpLoad %6 %89
+ %149 = OpIAdd %6 %148 %46
+ OpStore %89 %149
+ %150 = OpLoad %6 %87
+ %151 = OpAccessChain %7 %92 %149
+ OpStore %151 %150
+ OpBranch %142
+ %142 = OpLabel
+ OpBranch %104
+ %104 = OpLabel
+ OpBranch %101
+ %103 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 529
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %183 %324
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %11 "swap(i1;i1;"
+ OpName %9 "i"
+ OpName %10 "j"
+ OpName %16 "performPartition(i1;i1;"
+ OpName %14 "l"
+ OpName %15 "h"
+ OpName %18 "quicksort("
+ OpName %20 "temp"
+ OpName %24 "QuicksortObject"
+ OpMemberName %24 0 "numbers"
+ OpName %26 "obj"
+ OpName %40 "pivot"
+ OpName %44 "i"
+ OpName %48 "j"
+ OpName %69 "param"
+ OpName %71 "param"
+ OpName %78 "param"
+ OpName %80 "param"
+ OpName %86 "l"
+ OpName %87 "h"
+ OpName %89 "top"
+ OpName %92 "stack"
+ OpName %116 "p"
+ OpName %117 "param"
+ OpName %119 "param"
+ OpName %152 "i"
+ OpName %180 "uv"
+ OpName %183 "gl_FragCoord"
+ OpName %186 "buf0"
+ OpMemberName %186 0 "resolution"
+ OpName %188 ""
+ OpName %195 "color"
+ OpName %324 "_GLF_color"
+ OpDecorate %183 BuiltIn FragCoord
+ OpMemberDecorate %186 0 Offset 0
+ OpDecorate %186 Block
+ OpDecorate %188 DescriptorSet 0
+ OpDecorate %188 Binding 0
+ OpDecorate %324 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %13 = OpTypeFunction %6 %7 %7
+ %21 = OpTypeInt 32 0
+ %22 = OpConstant %21 10
+ %23 = OpTypeArray %6 %22
+ %24 = OpTypeStruct %23
+ %25 = OpTypePointer Private %24
+ %26 = OpVariable %25 Private
+ %27 = OpConstant %6 0
+ %29 = OpTypePointer Private %6
+ %46 = OpConstant %6 1
+ %58 = OpTypeBool
+ %88 = OpConstant %6 9
+ %90 = OpConstant %6 -1
+ %91 = OpTypePointer Function %23
+ %159 = OpConstant %6 10
+ %177 = OpTypeFloat 32
+ %178 = OpTypeVector %177 2
+ %179 = OpTypePointer Function %178
+ %181 = OpTypeVector %177 4
+ %182 = OpTypePointer Input %181
+ %183 = OpVariable %182 Input
+ %186 = OpTypeStruct %178
+ %187 = OpTypePointer Uniform %186
+ %188 = OpVariable %187 Uniform
+ %189 = OpTypePointer Uniform %178
+ %193 = OpTypeVector %177 3
+ %194 = OpTypePointer Function %193
+ %196 = OpConstant %177 1
+ %197 = OpConstant %177 2
+ %198 = OpConstant %177 3
+ %199 = OpConstantComposite %193 %196 %197 %198
+ %203 = OpConstant %21 0
+ %204 = OpTypePointer Function %177
+ %211 = OpConstant %177 0.25
+ %224 = OpConstant %177 0.5
+ %228 = OpConstant %6 2
+ %232 = OpConstant %21 1
+ %239 = OpConstant %177 0.75
+ %243 = OpConstant %6 3
+ %247 = OpConstant %21 2
+ %252 = OpConstant %6 4
+ %265 = OpConstant %6 5
+ %278 = OpConstant %6 6
+ %291 = OpConstant %6 7
+ %299 = OpConstant %6 8
+ %323 = OpTypePointer Output %181
+ %324 = OpVariable %323 Output
+ %438 = OpTypeMatrix %193 3
+ %521 = OpConstant %177 0
+ %522 = OpConstantComposite %193 %521 %521 %521
+ %527 = OpConstantComposite %438 %522 %522 %522
+ %8 = OpTypeFunction %2 %7 %7 %438
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %152 = OpVariable %7 Function
+ %180 = OpVariable %179 Function
+ %195 = OpVariable %194 Function
+ OpStore %152 %27
+ OpBranch %153
+ %153 = OpLabel
+ OpLoopMerge %155 %156 None
+ OpBranch %157
+ %157 = OpLabel
+ %158 = OpLoad %6 %152
+ %160 = OpSLessThan %58 %158 %159
+ OpBranchConditional %160 %154 %155
+ %154 = OpLabel
+ %161 = OpLoad %6 %152
+ %162 = OpLoad %6 %152
+ %163 = OpISub %6 %159 %162
+ %164 = OpAccessChain %29 %26 %27 %161
+ OpStore %164 %163
+ %165 = OpLoad %6 %152
+ %166 = OpLoad %6 %152
+ %167 = OpAccessChain %29 %26 %27 %166
+ %168 = OpLoad %6 %167
+ %169 = OpLoad %6 %152
+ %170 = OpAccessChain %29 %26 %27 %169
+ %171 = OpLoad %6 %170
+ %172 = OpIMul %6 %168 %171
+ %173 = OpAccessChain %29 %26 %27 %165
+ OpStore %173 %172
+ OpBranch %156
+ %156 = OpLabel
+ %174 = OpLoad %6 %152
+ %175 = OpIAdd %6 %174 %46
+ OpStore %152 %175
+ OpBranch %153
+ %155 = OpLabel
+ %176 = OpFunctionCall %2 %18
+ %184 = OpLoad %181 %183
+ %185 = OpVectorShuffle %178 %184 %184 0 1
+ %190 = OpAccessChain %189 %188 %27
+ %191 = OpLoad %178 %190
+ %192 = OpFDiv %178 %185 %191
+ OpStore %180 %192
+ OpStore %195 %199
+ %200 = OpAccessChain %29 %26 %27 %27
+ %201 = OpLoad %6 %200
+ %202 = OpConvertSToF %177 %201
+ %205 = OpAccessChain %204 %195 %203
+ %206 = OpLoad %177 %205
+ %207 = OpFAdd %177 %206 %202
+ %208 = OpAccessChain %204 %195 %203
+ OpStore %208 %207
+ %209 = OpAccessChain %204 %180 %203
+ %210 = OpLoad %177 %209
+ %212 = OpFOrdGreaterThan %58 %210 %211
+ OpSelectionMerge %214 None
+ OpBranchConditional %212 %213 %214
+ %213 = OpLabel
+ %215 = OpAccessChain %29 %26 %27 %46
+ %216 = OpLoad %6 %215
+ %217 = OpConvertSToF %177 %216
+ %218 = OpAccessChain %204 %195 %203
+ %219 = OpLoad %177 %218
+ %220 = OpFAdd %177 %219 %217
+ %221 = OpAccessChain %204 %195 %203
+ OpStore %221 %220
+ OpBranch %214
+ %214 = OpLabel
+ %222 = OpAccessChain %204 %180 %203
+ %223 = OpLoad %177 %222
+ %225 = OpFOrdGreaterThan %58 %223 %224
+ OpSelectionMerge %227 None
+ OpBranchConditional %225 %226 %227
+ %226 = OpLabel
+ %229 = OpAccessChain %29 %26 %27 %228
+ %230 = OpLoad %6 %229
+ %231 = OpConvertSToF %177 %230
+ %233 = OpAccessChain %204 %195 %232
+ %234 = OpLoad %177 %233
+ %235 = OpFAdd %177 %234 %231
+ %236 = OpAccessChain %204 %195 %232
+ OpStore %236 %235
+ OpBranch %227
+ %227 = OpLabel
+ %237 = OpAccessChain %204 %180 %203
+ %238 = OpLoad %177 %237
+ %240 = OpFOrdGreaterThan %58 %238 %239
+ OpSelectionMerge %242 None
+ OpBranchConditional %240 %241 %242
+ %241 = OpLabel
+ %244 = OpAccessChain %29 %26 %27 %243
+ %245 = OpLoad %6 %244
+ %246 = OpConvertSToF %177 %245
+ %248 = OpAccessChain %204 %195 %247
+ %249 = OpLoad %177 %248
+ %250 = OpFAdd %177 %249 %246
+ %251 = OpAccessChain %204 %195 %247
+ OpStore %251 %250
+ OpBranch %242
+ %242 = OpLabel
+ %253 = OpAccessChain %29 %26 %27 %252
+ %254 = OpLoad %6 %253
+ %255 = OpConvertSToF %177 %254
+ %256 = OpAccessChain %204 %195 %232
+ %257 = OpLoad %177 %256
+ %258 = OpFAdd %177 %257 %255
+ %259 = OpAccessChain %204 %195 %232
+ OpStore %259 %258
+ %260 = OpAccessChain %204 %180 %232
+ %261 = OpLoad %177 %260
+ %262 = OpFOrdGreaterThan %58 %261 %211
+ OpSelectionMerge %264 None
+ OpBranchConditional %262 %263 %264
+ %263 = OpLabel
+ %266 = OpAccessChain %29 %26 %27 %265
+ %267 = OpLoad %6 %266
+ %268 = OpConvertSToF %177 %267
+ %269 = OpAccessChain %204 %195 %203
+ %270 = OpLoad %177 %269
+ %271 = OpFAdd %177 %270 %268
+ %272 = OpAccessChain %204 %195 %203
+ OpStore %272 %271
+ OpBranch %264
+ %264 = OpLabel
+ %273 = OpAccessChain %204 %180 %232
+ %274 = OpLoad %177 %273
+ %275 = OpFOrdGreaterThan %58 %274 %224
+ OpSelectionMerge %277 None
+ OpBranchConditional %275 %276 %277
+ %276 = OpLabel
+ %279 = OpAccessChain %29 %26 %27 %278
+ %280 = OpLoad %6 %279
+ %281 = OpConvertSToF %177 %280
+ %282 = OpAccessChain %204 %195 %232
+ %283 = OpLoad %177 %282
+ %284 = OpFAdd %177 %283 %281
+ %285 = OpAccessChain %204 %195 %232
+ OpStore %285 %284
+ OpBranch %277
+ %277 = OpLabel
+ %286 = OpAccessChain %204 %180 %232
+ %287 = OpLoad %177 %286
+ %288 = OpFOrdGreaterThan %58 %287 %239
+ OpSelectionMerge %290 None
+ OpBranchConditional %288 %289 %290
+ %289 = OpLabel
+ %292 = OpAccessChain %29 %26 %27 %291
+ %293 = OpLoad %6 %292
+ %294 = OpConvertSToF %177 %293
+ %295 = OpAccessChain %204 %195 %247
+ %296 = OpLoad %177 %295
+ %297 = OpFAdd %177 %296 %294
+ %298 = OpAccessChain %204 %195 %247
+ OpStore %298 %297
+ OpBranch %290
+ %290 = OpLabel
+ %300 = OpAccessChain %29 %26 %27 %299
+ %301 = OpLoad %6 %300
+ %302 = OpConvertSToF %177 %301
+ %303 = OpAccessChain %204 %195 %247
+ %304 = OpLoad %177 %303
+ %305 = OpFAdd %177 %304 %302
+ %306 = OpAccessChain %204 %195 %247
+ OpStore %306 %305
+ %307 = OpAccessChain %204 %180 %203
+ %308 = OpLoad %177 %307
+ %309 = OpAccessChain %204 %180 %232
+ %310 = OpLoad %177 %309
+ %311 = OpFSub %177 %308 %310
+ %312 = OpExtInst %177 %1 FAbs %311
+ %313 = OpFOrdLessThan %58 %312 %211
+ OpSelectionMerge %315 None
+ OpBranchConditional %313 %314 %315
+ %314 = OpLabel
+ %316 = OpAccessChain %29 %26 %27 %88
+ %317 = OpLoad %6 %316
+ %318 = OpConvertSToF %177 %317
+ %319 = OpAccessChain %204 %195 %203
+ %320 = OpLoad %177 %319
+ %321 = OpFAdd %177 %320 %318
+ %322 = OpAccessChain %204 %195 %203
+ OpStore %322 %321
+ OpBranch %315
+ %315 = OpLabel
+ %325 = OpLoad %193 %195
+ %326 = OpExtInst %193 %1 Normalize %325
+ %327 = OpCompositeExtract %177 %326 0
+ %328 = OpCompositeExtract %177 %326 1
+ %329 = OpCompositeExtract %177 %326 2
+ %330 = OpCompositeConstruct %181 %327 %328 %329 %196
+ OpStore %324 %330
+ OpReturn
+ OpFunctionEnd
+ %11 = OpFunction %2 None %8
+ %9 = OpFunctionParameter %7
+ %10 = OpFunctionParameter %7
+ %528 = OpFunctionParameter %438
+ %12 = OpLabel
+ %20 = OpVariable %7 Function
+ %28 = OpLoad %6 %9
+ %30 = OpAccessChain %29 %26 %27 %28
+ %31 = OpLoad %6 %30
+ OpStore %20 %31
+ %32 = OpLoad %6 %9
+ %33 = OpLoad %6 %10
+ %34 = OpAccessChain %29 %26 %27 %33
+ %35 = OpLoad %6 %34
+ %36 = OpAccessChain %29 %26 %27 %32
+ OpStore %36 %35
+ %37 = OpLoad %6 %10
+ %38 = OpLoad %6 %20
+ %39 = OpAccessChain %29 %26 %27 %37
+ OpStore %39 %38
+ OpReturn
+ OpFunctionEnd
+ %16 = OpFunction %6 None %13
+ %14 = OpFunctionParameter %7
+ %15 = OpFunctionParameter %7
+ %17 = OpLabel
+ %40 = OpVariable %7 Function
+ %44 = OpVariable %7 Function
+ %48 = OpVariable %7 Function
+ %69 = OpVariable %7 Function
+ %71 = OpVariable %7 Function
+ %78 = OpVariable %7 Function
+ %80 = OpVariable %7 Function
+ %41 = OpLoad %6 %15
+ %42 = OpAccessChain %29 %26 %27 %41
+ %43 = OpLoad %6 %42
+ OpStore %40 %43
+ %45 = OpLoad %6 %14
+ %47 = OpISub %6 %45 %46
+ OpStore %44 %47
+ %49 = OpLoad %6 %14
+ OpStore %48 %49
+ OpBranch %50
+ %50 = OpLabel
+ OpLoopMerge %52 %53 None
+ OpBranch %54
+ %54 = OpLabel
+ %55 = OpLoad %6 %48
+ %56 = OpLoad %6 %15
+ %57 = OpISub %6 %56 %46
+ %59 = OpSLessThanEqual %58 %55 %57
+ OpBranchConditional %59 %51 %52
+ %51 = OpLabel
+ %60 = OpLoad %6 %48
+ %61 = OpAccessChain %29 %26 %27 %60
+ %62 = OpLoad %6 %61
+ %63 = OpLoad %6 %40
+ %64 = OpSLessThanEqual %58 %62 %63
+ OpSelectionMerge %66 None
+ OpBranchConditional %64 %65 %66
+ %65 = OpLabel
+ %67 = OpLoad %6 %44
+ %68 = OpIAdd %6 %67 %46
+ OpStore %44 %68
+ %70 = OpLoad %6 %44
+ OpStore %69 %70
+ %72 = OpLoad %6 %48
+ OpStore %71 %72
+ %73 = OpFunctionCall %2 %11 %69 %71 %527
+ OpBranch %66
+ %66 = OpLabel
+ OpBranch %53
+ %53 = OpLabel
+ %74 = OpLoad %6 %48
+ %75 = OpIAdd %6 %74 %46
+ OpStore %48 %75
+ OpBranch %50
+ %52 = OpLabel
+ %76 = OpLoad %6 %44
+ %77 = OpIAdd %6 %76 %46
+ OpStore %44 %77
+ %79 = OpLoad %6 %44
+ OpStore %78 %79
+ %81 = OpLoad %6 %15
+ OpStore %80 %81
+ %82 = OpFunctionCall %2 %11 %78 %80 %527
+ %83 = OpLoad %6 %44
+ OpReturnValue %83
+ OpFunctionEnd
+ %18 = OpFunction %2 None %3
+ %19 = OpLabel
+ %86 = OpVariable %7 Function
+ %87 = OpVariable %7 Function
+ %89 = OpVariable %7 Function
+ %92 = OpVariable %91 Function
+ %116 = OpVariable %7 Function
+ %117 = OpVariable %7 Function
+ %119 = OpVariable %7 Function
+ OpStore %86 %27
+ OpStore %87 %88
+ OpStore %89 %90
+ %93 = OpLoad %6 %89
+ %94 = OpIAdd %6 %93 %46
+ OpStore %89 %94
+ %95 = OpLoad %6 %86
+ %96 = OpAccessChain %7 %92 %94
+ OpStore %96 %95
+ %97 = OpLoad %6 %89
+ %98 = OpIAdd %6 %97 %46
+ OpStore %89 %98
+ %99 = OpLoad %6 %87
+ %100 = OpAccessChain %7 %92 %98
+ OpStore %100 %99
+ OpBranch %101
+ %101 = OpLabel
+ OpLoopMerge %103 %104 None
+ OpBranch %105
+ %105 = OpLabel
+ %106 = OpLoad %6 %89
+ %107 = OpSGreaterThanEqual %58 %106 %27
+ OpBranchConditional %107 %102 %103
+ %102 = OpLabel
+ %108 = OpLoad %6 %89
+ %109 = OpISub %6 %108 %46
+ OpStore %89 %109
+ %110 = OpAccessChain %7 %92 %108
+ %111 = OpLoad %6 %110
+ OpStore %87 %111
+ %112 = OpLoad %6 %89
+ %113 = OpISub %6 %112 %46
+ OpStore %89 %113
+ %114 = OpAccessChain %7 %92 %112
+ %115 = OpLoad %6 %114
+ OpStore %86 %115
+ %118 = OpLoad %6 %86
+ OpStore %117 %118
+ %120 = OpLoad %6 %87
+ OpStore %119 %120
+ %121 = OpFunctionCall %6 %16 %117 %119
+ OpStore %116 %121
+ %122 = OpLoad %6 %116
+ %123 = OpISub %6 %122 %46
+ %124 = OpLoad %6 %86
+ %125 = OpSGreaterThan %58 %123 %124
+ OpSelectionMerge %127 None
+ OpBranchConditional %125 %126 %127
+ %126 = OpLabel
+ %128 = OpLoad %6 %89
+ %129 = OpIAdd %6 %128 %46
+ OpStore %89 %129
+ %130 = OpLoad %6 %86
+ %131 = OpAccessChain %7 %92 %129
+ OpStore %131 %130
+ %132 = OpLoad %6 %89
+ %133 = OpIAdd %6 %132 %46
+ OpStore %89 %133
+ %134 = OpLoad %6 %116
+ %135 = OpISub %6 %134 %46
+ %136 = OpAccessChain %7 %92 %133
+ OpStore %136 %135
+ OpBranch %127
+ %127 = OpLabel
+ %137 = OpLoad %6 %116
+ %138 = OpIAdd %6 %137 %46
+ %139 = OpLoad %6 %87
+ %140 = OpSLessThan %58 %138 %139
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %143 = OpLoad %6 %89
+ %144 = OpIAdd %6 %143 %46
+ OpStore %89 %144
+ %145 = OpLoad %6 %116
+ %146 = OpIAdd %6 %145 %46
+ %147 = OpAccessChain %7 %92 %144
+ OpStore %147 %146
+ %148 = OpLoad %6 %89
+ %149 = OpIAdd %6 %148 %46
+ OpStore %89 %149
+ %150 = OpLoad %6 %87
+ %151 = OpAccessChain %7 %92 %149
+ OpStore %151 %150
+ OpBranch %142
+ %142 = OpLabel
+ OpBranch %104
+ %104 = OpLabel
+ OpBranch %101
+ %103 = OpLabel
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
--- /dev/null
+#!amber
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# A test for a bug found by the GraphicsFuzz project.
+
+# Short description: Three shaders diff: new variable used and mutated
+
+# The test renders three images using semantically equivalent shaders, and then
+# checks that the images are similar.
+# The test passes because the shaders have the same semantics and so the images
+# should be the same.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 286
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %165 %180
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %165 "gl_FragCoord"
+ OpName %168 "buf0"
+ OpMemberName %168 0 "resolution"
+ OpName %170 ""
+ OpName %180 "_GLF_color"
+ OpDecorate %165 BuiltIn FragCoord
+ OpMemberDecorate %168 0 Offset 0
+ OpDecorate %168 Block
+ OpDecorate %170 DescriptorSet 0
+ OpDecorate %170 Binding 0
+ OpDecorate %180 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %9 = OpTypeVector %6 4
+ %10 = OpTypePointer Function %9
+ %11 = OpTypeBool
+ %21 = OpTypeInt 32 0
+ %22 = OpConstant %21 0
+ %23 = OpTypePointer Function %6
+ %31 = OpConstantFalse %11
+ %33 = OpConstant %21 1
+ %66 = OpConstantTrue %11
+ %70 = OpConstant %6 0.5
+ %71 = OpConstant %6 1
+ %72 = OpConstantComposite %9 %70 %70 %71 %71
+ %73 = OpTypeInt 32 1
+ %76 = OpConstant %73 0
+ %83 = OpConstant %73 8
+ %85 = OpConstant %21 8
+ %86 = OpTypeArray %9 %85
+ %87 = OpConstant %6 4
+ %88 = OpConstant %6 20
+ %89 = OpConstantComposite %9 %87 %87 %88 %87
+ %90 = OpConstantComposite %9 %87 %87 %87 %88
+ %91 = OpConstantComposite %9 %87 %88 %88 %87
+ %92 = OpConstant %6 8
+ %93 = OpConstantComposite %9 %88 %87 %87 %92
+ %94 = OpConstant %6 6
+ %95 = OpConstant %6 2
+ %96 = OpConstantComposite %9 %92 %94 %87 %95
+ %97 = OpConstant %6 12
+ %98 = OpConstantComposite %9 %95 %97 %95 %87
+ %99 = OpConstant %6 16
+ %100 = OpConstantComposite %9 %99 %95 %87 %87
+ %101 = OpConstant %6 22
+ %102 = OpConstantComposite %9 %97 %101 %87 %87
+ %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+ %108 = OpTypePointer Function %86
+ %115 = OpConstant %21 16
+ %116 = OpTypeArray %9 %115
+ %117 = OpConstant %6 0
+ %118 = OpConstantComposite %9 %117 %117 %117 %71
+ %119 = OpConstantComposite %9 %70 %117 %117 %71
+ %120 = OpConstantComposite %9 %117 %70 %117 %71
+ %121 = OpConstantComposite %9 %70 %70 %117 %71
+ %122 = OpConstantComposite %9 %117 %117 %70 %71
+ %123 = OpConstantComposite %9 %70 %117 %70 %71
+ %124 = OpConstantComposite %9 %117 %70 %70 %71
+ %125 = OpConstantComposite %9 %70 %70 %70 %71
+ %126 = OpConstantComposite %9 %71 %117 %117 %71
+ %127 = OpConstantComposite %9 %117 %71 %117 %71
+ %128 = OpConstantComposite %9 %71 %71 %117 %71
+ %129 = OpConstantComposite %9 %117 %117 %71 %71
+ %130 = OpConstantComposite %9 %71 %117 %71 %71
+ %131 = OpConstantComposite %9 %117 %71 %71 %71
+ %132 = OpConstantComposite %9 %71 %71 %71 %71
+ %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+ %146 = OpConstant %73 9
+ %149 = OpConstant %73 11
+ %151 = OpConstant %73 16
+ %153 = OpTypePointer Function %116
+ %158 = OpConstant %73 1
+ %164 = OpTypePointer Input %9
+ %165 = OpVariable %164 Input
+ %168 = OpTypeStruct %7
+ %169 = OpTypePointer Uniform %168
+ %170 = OpVariable %169 Uniform
+ %171 = OpTypePointer Uniform %7
+ %176 = OpConstant %6 32
+ %179 = OpTypePointer Output %9
+ %180 = OpVariable %179 Output
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %199 = OpVariable %108 Function
+ %200 = OpVariable %108 Function
+ %201 = OpVariable %108 Function
+ %202 = OpVariable %153 Function
+ %166 = OpLoad %9 %165
+ %167 = OpVectorShuffle %7 %166 %166 0 1
+ %172 = OpAccessChain %171 %170 %76
+ %173 = OpLoad %7 %172
+ %174 = OpFDiv %7 %167 %173
+ %177 = OpVectorTimesScalar %7 %174 %176
+ %178 = OpExtInst %7 %1 Floor %177
+ OpBranch %205
+ %205 = OpLabel
+ %280 = OpPhi %9 %72 %5 %285 %233
+ %279 = OpPhi %73 %76 %5 %235 %233
+ %208 = OpSLessThan %11 %279 %83
+ OpLoopMerge %236 %233 None
+ OpBranchConditional %208 %209 %236
+ %209 = OpLabel
+ OpStore %199 %103
+ %212 = OpAccessChain %10 %199 %279
+ %213 = OpLoad %9 %212
+ OpSelectionMerge %277 None
+ OpSwitch %22 %242
+ %242 = OpLabel
+ %244 = OpCompositeExtract %6 %178 0
+ %246 = OpCompositeExtract %6 %213 0
+ %247 = OpFOrdLessThan %11 %244 %246
+ OpSelectionMerge %249 None
+ OpBranchConditional %247 %248 %249
+ %248 = OpLabel
+ OpBranch %277
+ %249 = OpLabel
+ %251 = OpCompositeExtract %6 %178 1
+ %253 = OpCompositeExtract %6 %213 1
+ %254 = OpFOrdLessThan %11 %251 %253
+ OpSelectionMerge %256 None
+ OpBranchConditional %254 %255 %256
+ %255 = OpLabel
+ OpBranch %277
+ %256 = OpLabel
+ %262 = OpCompositeExtract %6 %213 2
+ %263 = OpFAdd %6 %246 %262
+ %264 = OpFOrdGreaterThan %11 %244 %263
+ OpSelectionMerge %266 None
+ OpBranchConditional %264 %265 %266
+ %265 = OpLabel
+ OpBranch %277
+ %266 = OpLabel
+ %272 = OpCompositeExtract %6 %213 3
+ %273 = OpFAdd %6 %253 %272
+ %274 = OpFOrdGreaterThan %11 %251 %273
+ OpSelectionMerge %276 None
+ OpBranchConditional %274 %275 %276
+ %275 = OpLabel
+ OpBranch %277
+ %276 = OpLabel
+ OpBranch %277
+ %277 = OpLabel
+ %282 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276
+ OpSelectionMerge %232 None
+ OpBranchConditional %282 %215 %232
+ %215 = OpLabel
+ OpStore %200 %103
+ %217 = OpAccessChain %23 %200 %279 %22
+ %218 = OpLoad %6 %217
+ %219 = OpConvertFToS %73 %218
+ OpStore %201 %103
+ %221 = OpAccessChain %23 %201 %279 %33
+ %222 = OpLoad %6 %221
+ %223 = OpConvertFToS %73 %222
+ %224 = OpIMul %73 %219 %223
+ %226 = OpIMul %73 %279 %146
+ %227 = OpIAdd %73 %224 %226
+ %228 = OpIAdd %73 %227 %149
+ %229 = OpSMod %73 %228 %151
+ OpStore %202 %133
+ %230 = OpAccessChain %10 %202 %229
+ %231 = OpLoad %9 %230
+ OpBranch %232
+ %232 = OpLabel
+ %285 = OpPhi %9 %280 %277 %231 %215
+ OpBranch %233
+ %233 = OpLabel
+ %235 = OpIAdd %73 %279 %158
+ OpBranch %205
+ %236 = OpLabel
+ OpStore %180 %280
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics reference_pipeline
+ ATTACH reference_vertex_shader
+ ATTACH reference_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER reference_framebuffer AS color LOCATION 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR reference_pipeline 0 0 0 255
+
+CLEAR reference_pipeline
+RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 517
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %165 %180
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %165 "gl_FragCoord"
+ OpName %168 "buf0"
+ OpMemberName %168 0 "resolution"
+ OpName %170 ""
+ OpName %180 "_GLF_color"
+ OpDecorate %165 BuiltIn FragCoord
+ OpMemberDecorate %168 0 Offset 0
+ OpDecorate %168 Block
+ OpDecorate %170 DescriptorSet 0
+ OpDecorate %170 Binding 0
+ OpDecorate %180 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %9 = OpTypeVector %6 4
+ %10 = OpTypePointer Function %9
+ %11 = OpTypeBool
+ %21 = OpTypeInt 32 0
+ %22 = OpConstant %21 0
+ %23 = OpTypePointer Function %6
+ %31 = OpConstantFalse %11
+ %33 = OpConstant %21 1
+ %66 = OpConstantTrue %11
+ %70 = OpConstant %6 0.5
+ %71 = OpConstant %6 1
+ %72 = OpConstantComposite %9 %70 %70 %71 %71
+ %73 = OpTypeInt 32 1
+ %76 = OpConstant %73 0
+ %83 = OpConstant %73 8
+ %85 = OpConstant %21 8
+ %86 = OpTypeArray %9 %85
+ %87 = OpConstant %6 4
+ %88 = OpConstant %6 20
+ %89 = OpConstantComposite %9 %87 %87 %88 %87
+ %90 = OpConstantComposite %9 %87 %87 %87 %88
+ %91 = OpConstantComposite %9 %87 %88 %88 %87
+ %92 = OpConstant %6 8
+ %93 = OpConstantComposite %9 %88 %87 %87 %92
+ %94 = OpConstant %6 6
+ %95 = OpConstant %6 2
+ %96 = OpConstantComposite %9 %92 %94 %87 %95
+ %97 = OpConstant %6 12
+ %98 = OpConstantComposite %9 %95 %97 %95 %87
+ %99 = OpConstant %6 16
+ %100 = OpConstantComposite %9 %99 %95 %87 %87
+ %101 = OpConstant %6 22
+ %102 = OpConstantComposite %9 %97 %101 %87 %87
+ %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+ %108 = OpTypePointer Function %86
+ %115 = OpConstant %21 16
+ %116 = OpTypeArray %9 %115
+ %117 = OpConstant %6 0
+ %118 = OpConstantComposite %9 %117 %117 %117 %71
+ %119 = OpConstantComposite %9 %70 %117 %117 %71
+ %120 = OpConstantComposite %9 %117 %70 %117 %71
+ %121 = OpConstantComposite %9 %70 %70 %117 %71
+ %122 = OpConstantComposite %9 %117 %117 %70 %71
+ %123 = OpConstantComposite %9 %70 %117 %70 %71
+ %124 = OpConstantComposite %9 %117 %70 %70 %71
+ %125 = OpConstantComposite %9 %70 %70 %70 %71
+ %126 = OpConstantComposite %9 %71 %117 %117 %71
+ %127 = OpConstantComposite %9 %117 %71 %117 %71
+ %128 = OpConstantComposite %9 %71 %71 %117 %71
+ %129 = OpConstantComposite %9 %117 %117 %71 %71
+ %130 = OpConstantComposite %9 %71 %117 %71 %71
+ %131 = OpConstantComposite %9 %117 %71 %71 %71
+ %132 = OpConstantComposite %9 %71 %71 %71 %71
+ %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+ %146 = OpConstant %73 9
+ %149 = OpConstant %73 11
+ %151 = OpConstant %73 16
+ %153 = OpTypePointer Function %116
+ %158 = OpConstant %73 1
+ %164 = OpTypePointer Input %9
+ %165 = OpVariable %164 Input
+ %168 = OpTypeStruct %7
+ %169 = OpTypePointer Uniform %168
+ %170 = OpVariable %169 Uniform
+ %171 = OpTypePointer Uniform %7
+ %176 = OpConstant %6 32
+ %179 = OpTypePointer Output %9
+ %180 = OpVariable %179 Output
+ %386 = OpConstantComposite %9 %117 %117 %117 %117
+ %387 = OpConstantComposite %86 %386 %386 %386 %386 %386 %386 %386 %386
+ %498 = OpConstant %6 0
+ %499 = OpConstantComposite %9 %498 %498 %498 %498
+ %503 = OpConstantComposite %86 %499 %499 %499 %499 %499 %499 %499 %499
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %389 = OpVariable %108 Function %387
+ %199 = OpVariable %108 Function
+ %200 = OpVariable %108 Function
+ %201 = OpVariable %108 Function
+ %202 = OpVariable %153 Function
+ OpStore %389 %103
+ %388 = OpLoad %86 %389
+ %166 = OpLoad %9 %165
+ %167 = OpVectorShuffle %7 %166 %166 0 1
+ %172 = OpAccessChain %171 %170 %76
+ %173 = OpLoad %7 %172
+ %174 = OpFDiv %7 %167 %173
+ %177 = OpVectorTimesScalar %7 %174 %176
+ %178 = OpExtInst %7 %1 Floor %177
+ OpBranch %205
+ %205 = OpLabel
+ %280 = OpPhi %9 %72 %5 %285 %233
+ %279 = OpPhi %73 %76 %5 %235 %233
+ %208 = OpSLessThan %11 %279 %83
+ OpLoopMerge %236 %233 None
+ OpBranchConditional %208 %209 %236
+ %209 = OpLabel
+ OpStore %199 %388
+ %212 = OpAccessChain %10 %199 %279
+ %213 = OpLoad %9 %212
+ OpSelectionMerge %277 None
+ OpSwitch %22 %242
+ %242 = OpLabel
+ %244 = OpCompositeExtract %6 %178 0
+ %246 = OpCompositeExtract %6 %213 0
+ %247 = OpFOrdLessThan %11 %244 %246
+ OpSelectionMerge %249 None
+ OpBranchConditional %247 %248 %249
+ %248 = OpLabel
+ OpBranch %277
+ %249 = OpLabel
+ %251 = OpCompositeExtract %6 %178 1
+ %253 = OpCompositeExtract %6 %213 1
+ %254 = OpFOrdLessThan %11 %251 %253
+ OpSelectionMerge %256 None
+ OpBranchConditional %254 %255 %256
+ %255 = OpLabel
+ OpBranch %277
+ %256 = OpLabel
+ %262 = OpCompositeExtract %6 %213 2
+ %263 = OpFAdd %6 %246 %262
+ %264 = OpFOrdGreaterThan %11 %244 %263
+ OpSelectionMerge %266 None
+ OpBranchConditional %264 %265 %266
+ %265 = OpLabel
+ OpBranch %277
+ %266 = OpLabel
+ %272 = OpCompositeExtract %6 %213 3
+ %273 = OpFAdd %6 %253 %272
+ %274 = OpFOrdGreaterThan %11 %251 %273
+ OpSelectionMerge %276 None
+ OpBranchConditional %274 %275 %276
+ %275 = OpLabel
+ OpBranch %277
+ %276 = OpLabel
+ OpBranch %277
+ %277 = OpLabel
+ %282 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276
+ OpSelectionMerge %232 None
+ OpBranchConditional %282 %215 %232
+ %215 = OpLabel
+ OpStore %200 %103
+ %217 = OpAccessChain %23 %200 %279 %22
+ %218 = OpLoad %6 %217
+ %219 = OpConvertFToS %73 %218
+ OpStore %201 %103
+ %221 = OpAccessChain %23 %201 %279 %33
+ %222 = OpLoad %6 %221
+ %516 = OpLoad %86 %389
+ OpStore %389 %503
+ OpStore %389 %516
+ %223 = OpConvertFToS %73 %222
+ %224 = OpIMul %73 %219 %223
+ %226 = OpIMul %73 %279 %146
+ %227 = OpIAdd %73 %224 %226
+ %228 = OpIAdd %73 %227 %149
+ %229 = OpSMod %73 %228 %151
+ OpStore %202 %133
+ %230 = OpAccessChain %10 %202 %229
+ %231 = OpLoad %9 %230
+ OpBranch %232
+ %232 = OpLabel
+ %285 = OpPhi %9 %280 %277 %231 %215
+ OpBranch %233
+ %233 = OpLabel
+ %235 = OpIAdd %73 %279 %158
+ OpBranch %205
+ %236 = OpLabel
+ OpStore %180 %280
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_pipeline
+ ATTACH variant_vertex_shader
+ ATTACH variant_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_pipeline 0 0 0 255
+
+CLEAR variant_pipeline
+RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+
+SHADER vertex variant_2_vertex_shader PASSTHROUGH
+
+SHADER fragment variant_2_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 504
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %165 %180
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %165 "gl_FragCoord"
+ OpName %168 "buf0"
+ OpMemberName %168 0 "resolution"
+ OpName %170 ""
+ OpName %180 "_GLF_color"
+ OpDecorate %165 BuiltIn FragCoord
+ OpMemberDecorate %168 0 Offset 0
+ OpDecorate %168 Block
+ OpDecorate %170 DescriptorSet 0
+ OpDecorate %170 Binding 0
+ OpDecorate %180 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %9 = OpTypeVector %6 4
+ %10 = OpTypePointer Function %9
+ %11 = OpTypeBool
+ %21 = OpTypeInt 32 0
+ %22 = OpConstant %21 0
+ %23 = OpTypePointer Function %6
+ %31 = OpConstantFalse %11
+ %33 = OpConstant %21 1
+ %66 = OpConstantTrue %11
+ %70 = OpConstant %6 0.5
+ %71 = OpConstant %6 1
+ %72 = OpConstantComposite %9 %70 %70 %71 %71
+ %73 = OpTypeInt 32 1
+ %76 = OpConstant %73 0
+ %83 = OpConstant %73 8
+ %85 = OpConstant %21 8
+ %86 = OpTypeArray %9 %85
+ %87 = OpConstant %6 4
+ %88 = OpConstant %6 20
+ %89 = OpConstantComposite %9 %87 %87 %88 %87
+ %90 = OpConstantComposite %9 %87 %87 %87 %88
+ %91 = OpConstantComposite %9 %87 %88 %88 %87
+ %92 = OpConstant %6 8
+ %93 = OpConstantComposite %9 %88 %87 %87 %92
+ %94 = OpConstant %6 6
+ %95 = OpConstant %6 2
+ %96 = OpConstantComposite %9 %92 %94 %87 %95
+ %97 = OpConstant %6 12
+ %98 = OpConstantComposite %9 %95 %97 %95 %87
+ %99 = OpConstant %6 16
+ %100 = OpConstantComposite %9 %99 %95 %87 %87
+ %101 = OpConstant %6 22
+ %102 = OpConstantComposite %9 %97 %101 %87 %87
+ %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+ %108 = OpTypePointer Function %86
+ %115 = OpConstant %21 16
+ %116 = OpTypeArray %9 %115
+ %117 = OpConstant %6 0
+ %118 = OpConstantComposite %9 %117 %117 %117 %71
+ %119 = OpConstantComposite %9 %70 %117 %117 %71
+ %120 = OpConstantComposite %9 %117 %70 %117 %71
+ %121 = OpConstantComposite %9 %70 %70 %117 %71
+ %122 = OpConstantComposite %9 %117 %117 %70 %71
+ %123 = OpConstantComposite %9 %70 %117 %70 %71
+ %124 = OpConstantComposite %9 %117 %70 %70 %71
+ %125 = OpConstantComposite %9 %70 %70 %70 %71
+ %126 = OpConstantComposite %9 %71 %117 %117 %71
+ %127 = OpConstantComposite %9 %117 %71 %117 %71
+ %128 = OpConstantComposite %9 %71 %71 %117 %71
+ %129 = OpConstantComposite %9 %117 %117 %71 %71
+ %130 = OpConstantComposite %9 %71 %117 %71 %71
+ %131 = OpConstantComposite %9 %117 %71 %71 %71
+ %132 = OpConstantComposite %9 %71 %71 %71 %71
+ %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+ %146 = OpConstant %73 9
+ %149 = OpConstant %73 11
+ %151 = OpConstant %73 16
+ %153 = OpTypePointer Function %116
+ %158 = OpConstant %73 1
+ %164 = OpTypePointer Input %9
+ %165 = OpVariable %164 Input
+ %168 = OpTypeStruct %7
+ %169 = OpTypePointer Uniform %168
+ %170 = OpVariable %169 Uniform
+ %171 = OpTypePointer Uniform %7
+ %176 = OpConstant %6 32
+ %179 = OpTypePointer Output %9
+ %180 = OpVariable %179 Output
+ %386 = OpConstantComposite %9 %117 %117 %117 %117
+ %387 = OpConstantComposite %86 %386 %386 %386 %386 %386 %386 %386 %386
+ %498 = OpConstant %6 0
+ %499 = OpConstantComposite %9 %498 %498 %498 %498
+ %503 = OpConstantComposite %86 %499 %499 %499 %499 %499 %499 %499 %499
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %389 = OpVariable %108 Function %387
+ %199 = OpVariable %108 Function
+ %200 = OpVariable %108 Function
+ %201 = OpVariable %108 Function
+ %202 = OpVariable %153 Function
+ OpStore %389 %103
+ %388 = OpLoad %86 %389
+ %166 = OpLoad %9 %165
+ %167 = OpVectorShuffle %7 %166 %166 0 1
+ %172 = OpAccessChain %171 %170 %76
+ %173 = OpLoad %7 %172
+ %174 = OpFDiv %7 %167 %173
+ %177 = OpVectorTimesScalar %7 %174 %176
+ %178 = OpExtInst %7 %1 Floor %177
+ OpBranch %205
+ %205 = OpLabel
+ %280 = OpPhi %9 %72 %5 %285 %233
+ %279 = OpPhi %73 %76 %5 %235 %233
+ %208 = OpSLessThan %11 %279 %83
+ OpLoopMerge %236 %233 None
+ OpBranchConditional %208 %209 %236
+ %209 = OpLabel
+ OpStore %199 %388
+ %212 = OpAccessChain %10 %199 %279
+ %213 = OpLoad %9 %212
+ OpSelectionMerge %277 None
+ OpSwitch %22 %242
+ %242 = OpLabel
+ %244 = OpCompositeExtract %6 %178 0
+ %246 = OpCompositeExtract %6 %213 0
+ %247 = OpFOrdLessThan %11 %244 %246
+ OpSelectionMerge %249 None
+ OpBranchConditional %247 %248 %249
+ %248 = OpLabel
+ OpBranch %277
+ %249 = OpLabel
+ %251 = OpCompositeExtract %6 %178 1
+ %253 = OpCompositeExtract %6 %213 1
+ %254 = OpFOrdLessThan %11 %251 %253
+ OpSelectionMerge %256 None
+ OpBranchConditional %254 %255 %256
+ %255 = OpLabel
+ OpBranch %277
+ %256 = OpLabel
+ %262 = OpCompositeExtract %6 %213 2
+ %263 = OpFAdd %6 %246 %262
+ %264 = OpFOrdGreaterThan %11 %244 %263
+ OpSelectionMerge %266 None
+ OpBranchConditional %264 %265 %266
+ %265 = OpLabel
+ OpBranch %277
+ %266 = OpLabel
+ %272 = OpCompositeExtract %6 %213 3
+ %273 = OpFAdd %6 %253 %272
+ %274 = OpFOrdGreaterThan %11 %251 %273
+ OpSelectionMerge %276 None
+ OpBranchConditional %274 %275 %276
+ %275 = OpLabel
+ OpBranch %277
+ %276 = OpLabel
+ OpBranch %277
+ %277 = OpLabel
+ %282 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276
+ OpSelectionMerge %232 None
+ OpBranchConditional %282 %215 %232
+ %215 = OpLabel
+ OpStore %200 %103
+ %217 = OpAccessChain %23 %200 %279 %22
+ %218 = OpLoad %6 %217
+ %219 = OpConvertFToS %73 %218
+ OpStore %201 %103
+ %221 = OpAccessChain %23 %201 %279 %33
+ %222 = OpLoad %6 %221
+ %223 = OpConvertFToS %73 %222
+ %224 = OpIMul %73 %219 %223
+ %226 = OpIMul %73 %279 %146
+ %227 = OpIAdd %73 %224 %226
+ %228 = OpIAdd %73 %227 %149
+ %229 = OpSMod %73 %228 %151
+ OpStore %202 %133
+ %230 = OpAccessChain %10 %202 %229
+ %231 = OpLoad %9 %230
+ OpBranch %232
+ %232 = OpLabel
+ %285 = OpPhi %9 %280 %277 %231 %215
+ OpBranch %233
+ %233 = OpLabel
+ %235 = OpIAdd %73 %279 %158
+ OpBranch %205
+ %236 = OpLabel
+ OpStore %180 %280
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant_2
+
+# resolution
+BUFFER variant_2_resolution DATA_TYPE vec2<float> STD140 DATA
+ 256.0 256.0
+END
+
+BUFFER variant_2_framebuffer FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics variant_2_pipeline
+ ATTACH variant_2_vertex_shader
+ ATTACH variant_2_fragment_shader
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER variant_2_framebuffer AS color LOCATION 0
+ BIND BUFFER variant_2_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
+END
+CLEAR_COLOR variant_2_pipeline 0 0 0 255
+
+CLEAR variant_2_pipeline
+RUN variant_2_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005
+EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_2_framebuffer TOLERANCE 0.005
dEQP-VK.graphicsfuzz.spv-double-branch-to-same-block3
dEQP-VK.graphicsfuzz.spv-load-from-frag-color
dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll
+dEQP-VK.graphicsfuzz.spv-stable-bifurcation-Os-mutate-var-vector-shuffle
+dEQP-VK.graphicsfuzz.spv-stable-collatz-O-mutate-composite-construct-extract
+dEQP-VK.graphicsfuzz.spv-stable-colorgrid-modulo-O-move-block-down
+dEQP-VK.graphicsfuzz.spv-stable-maze-flatten-copy-composite
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-O-prop-up-mutate-var
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-flatten-selection-dead-continues
+dEQP-VK.graphicsfuzz.spv-stable-mergesort-func-inline-mutate-var
+dEQP-VK.graphicsfuzz.spv-stable-orbit-O-mutate-variable
+dEQP-VK.graphicsfuzz.spv-stable-orbit-Os-access-chain-mutate-pointer
+dEQP-VK.graphicsfuzz.spv-stable-pillars-O-op-select-to-op-phi
+dEQP-VK.graphicsfuzz.spv-stable-quicksort-mat-func-param
+dEQP-VK.graphicsfuzz.spv-stable-rects-Os-mutate-var-push-through-var
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-with-loop-read-write-global
dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-injected-conditional-true
dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-true-conditional-simple-loop