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-bubblesort-flag-complex-conditionals
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-O-dead-code
+dEQP-VK.graphicsfuzz.spv-stable-maze-O-memory-accesses
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-dead-code
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-dontinline
dEQP-VK.graphicsfuzz.spv-stable-quicksort-mat-func-param
dEQP-VK.graphicsfuzz.spv-stable-rects-Os-mutate-var-push-through-var
+dEQP-VK.graphicsfuzz.spv-stable-sampler-loop-extra-instructions
+dEQP-VK.graphicsfuzz.spv-stable-sampler-polar-simple-O-access-chain
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-false-if-discard-loop
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-fragcoord-less-than-zero
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-nested-if-and-conditional
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-bubblesort-flag-complex-conditionals
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-O-dead-code
+dEQP-VK.graphicsfuzz.spv-stable-maze-O-memory-accesses
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-dead-code
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-dontinline
dEQP-VK.graphicsfuzz.spv-stable-quicksort-mat-func-param
dEQP-VK.graphicsfuzz.spv-stable-rects-Os-mutate-var-push-through-var
+dEQP-VK.graphicsfuzz.spv-stable-sampler-loop-extra-instructions
+dEQP-VK.graphicsfuzz.spv-stable-sampler-polar-simple-O-access-chain
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-false-if-discard-loop
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-fragcoord-less-than-zero
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-nested-if-and-conditional
{ "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-bubblesort-flag-complex-conditionals.amber", "spv-stable-bubblesort-flag-complex-conditionals", "Equivalent shaders, one with more complex conditionals" },
{ "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-O-dead-code.amber", "spv-stable-maze-O-dead-code", "Equivalent shaders, one with instructions propagated to predecessors" },
+{ "spv-stable-maze-O-memory-accesses.amber", "spv-stable-maze-O-memory-accesses", "Equivalent shaders, one extra memory accesses" },
{ "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-dead-code.amber", "spv-stable-mergesort-dead-code", "Equivalent shaders, one with additional dead code" },
{ "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-dontinline.amber", "spv-stable-quicksort-dontinline", "Equivalent shaders, one with DontInline attribute" },
{ "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" },
+{ "spv-stable-sampler-loop-extra-instructions.amber", "spv-stable-sampler-loop-extra-instructions", "Equivalent shaders, one with irrelevant extra instructions" },
+{ "spv-stable-sampler-polar-simple-O-access-chain.amber", "spv-stable-sampler-polar-simple-O-access-chain", "Equivalent shaders, one with an additional access chain" },
{ "stable-binarysearch-tree-false-if-discard-loop.amber", "stable-binarysearch-tree-false-if-discard-loop", "A fragment shader with always false if with discard loop" },
{ "stable-binarysearch-tree-fragcoord-less-than-zero.amber", "stable-binarysearch-tree-fragcoord-less-than-zero", "A fragment shader with gl_FragCoord.x less than zero" },
{ "stable-binarysearch-tree-nested-if-and-conditional.amber", "stable-binarysearch-tree-nested-if-and-conditional", "A fragment shader with nested if and conditional statement" },
--- /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: Equivalent shaders, one with more complex conditionals
+
+# The test passes because both shaders render the same image.
+
+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; 10
+; Bound: 164
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %16 %139
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "checkSwap(f1;f1;"
+ OpName %10 "a"
+ OpName %11 "b"
+ OpName %16 "gl_FragCoord"
+ OpName %23 "buf1"
+ OpMemberName %23 0 "resolution"
+ OpName %25 ""
+ OpName %49 "i"
+ OpName %61 "data"
+ OpName %66 "buf0"
+ OpMemberName %66 0 "injectionSwitch"
+ OpName %68 ""
+ OpName %76 "i"
+ OpName %85 "j"
+ OpName %100 "doSwap"
+ OpName %103 "param"
+ OpName %106 "param"
+ OpName %113 "temp"
+ OpName %139 "_GLF_color"
+ OpDecorate %16 BuiltIn FragCoord
+ OpMemberDecorate %23 0 Offset 0
+ OpDecorate %23 Block
+ OpDecorate %25 DescriptorSet 0
+ OpDecorate %25 Binding 1
+ OpMemberDecorate %66 0 Offset 0
+ OpDecorate %66 Block
+ OpDecorate %68 DescriptorSet 0
+ OpDecorate %68 Binding 0
+ OpDecorate %139 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeBool
+ %9 = OpTypeFunction %8 %7 %7
+ %14 = OpTypeVector %6 4
+ %15 = OpTypePointer Input %14
+ %16 = OpVariable %15 Input
+ %17 = OpTypeInt 32 0
+ %18 = OpConstant %17 1
+ %19 = OpTypePointer Input %6
+ %22 = OpTypeVector %6 2
+ %23 = OpTypeStruct %22
+ %24 = OpTypePointer Uniform %23
+ %25 = OpVariable %24 Uniform
+ %26 = OpTypeInt 32 1
+ %27 = OpConstant %26 0
+ %28 = OpTypePointer Uniform %6
+ %31 = OpConstant %6 2
+ %34 = OpTypePointer Function %8
+ %48 = OpTypePointer Function %26
+ %56 = OpConstant %26 10
+ %58 = OpConstant %17 10
+ %59 = OpTypeArray %6 %58
+ %60 = OpTypePointer Function %59
+ %66 = OpTypeStruct %22
+ %67 = OpTypePointer Uniform %66
+ %68 = OpVariable %67 Uniform
+ %74 = OpConstant %26 1
+ %83 = OpConstant %26 9
+ %129 = OpConstant %17 0
+ %138 = OpTypePointer Output %14
+ %139 = OpVariable %138 Output
+ %142 = OpConstant %6 10
+ %144 = OpConstant %26 5
+ %151 = OpConstant %6 1
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %49 = OpVariable %48 Function
+ %61 = OpVariable %60 Function
+ %76 = OpVariable %48 Function
+ %85 = OpVariable %48 Function
+ %100 = OpVariable %34 Function
+ %103 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %113 = OpVariable %7 Function
+ OpStore %49 %27
+ OpBranch %50
+ %50 = OpLabel
+ OpLoopMerge %52 %53 None
+ OpBranch %54
+ %54 = OpLabel
+ %55 = OpLoad %26 %49
+ %57 = OpSLessThan %8 %55 %56
+ OpBranchConditional %57 %51 %52
+ %51 = OpLabel
+ %62 = OpLoad %26 %49
+ %63 = OpLoad %26 %49
+ %64 = OpISub %26 %56 %63
+ %65 = OpConvertSToF %6 %64
+ %69 = OpAccessChain %28 %68 %27 %18
+ %70 = OpLoad %6 %69
+ %71 = OpFMul %6 %65 %70
+ %72 = OpAccessChain %7 %61 %62
+ OpStore %72 %71
+ OpBranch %53
+ %53 = OpLabel
+ %73 = OpLoad %26 %49
+ %75 = OpIAdd %26 %73 %74
+ OpStore %49 %75
+ OpBranch %50
+ %52 = OpLabel
+ OpStore %76 %27
+ OpBranch %77
+ %77 = OpLabel
+ OpLoopMerge %79 %80 None
+ OpBranch %81
+ %81 = OpLabel
+ %82 = OpLoad %26 %76
+ %84 = OpSLessThan %8 %82 %83
+ OpBranchConditional %84 %78 %79
+ %78 = OpLabel
+ OpStore %85 %27
+ OpBranch %86
+ %86 = OpLabel
+ OpLoopMerge %88 %89 None
+ OpBranch %90
+ %90 = OpLabel
+ %91 = OpLoad %26 %85
+ %92 = OpSLessThan %8 %91 %56
+ OpBranchConditional %92 %87 %88
+ %87 = OpLabel
+ %93 = OpLoad %26 %85
+ %94 = OpLoad %26 %76
+ %95 = OpIAdd %26 %94 %74
+ %96 = OpSLessThan %8 %93 %95
+ OpSelectionMerge %98 None
+ OpBranchConditional %96 %97 %98
+ %97 = OpLabel
+ OpBranch %89
+ %98 = OpLabel
+ %101 = OpLoad %26 %76
+ %102 = OpLoad %26 %85
+ %104 = OpAccessChain %7 %61 %101
+ %105 = OpLoad %6 %104
+ OpStore %103 %105
+ %107 = OpAccessChain %7 %61 %102
+ %108 = OpLoad %6 %107
+ OpStore %106 %108
+ %109 = OpFunctionCall %8 %12 %103 %106
+ OpStore %100 %109
+ %110 = OpLoad %8 %100
+ OpSelectionMerge %112 None
+ OpBranchConditional %110 %111 %112
+ %111 = OpLabel
+ %114 = OpLoad %26 %76
+ %115 = OpAccessChain %7 %61 %114
+ %116 = OpLoad %6 %115
+ OpStore %113 %116
+ %117 = OpLoad %26 %76
+ %118 = OpLoad %26 %85
+ %119 = OpAccessChain %7 %61 %118
+ %120 = OpLoad %6 %119
+ %121 = OpAccessChain %7 %61 %117
+ OpStore %121 %120
+ %122 = OpLoad %26 %85
+ %123 = OpLoad %6 %113
+ %124 = OpAccessChain %7 %61 %122
+ OpStore %124 %123
+ OpBranch %112
+ %112 = OpLabel
+ OpBranch %89
+ %89 = OpLabel
+ %125 = OpLoad %26 %85
+ %126 = OpIAdd %26 %125 %74
+ OpStore %85 %126
+ OpBranch %86
+ %88 = OpLabel
+ OpBranch %80
+ %80 = OpLabel
+ %127 = OpLoad %26 %76
+ %128 = OpIAdd %26 %127 %74
+ OpStore %76 %128
+ OpBranch %77
+ %79 = OpLabel
+ %130 = OpAccessChain %19 %16 %129
+ %131 = OpLoad %6 %130
+ %132 = OpAccessChain %28 %25 %27 %129
+ %133 = OpLoad %6 %132
+ %134 = OpFDiv %6 %133 %31
+ %135 = OpFOrdLessThan %8 %131 %134
+ OpSelectionMerge %137 None
+ OpBranchConditional %135 %136 %153
+ %136 = OpLabel
+ %140 = OpAccessChain %7 %61 %27
+ %141 = OpLoad %6 %140
+ %143 = OpFDiv %6 %141 %142
+ %145 = OpAccessChain %7 %61 %144
+ %146 = OpLoad %6 %145
+ %147 = OpFDiv %6 %146 %142
+ %148 = OpAccessChain %7 %61 %83
+ %149 = OpLoad %6 %148
+ %150 = OpFDiv %6 %149 %142
+ %152 = OpCompositeConstruct %14 %143 %147 %150 %151
+ OpStore %139 %152
+ OpBranch %137
+ %153 = OpLabel
+ %154 = OpAccessChain %7 %61 %144
+ %155 = OpLoad %6 %154
+ %156 = OpFDiv %6 %155 %142
+ %157 = OpAccessChain %7 %61 %83
+ %158 = OpLoad %6 %157
+ %159 = OpFDiv %6 %158 %142
+ %160 = OpAccessChain %7 %61 %27
+ %161 = OpLoad %6 %160
+ %162 = OpFDiv %6 %161 %142
+ %163 = OpCompositeConstruct %14 %156 %159 %162 %151
+ OpStore %139 %163
+ OpBranch %137
+ %137 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %8 None %9
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %35 = OpVariable %34 Function
+ %20 = OpAccessChain %19 %16 %18
+ %21 = OpLoad %6 %20
+ %29 = OpAccessChain %28 %25 %27 %18
+ %30 = OpLoad %6 %29
+ %32 = OpFDiv %6 %30 %31
+ %33 = OpFOrdLessThan %8 %21 %32
+ OpSelectionMerge %37 None
+ OpBranchConditional %33 %36 %41
+ %36 = OpLabel
+ %38 = OpLoad %6 %10
+ %39 = OpLoad %6 %11
+ %40 = OpFOrdGreaterThan %8 %38 %39
+ OpStore %35 %40
+ OpBranch %37
+ %41 = OpLabel
+ %42 = OpLoad %6 %10
+ %43 = OpLoad %6 %11
+ %44 = OpFOrdLessThan %8 %42 %43
+ OpStore %35 %44
+ OpBranch %37
+ %37 = OpLabel
+ %45 = OpLoad %8 %35
+ OpReturnValue %45
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# injectionSwitch
+BUFFER reference_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+# 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_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1
+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; 10
+; Bound: 816
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %16 %139
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %12 "checkSwap(f1;f1;"
+ OpName %10 "a"
+ OpName %11 "b"
+ OpName %16 "gl_FragCoord"
+ OpName %23 "buf1"
+ OpMemberName %23 0 "resolution"
+ OpName %25 ""
+ OpName %49 "i"
+ OpName %61 "data"
+ OpName %66 "buf0"
+ OpMemberName %66 0 "injectionSwitch"
+ OpName %68 ""
+ OpName %76 "i"
+ OpName %85 "j"
+ OpName %100 "doSwap"
+ OpName %103 "param"
+ OpName %106 "param"
+ OpName %113 "temp"
+ OpName %139 "_GLF_color"
+ OpDecorate %16 BuiltIn FragCoord
+ OpMemberDecorate %23 0 Offset 0
+ OpDecorate %23 Block
+ OpDecorate %25 DescriptorSet 0
+ OpDecorate %25 Binding 1
+ OpMemberDecorate %66 0 Offset 0
+ OpDecorate %66 Block
+ OpDecorate %68 DescriptorSet 0
+ OpDecorate %68 Binding 0
+ OpDecorate %139 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypePointer Function %6
+ %8 = OpTypeBool
+ %9 = OpTypeFunction %8 %7 %7
+ %14 = OpTypeVector %6 4
+ %15 = OpTypePointer Input %14
+ %16 = OpVariable %15 Input
+ %17 = OpTypeInt 32 0
+ %18 = OpConstant %17 1
+ %19 = OpTypePointer Input %6
+ %22 = OpTypeVector %6 2
+ %23 = OpTypeStruct %22
+ %24 = OpTypePointer Uniform %23
+ %25 = OpVariable %24 Uniform
+ %26 = OpTypeInt 32 1
+ %27 = OpConstant %26 0
+ %28 = OpTypePointer Uniform %6
+ %31 = OpConstant %6 2
+ %34 = OpTypePointer Function %8
+ %48 = OpTypePointer Function %26
+ %56 = OpConstant %26 10
+ %58 = OpConstant %17 10
+ %59 = OpTypeArray %6 %58
+ %60 = OpTypePointer Function %59
+ %66 = OpTypeStruct %22
+ %67 = OpTypePointer Uniform %66
+ %68 = OpVariable %67 Uniform
+ %74 = OpConstant %26 1
+ %83 = OpConstant %26 9
+ %129 = OpConstant %17 0
+ %138 = OpTypePointer Output %14
+ %139 = OpVariable %138 Output
+ %142 = OpConstant %6 10
+ %144 = OpConstant %26 5
+ %151 = OpConstant %6 1
+ %285 = OpConstant %6 0
+ %387 = OpConstantFalse %8
+ %815 = OpConstantTrue %8
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %49 = OpVariable %48 Function
+ %61 = OpVariable %60 Function
+ %76 = OpVariable %48 Function
+ %85 = OpVariable %48 Function
+ %100 = OpVariable %34 Function
+ %103 = OpVariable %7 Function
+ %106 = OpVariable %7 Function
+ %113 = OpVariable %7 Function
+ OpStore %49 %27
+ OpBranch %50
+ %50 = OpLabel
+ OpLoopMerge %52 %53 None
+ OpBranch %54
+ %54 = OpLabel
+ %55 = OpLoad %26 %49
+ %57 = OpSLessThan %8 %55 %56
+ OpBranchConditional %57 %51 %52
+ %51 = OpLabel
+ %62 = OpLoad %26 %49
+ %63 = OpLoad %26 %49
+ %64 = OpISub %26 %56 %63
+ %65 = OpConvertSToF %6 %64
+ %69 = OpAccessChain %28 %68 %27 %18
+ %70 = OpLoad %6 %69
+ %71 = OpFMul %6 %65 %70
+ %72 = OpAccessChain %7 %61 %62
+ OpStore %72 %71
+ OpBranch %53
+ %53 = OpLabel
+ %73 = OpLoad %26 %49
+ %75 = OpIAdd %26 %73 %74
+ OpStore %49 %75
+ OpBranch %50
+ %52 = OpLabel
+ OpStore %76 %27
+ OpBranch %77
+ %77 = OpLabel
+ OpLoopMerge %79 %80 None
+ OpBranch %81
+ %81 = OpLabel
+ %82 = OpLoad %26 %76
+ %84 = OpSLessThan %8 %82 %83
+ OpBranchConditional %84 %78 %79
+ %78 = OpLabel
+ OpStore %85 %27
+ OpBranch %86
+ %86 = OpLabel
+ OpLoopMerge %88 %89 None
+ OpBranch %90
+ %90 = OpLabel
+ %91 = OpLoad %26 %85
+ %92 = OpSLessThan %8 %91 %56
+ OpBranchConditional %92 %87 %88
+ %87 = OpLabel
+ %93 = OpLoad %26 %85
+ %94 = OpLoad %26 %76
+ %95 = OpIAdd %26 %94 %74
+ %96 = OpSLessThan %8 %93 %95
+ OpSelectionMerge %98 None
+ OpBranchConditional %96 %97 %98
+ %97 = OpLabel
+ OpBranch %89
+ %98 = OpLabel
+ %101 = OpLoad %26 %76
+ %102 = OpLoad %26 %85
+ %104 = OpAccessChain %7 %61 %101
+ %105 = OpLoad %6 %104
+ OpStore %103 %105
+ %107 = OpAccessChain %7 %61 %102
+ %108 = OpLoad %6 %107
+ OpStore %106 %108
+ %109 = OpFunctionCall %8 %12 %103 %106
+ OpStore %100 %109
+ %110 = OpLoad %8 %100
+ OpSelectionMerge %112 None
+ OpBranchConditional %110 %111 %112
+ %111 = OpLabel
+ %114 = OpLoad %26 %76
+ %115 = OpAccessChain %7 %61 %114
+ %116 = OpLoad %6 %115
+ OpStore %113 %116
+ %117 = OpLoad %26 %76
+ %118 = OpLoad %26 %85
+ %119 = OpAccessChain %7 %61 %118
+ %120 = OpLoad %6 %119
+ %121 = OpAccessChain %7 %61 %117
+ OpStore %121 %120
+ %122 = OpLoad %26 %85
+ %123 = OpLoad %6 %113
+ %124 = OpAccessChain %7 %61 %122
+ OpStore %124 %123
+ OpBranch %112
+ %112 = OpLabel
+ OpBranch %89
+ %89 = OpLabel
+ %125 = OpLoad %26 %85
+ %126 = OpIAdd %26 %125 %74
+ OpStore %85 %126
+ OpBranch %86
+ %88 = OpLabel
+ OpBranch %80
+ %80 = OpLabel
+ %127 = OpLoad %26 %76
+ %128 = OpIAdd %26 %127 %74
+ OpStore %76 %128
+ OpBranch %77
+ %79 = OpLabel
+ %130 = OpAccessChain %19 %16 %129
+ %131 = OpLoad %6 %130
+ %132 = OpAccessChain %28 %25 %27 %129
+ %133 = OpLoad %6 %132
+ %134 = OpFDiv %6 %133 %31
+ %135 = OpFOrdLessThan %8 %131 %134
+ OpSelectionMerge %137 None
+ OpBranchConditional %135 %136 %153
+ %136 = OpLabel
+ %140 = OpAccessChain %7 %61 %27
+ %141 = OpLoad %6 %140
+ %143 = OpFDiv %6 %141 %142
+ %145 = OpAccessChain %7 %61 %144
+ %146 = OpLoad %6 %145
+ %147 = OpFDiv %6 %146 %142
+ %148 = OpAccessChain %7 %61 %83
+ %149 = OpLoad %6 %148
+ %150 = OpFDiv %6 %149 %142
+ %152 = OpCompositeConstruct %14 %143 %147 %150 %151
+ OpStore %139 %152
+ OpBranch %137
+ %153 = OpLabel
+ %154 = OpAccessChain %7 %61 %144
+ %155 = OpLoad %6 %154
+ %156 = OpFDiv %6 %155 %142
+ %157 = OpAccessChain %7 %61 %83
+ %158 = OpLoad %6 %157
+ %159 = OpFDiv %6 %158 %142
+ %160 = OpAccessChain %7 %61 %27
+ %161 = OpLoad %6 %160
+ %162 = OpFDiv %6 %161 %142
+ %163 = OpCompositeConstruct %14 %156 %159 %162 %151
+ OpStore %139 %163
+ OpBranch %137
+ %137 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %12 = OpFunction %8 None %9
+ %10 = OpFunctionParameter %7
+ %11 = OpFunctionParameter %7
+ %13 = OpLabel
+ %35 = OpVariable %34 Function
+ %20 = OpAccessChain %19 %16 %18
+ %21 = OpLoad %6 %20
+ %29 = OpAccessChain %28 %25 %27 %18
+ %30 = OpLoad %6 %29
+ %32 = OpFDiv %6 %30 %31
+ %33 = OpFOrdLessThan %8 %21 %32
+ OpBranch %36
+ %36 = OpLabel
+ OpSelectionMerge %351 None
+ OpBranchConditional %33 %352 %354
+ %352 = OpLabel
+ %353 = OpLoad %6 %10
+ OpBranch %351
+ %354 = OpLabel
+ %355 = OpCopyObject %6 %285
+ OpBranch %351
+ %351 = OpLabel
+ %38 = OpPhi %6 %353 %352 %355 %354
+ OpSelectionMerge %386 None
+ OpBranchConditional %387 %385 %385
+ %385 = OpLabel
+ OpSelectionMerge %356 None
+ OpBranchConditional %33 %357 %359
+ %357 = OpLabel
+ %358 = OpLoad %6 %11
+ OpBranch %356
+ %359 = OpLabel
+ %360 = OpCopyObject %6 %285
+ OpBranch %356
+ %356 = OpLabel
+ %39 = OpPhi %6 %358 %357 %360 %359
+ %40 = OpFOrdGreaterThan %8 %38 %39
+ OpBranch %362
+ %362 = OpLabel
+ OpSelectionMerge %479 None
+ OpBranchConditional %33 %480 %479
+ %480 = OpLabel
+ OpStore %35 %40
+ OpBranch %479
+ %479 = OpLabel
+ OpBranchConditional %815 %361 %386
+ %361 = OpLabel
+ OpBranch %386
+ %386 = OpLabel
+ OpBranch %41
+ %41 = OpLabel
+ OpSelectionMerge %363 None
+ OpBranchConditional %33 %366 %364
+ %364 = OpLabel
+ %365 = OpLoad %6 %10
+ OpBranch %363
+ %366 = OpLabel
+ %367 = OpCopyObject %6 %285
+ OpBranch %363
+ %363 = OpLabel
+ %42 = OpPhi %6 %365 %364 %367 %366
+ OpSelectionMerge %368 None
+ OpBranchConditional %33 %371 %369
+ %369 = OpLabel
+ %370 = OpLoad %6 %11
+ OpBranch %368
+ %371 = OpLabel
+ %372 = OpCopyObject %6 %285
+ OpBranch %368
+ %368 = OpLabel
+ %43 = OpPhi %6 %370 %369 %372 %371
+ %44 = OpFOrdLessThan %8 %42 %43
+ OpSelectionMerge %373 None
+ OpBranchConditional %33 %373 %374
+ %374 = OpLabel
+ OpStore %35 %44
+ OpBranch %373
+ %373 = OpLabel
+ OpBranch %37
+ %37 = OpLabel
+ %45 = OpLoad %8 %35
+ OpReturnValue %45
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# injectionSwitch
+BUFFER variant_injectionSwitch DATA_TYPE vec2<float> STD140 DATA
+ 0.0 1.0
+END
+# 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_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0
+ BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1
+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: Equivalent shaders, one with instructions propagated to predecessors
+
+# The test passes because both shaders render the same image.
+
+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: 653
+; 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 %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %55 "map"
+ 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
+ %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
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %32 = OpConstant %6 16
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %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
+ %447 = OpTypePointer Function %53
+ %648 = OpConstant %18 32
+ %649 = OpUndef %24
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %55 = OpVariable %447 Function
+ OpSelectionMerge %442 None
+ OpSwitch %28 %443
+ %443 = OpLabel
+ %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
+ OpBranch %43
+ %43 = OpLabel
+ %518 = OpPhi %18 %19 %443 %61 %44
+ %51 = OpSLessThan %50 %518 %49
+ OpLoopMerge %45 %44 None
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %58 = OpAccessChain %41 %55 %518
+ OpStore %58 %19
+ %61 = OpIAdd %18 %518 %60
+ OpBranch %43
+ %45 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ %591 = OpPhi %50 %66 %45 %569 %71
+ %520 = OpPhi %24 %63 %45 %637 %71
+ %519 = OpPhi %18 %19 %45 %621 %71
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %73 = OpIAdd %18 %519 %60
+ %76 = OpCompositeExtract %18 %520 0
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %83 = OpISub %18 %76 %82
+ %85 = OpCompositeExtract %18 %520 1
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %41 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ %650 = OpSelect %18 %92 %60 %19
+ %98 = OpCompositeExtract %18 %520 1
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %106 = OpISub %18 %98 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %76 %107
+ %109 = OpAccessChain %41 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %79 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %116 = OpIAdd %18 %650 %60
+ OpBranch %114
+ %114 = OpLabel
+ %529 = OpPhi %18 %650 %101 %116 %113
+ %120 = OpSLessThan %50 %76 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %125 = OpIAdd %18 %76 %82
+ %128 = OpIMul %18 %98 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %41 %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
+ %137 = OpIAdd %18 %529 %60
+ OpBranch %135
+ %135 = OpLabel
+ %533 = OpPhi %18 %529 %122 %137 %134
+ %140 = OpSLessThan %50 %98 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %147 = OpIAdd %18 %98 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %76 %148
+ %150 = OpAccessChain %41 %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
+ %157 = OpIAdd %18 %533 %60
+ OpBranch %155
+ %155 = OpLabel
+ %534 = OpPhi %18 %533 %142 %157 %154
+ %159 = OpIEqual %50 %534 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpBranch %163
+ %163 = OpLabel
+ %570 = OpPhi %50 %162 %160 %639 %166
+ %568 = OpPhi %24 %520 %160 %619 %166
+ %567 = OpPhi %18 %19 %160 %199 %166
+ %170 = OpSLessThan %50 %567 %169
+ OpLoopMerge %165 %166 None
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpBranch %172
+ %172 = OpLabel
+ %619 = OpPhi %24 %568 %164 %644 %175
+ %617 = OpPhi %18 %19 %164 %197 %175
+ %639 = OpPhi %50 %570 %164 %651 %175
+ %178 = OpSLessThan %50 %617 %169
+ OpLoopMerge %174 %175 None
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %180 = OpIMul %18 %617 %82
+ %182 = OpIMul %18 %567 %82
+ %183 = OpIMul %18 %567 %648
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %41 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %463 = OpCompositeInsert %24 %180 %649 0
+ %465 = OpCompositeInsert %24 %182 %463 1
+ OpBranch %189
+ %189 = OpLabel
+ %644 = OpPhi %24 %619 %173 %465 %188
+ %651 = OpSelect %50 %187 %66 %639
+ OpBranch %175
+ %175 = OpLabel
+ %197 = OpIAdd %18 %617 %60
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %199 = OpIAdd %18 %567 %60
+ OpBranch %163
+ %165 = OpLabel
+ %201 = OpCompositeExtract %18 %568 0
+ %203 = OpCompositeExtract %18 %568 1
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %41 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %211 = OpSMod %18 %73 %534
+ %214 = OpIAdd %18 %73 %534
+ %216 = OpSGreaterThanEqual %50 %211 %19
+ %652 = OpSelect %50 %216 %77 %216
+ OpSelectionMerge %224 None
+ OpBranchConditional %652 %223 %224
+ %223 = OpLabel
+ %227 = OpISub %18 %76 %82
+ %230 = OpIMul %18 %98 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %41 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %652 %207 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %239 = OpISub %18 %211 %60
+ %244 = OpIMul %18 %98 %86
+ %245 = OpIAdd %18 %76 %244
+ %246 = OpAccessChain %41 %55 %245
+ OpStore %246 %60
+ %249 = OpISub %18 %76 %60
+ %253 = OpIAdd %18 %249 %244
+ %254 = OpAccessChain %41 %55 %253
+ OpStore %254 %60
+ %257 = OpISub %18 %76 %82
+ %261 = OpIAdd %18 %257 %244
+ %262 = OpAccessChain %41 %55 %261
+ OpStore %262 %60
+ %479 = OpCompositeInsert %24 %257 %520 0
+ OpBranch %237
+ %237 = OpLabel
+ %550 = OpPhi %24 %520 %224 %479 %236
+ %549 = OpPhi %18 %211 %224 %239 %236
+ %268 = OpSGreaterThanEqual %50 %549 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %272 = OpCompositeExtract %18 %550 1
+ %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
+ %278 = OpCompositeExtract %18 %550 0
+ %280 = OpCompositeExtract %18 %550 1
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %41 %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
+ %291 = OpISub %18 %549 %60
+ %293 = OpCompositeExtract %18 %550 0
+ %295 = OpCompositeExtract %18 %550 1
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %41 %55 %297
+ OpStore %298 %60
+ %303 = OpISub %18 %295 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %293 %304
+ %306 = OpAccessChain %41 %55 %305
+ OpStore %306 %60
+ %311 = OpISub %18 %295 %82
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %293 %312
+ %314 = OpAccessChain %41 %55 %313
+ OpStore %314 %60
+ %491 = OpCompositeInsert %24 %311 %550 1
+ OpBranch %289
+ %289 = OpLabel
+ %556 = OpPhi %24 %550 %276 %491 %288
+ %555 = OpPhi %18 %549 %276 %291 %288
+ %320 = OpSGreaterThanEqual %50 %555 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %324 = OpCompositeExtract %18 %556 0
+ %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
+ %330 = OpCompositeExtract %18 %556 0
+ %331 = OpIAdd %18 %330 %82
+ %333 = OpCompositeExtract %18 %556 1
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %41 %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
+ %343 = OpISub %18 %555 %60
+ %345 = OpCompositeExtract %18 %556 0
+ %347 = OpCompositeExtract %18 %556 1
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %41 %55 %349
+ OpStore %350 %60
+ %353 = OpIAdd %18 %345 %60
+ %357 = OpIAdd %18 %353 %348
+ %358 = OpAccessChain %41 %55 %357
+ OpStore %358 %60
+ %361 = OpIAdd %18 %345 %82
+ %365 = OpIAdd %18 %361 %348
+ %366 = OpAccessChain %41 %55 %365
+ OpStore %366 %60
+ %503 = OpCompositeInsert %24 %361 %556 0
+ OpBranch %341
+ %341 = OpLabel
+ %562 = OpPhi %24 %556 %328 %503 %340
+ %561 = OpPhi %18 %555 %328 %343 %340
+ %372 = OpSGreaterThanEqual %50 %561 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %376 = OpCompositeExtract %18 %562 1
+ %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
+ %382 = OpCompositeExtract %18 %562 0
+ %384 = OpCompositeExtract %18 %562 1
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %41 %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
+ %397 = OpCompositeExtract %18 %562 0
+ %399 = OpCompositeExtract %18 %562 1
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %41 %55 %401
+ OpStore %402 %60
+ %407 = OpIAdd %18 %399 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %397 %408
+ %410 = OpAccessChain %41 %55 %409
+ OpStore %410 %60
+ %415 = OpIAdd %18 %399 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %397 %416
+ %418 = OpAccessChain %41 %55 %417
+ OpStore %418 %60
+ %515 = OpCompositeInsert %24 %415 %562 1
+ OpBranch %393
+ %393 = OpLabel
+ %638 = OpPhi %24 %562 %380 %515 %392
+ OpBranch %161
+ %161 = OpLabel
+ %637 = OpPhi %24 %568 %165 %638 %393
+ %621 = OpPhi %18 %73 %165 %214 %393
+ %569 = OpPhi %50 %570 %165 %591 %393
+ %425 = OpIMul %18 %39 %86
+ %428 = OpIAdd %18 %425 %34
+ %429 = OpAccessChain %41 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpBranch %70
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ OpBranchConditional %569 %68 %70
+ %70 = OpLabel
+ %592 = OpPhi %50 %66 %432 %162 %71
+ OpSelectionMerge %445 None
+ OpBranchConditional %592 %442 %445
+ %445 = OpLabel
+ OpStore %435 %441
+ OpBranch %442
+ %442 = 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: 865
+; 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 %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %55 "map"
+ 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
+ %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
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %32 = OpConstant %6 16
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %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
+ %447 = OpTypePointer Function %53
+ %648 = OpConstant %18 32
+ %649 = OpUndef %24
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %55 = OpVariable %447 Function
+ OpSelectionMerge %442 None
+ OpSwitch %28 %443
+ %443 = OpLabel
+ %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
+ %753 = OpSLessThan %50 %19 %49
+ %827 = OpIAdd %18 %19 %60
+ %863 = OpSLessThan %50 %827 %49
+ OpBranch %43
+ %43 = OpLabel
+ %829 = OpPhi %50 %863 %443 %864 %44
+ %755 = OpPhi %18 %827 %443 %828 %44
+ %51 = OpPhi %50 %753 %443 %754 %44
+ %518 = OpPhi %18 %19 %443 %61 %44
+ OpLoopMerge %45 %44 None
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %754 = OpPhi %50 %829 %43
+ %61 = OpPhi %18 %755 %43
+ %58 = OpAccessChain %41 %55 %518
+ OpStore %58 %19
+ %828 = OpIAdd %18 %61 %60
+ %864 = OpSLessThan %50 %828 %49
+ OpBranch %43
+ %45 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ %591 = OpPhi %50 %66 %45 %569 %71
+ %520 = OpPhi %24 %63 %45 %637 %71
+ %519 = OpPhi %18 %19 %45 %621 %71
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %73 = OpIAdd %18 %519 %60
+ %76 = OpCompositeExtract %18 %520 0
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %83 = OpISub %18 %76 %82
+ %85 = OpCompositeExtract %18 %520 1
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %41 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ %650 = OpSelect %18 %92 %60 %19
+ %98 = OpCompositeExtract %18 %520 1
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %106 = OpISub %18 %98 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %76 %107
+ %109 = OpAccessChain %41 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %79 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %116 = OpIAdd %18 %650 %60
+ OpBranch %114
+ %114 = OpLabel
+ %529 = OpPhi %18 %650 %101 %116 %113
+ %120 = OpSLessThan %50 %76 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %125 = OpIAdd %18 %76 %82
+ %128 = OpIMul %18 %98 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %41 %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
+ %137 = OpIAdd %18 %529 %60
+ OpBranch %135
+ %135 = OpLabel
+ %533 = OpPhi %18 %529 %122 %137 %134
+ %140 = OpSLessThan %50 %98 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %147 = OpIAdd %18 %98 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %76 %148
+ %150 = OpAccessChain %41 %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
+ %157 = OpIAdd %18 %533 %60
+ OpBranch %155
+ %155 = OpLabel
+ %534 = OpPhi %18 %533 %142 %157 %154
+ %159 = OpIEqual %50 %534 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpBranch %163
+ %163 = OpLabel
+ %570 = OpPhi %50 %162 %160 %639 %166
+ %568 = OpPhi %24 %520 %160 %619 %166
+ %567 = OpPhi %18 %19 %160 %199 %166
+ %170 = OpSLessThan %50 %567 %169
+ OpLoopMerge %165 %166 None
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpBranch %172
+ %172 = OpLabel
+ %619 = OpPhi %24 %568 %164 %644 %175
+ %617 = OpPhi %18 %19 %164 %197 %175
+ %639 = OpPhi %50 %570 %164 %651 %175
+ %178 = OpSLessThan %50 %617 %169
+ OpLoopMerge %174 %175 None
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %180 = OpIMul %18 %617 %82
+ %182 = OpIMul %18 %567 %82
+ %183 = OpIMul %18 %567 %648
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %41 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %463 = OpCompositeInsert %24 %180 %649 0
+ %465 = OpCompositeInsert %24 %182 %463 1
+ OpBranch %189
+ %189 = OpLabel
+ %644 = OpPhi %24 %619 %173 %465 %188
+ %651 = OpSelect %50 %187 %66 %639
+ OpBranch %175
+ %175 = OpLabel
+ %197 = OpIAdd %18 %617 %60
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %199 = OpIAdd %18 %567 %60
+ OpBranch %163
+ %165 = OpLabel
+ %201 = OpCompositeExtract %18 %568 0
+ %203 = OpCompositeExtract %18 %568 1
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %41 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %211 = OpSMod %18 %73 %534
+ %214 = OpIAdd %18 %73 %534
+ %216 = OpSGreaterThanEqual %50 %211 %19
+ %652 = OpSelect %50 %216 %77 %216
+ OpSelectionMerge %224 None
+ OpBranchConditional %652 %223 %224
+ %223 = OpLabel
+ %227 = OpISub %18 %76 %82
+ %230 = OpIMul %18 %98 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %41 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %652 %207 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %239 = OpISub %18 %211 %60
+ %244 = OpIMul %18 %98 %86
+ %245 = OpIAdd %18 %76 %244
+ %246 = OpAccessChain %41 %55 %245
+ OpStore %246 %60
+ %249 = OpISub %18 %76 %60
+ %253 = OpIAdd %18 %249 %244
+ %254 = OpAccessChain %41 %55 %253
+ OpStore %254 %60
+ %257 = OpISub %18 %76 %82
+ %261 = OpIAdd %18 %257 %244
+ %262 = OpAccessChain %41 %55 %261
+ OpStore %262 %60
+ %479 = OpCompositeInsert %24 %257 %520 0
+ OpBranch %237
+ %237 = OpLabel
+ %550 = OpPhi %24 %520 %224 %479 %236
+ %549 = OpPhi %18 %211 %224 %239 %236
+ %268 = OpSGreaterThanEqual %50 %549 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %272 = OpCompositeExtract %18 %550 1
+ %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
+ %278 = OpCompositeExtract %18 %550 0
+ %280 = OpCompositeExtract %18 %550 1
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %41 %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
+ %291 = OpISub %18 %549 %60
+ %293 = OpCompositeExtract %18 %550 0
+ %295 = OpCompositeExtract %18 %550 1
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %41 %55 %297
+ OpStore %298 %60
+ %303 = OpISub %18 %295 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %293 %304
+ %306 = OpAccessChain %41 %55 %305
+ OpStore %306 %60
+ %311 = OpISub %18 %295 %82
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %293 %312
+ %314 = OpAccessChain %41 %55 %313
+ OpStore %314 %60
+ %491 = OpCompositeInsert %24 %311 %550 1
+ OpBranch %289
+ %289 = OpLabel
+ %556 = OpPhi %24 %550 %276 %491 %288
+ %555 = OpPhi %18 %549 %276 %291 %288
+ %320 = OpSGreaterThanEqual %50 %555 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %324 = OpCompositeExtract %18 %556 0
+ %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
+ %330 = OpCompositeExtract %18 %556 0
+ %331 = OpIAdd %18 %330 %82
+ %333 = OpCompositeExtract %18 %556 1
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %41 %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
+ %343 = OpISub %18 %555 %60
+ %345 = OpCompositeExtract %18 %556 0
+ %347 = OpCompositeExtract %18 %556 1
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %41 %55 %349
+ OpStore %350 %60
+ %353 = OpIAdd %18 %345 %60
+ %357 = OpIAdd %18 %353 %348
+ %358 = OpAccessChain %41 %55 %357
+ OpStore %358 %60
+ %361 = OpIAdd %18 %345 %82
+ %365 = OpIAdd %18 %361 %348
+ %366 = OpAccessChain %41 %55 %365
+ OpStore %366 %60
+ %503 = OpCompositeInsert %24 %361 %556 0
+ OpBranch %341
+ %341 = OpLabel
+ %562 = OpPhi %24 %556 %328 %503 %340
+ %561 = OpPhi %18 %555 %328 %343 %340
+ %372 = OpSGreaterThanEqual %50 %561 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %376 = OpCompositeExtract %18 %562 1
+ %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
+ %382 = OpCompositeExtract %18 %562 0
+ %384 = OpCompositeExtract %18 %562 1
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %41 %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
+ %397 = OpCompositeExtract %18 %562 0
+ %399 = OpCompositeExtract %18 %562 1
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %41 %55 %401
+ OpStore %402 %60
+ %407 = OpIAdd %18 %399 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %397 %408
+ %410 = OpAccessChain %41 %55 %409
+ OpStore %410 %60
+ %415 = OpIAdd %18 %399 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %397 %416
+ %418 = OpAccessChain %41 %55 %417
+ OpStore %418 %60
+ %515 = OpCompositeInsert %24 %415 %562 1
+ OpBranch %393
+ %393 = OpLabel
+ %638 = OpPhi %24 %562 %380 %515 %392
+ OpBranch %161
+ %161 = OpLabel
+ %637 = OpPhi %24 %568 %165 %638 %393
+ %621 = OpPhi %18 %73 %165 %214 %393
+ %569 = OpPhi %50 %570 %165 %591 %393
+ %425 = OpIMul %18 %39 %86
+ %428 = OpIAdd %18 %425 %34
+ %429 = OpAccessChain %41 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpBranch %70
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ OpBranchConditional %569 %68 %70
+ %70 = OpLabel
+ %592 = OpPhi %50 %66 %432 %162 %71
+ OpSelectionMerge %445 None
+ OpBranchConditional %592 %442 %445
+ %445 = OpLabel
+ OpStore %435 %441
+ OpBranch %442
+ %442 = 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: Equivalent shaders, one extra memory accesses
+
+# The test passes because both shaders render the same image.
+
+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: 653
+; 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 %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %55 "map"
+ 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
+ %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
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %32 = OpConstant %6 16
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %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
+ %447 = OpTypePointer Function %53
+ %648 = OpConstant %18 32
+ %649 = OpUndef %24
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %55 = OpVariable %447 Function
+ OpSelectionMerge %442 None
+ OpSwitch %28 %443
+ %443 = OpLabel
+ %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
+ OpBranch %43
+ %43 = OpLabel
+ %518 = OpPhi %18 %19 %443 %61 %44
+ %51 = OpSLessThan %50 %518 %49
+ OpLoopMerge %45 %44 None
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %58 = OpAccessChain %41 %55 %518
+ OpStore %58 %19
+ %61 = OpIAdd %18 %518 %60
+ OpBranch %43
+ %45 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ %591 = OpPhi %50 %66 %45 %569 %71
+ %520 = OpPhi %24 %63 %45 %637 %71
+ %519 = OpPhi %18 %19 %45 %621 %71
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %73 = OpIAdd %18 %519 %60
+ %76 = OpCompositeExtract %18 %520 0
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %83 = OpISub %18 %76 %82
+ %85 = OpCompositeExtract %18 %520 1
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %41 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ %650 = OpSelect %18 %92 %60 %19
+ %98 = OpCompositeExtract %18 %520 1
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %106 = OpISub %18 %98 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %76 %107
+ %109 = OpAccessChain %41 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %79 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %116 = OpIAdd %18 %650 %60
+ OpBranch %114
+ %114 = OpLabel
+ %529 = OpPhi %18 %650 %101 %116 %113
+ %120 = OpSLessThan %50 %76 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %125 = OpIAdd %18 %76 %82
+ %128 = OpIMul %18 %98 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %41 %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
+ %137 = OpIAdd %18 %529 %60
+ OpBranch %135
+ %135 = OpLabel
+ %533 = OpPhi %18 %529 %122 %137 %134
+ %140 = OpSLessThan %50 %98 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %147 = OpIAdd %18 %98 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %76 %148
+ %150 = OpAccessChain %41 %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
+ %157 = OpIAdd %18 %533 %60
+ OpBranch %155
+ %155 = OpLabel
+ %534 = OpPhi %18 %533 %142 %157 %154
+ %159 = OpIEqual %50 %534 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpBranch %163
+ %163 = OpLabel
+ %570 = OpPhi %50 %162 %160 %639 %166
+ %568 = OpPhi %24 %520 %160 %619 %166
+ %567 = OpPhi %18 %19 %160 %199 %166
+ %170 = OpSLessThan %50 %567 %169
+ OpLoopMerge %165 %166 None
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpBranch %172
+ %172 = OpLabel
+ %619 = OpPhi %24 %568 %164 %644 %175
+ %617 = OpPhi %18 %19 %164 %197 %175
+ %639 = OpPhi %50 %570 %164 %651 %175
+ %178 = OpSLessThan %50 %617 %169
+ OpLoopMerge %174 %175 None
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %180 = OpIMul %18 %617 %82
+ %182 = OpIMul %18 %567 %82
+ %183 = OpIMul %18 %567 %648
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %41 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %463 = OpCompositeInsert %24 %180 %649 0
+ %465 = OpCompositeInsert %24 %182 %463 1
+ OpBranch %189
+ %189 = OpLabel
+ %644 = OpPhi %24 %619 %173 %465 %188
+ %651 = OpSelect %50 %187 %66 %639
+ OpBranch %175
+ %175 = OpLabel
+ %197 = OpIAdd %18 %617 %60
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %199 = OpIAdd %18 %567 %60
+ OpBranch %163
+ %165 = OpLabel
+ %201 = OpCompositeExtract %18 %568 0
+ %203 = OpCompositeExtract %18 %568 1
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %41 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %211 = OpSMod %18 %73 %534
+ %214 = OpIAdd %18 %73 %534
+ %216 = OpSGreaterThanEqual %50 %211 %19
+ %652 = OpSelect %50 %216 %77 %216
+ OpSelectionMerge %224 None
+ OpBranchConditional %652 %223 %224
+ %223 = OpLabel
+ %227 = OpISub %18 %76 %82
+ %230 = OpIMul %18 %98 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %41 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %652 %207 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %239 = OpISub %18 %211 %60
+ %244 = OpIMul %18 %98 %86
+ %245 = OpIAdd %18 %76 %244
+ %246 = OpAccessChain %41 %55 %245
+ OpStore %246 %60
+ %249 = OpISub %18 %76 %60
+ %253 = OpIAdd %18 %249 %244
+ %254 = OpAccessChain %41 %55 %253
+ OpStore %254 %60
+ %257 = OpISub %18 %76 %82
+ %261 = OpIAdd %18 %257 %244
+ %262 = OpAccessChain %41 %55 %261
+ OpStore %262 %60
+ %479 = OpCompositeInsert %24 %257 %520 0
+ OpBranch %237
+ %237 = OpLabel
+ %550 = OpPhi %24 %520 %224 %479 %236
+ %549 = OpPhi %18 %211 %224 %239 %236
+ %268 = OpSGreaterThanEqual %50 %549 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %272 = OpCompositeExtract %18 %550 1
+ %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
+ %278 = OpCompositeExtract %18 %550 0
+ %280 = OpCompositeExtract %18 %550 1
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %41 %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
+ %291 = OpISub %18 %549 %60
+ %293 = OpCompositeExtract %18 %550 0
+ %295 = OpCompositeExtract %18 %550 1
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %41 %55 %297
+ OpStore %298 %60
+ %303 = OpISub %18 %295 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %293 %304
+ %306 = OpAccessChain %41 %55 %305
+ OpStore %306 %60
+ %311 = OpISub %18 %295 %82
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %293 %312
+ %314 = OpAccessChain %41 %55 %313
+ OpStore %314 %60
+ %491 = OpCompositeInsert %24 %311 %550 1
+ OpBranch %289
+ %289 = OpLabel
+ %556 = OpPhi %24 %550 %276 %491 %288
+ %555 = OpPhi %18 %549 %276 %291 %288
+ %320 = OpSGreaterThanEqual %50 %555 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %324 = OpCompositeExtract %18 %556 0
+ %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
+ %330 = OpCompositeExtract %18 %556 0
+ %331 = OpIAdd %18 %330 %82
+ %333 = OpCompositeExtract %18 %556 1
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %41 %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
+ %343 = OpISub %18 %555 %60
+ %345 = OpCompositeExtract %18 %556 0
+ %347 = OpCompositeExtract %18 %556 1
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %41 %55 %349
+ OpStore %350 %60
+ %353 = OpIAdd %18 %345 %60
+ %357 = OpIAdd %18 %353 %348
+ %358 = OpAccessChain %41 %55 %357
+ OpStore %358 %60
+ %361 = OpIAdd %18 %345 %82
+ %365 = OpIAdd %18 %361 %348
+ %366 = OpAccessChain %41 %55 %365
+ OpStore %366 %60
+ %503 = OpCompositeInsert %24 %361 %556 0
+ OpBranch %341
+ %341 = OpLabel
+ %562 = OpPhi %24 %556 %328 %503 %340
+ %561 = OpPhi %18 %555 %328 %343 %340
+ %372 = OpSGreaterThanEqual %50 %561 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %376 = OpCompositeExtract %18 %562 1
+ %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
+ %382 = OpCompositeExtract %18 %562 0
+ %384 = OpCompositeExtract %18 %562 1
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %41 %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
+ %397 = OpCompositeExtract %18 %562 0
+ %399 = OpCompositeExtract %18 %562 1
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %41 %55 %401
+ OpStore %402 %60
+ %407 = OpIAdd %18 %399 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %397 %408
+ %410 = OpAccessChain %41 %55 %409
+ OpStore %410 %60
+ %415 = OpIAdd %18 %399 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %397 %416
+ %418 = OpAccessChain %41 %55 %417
+ OpStore %418 %60
+ %515 = OpCompositeInsert %24 %415 %562 1
+ OpBranch %393
+ %393 = OpLabel
+ %638 = OpPhi %24 %562 %380 %515 %392
+ OpBranch %161
+ %161 = OpLabel
+ %637 = OpPhi %24 %568 %165 %638 %393
+ %621 = OpPhi %18 %73 %165 %214 %393
+ %569 = OpPhi %50 %570 %165 %591 %393
+ %425 = OpIMul %18 %39 %86
+ %428 = OpIAdd %18 %425 %34
+ %429 = OpAccessChain %41 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpBranch %70
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ OpBranchConditional %569 %68 %70
+ %70 = OpLabel
+ %592 = OpPhi %50 %66 %432 %162 %71
+ OpSelectionMerge %445 None
+ OpBranchConditional %592 %442 %445
+ %445 = OpLabel
+ OpStore %435 %441
+ OpBranch %442
+ %442 = 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: 822
+; 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 %12 "gl_FragCoord"
+ OpName %15 "buf0"
+ OpMemberName %15 0 "resolution"
+ OpName %17 ""
+ OpName %55 "map"
+ 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
+ %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
+ %27 = OpTypeInt 32 0
+ %28 = OpConstant %27 0
+ %32 = OpConstant %6 16
+ %41 = OpTypePointer Function %18
+ %49 = OpConstant %18 256
+ %50 = OpTypeBool
+ %52 = OpConstant %27 256
+ %53 = OpTypeArray %18 %52
+ %60 = OpConstant %18 1
+ %63 = OpConstantComposite %24 %19 %19
+ %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
+ %447 = OpTypePointer Function %53
+ %648 = OpConstant %18 32
+ %649 = OpUndef %24
+ %753 = OpTypePointer Private %24
+ %754 = OpVariable %753 Private %63
+ %759 = OpTypePointer Private %18
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %55 = OpVariable %447 Function
+ OpSelectionMerge %442 None
+ OpSwitch %28 %443
+ %443 = OpLabel
+ %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
+ %813 = OpULessThanEqual %50 %19 %60
+ %814 = OpSelect %18 %813 %19 %60
+ %815 = OpAccessChain %759 %754 %814
+ OpBranch %43
+ %43 = OpLabel
+ %518 = OpPhi %18 %19 %443 %61 %44
+ %51 = OpSLessThan %50 %518 %49
+ OpLoopMerge %45 %44 None
+ OpBranchConditional %51 %44 %45
+ %44 = OpLabel
+ %58 = OpAccessChain %41 %55 %518
+ OpStore %58 %19
+ %61 = OpIAdd %18 %518 %60
+ OpBranch %43
+ %45 = OpLabel
+ OpBranch %68
+ %68 = OpLabel
+ %591 = OpPhi %50 %66 %45 %569 %71
+ %520 = OpPhi %24 %63 %45 %637 %71
+ %519 = OpPhi %18 %19 %45 %621 %71
+ %821 = OpAccessChain %759 %815
+ OpLoopMerge %70 %71 None
+ OpBranch %69
+ %69 = OpLabel
+ %73 = OpIAdd %18 %519 %60
+ OpStore %754 %520
+ %755 = OpLoad %24 %754
+ %76 = OpCompositeExtract %18 %520 0
+ %77 = OpSGreaterThan %50 %76 %19
+ OpSelectionMerge %79 None
+ OpBranchConditional %77 %78 %79
+ %78 = OpLabel
+ %83 = OpISub %18 %76 %82
+ %85 = OpCompositeExtract %18 %520 1
+ %87 = OpIMul %18 %85 %86
+ %88 = OpIAdd %18 %83 %87
+ %89 = OpAccessChain %41 %55 %88
+ %90 = OpLoad %18 %89
+ %91 = OpIEqual %50 %90 %19
+ OpBranch %79
+ %79 = OpLabel
+ %92 = OpPhi %50 %77 %69 %91 %78
+ %650 = OpSelect %18 %92 %60 %19
+ %98 = OpCompositeExtract %18 %520 1
+ %99 = OpSGreaterThan %50 %98 %19
+ OpSelectionMerge %101 None
+ OpBranchConditional %99 %100 %101
+ %100 = OpLabel
+ %106 = OpISub %18 %98 %82
+ %107 = OpIMul %18 %106 %86
+ %108 = OpIAdd %18 %76 %107
+ %109 = OpAccessChain %41 %55 %108
+ %110 = OpLoad %18 %109
+ %111 = OpIEqual %50 %110 %19
+ OpBranch %101
+ %101 = OpLabel
+ %112 = OpPhi %50 %99 %79 %111 %100
+ OpSelectionMerge %114 None
+ OpBranchConditional %112 %113 %114
+ %113 = OpLabel
+ %116 = OpIAdd %18 %650 %60
+ OpBranch %114
+ %114 = OpLabel
+ %529 = OpPhi %18 %650 %101 %116 %113
+ %120 = OpSLessThan %50 %76 %119
+ OpSelectionMerge %122 None
+ OpBranchConditional %120 %121 %122
+ %121 = OpLabel
+ %125 = OpIAdd %18 %76 %82
+ %128 = OpIMul %18 %98 %86
+ %129 = OpIAdd %18 %125 %128
+ %130 = OpAccessChain %41 %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
+ %137 = OpIAdd %18 %529 %60
+ OpBranch %135
+ %135 = OpLabel
+ %533 = OpPhi %18 %529 %122 %137 %134
+ %140 = OpSLessThan %50 %98 %119
+ OpSelectionMerge %142 None
+ OpBranchConditional %140 %141 %142
+ %141 = OpLabel
+ %147 = OpIAdd %18 %98 %82
+ %148 = OpIMul %18 %147 %86
+ %149 = OpIAdd %18 %76 %148
+ %150 = OpAccessChain %41 %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
+ %157 = OpIAdd %18 %533 %60
+ OpBranch %155
+ %155 = OpLabel
+ %534 = OpPhi %18 %533 %142 %157 %154
+ %159 = OpIEqual %50 %534 %19
+ OpSelectionMerge %161 None
+ OpBranchConditional %159 %160 %207
+ %160 = OpLabel
+ OpBranch %163
+ %163 = OpLabel
+ %570 = OpPhi %50 %162 %160 %639 %166
+ %568 = OpPhi %24 %520 %160 %619 %166
+ %567 = OpPhi %18 %19 %160 %199 %166
+ %170 = OpSLessThan %50 %567 %169
+ OpLoopMerge %165 %166 None
+ OpBranchConditional %170 %164 %165
+ %164 = OpLabel
+ OpBranch %172
+ %172 = OpLabel
+ %619 = OpPhi %24 %568 %164 %644 %175
+ %617 = OpPhi %18 %19 %164 %197 %175
+ %639 = OpPhi %50 %570 %164 %651 %175
+ %178 = OpSLessThan %50 %617 %169
+ OpLoopMerge %174 %175 None
+ OpBranchConditional %178 %173 %174
+ %173 = OpLabel
+ %180 = OpIMul %18 %617 %82
+ %182 = OpIMul %18 %567 %82
+ %183 = OpIMul %18 %567 %648
+ %184 = OpIAdd %18 %180 %183
+ %185 = OpAccessChain %41 %55 %184
+ %186 = OpLoad %18 %185
+ %187 = OpIEqual %50 %186 %19
+ OpSelectionMerge %189 None
+ OpBranchConditional %187 %188 %189
+ %188 = OpLabel
+ %463 = OpCompositeInsert %24 %180 %649 0
+ %465 = OpCompositeInsert %24 %182 %463 1
+ OpBranch %189
+ %189 = OpLabel
+ %644 = OpPhi %24 %619 %173 %465 %188
+ %651 = OpSelect %50 %187 %66 %639
+ OpBranch %175
+ %175 = OpLabel
+ %197 = OpIAdd %18 %617 %60
+ OpBranch %172
+ %174 = OpLabel
+ OpBranch %166
+ %166 = OpLabel
+ %199 = OpIAdd %18 %567 %60
+ OpBranch %163
+ %165 = OpLabel
+ %201 = OpCompositeExtract %18 %568 0
+ %203 = OpCompositeExtract %18 %568 1
+ %204 = OpIMul %18 %203 %86
+ %205 = OpIAdd %18 %201 %204
+ %206 = OpAccessChain %41 %55 %205
+ OpStore %206 %60
+ OpBranch %161
+ %207 = OpLabel
+ %211 = OpSMod %18 %73 %534
+ %214 = OpIAdd %18 %73 %534
+ %216 = OpSGreaterThanEqual %50 %211 %19
+ %652 = OpSelect %50 %216 %77 %216
+ OpSelectionMerge %224 None
+ OpBranchConditional %652 %223 %224
+ %223 = OpLabel
+ %227 = OpISub %18 %76 %82
+ %230 = OpIMul %18 %98 %86
+ %231 = OpIAdd %18 %227 %230
+ %232 = OpAccessChain %41 %55 %231
+ %233 = OpLoad %18 %232
+ %234 = OpIEqual %50 %233 %19
+ OpBranch %224
+ %224 = OpLabel
+ %235 = OpPhi %50 %652 %207 %234 %223
+ OpSelectionMerge %237 None
+ OpBranchConditional %235 %236 %237
+ %236 = OpLabel
+ %239 = OpISub %18 %211 %60
+ %244 = OpIMul %18 %98 %86
+ %245 = OpIAdd %18 %76 %244
+ %246 = OpAccessChain %41 %55 %245
+ OpStore %246 %60
+ %249 = OpISub %18 %76 %60
+ %253 = OpIAdd %18 %249 %244
+ %254 = OpAccessChain %41 %55 %253
+ OpStore %254 %60
+ %257 = OpISub %18 %76 %82
+ %261 = OpIAdd %18 %257 %244
+ %262 = OpAccessChain %41 %55 %261
+ OpStore %262 %60
+ %479 = OpCompositeInsert %24 %257 %520 0
+ OpBranch %237
+ %237 = OpLabel
+ %550 = OpPhi %24 %520 %224 %479 %236
+ %549 = OpPhi %18 %211 %224 %239 %236
+ %268 = OpSGreaterThanEqual %50 %549 %19
+ OpSelectionMerge %270 None
+ OpBranchConditional %268 %269 %270
+ %269 = OpLabel
+ %272 = OpCompositeExtract %18 %550 1
+ %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
+ %278 = OpCompositeExtract %18 %550 0
+ %280 = OpCompositeExtract %18 %550 1
+ %281 = OpISub %18 %280 %82
+ %282 = OpIMul %18 %281 %86
+ %283 = OpIAdd %18 %278 %282
+ %284 = OpAccessChain %41 %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
+ %291 = OpISub %18 %549 %60
+ %293 = OpCompositeExtract %18 %550 0
+ %295 = OpCompositeExtract %18 %550 1
+ %296 = OpIMul %18 %295 %86
+ %297 = OpIAdd %18 %293 %296
+ %298 = OpAccessChain %41 %55 %297
+ OpStore %298 %60
+ %303 = OpISub %18 %295 %60
+ %304 = OpIMul %18 %303 %86
+ %305 = OpIAdd %18 %293 %304
+ %306 = OpAccessChain %41 %55 %305
+ OpStore %306 %60
+ %311 = OpISub %18 %295 %82
+ %312 = OpIMul %18 %311 %86
+ %313 = OpIAdd %18 %293 %312
+ %314 = OpAccessChain %41 %55 %313
+ OpStore %314 %60
+ %491 = OpCompositeInsert %24 %311 %550 1
+ OpBranch %289
+ %289 = OpLabel
+ %556 = OpPhi %24 %550 %276 %491 %288
+ %555 = OpPhi %18 %549 %276 %291 %288
+ %320 = OpSGreaterThanEqual %50 %555 %19
+ OpSelectionMerge %322 None
+ OpBranchConditional %320 %321 %322
+ %321 = OpLabel
+ %324 = OpCompositeExtract %18 %556 0
+ %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
+ %330 = OpCompositeExtract %18 %556 0
+ %331 = OpIAdd %18 %330 %82
+ %333 = OpCompositeExtract %18 %556 1
+ %334 = OpIMul %18 %333 %86
+ %335 = OpIAdd %18 %331 %334
+ %336 = OpAccessChain %41 %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
+ %343 = OpISub %18 %555 %60
+ %345 = OpCompositeExtract %18 %556 0
+ %347 = OpCompositeExtract %18 %556 1
+ %348 = OpIMul %18 %347 %86
+ %349 = OpIAdd %18 %345 %348
+ %350 = OpAccessChain %41 %55 %349
+ OpStore %350 %60
+ %353 = OpIAdd %18 %345 %60
+ %357 = OpIAdd %18 %353 %348
+ %358 = OpAccessChain %41 %55 %357
+ OpStore %358 %60
+ %361 = OpIAdd %18 %345 %82
+ %365 = OpIAdd %18 %361 %348
+ %366 = OpAccessChain %41 %55 %365
+ OpStore %366 %60
+ %503 = OpCompositeInsert %24 %361 %556 0
+ OpBranch %341
+ %341 = OpLabel
+ %562 = OpPhi %24 %556 %328 %503 %340
+ %561 = OpPhi %18 %555 %328 %343 %340
+ %372 = OpSGreaterThanEqual %50 %561 %19
+ OpSelectionMerge %374 None
+ OpBranchConditional %372 %373 %374
+ %373 = OpLabel
+ %376 = OpCompositeExtract %18 %562 1
+ %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
+ %382 = OpCompositeExtract %18 %562 0
+ %384 = OpCompositeExtract %18 %562 1
+ %385 = OpIAdd %18 %384 %82
+ %386 = OpIMul %18 %385 %86
+ %387 = OpIAdd %18 %382 %386
+ %388 = OpAccessChain %41 %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
+ %397 = OpCompositeExtract %18 %562 0
+ %399 = OpCompositeExtract %18 %562 1
+ %400 = OpIMul %18 %399 %86
+ %401 = OpIAdd %18 %397 %400
+ %402 = OpAccessChain %41 %55 %401
+ OpStore %402 %60
+ %407 = OpIAdd %18 %399 %60
+ %408 = OpIMul %18 %407 %86
+ %409 = OpIAdd %18 %397 %408
+ %410 = OpAccessChain %41 %55 %409
+ OpStore %410 %60
+ %415 = OpIAdd %18 %399 %82
+ %416 = OpIMul %18 %415 %86
+ %417 = OpIAdd %18 %397 %416
+ %418 = OpAccessChain %41 %55 %417
+ OpStore %418 %60
+ %515 = OpCompositeInsert %24 %415 %562 1
+ OpBranch %393
+ %393 = OpLabel
+ %638 = OpPhi %24 %562 %380 %515 %392
+ OpBranch %161
+ %161 = OpLabel
+ %637 = OpPhi %24 %568 %165 %638 %393
+ %621 = OpPhi %18 %73 %165 %214 %393
+ %569 = OpPhi %50 %570 %165 %591 %393
+ %425 = OpIMul %18 %39 %86
+ %428 = OpIAdd %18 %425 %34
+ %429 = OpAccessChain %41 %55 %428
+ %430 = OpLoad %18 %429
+ %431 = OpIEqual %50 %430 %60
+ OpSelectionMerge %433 None
+ OpBranchConditional %431 %432 %433
+ %432 = OpLabel
+ OpStore %435 %437
+ OpBranch %70
+ %433 = OpLabel
+ OpBranch %71
+ %71 = OpLabel
+ OpBranchConditional %569 %68 %70
+ %70 = OpLabel
+ %592 = OpPhi %50 %66 %432 %162 %71
+ OpSelectionMerge %445 None
+ OpBranchConditional %592 %442 %445
+ %445 = OpLabel
+ OpStore %435 %441
+ OpBranch %442
+ %442 = 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: Equivalent shaders, one with additional dead code
+
+# The test passes because both shaders render the same image.
+
+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; 10
+; 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; 10
+; Bound: 1343
+; 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
+ %518 = OpConstantFalse %31
+ %715 = 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
+ %1342 = OpAccessChain %163 %161 %105 %105
+ %1341 = OpLoad %157 %1342
+ %1340 = OpFUnordGreaterThan %31 %1341 %373
+ OpSelectionMerge %485 None
+ OpBranchConditional %1340 %537 %485
+ %537 = OpLabel
+ OpStore %254 %373
+ OpBranchConditional %518 %485 %485
+ %485 = OpLabel
+ 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
+ %720 = OpAccessChain %163 %161 %105 %22
+ %719 = OpLoad %157 %720
+ %718 = OpFUnordGreaterThanEqual %31 %715 %719
+ OpBranchConditional %718 %359 %499
+ %499 = 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
+
+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: Equivalent shaders, one with DontInline attribute
+
+# The test passes because both shaders render the same image.
+
+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: 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 DontInline %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 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: Equivalent shaders, one with irrelevant extra instructions
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex texgen_vert PASSTHROUGH
+
+SHADER fragment texgen_frag GLSL
+#version 430
+precision highp float;
+
+layout(location = 0) out vec4 _GLF_color;
+
+void main()
+{
+ _GLF_color = vec4(
+ gl_FragCoord.x * (1.0 / 256.0),
+ (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 256.0),
+ gl_FragCoord.y * (1.0 / 256.0),
+ 1.0);
+}
+END
+BUFFER default_texture FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics texgen_pipeline
+ ATTACH texgen_vert
+ ATTACH texgen_frag
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER default_texture AS color LOCATION 0
+END
+
+CLEAR_COLOR texgen_pipeline 0 0 0 255
+CLEAR texgen_pipeline
+RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+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; 10
+; Bound: 75
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %16 %73
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %8 "i"
+ OpName %13 "coord"
+ OpName %16 "gl_FragCoord"
+ OpName %22 "texel"
+ OpName %26 "tex"
+ OpName %73 "_GLF_color"
+ OpDecorate %8 RelaxedPrecision
+ OpDecorate %16 BuiltIn FragCoord
+ OpDecorate %26 RelaxedPrecision
+ OpDecorate %26 DescriptorSet 0
+ OpDecorate %26 Binding 0
+ OpDecorate %27 RelaxedPrecision
+ OpDecorate %29 RelaxedPrecision
+ OpDecorate %51 RelaxedPrecision
+ OpDecorate %66 RelaxedPrecision
+ OpDecorate %68 RelaxedPrecision
+ OpDecorate %69 RelaxedPrecision
+ OpDecorate %71 RelaxedPrecision
+ OpDecorate %73 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %9 = OpConstant %6 0
+ %10 = OpTypeFloat 32
+ %11 = OpTypeVector %10 2
+ %12 = OpTypePointer Function %11
+ %14 = OpTypeVector %10 4
+ %15 = OpTypePointer Input %14
+ %16 = OpVariable %15 Input
+ %19 = OpConstant %10 0.00390625
+ %21 = OpTypePointer Function %14
+ %23 = OpTypeImage %10 2D 0 0 0 1 Unknown
+ %24 = OpTypeSampledImage %23
+ %25 = OpTypePointer UniformConstant %24
+ %26 = OpVariable %25 UniformConstant
+ %35 = OpTypeInt 32 0
+ %36 = OpConstant %35 0
+ %37 = OpTypePointer Function %10
+ %40 = OpConstant %35 1
+ %44 = OpConstant %35 2
+ %48 = OpConstant %10 1
+ %49 = OpTypeBool
+ %52 = OpConstant %6 16
+ %61 = OpConstant %10 256
+ %70 = OpConstant %6 1
+ %72 = OpTypePointer Output %14
+ %73 = OpVariable %72 Output
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %8 = OpVariable %7 Function
+ %13 = OpVariable %12 Function
+ %22 = OpVariable %21 Function
+ OpStore %8 %9
+ %17 = OpLoad %14 %16
+ %18 = OpVectorShuffle %11 %17 %17 0 1
+ %20 = OpVectorTimesScalar %11 %18 %19
+ OpStore %13 %20
+ %27 = OpLoad %24 %26
+ %28 = OpLoad %11 %13
+ %29 = OpImageSampleImplicitLod %14 %27 %28
+ OpStore %22 %29
+ OpBranch %30
+ %30 = OpLabel
+ OpLoopMerge %32 %33 None
+ OpBranch %34
+ %34 = OpLabel
+ %38 = OpAccessChain %37 %22 %36
+ %39 = OpLoad %10 %38
+ %41 = OpAccessChain %37 %22 %40
+ %42 = OpLoad %10 %41
+ %43 = OpFAdd %10 %39 %42
+ %45 = OpAccessChain %37 %22 %44
+ %46 = OpLoad %10 %45
+ %47 = OpFAdd %10 %43 %46
+ %50 = OpFOrdGreaterThan %49 %47 %48
+ %51 = OpLoad %6 %8
+ %53 = OpSLessThan %49 %51 %52
+ %54 = OpLogicalAnd %49 %50 %53
+ OpBranchConditional %54 %31 %32
+ %31 = OpLabel
+ %55 = OpLoad %14 %22
+ %56 = OpVectorShuffle %11 %55 %55 0 2
+ %57 = OpLoad %14 %22
+ %58 = OpVectorShuffle %11 %57 %57 1 1
+ %59 = OpFAdd %11 %56 %58
+ OpStore %13 %59
+ %60 = OpLoad %11 %13
+ %62 = OpVectorTimesScalar %11 %60 %61
+ %63 = OpExtInst %11 %1 Floor %62
+ %64 = OpCompositeConstruct %11 %61 %61
+ %65 = OpFDiv %11 %63 %64
+ OpStore %13 %65
+ %66 = OpLoad %24 %26
+ %67 = OpLoad %11 %13
+ %68 = OpImageSampleImplicitLod %14 %66 %67
+ OpStore %22 %68
+ %69 = OpLoad %6 %8
+ %71 = OpIAdd %6 %69 %70
+ OpStore %8 %71
+ OpBranch %33
+ %33 = OpLabel
+ OpBranch %30
+ %32 = OpLabel
+ %74 = OpLoad %14 %22
+ OpStore %73 %74
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# tex
+SAMPLER reference_tex
+
+
+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 default_texture AS combined_image_sampler SAMPLER reference_tex 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; 10
+; Bound: 377
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %16 %73
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %8 "i"
+ OpName %13 "coord"
+ OpName %16 "gl_FragCoord"
+ OpName %22 "texel"
+ OpName %26 "tex"
+ OpName %73 "_GLF_color"
+ OpDecorate %8 RelaxedPrecision
+ OpDecorate %16 BuiltIn FragCoord
+ OpDecorate %26 RelaxedPrecision
+ OpDecorate %26 DescriptorSet 0
+ OpDecorate %26 Binding 0
+ OpDecorate %27 RelaxedPrecision
+ OpDecorate %29 RelaxedPrecision
+ OpDecorate %51 RelaxedPrecision
+ OpDecorate %66 RelaxedPrecision
+ OpDecorate %68 RelaxedPrecision
+ OpDecorate %69 RelaxedPrecision
+ OpDecorate %71 RelaxedPrecision
+ OpDecorate %73 Location 0
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeInt 32 1
+ %7 = OpTypePointer Function %6
+ %9 = OpConstant %6 0
+ %10 = OpTypeFloat 32
+ %11 = OpTypeVector %10 2
+ %12 = OpTypePointer Function %11
+ %14 = OpTypeVector %10 4
+ %15 = OpTypePointer Input %14
+ %16 = OpVariable %15 Input
+ %19 = OpConstant %10 0.00390625
+ %21 = OpTypePointer Function %14
+ %23 = OpTypeImage %10 2D 0 0 0 1 Unknown
+ %24 = OpTypeSampledImage %23
+ %25 = OpTypePointer UniformConstant %24
+ %26 = OpVariable %25 UniformConstant
+ %35 = OpTypeInt 32 0
+ %36 = OpConstant %35 0
+ %37 = OpTypePointer Function %10
+ %40 = OpConstant %35 1
+ %44 = OpConstant %35 2
+ %48 = OpConstant %10 1
+ %49 = OpTypeBool
+ %52 = OpConstant %6 16
+ %61 = OpConstant %10 256
+ %70 = OpConstant %6 1
+ %72 = OpTypePointer Output %14
+ %73 = OpVariable %72 Output
+ %178 = OpTypeVector %6 3
+ %179 = OpTypeVector %6 4
+ %180 = OpTypeVector %35 2
+ %181 = OpTypeVector %35 3
+ %182 = OpTypeVector %10 3
+ %183 = OpTypeMatrix %182 2
+ %187 = OpTypeMatrix %14 4
+ %222 = OpConstantComposite %180 %36 %36
+ %225 = OpConstant %10 0
+ %226 = OpConstantComposite %11 %225 %225
+ %231 = OpConstantComposite %14 %225 %225 %225 %225
+ %265 = OpTypeStruct %180 %180
+ %267 = OpTypeStruct %35 %35
+ %279 = OpTypePointer Function %265
+ %280 = OpConstantComposite %265 %222 %222
+ %294 = OpConstant %35 3
+ %323 = OpTypePointer Function %35
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %293 = OpVariable %12 Function %226
+ %288 = OpVariable %21 Function %231
+ %281 = OpVariable %279 Function %280
+ %8 = OpVariable %7 Function
+ %13 = OpVariable %12 Function
+ %22 = OpVariable %21 Function
+ %188 = OpCompositeConstruct %180 %44 %40
+ OpStore %8 %9
+ %266 = OpIAddCarry %265 %188 %222
+ %299 = OpULessThanEqual %49 %9 %70
+ %344 = OpULessThanEqual %49 %294 %294
+ %345 = OpSelect %35 %344 %294 %294
+ OpStore %281 %266
+ %346 = OpAccessChain %37 %288 %345
+ %300 = OpSelect %6 %299 %9 %70
+ %301 = OpAccessChain %37 %293 %300
+ %17 = OpLoad %14 %16
+ %360 = OpULessThanEqual %49 %36 %294
+ %361 = OpSelect %35 %360 %36 %294
+ %362 = OpAccessChain %37 %22 %361
+ %223 = OpCompositeExtract %180 %266 0
+ %189 = OpCompositeConstruct %14 %19 %19 %61 %61
+ %18 = OpVectorShuffle %11 %17 %17 0 1
+ %20 = OpVectorTimesScalar %11 %18 %19
+ %227 = OpFSub %11 %20 %226
+ %190 = OpCompositeConstruct %182 %61 %48 %48
+ %228 = OpFSub %10 %48 %225
+ OpStore %13 %20
+ %191 = OpCompositeConstruct %180 %36 %40
+ %27 = OpLoad %24 %26
+ %28 = OpLoad %11 %13
+ %29 = OpImageSampleImplicitLod %14 %27 %28
+ OpStore %22 %29
+ OpBranch %30
+ %30 = OpLabel
+ OpLoopMerge %32 %33 None
+ OpBranch %34
+ %34 = OpLabel
+ %38 = OpAccessChain %37 %22 %36
+ %39 = OpLoad %10 %38
+ %41 = OpAccessChain %37 %22 %40
+ %42 = OpLoad %10 %41
+ %232 = OpFSub %14 %189 %231
+ %43 = OpFAdd %10 %39 %42
+ %45 = OpAccessChain %37 %22 %44
+ %46 = OpLoad %10 %45
+ %47 = OpFAdd %10 %43 %46
+ %234 = OpCopyObject %10 %61
+ %50 = OpFOrdGreaterThan %49 %47 %48
+ %235 = OpISub %35 %40 %36
+ %51 = OpLoad %6 %8
+ %53 = OpSLessThan %49 %51 %52
+ %54 = OpLogicalAnd %49 %50 %53
+ OpBranchConditional %54 %31 %32
+ %31 = OpLabel
+ %55 = OpLoad %14 %22
+ %56 = OpVectorShuffle %11 %55 %55 0 2
+ %57 = OpLoad %14 %22
+ %58 = OpVectorShuffle %11 %57 %57 1 1
+ %59 = OpFAdd %11 %56 %58
+ OpStore %13 %59
+ %60 = OpLoad %11 %13
+ %268 = OpUMulExtended %267 %36 %40
+ %321 = OpULessThanEqual %49 %9 %70
+ %322 = OpSelect %6 %321 %9 %70
+ %324 = OpAccessChain %323 %281 %40 %322
+ %243 = OpCompositeExtract %35 %268 0
+ %62 = OpVectorTimesScalar %11 %60 %61
+ %63 = OpExtInst %11 %1 Floor %62
+ %64 = OpCompositeConstruct %11 %61 %61
+ %65 = OpFDiv %11 %63 %64
+ %205 = OpCompositeConstruct %181 %188 %40
+ OpStore %13 %65
+ %66 = OpLoad %24 %26
+ %67 = OpLoad %11 %13
+ %68 = OpImageSampleImplicitLod %14 %66 %67
+ OpStore %22 %68
+ %69 = OpLoad %6 %8
+ %71 = OpIAdd %6 %69 %70
+ %376 = OpAccessChain %323 %324
+ %207 = OpCompositeConstruct %183 %190 %190
+ OpStore %376 %361
+ %244 = OpFMul %10 %234 %48
+ OpStore %8 %71
+ OpBranch %33
+ %33 = OpLabel
+ %208 = OpCompositeConstruct %14 %39 %42 %58
+ OpBranch %30
+ %32 = OpLabel
+ %209 = OpCompositeConstruct %183 %190 %190
+ %74 = OpLoad %14 %22
+ OpStore %73 %74
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# tex
+SAMPLER variant_tex
+
+
+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 default_texture AS combined_image_sampler SAMPLER variant_tex 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: Equivalent shaders, one with an additional access chain
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex texgen_vert PASSTHROUGH
+
+SHADER fragment texgen_frag GLSL
+#version 430
+precision highp float;
+
+layout(location = 0) out vec4 _GLF_color;
+
+void main()
+{
+ _GLF_color = vec4(
+ gl_FragCoord.x * (1.0 / 256.0),
+ (int(gl_FragCoord.x) ^ int(gl_FragCoord.y)) * (1.0 / 256.0),
+ gl_FragCoord.y * (1.0 / 256.0),
+ 1.0);
+}
+END
+BUFFER default_texture FORMAT B8G8R8A8_UNORM
+
+PIPELINE graphics texgen_pipeline
+ ATTACH texgen_vert
+ ATTACH texgen_frag
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER default_texture AS color LOCATION 0
+END
+
+CLEAR_COLOR texgen_pipeline 0 0 0 255
+CLEAR texgen_pipeline
+RUN texgen_pipeline DRAW_RECT POS 0 0 SIZE 256 256
+
+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; 10
+; Bound: 254
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %115 %130
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %115 "gl_FragCoord"
+ OpName %130 "_GLF_color"
+ OpName %134 "tex"
+ OpDecorate %115 BuiltIn FragCoord
+ OpDecorate %130 Location 0
+ OpDecorate %134 RelaxedPrecision
+ OpDecorate %134 DescriptorSet 0
+ OpDecorate %134 Binding 0
+ OpDecorate %135 RelaxedPrecision
+ OpDecorate %137 RelaxedPrecision
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %19 = OpConstant %6 0.318309873
+ %22 = OpConstant %6 0.00100000005
+ %23 = OpTypeBool
+ %27 = OpConstant %6 0
+ %32 = OpTypeInt 32 0
+ %36 = OpConstant %32 0
+ %55 = OpConstant %6 0.970000029
+ %56 = OpConstant %6 0.189999998
+ %73 = OpConstant %6 0.5
+ %81 = OpConstant %6 1
+ %98 = OpConstantComposite %7 %73 %73
+ %113 = OpTypeVector %6 4
+ %114 = OpTypePointer Input %113
+ %115 = OpVariable %114 Input
+ %118 = OpConstant %6 0.00390625
+ %124 = OpConstant %6 256
+ %129 = OpTypePointer Output %113
+ %130 = OpVariable %129 Output
+ %131 = OpTypeImage %6 2D 0 0 0 1 Unknown
+ %132 = OpTypeSampledImage %131
+ %133 = OpTypePointer UniformConstant %132
+ %134 = OpVariable %133 UniformConstant
+ %253 = OpConstantComposite %7 %118 %118
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %116 = OpLoad %113 %115
+ %117 = OpVectorShuffle %7 %116 %116 0 1
+ %119 = OpVectorTimesScalar %7 %117 %118
+ %160 = OpFSub %7 %119 %98
+ %162 = OpExtInst %6 %1 Length %160
+ OpSelectionMerge %235 None
+ OpSwitch %36 %176
+ %176 = OpLabel
+ %179 = OpFOrdLessThan %23 %162 %22
+ OpSelectionMerge %181 None
+ OpBranchConditional %179 %180 %181
+ %180 = OpLabel
+ OpBranch %235
+ %181 = OpLabel
+ %183 = OpExtInst %7 %1 FAbs %160
+ %185 = OpCompositeExtract %6 %183 1
+ %187 = OpCompositeExtract %6 %183 0
+ %188 = OpFOrdGreaterThan %23 %185 %187
+ OpSelectionMerge %201 None
+ OpBranchConditional %188 %189 %195
+ %189 = OpLabel
+ %194 = OpFDiv %6 %187 %185
+ OpBranch %201
+ %195 = OpLabel
+ %200 = OpFDiv %6 %185 %187
+ OpBranch %201
+ %201 = OpLabel
+ %247 = OpPhi %6 %194 %189 %200 %195
+ %203 = OpFMul %6 %56 %247
+ %205 = OpFMul %6 %203 %247
+ %206 = OpFSub %6 %55 %205
+ %208 = OpFMul %6 %206 %247
+ %210 = OpFMul %6 %208 %19
+ %215 = OpFOrdLessThan %23 %185 %187
+ OpSelectionMerge %219 None
+ OpBranchConditional %215 %216 %219
+ %216 = OpLabel
+ %218 = OpFSub %6 %73 %210
+ OpBranch %219
+ %219 = OpLabel
+ %248 = OpPhi %6 %210 %201 %218 %216
+ %221 = OpCompositeExtract %6 %160 0
+ %222 = OpFOrdLessThan %23 %221 %27
+ OpSelectionMerge %226 None
+ OpBranchConditional %222 %223 %226
+ %223 = OpLabel
+ %225 = OpFSub %6 %81 %248
+ OpBranch %226
+ %226 = OpLabel
+ %249 = OpPhi %6 %248 %219 %225 %223
+ %228 = OpCompositeExtract %6 %160 1
+ %229 = OpFOrdLessThan %23 %228 %27
+ OpSelectionMerge %233 None
+ OpBranchConditional %229 %230 %233
+ %230 = OpLabel
+ %232 = OpFNegate %6 %249
+ OpBranch %233
+ %233 = OpLabel
+ %250 = OpPhi %6 %249 %226 %232 %230
+ OpBranch %235
+ %235 = OpLabel
+ %251 = OpPhi %6 %27 %180 %250 %233
+ %167 = OpCompositeConstruct %7 %162 %251
+ %125 = OpVectorTimesScalar %7 %167 %124
+ %126 = OpExtInst %7 %1 Floor %125
+ %128 = OpFMul %7 %126 %253
+ %135 = OpLoad %132 %134
+ %137 = OpImageSampleImplicitLod %113 %135 %128
+ %140 = OpCompositeExtract %6 %137 0
+ %141 = OpCompositeExtract %6 %137 1
+ %142 = OpCompositeExtract %6 %137 2
+ %143 = OpCompositeConstruct %113 %140 %141 %142 %81
+ OpStore %130 %143
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for reference
+
+# tex
+SAMPLER reference_tex
+
+
+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 default_texture AS combined_image_sampler SAMPLER reference_tex 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; 10
+; Bound: 529
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main" %115 %130
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ OpName %115 "gl_FragCoord"
+ OpName %130 "_GLF_color"
+ OpName %134 "tex"
+ OpDecorate %115 BuiltIn FragCoord
+ OpDecorate %130 Location 0
+ OpDecorate %134 RelaxedPrecision
+ OpDecorate %134 DescriptorSet 0
+ OpDecorate %134 Binding 0
+ OpDecorate %135 RelaxedPrecision
+ OpDecorate %137 RelaxedPrecision
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %19 = OpConstant %6 0.318309873
+ %22 = OpConstant %6 0.00100000005
+ %23 = OpTypeBool
+ %27 = OpConstant %6 0
+ %32 = OpTypeInt 32 0
+ %36 = OpConstant %32 0
+ %55 = OpConstant %6 0.970000029
+ %56 = OpConstant %6 0.189999998
+ %73 = OpConstant %6 0.5
+ %81 = OpConstant %6 1
+ %98 = OpConstantComposite %7 %73 %73
+ %113 = OpTypeVector %6 4
+ %114 = OpTypePointer Input %113
+ %115 = OpVariable %114 Input
+ %118 = OpConstant %6 0.00390625
+ %124 = OpConstant %6 256
+ %129 = OpTypePointer Output %113
+ %130 = OpVariable %129 Output
+ %131 = OpTypeImage %6 2D 0 0 0 1 Unknown
+ %132 = OpTypeSampledImage %131
+ %133 = OpTypePointer UniformConstant %132
+ %134 = OpVariable %133 UniformConstant
+ %253 = OpConstantComposite %7 %118 %118
+ %379 = OpTypeInt 32 1
+ %380 = OpConstant %379 3
+ %383 = OpConstant %379 0
+ %384 = OpTypePointer Input %6
+ %475 = OpConstantFalse %23
+ %526 = OpTypePointer Function %23
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ %527 = OpVariable %526 Function %475
+ %116 = OpLoad %113 %115
+ %117 = OpVectorShuffle %7 %116 %116 0 1
+ %119 = OpVectorTimesScalar %7 %117 %118
+ %160 = OpFSub %7 %119 %98
+ %162 = OpExtInst %6 %1 Length %160
+ OpSelectionMerge %235 None
+ OpSwitch %36 %176
+ %176 = OpLabel
+ %179 = OpFOrdLessThan %23 %162 %22
+ OpSelectionMerge %181 None
+ OpBranchConditional %179 %180 %181
+ %180 = OpLabel
+ OpBranch %235
+ %181 = OpLabel
+ %183 = OpExtInst %7 %1 FAbs %160
+ %185 = OpCompositeExtract %6 %183 1
+ %187 = OpCompositeExtract %6 %183 0
+ %188 = OpFOrdGreaterThan %23 %185 %187
+ OpSelectionMerge %201 None
+ OpBranchConditional %188 %189 %195
+ %189 = OpLabel
+ %194 = OpFDiv %6 %187 %185
+ OpBranch %201
+ %195 = OpLabel
+ %200 = OpFDiv %6 %185 %187
+ OpBranch %201
+ %201 = OpLabel
+ %247 = OpPhi %6 %194 %189 %200 %195
+ %203 = OpFMul %6 %56 %247
+ %205 = OpFMul %6 %203 %247
+ %206 = OpFSub %6 %55 %205
+ %208 = OpFMul %6 %206 %247
+ %210 = OpFMul %6 %208 %19
+ %215 = OpFOrdLessThan %23 %185 %187
+ OpSelectionMerge %219 None
+ OpBranchConditional %215 %216 %219
+ %216 = OpLabel
+ %218 = OpFSub %6 %73 %210
+ OpBranch %219
+ %219 = OpLabel
+ %248 = OpPhi %6 %210 %201 %218 %216
+ %221 = OpCompositeExtract %6 %160 0
+ %222 = OpFOrdLessThan %23 %221 %27
+ OpSelectionMerge %226 None
+ OpBranchConditional %222 %223 %226
+ %223 = OpLabel
+ %225 = OpFSub %6 %81 %248
+ OpBranch %226
+ %226 = OpLabel
+ %249 = OpPhi %6 %248 %219 %225 %223
+ %228 = OpCompositeExtract %6 %160 1
+ %229 = OpFOrdLessThan %23 %228 %27
+ OpSelectionMerge %233 None
+ OpBranchConditional %229 %230 %233
+ %230 = OpLabel
+ %232 = OpFNegate %6 %249
+ OpBranch %233
+ %233 = OpLabel
+ %250 = OpPhi %6 %249 %226 %232 %230
+ OpBranch %235
+ %235 = OpLabel
+ %251 = OpPhi %6 %27 %180 %250 %233
+ %167 = OpCompositeConstruct %7 %162 %251
+ %125 = OpVectorTimesScalar %7 %167 %124
+ %126 = OpExtInst %7 %1 Floor %125
+ %128 = OpFMul %7 %126 %253
+ %135 = OpLoad %132 %134
+ %137 = OpImageSampleImplicitLod %113 %135 %128
+ %140 = OpCompositeExtract %6 %137 0
+ %141 = OpCompositeExtract %6 %137 1
+ %142 = OpCompositeExtract %6 %137 2
+ OpStore %527 %179
+ %528 = OpLoad %23 %527
+ %381 = OpULessThanEqual %23 %383 %380
+ %382 = OpSelect %379 %381 %383 %380
+ %385 = OpAccessChain %384 %115 %382
+ %143 = OpCompositeConstruct %113 %140 %141 %142 %81
+ OpStore %130 %143
+ OpReturn
+ OpFunctionEnd
+END
+
+# uniforms for variant
+
+# tex
+SAMPLER variant_tex
+
+
+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 default_texture AS combined_image_sampler SAMPLER variant_tex 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
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-bubblesort-flag-complex-conditionals
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-O-dead-code
+dEQP-VK.graphicsfuzz.spv-stable-maze-O-memory-accesses
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-dead-code
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-dontinline
dEQP-VK.graphicsfuzz.spv-stable-quicksort-mat-func-param
dEQP-VK.graphicsfuzz.spv-stable-rects-Os-mutate-var-push-through-var
+dEQP-VK.graphicsfuzz.spv-stable-sampler-loop-extra-instructions
+dEQP-VK.graphicsfuzz.spv-stable-sampler-polar-simple-O-access-chain
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-false-if-discard-loop
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-fragcoord-less-than-zero
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-nested-if-and-conditional