Add a batch of GraphicsFuzz tests
authorAlastair Donaldson <afdx@google.com>
Fri, 17 Jul 2020 11:53:46 +0000 (12:53 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 2 Sep 2020 07:20:07 +0000 (03:20 -0400)
Components: Vulkan

New Tests:

dEQP-VK.graphicsfuzz.spv-access-chains
dEQP-VK.graphicsfuzz.spv-composite-phi
dEQP-VK.graphicsfuzz.spv-composite2
dEQP-VK.graphicsfuzz.spv-composites
dEQP-VK.graphicsfuzz.spv-copy-object
dEQP-VK.graphicsfuzz.spv-dead-break-and-unroll
dEQP-VK.graphicsfuzz.spv-declare-bvec4
dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll

Change-Id: I5229fbb25871948318461875b2786e319bd73bc9

12 files changed:
android/cts/master/vk-master-2020-03-01.txt
android/cts/master/vk-master.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/index.txt
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-access-chains.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composite-phi.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composite2.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composites.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-copy-object.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber [new file with mode: 0644]
external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber [new file with mode: 0644]
external/vulkancts/mustpass/master/vk-default.txt

index b11d5d6..5171c6b 100644 (file)
@@ -292174,6 +292174,14 @@ dEQP-VK.graphicsfuzz.returned-boolean-in-vector
 dEQP-VK.graphicsfuzz.set-color-in-one-iteration-while-loop
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.smoothstep-after-loop
+dEQP-VK.graphicsfuzz.spv-access-chains
+dEQP-VK.graphicsfuzz.spv-composite-phi
+dEQP-VK.graphicsfuzz.spv-composite2
+dEQP-VK.graphicsfuzz.spv-composites
+dEQP-VK.graphicsfuzz.spv-copy-object
+dEQP-VK.graphicsfuzz.spv-dead-break-and-unroll
+dEQP-VK.graphicsfuzz.spv-declare-bvec4
+dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll
 dEQP-VK.graphicsfuzz.stable-binarysearch-tree-with-loop-read-write-global
 dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-injected-conditional-true
 dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-true-conditional-simple-loop
index bfa45ae..cc7d2a2 100644 (file)
@@ -702367,6 +702367,14 @@ dEQP-VK.graphicsfuzz.returned-boolean-in-vector
 dEQP-VK.graphicsfuzz.set-color-in-one-iteration-while-loop
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.smoothstep-after-loop
+dEQP-VK.graphicsfuzz.spv-access-chains
+dEQP-VK.graphicsfuzz.spv-composite-phi
+dEQP-VK.graphicsfuzz.spv-composite2
+dEQP-VK.graphicsfuzz.spv-composites
+dEQP-VK.graphicsfuzz.spv-copy-object
+dEQP-VK.graphicsfuzz.spv-dead-break-and-unroll
+dEQP-VK.graphicsfuzz.spv-declare-bvec4
+dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll
 dEQP-VK.graphicsfuzz.stable-binarysearch-tree-with-loop-read-write-global
 dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-injected-conditional-true
 dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-true-conditional-simple-loop
index 8d40646..d575051 100644 (file)
 {      "set-color-in-one-iteration-while-loop.amber",                                                                                          "set-color-in-one-iteration-while-loop",                                                                                        "A frag shader that sets the color in one iter while loop"                                                      },
 {      "similar-nested-ifs.amber",                                                                                                                                     "similar-nested-ifs",                                                                                                                           "A fragment shader with similar nested ifs and loops"                                                           },
 {      "smoothstep-after-loop.amber",                                                                                                                          "smoothstep-after-loop",                                                                                                                        "Fragment shader with 1-iteration loop and smoothstep"                                                          },
+{      "spv-access-chains.amber",                                                                                                                                      "spv-access-chains",                                                                                                                            "Equivalent shaders, one with extra access chains"                                                                      },
+{      "spv-composite-phi.amber",                                                                                                                                      "spv-composite-phi",                                                                                                                            "Equivalent shaders, one with id used by OpPhi hidden in composite"                                     },
+{      "spv-composite2.amber",                                                                                                                                         "spv-composite2",                                                                                                                                       "Equivalent shaders, one where an id is hidden inside a composite"                                      },
+{      "spv-composites.amber",                                                                                                                                         "spv-composites",                                                                                                                                       "Equivalent shaders; one obfuscates an id via composites"                                                       },
+{      "spv-copy-object.amber",                                                                                                                                        "spv-copy-object",                                                                                                                                      "Equivalent shaders; one features extra OpCopyObject instructions"                                      },
+{      "spv-dead-break-and-unroll.amber",                                                                                                                      "spv-dead-break-and-unroll",                                                                                                            "Equivalent shaders, one with a dead break and an Unroll annotation"                            },
+{      "spv-declare-bvec4.amber",                                                                                                                                      "spv-declare-bvec4",                                                                                                                            "Equivalent shaders except one declares a bvec4"                                                                        },
+{      "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"                         },
 {      "stable-binarysearch-tree-with-loop-read-write-global.amber",                                                           "stable-binarysearch-tree-with-loop-read-write-global",                                                         "A pair of fragment shaders that both render red"                                                                       },
 {      "stable-colorgrid-modulo-injected-conditional-true.amber",                                                                      "stable-colorgrid-modulo-injected-conditional-true",                                                            "A fragment shader with an always true conditional"                                                                     },
 {      "stable-colorgrid-modulo-true-conditional-simple-loop.amber",                                                           "stable-colorgrid-modulo-true-conditional-simple-loop",                                                         "A fragment shader with conditional and simple loop"                                                            },
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-access-chains.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-access-chains.amber
new file mode 100644 (file)
index 0000000..4960622
--- /dev/null
@@ -0,0 +1,1307 @@
+#!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 extra access chains
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 442
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %435
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %9 "pos"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %26 "ipos"
+               OpName %42 "i"
+               OpName %55 "map"
+               OpName %62 "p"
+               OpName %65 "canwalk"
+               OpName %67 "v"
+               OpName %74 "directions"
+               OpName %171 "j"
+               OpName %208 "d"
+               OpName %435 "_GLF_color"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %435 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %24 = OpTypeVector %18 2
+         %25 = OpTypePointer Function %24
+         %27 = OpTypeInt 32 0
+         %28 = OpConstant %27 0
+         %29 = OpTypePointer Function %6
+         %32 = OpConstant %6 16
+         %35 = OpConstant %27 1
+         %41 = OpTypePointer Function %18
+         %49 = OpConstant %18 256
+         %50 = OpTypeBool
+         %52 = OpConstant %27 256
+         %53 = OpTypeArray %18 %52
+         %54 = OpTypePointer Private %53
+         %55 = OpVariable %54 Private
+         %57 = OpTypePointer Private %18
+         %60 = OpConstant %18 1
+         %63 = OpConstantComposite %24 %19 %19
+         %64 = OpTypePointer Function %50
+         %66 = OpConstantTrue %50
+         %82 = OpConstant %18 2
+         %86 = OpConstant %18 16
+        %119 = OpConstant %18 14
+        %162 = OpConstantFalse %50
+        %169 = OpConstant %18 8
+        %434 = OpTypePointer Output %10
+        %435 = OpVariable %434 Output
+        %436 = OpConstant %6 1
+        %437 = OpConstantComposite %10 %436 %436 %436 %436
+        %440 = OpConstant %6 0
+        %441 = OpConstantComposite %10 %440 %440 %440 %436
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+          %9 = OpVariable %8 Function
+         %26 = OpVariable %25 Function
+         %42 = OpVariable %41 Function
+         %62 = OpVariable %25 Function
+         %65 = OpVariable %64 Function
+         %67 = OpVariable %41 Function
+         %74 = OpVariable %41 Function
+        %171 = OpVariable %41 Function
+        %208 = OpVariable %41 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+               OpStore %9 %23
+         %30 = OpAccessChain %29 %9 %28
+         %31 = OpLoad %6 %30
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %36 = OpAccessChain %29 %9 %35
+         %37 = OpLoad %6 %36
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %40 = OpCompositeConstruct %24 %34 %39
+               OpStore %26 %40
+               OpStore %42 %19
+               OpBranch %43
+         %43 = OpLabel
+               OpLoopMerge %45 %46 None
+               OpBranch %47
+         %47 = OpLabel
+         %48 = OpLoad %18 %42
+         %51 = OpSLessThan %50 %48 %49
+               OpBranchConditional %51 %44 %45
+         %44 = OpLabel
+         %56 = OpLoad %18 %42
+         %58 = OpAccessChain %57 %55 %56
+               OpStore %58 %19
+               OpBranch %46
+         %46 = OpLabel
+         %59 = OpLoad %18 %42
+         %61 = OpIAdd %18 %59 %60
+               OpStore %42 %61
+               OpBranch %43
+         %45 = OpLabel
+               OpStore %62 %63
+               OpStore %65 %66
+               OpStore %67 %19
+               OpBranch %68
+         %68 = OpLabel
+               OpLoopMerge %70 %71 None
+               OpBranch %69
+         %69 = OpLabel
+         %72 = OpLoad %18 %67
+         %73 = OpIAdd %18 %72 %60
+               OpStore %67 %73
+               OpStore %74 %19
+         %75 = OpAccessChain %41 %62 %28
+         %76 = OpLoad %18 %75
+         %77 = OpSGreaterThan %50 %76 %19
+               OpSelectionMerge %79 None
+               OpBranchConditional %77 %78 %79
+         %78 = OpLabel
+         %80 = OpAccessChain %41 %62 %28
+         %81 = OpLoad %18 %80
+         %83 = OpISub %18 %81 %82
+         %84 = OpAccessChain %41 %62 %35
+         %85 = OpLoad %18 %84
+         %87 = OpIMul %18 %85 %86
+         %88 = OpIAdd %18 %83 %87
+         %89 = OpAccessChain %57 %55 %88
+         %90 = OpLoad %18 %89
+         %91 = OpIEqual %50 %90 %19
+               OpBranch %79
+         %79 = OpLabel
+         %92 = OpPhi %50 %77 %69 %91 %78
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpLoad %18 %74
+         %96 = OpIAdd %18 %95 %60
+               OpStore %74 %96
+               OpBranch %94
+         %94 = OpLabel
+         %97 = OpAccessChain %41 %62 %35
+         %98 = OpLoad %18 %97
+         %99 = OpSGreaterThan %50 %98 %19
+               OpSelectionMerge %101 None
+               OpBranchConditional %99 %100 %101
+        %100 = OpLabel
+        %102 = OpAccessChain %41 %62 %28
+        %103 = OpLoad %18 %102
+        %104 = OpAccessChain %41 %62 %35
+        %105 = OpLoad %18 %104
+        %106 = OpISub %18 %105 %82
+        %107 = OpIMul %18 %106 %86
+        %108 = OpIAdd %18 %103 %107
+        %109 = OpAccessChain %57 %55 %108
+        %110 = OpLoad %18 %109
+        %111 = OpIEqual %50 %110 %19
+               OpBranch %101
+        %101 = OpLabel
+        %112 = OpPhi %50 %99 %94 %111 %100
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %115 = OpLoad %18 %74
+        %116 = OpIAdd %18 %115 %60
+               OpStore %74 %116
+               OpBranch %114
+        %114 = OpLabel
+        %117 = OpAccessChain %41 %62 %28
+        %118 = OpLoad %18 %117
+        %120 = OpSLessThan %50 %118 %119
+               OpSelectionMerge %122 None
+               OpBranchConditional %120 %121 %122
+        %121 = OpLabel
+        %123 = OpAccessChain %41 %62 %28
+        %124 = OpLoad %18 %123
+        %125 = OpIAdd %18 %124 %82
+        %126 = OpAccessChain %41 %62 %35
+        %127 = OpLoad %18 %126
+        %128 = OpIMul %18 %127 %86
+        %129 = OpIAdd %18 %125 %128
+        %130 = OpAccessChain %57 %55 %129
+        %131 = OpLoad %18 %130
+        %132 = OpIEqual %50 %131 %19
+               OpBranch %122
+        %122 = OpLabel
+        %133 = OpPhi %50 %120 %114 %132 %121
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %134 %135
+        %134 = OpLabel
+        %136 = OpLoad %18 %74
+        %137 = OpIAdd %18 %136 %60
+               OpStore %74 %137
+               OpBranch %135
+        %135 = OpLabel
+        %138 = OpAccessChain %41 %62 %35
+        %139 = OpLoad %18 %138
+        %140 = OpSLessThan %50 %139 %119
+               OpSelectionMerge %142 None
+               OpBranchConditional %140 %141 %142
+        %141 = OpLabel
+        %143 = OpAccessChain %41 %62 %28
+        %144 = OpLoad %18 %143
+        %145 = OpAccessChain %41 %62 %35
+        %146 = OpLoad %18 %145
+        %147 = OpIAdd %18 %146 %82
+        %148 = OpIMul %18 %147 %86
+        %149 = OpIAdd %18 %144 %148
+        %150 = OpAccessChain %57 %55 %149
+        %151 = OpLoad %18 %150
+        %152 = OpIEqual %50 %151 %19
+               OpBranch %142
+        %142 = OpLabel
+        %153 = OpPhi %50 %140 %135 %152 %141
+               OpSelectionMerge %155 None
+               OpBranchConditional %153 %154 %155
+        %154 = OpLabel
+        %156 = OpLoad %18 %74
+        %157 = OpIAdd %18 %156 %60
+               OpStore %74 %157
+               OpBranch %155
+        %155 = OpLabel
+        %158 = OpLoad %18 %74
+        %159 = OpIEqual %50 %158 %19
+               OpSelectionMerge %161 None
+               OpBranchConditional %159 %160 %207
+        %160 = OpLabel
+               OpStore %65 %162
+               OpStore %42 %19
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %18 %42
+        %170 = OpSLessThan %50 %168 %169
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %171 %19
+               OpBranch %172
+        %172 = OpLabel
+               OpLoopMerge %174 %175 None
+               OpBranch %176
+        %176 = OpLabel
+        %177 = OpLoad %18 %171
+        %178 = OpSLessThan %50 %177 %169
+               OpBranchConditional %178 %173 %174
+        %173 = OpLabel
+        %179 = OpLoad %18 %171
+        %180 = OpIMul %18 %179 %82
+        %181 = OpLoad %18 %42
+        %182 = OpIMul %18 %181 %82
+        %183 = OpIMul %18 %182 %86
+        %184 = OpIAdd %18 %180 %183
+        %185 = OpAccessChain %57 %55 %184
+        %186 = OpLoad %18 %185
+        %187 = OpIEqual %50 %186 %19
+               OpSelectionMerge %189 None
+               OpBranchConditional %187 %188 %189
+        %188 = OpLabel
+        %190 = OpLoad %18 %171
+        %191 = OpIMul %18 %190 %82
+        %192 = OpAccessChain %41 %62 %28
+               OpStore %192 %191
+        %193 = OpLoad %18 %42
+        %194 = OpIMul %18 %193 %82
+        %195 = OpAccessChain %41 %62 %35
+               OpStore %195 %194
+               OpStore %65 %66
+               OpBranch %189
+        %189 = OpLabel
+               OpBranch %175
+        %175 = OpLabel
+        %196 = OpLoad %18 %171
+        %197 = OpIAdd %18 %196 %60
+               OpStore %171 %197
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %198 = OpLoad %18 %42
+        %199 = OpIAdd %18 %198 %60
+               OpStore %42 %199
+               OpBranch %163
+        %165 = OpLabel
+        %200 = OpAccessChain %41 %62 %28
+        %201 = OpLoad %18 %200
+        %202 = OpAccessChain %41 %62 %35
+        %203 = OpLoad %18 %202
+        %204 = OpIMul %18 %203 %86
+        %205 = OpIAdd %18 %201 %204
+        %206 = OpAccessChain %57 %55 %205
+               OpStore %206 %60
+               OpBranch %161
+        %207 = OpLabel
+        %209 = OpLoad %18 %67
+        %210 = OpLoad %18 %74
+        %211 = OpSMod %18 %209 %210
+               OpStore %208 %211
+        %212 = OpLoad %18 %74
+        %213 = OpLoad %18 %67
+        %214 = OpIAdd %18 %213 %212
+               OpStore %67 %214
+        %215 = OpLoad %18 %208
+        %216 = OpSGreaterThanEqual %50 %215 %19
+               OpSelectionMerge %218 None
+               OpBranchConditional %216 %217 %218
+        %217 = OpLabel
+        %219 = OpAccessChain %41 %62 %28
+        %220 = OpLoad %18 %219
+        %221 = OpSGreaterThan %50 %220 %19
+               OpBranch %218
+        %218 = OpLabel
+        %222 = OpPhi %50 %216 %207 %221 %217
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %223 %224
+        %223 = OpLabel
+        %225 = OpAccessChain %41 %62 %28
+        %226 = OpLoad %18 %225
+        %227 = OpISub %18 %226 %82
+        %228 = OpAccessChain %41 %62 %35
+        %229 = OpLoad %18 %228
+        %230 = OpIMul %18 %229 %86
+        %231 = OpIAdd %18 %227 %230
+        %232 = OpAccessChain %57 %55 %231
+        %233 = OpLoad %18 %232
+        %234 = OpIEqual %50 %233 %19
+               OpBranch %224
+        %224 = OpLabel
+        %235 = OpPhi %50 %222 %218 %234 %223
+               OpSelectionMerge %237 None
+               OpBranchConditional %235 %236 %237
+        %236 = OpLabel
+        %238 = OpLoad %18 %208
+        %239 = OpISub %18 %238 %60
+               OpStore %208 %239
+        %240 = OpAccessChain %41 %62 %28
+        %241 = OpLoad %18 %240
+        %242 = OpAccessChain %41 %62 %35
+        %243 = OpLoad %18 %242
+        %244 = OpIMul %18 %243 %86
+        %245 = OpIAdd %18 %241 %244
+        %246 = OpAccessChain %57 %55 %245
+               OpStore %246 %60
+        %247 = OpAccessChain %41 %62 %28
+        %248 = OpLoad %18 %247
+        %249 = OpISub %18 %248 %60
+        %250 = OpAccessChain %41 %62 %35
+        %251 = OpLoad %18 %250
+        %252 = OpIMul %18 %251 %86
+        %253 = OpIAdd %18 %249 %252
+        %254 = OpAccessChain %57 %55 %253
+               OpStore %254 %60
+        %255 = OpAccessChain %41 %62 %28
+        %256 = OpLoad %18 %255
+        %257 = OpISub %18 %256 %82
+        %258 = OpAccessChain %41 %62 %35
+        %259 = OpLoad %18 %258
+        %260 = OpIMul %18 %259 %86
+        %261 = OpIAdd %18 %257 %260
+        %262 = OpAccessChain %57 %55 %261
+               OpStore %262 %60
+        %263 = OpAccessChain %41 %62 %28
+        %264 = OpLoad %18 %263
+        %265 = OpISub %18 %264 %82
+        %266 = OpAccessChain %41 %62 %28
+               OpStore %266 %265
+               OpBranch %237
+        %237 = OpLabel
+        %267 = OpLoad %18 %208
+        %268 = OpSGreaterThanEqual %50 %267 %19
+               OpSelectionMerge %270 None
+               OpBranchConditional %268 %269 %270
+        %269 = OpLabel
+        %271 = OpAccessChain %41 %62 %35
+        %272 = OpLoad %18 %271
+        %273 = OpSGreaterThan %50 %272 %19
+               OpBranch %270
+        %270 = OpLabel
+        %274 = OpPhi %50 %268 %237 %273 %269
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+        %277 = OpAccessChain %41 %62 %28
+        %278 = OpLoad %18 %277
+        %279 = OpAccessChain %41 %62 %35
+        %280 = OpLoad %18 %279
+        %281 = OpISub %18 %280 %82
+        %282 = OpIMul %18 %281 %86
+        %283 = OpIAdd %18 %278 %282
+        %284 = OpAccessChain %57 %55 %283
+        %285 = OpLoad %18 %284
+        %286 = OpIEqual %50 %285 %19
+               OpBranch %276
+        %276 = OpLabel
+        %287 = OpPhi %50 %274 %270 %286 %275
+               OpSelectionMerge %289 None
+               OpBranchConditional %287 %288 %289
+        %288 = OpLabel
+        %290 = OpLoad %18 %208
+        %291 = OpISub %18 %290 %60
+               OpStore %208 %291
+        %292 = OpAccessChain %41 %62 %28
+        %293 = OpLoad %18 %292
+        %294 = OpAccessChain %41 %62 %35
+        %295 = OpLoad %18 %294
+        %296 = OpIMul %18 %295 %86
+        %297 = OpIAdd %18 %293 %296
+        %298 = OpAccessChain %57 %55 %297
+               OpStore %298 %60
+        %299 = OpAccessChain %41 %62 %28
+        %300 = OpLoad %18 %299
+        %301 = OpAccessChain %41 %62 %35
+        %302 = OpLoad %18 %301
+        %303 = OpISub %18 %302 %60
+        %304 = OpIMul %18 %303 %86
+        %305 = OpIAdd %18 %300 %304
+        %306 = OpAccessChain %57 %55 %305
+               OpStore %306 %60
+        %307 = OpAccessChain %41 %62 %28
+        %308 = OpLoad %18 %307
+        %309 = OpAccessChain %41 %62 %35
+        %310 = OpLoad %18 %309
+        %311 = OpISub %18 %310 %82
+        %312 = OpIMul %18 %311 %86
+        %313 = OpIAdd %18 %308 %312
+        %314 = OpAccessChain %57 %55 %313
+               OpStore %314 %60
+        %315 = OpAccessChain %41 %62 %35
+        %316 = OpLoad %18 %315
+        %317 = OpISub %18 %316 %82
+        %318 = OpAccessChain %41 %62 %35
+               OpStore %318 %317
+               OpBranch %289
+        %289 = OpLabel
+        %319 = OpLoad %18 %208
+        %320 = OpSGreaterThanEqual %50 %319 %19
+               OpSelectionMerge %322 None
+               OpBranchConditional %320 %321 %322
+        %321 = OpLabel
+        %323 = OpAccessChain %41 %62 %28
+        %324 = OpLoad %18 %323
+        %325 = OpSLessThan %50 %324 %119
+               OpBranch %322
+        %322 = OpLabel
+        %326 = OpPhi %50 %320 %289 %325 %321
+               OpSelectionMerge %328 None
+               OpBranchConditional %326 %327 %328
+        %327 = OpLabel
+        %329 = OpAccessChain %41 %62 %28
+        %330 = OpLoad %18 %329
+        %331 = OpIAdd %18 %330 %82
+        %332 = OpAccessChain %41 %62 %35
+        %333 = OpLoad %18 %332
+        %334 = OpIMul %18 %333 %86
+        %335 = OpIAdd %18 %331 %334
+        %336 = OpAccessChain %57 %55 %335
+        %337 = OpLoad %18 %336
+        %338 = OpIEqual %50 %337 %19
+               OpBranch %328
+        %328 = OpLabel
+        %339 = OpPhi %50 %326 %322 %338 %327
+               OpSelectionMerge %341 None
+               OpBranchConditional %339 %340 %341
+        %340 = OpLabel
+        %342 = OpLoad %18 %208
+        %343 = OpISub %18 %342 %60
+               OpStore %208 %343
+        %344 = OpAccessChain %41 %62 %28
+        %345 = OpLoad %18 %344
+        %346 = OpAccessChain %41 %62 %35
+        %347 = OpLoad %18 %346
+        %348 = OpIMul %18 %347 %86
+        %349 = OpIAdd %18 %345 %348
+        %350 = OpAccessChain %57 %55 %349
+               OpStore %350 %60
+        %351 = OpAccessChain %41 %62 %28
+        %352 = OpLoad %18 %351
+        %353 = OpIAdd %18 %352 %60
+        %354 = OpAccessChain %41 %62 %35
+        %355 = OpLoad %18 %354
+        %356 = OpIMul %18 %355 %86
+        %357 = OpIAdd %18 %353 %356
+        %358 = OpAccessChain %57 %55 %357
+               OpStore %358 %60
+        %359 = OpAccessChain %41 %62 %28
+        %360 = OpLoad %18 %359
+        %361 = OpIAdd %18 %360 %82
+        %362 = OpAccessChain %41 %62 %35
+        %363 = OpLoad %18 %362
+        %364 = OpIMul %18 %363 %86
+        %365 = OpIAdd %18 %361 %364
+        %366 = OpAccessChain %57 %55 %365
+               OpStore %366 %60
+        %367 = OpAccessChain %41 %62 %28
+        %368 = OpLoad %18 %367
+        %369 = OpIAdd %18 %368 %82
+        %370 = OpAccessChain %41 %62 %28
+               OpStore %370 %369
+               OpBranch %341
+        %341 = OpLabel
+        %371 = OpLoad %18 %208
+        %372 = OpSGreaterThanEqual %50 %371 %19
+               OpSelectionMerge %374 None
+               OpBranchConditional %372 %373 %374
+        %373 = OpLabel
+        %375 = OpAccessChain %41 %62 %35
+        %376 = OpLoad %18 %375
+        %377 = OpSLessThan %50 %376 %119
+               OpBranch %374
+        %374 = OpLabel
+        %378 = OpPhi %50 %372 %341 %377 %373
+               OpSelectionMerge %380 None
+               OpBranchConditional %378 %379 %380
+        %379 = OpLabel
+        %381 = OpAccessChain %41 %62 %28
+        %382 = OpLoad %18 %381
+        %383 = OpAccessChain %41 %62 %35
+        %384 = OpLoad %18 %383
+        %385 = OpIAdd %18 %384 %82
+        %386 = OpIMul %18 %385 %86
+        %387 = OpIAdd %18 %382 %386
+        %388 = OpAccessChain %57 %55 %387
+        %389 = OpLoad %18 %388
+        %390 = OpIEqual %50 %389 %19
+               OpBranch %380
+        %380 = OpLabel
+        %391 = OpPhi %50 %378 %374 %390 %379
+               OpSelectionMerge %393 None
+               OpBranchConditional %391 %392 %393
+        %392 = OpLabel
+        %394 = OpLoad %18 %208
+        %395 = OpISub %18 %394 %60
+               OpStore %208 %395
+        %396 = OpAccessChain %41 %62 %28
+        %397 = OpLoad %18 %396
+        %398 = OpAccessChain %41 %62 %35
+        %399 = OpLoad %18 %398
+        %400 = OpIMul %18 %399 %86
+        %401 = OpIAdd %18 %397 %400
+        %402 = OpAccessChain %57 %55 %401
+               OpStore %402 %60
+        %403 = OpAccessChain %41 %62 %28
+        %404 = OpLoad %18 %403
+        %405 = OpAccessChain %41 %62 %35
+        %406 = OpLoad %18 %405
+        %407 = OpIAdd %18 %406 %60
+        %408 = OpIMul %18 %407 %86
+        %409 = OpIAdd %18 %404 %408
+        %410 = OpAccessChain %57 %55 %409
+               OpStore %410 %60
+        %411 = OpAccessChain %41 %62 %28
+        %412 = OpLoad %18 %411
+        %413 = OpAccessChain %41 %62 %35
+        %414 = OpLoad %18 %413
+        %415 = OpIAdd %18 %414 %82
+        %416 = OpIMul %18 %415 %86
+        %417 = OpIAdd %18 %412 %416
+        %418 = OpAccessChain %57 %55 %417
+               OpStore %418 %60
+        %419 = OpAccessChain %41 %62 %35
+        %420 = OpLoad %18 %419
+        %421 = OpIAdd %18 %420 %82
+        %422 = OpAccessChain %41 %62 %35
+               OpStore %422 %421
+               OpBranch %393
+        %393 = OpLabel
+               OpBranch %161
+        %161 = OpLabel
+        %423 = OpAccessChain %41 %26 %35
+        %424 = OpLoad %18 %423
+        %425 = OpIMul %18 %424 %86
+        %426 = OpAccessChain %41 %26 %28
+        %427 = OpLoad %18 %426
+        %428 = OpIAdd %18 %425 %427
+        %429 = OpAccessChain %57 %55 %428
+        %430 = OpLoad %18 %429
+        %431 = OpIEqual %50 %430 %60
+               OpSelectionMerge %433 None
+               OpBranchConditional %431 %432 %433
+        %432 = OpLabel
+               OpStore %435 %437
+               OpReturn
+        %433 = OpLabel
+               OpBranch %71
+         %71 = OpLabel
+        %439 = OpLoad %50 %65
+               OpBranchConditional %439 %68 %70
+         %70 = OpLabel
+               OpStore %435 %441
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 742
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %435
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %9 "pos"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %26 "ipos"
+               OpName %42 "i"
+               OpName %55 "map"
+               OpName %62 "p"
+               OpName %65 "canwalk"
+               OpName %67 "v"
+               OpName %74 "directions"
+               OpName %171 "j"
+               OpName %208 "d"
+               OpName %435 "_GLF_color"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %435 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %24 = OpTypeVector %18 2
+         %25 = OpTypePointer Function %24
+         %27 = OpTypeInt 32 0
+         %28 = OpConstant %27 0
+         %29 = OpTypePointer Function %6
+         %32 = OpConstant %6 16
+         %35 = OpConstant %27 1
+         %41 = OpTypePointer Function %18
+         %49 = OpConstant %18 256
+         %50 = OpTypeBool
+         %52 = OpConstant %27 256
+         %53 = OpTypeArray %18 %52
+         %54 = OpTypePointer Private %53
+         %55 = OpVariable %54 Private
+         %57 = OpTypePointer Private %18
+         %60 = OpConstant %18 1
+         %63 = OpConstantComposite %24 %19 %19
+         %64 = OpTypePointer Function %50
+         %66 = OpConstantTrue %50
+         %82 = OpConstant %18 2
+         %86 = OpConstant %18 16
+        %119 = OpConstant %18 14
+        %162 = OpConstantFalse %50
+        %169 = OpConstant %18 8
+        %434 = OpTypePointer Output %10
+        %435 = OpVariable %434 Output
+        %436 = OpConstant %6 1
+        %437 = OpConstantComposite %10 %436 %436 %436 %436
+        %440 = OpConstant %6 0
+        %441 = OpConstantComposite %10 %440 %440 %440 %436
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+          %9 = OpVariable %8 Function
+         %26 = OpVariable %25 Function
+         %42 = OpVariable %41 Function
+         %62 = OpVariable %25 Function
+         %65 = OpVariable %64 Function
+         %67 = OpVariable %41 Function
+         %74 = OpVariable %41 Function
+        %171 = OpVariable %41 Function
+        %208 = OpVariable %41 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+               OpStore %9 %23
+         %30 = OpAccessChain %29 %9 %28
+         %31 = OpLoad %6 %30
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %36 = OpAccessChain %29 %9 %35
+         %37 = OpLoad %6 %36
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %40 = OpCompositeConstruct %24 %34 %39
+               OpStore %26 %40
+               OpStore %42 %19
+               OpBranch %43
+         %43 = OpLabel
+               OpLoopMerge %45 %46 None
+               OpBranch %47
+         %47 = OpLabel
+         %48 = OpLoad %18 %42
+         %51 = OpSLessThan %50 %48 %49
+               OpBranchConditional %51 %44 %45
+         %44 = OpLabel
+         %56 = OpLoad %18 %42
+         %58 = OpAccessChain %57 %55 %56
+               OpStore %58 %19
+               OpBranch %46
+         %46 = OpLabel
+         %59 = OpLoad %18 %42
+         %61 = OpIAdd %18 %59 %60
+               OpStore %42 %61
+               OpBranch %43
+         %45 = OpLabel
+               OpStore %62 %63
+               OpStore %65 %66
+               OpStore %67 %19
+               OpBranch %68
+         %68 = OpLabel
+               OpLoopMerge %70 %71 None
+               OpBranch %69
+         %69 = OpLabel
+         %72 = OpLoad %18 %67
+         %73 = OpIAdd %18 %72 %60
+               OpStore %67 %73
+               OpStore %74 %19
+         %75 = OpAccessChain %41 %62 %28
+         %76 = OpLoad %18 %75
+         %77 = OpSGreaterThan %50 %76 %19
+               OpSelectionMerge %79 None
+               OpBranchConditional %77 %78 %79
+         %78 = OpLabel
+         %80 = OpAccessChain %41 %62 %28
+         %81 = OpLoad %18 %80
+         %83 = OpISub %18 %81 %82
+         %84 = OpAccessChain %41 %62 %35
+         %85 = OpLoad %18 %84
+         %87 = OpIMul %18 %85 %86
+         %88 = OpIAdd %18 %83 %87
+         %89 = OpAccessChain %57 %55 %88
+         %90 = OpLoad %18 %89
+         %91 = OpIEqual %50 %90 %19
+               OpBranch %79
+         %79 = OpLabel
+         %92 = OpPhi %50 %77 %69 %91 %78
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpLoad %18 %74
+         %96 = OpIAdd %18 %95 %60
+               OpStore %74 %96
+               OpBranch %94
+         %94 = OpLabel
+         %97 = OpAccessChain %41 %62 %35
+         %98 = OpLoad %18 %97
+         %99 = OpSGreaterThan %50 %98 %19
+               OpSelectionMerge %101 None
+               OpBranchConditional %99 %100 %101
+        %100 = OpLabel
+        %102 = OpAccessChain %41 %62 %28
+        %103 = OpLoad %18 %102
+        %104 = OpAccessChain %41 %62 %35
+        %105 = OpLoad %18 %104
+        %106 = OpISub %18 %105 %82
+        %107 = OpIMul %18 %106 %86
+        %108 = OpIAdd %18 %103 %107
+        %109 = OpAccessChain %57 %55 %108
+        %110 = OpLoad %18 %109
+        %111 = OpIEqual %50 %110 %19
+               OpBranch %101
+        %101 = OpLabel
+        %112 = OpPhi %50 %99 %94 %111 %100
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %115 = OpLoad %18 %74
+        %116 = OpIAdd %18 %115 %60
+               OpStore %74 %116
+               OpBranch %114
+        %114 = OpLabel
+        %117 = OpAccessChain %41 %62 %28
+        %118 = OpLoad %18 %117
+        %120 = OpSLessThan %50 %118 %119
+               OpSelectionMerge %122 None
+               OpBranchConditional %120 %121 %122
+        %121 = OpLabel
+        %123 = OpAccessChain %41 %62 %28
+        %124 = OpLoad %18 %123
+        %125 = OpIAdd %18 %124 %82
+        %126 = OpAccessChain %41 %62 %35
+        %127 = OpLoad %18 %126
+        %128 = OpIMul %18 %127 %86
+        %129 = OpIAdd %18 %125 %128
+        %130 = OpAccessChain %57 %55 %129
+        %131 = OpLoad %18 %130
+        %132 = OpIEqual %50 %131 %19
+               OpBranch %122
+        %122 = OpLabel
+        %133 = OpPhi %50 %120 %114 %132 %121
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %134 %135
+        %134 = OpLabel
+        %136 = OpLoad %18 %74
+        %137 = OpIAdd %18 %136 %60
+               OpStore %74 %137
+               OpBranch %135
+        %135 = OpLabel
+        %138 = OpAccessChain %41 %62 %35
+        %139 = OpLoad %18 %138
+        %140 = OpSLessThan %50 %139 %119
+               OpSelectionMerge %142 None
+               OpBranchConditional %140 %141 %142
+        %141 = OpLabel
+        %143 = OpAccessChain %41 %62 %28
+        %144 = OpLoad %18 %143
+        %145 = OpAccessChain %41 %62 %35
+        %146 = OpLoad %18 %145
+        %147 = OpIAdd %18 %146 %82
+        %148 = OpIMul %18 %147 %86
+        %149 = OpIAdd %18 %144 %148
+        %150 = OpAccessChain %57 %55 %149
+        %151 = OpLoad %18 %150
+        %152 = OpIEqual %50 %151 %19
+               OpBranch %142
+        %142 = OpLabel
+        %153 = OpPhi %50 %140 %135 %152 %141
+               OpSelectionMerge %155 None
+               OpBranchConditional %153 %154 %155
+        %154 = OpLabel
+        %156 = OpLoad %18 %74
+        %157 = OpIAdd %18 %156 %60
+               OpStore %74 %157
+               OpBranch %155
+        %155 = OpLabel
+        %158 = OpLoad %18 %74
+        %159 = OpIEqual %50 %158 %19
+               OpSelectionMerge %161 None
+               OpBranchConditional %159 %160 %207
+        %160 = OpLabel
+               OpStore %65 %162
+               OpStore %42 %19
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %18 %42
+        %170 = OpSLessThan %50 %168 %169
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %171 %19
+               OpBranch %172
+        %172 = OpLabel
+               OpLoopMerge %174 %175 None
+               OpBranch %176
+        %176 = OpLabel
+        %177 = OpLoad %18 %171
+        %178 = OpSLessThan %50 %177 %169
+               OpBranchConditional %178 %173 %174
+        %173 = OpLabel
+        %179 = OpLoad %18 %171
+        %180 = OpIMul %18 %179 %82
+        %181 = OpLoad %18 %42
+        %182 = OpIMul %18 %181 %82
+        %183 = OpIMul %18 %182 %86
+        %184 = OpIAdd %18 %180 %183
+        %185 = OpAccessChain %57 %55 %184
+        %186 = OpLoad %18 %185
+        %187 = OpIEqual %50 %186 %19
+               OpSelectionMerge %189 None
+               OpBranchConditional %187 %188 %189
+        %188 = OpLabel
+        %190 = OpLoad %18 %171
+        %191 = OpIMul %18 %190 %82
+        %192 = OpAccessChain %41 %62 %28
+               OpStore %192 %191
+        %193 = OpLoad %18 %42
+        %194 = OpIMul %18 %193 %82
+        %195 = OpAccessChain %41 %62 %35
+               OpStore %195 %194
+               OpStore %65 %66
+               OpBranch %189
+        %189 = OpLabel
+               OpBranch %175
+        %175 = OpLabel
+        %196 = OpLoad %18 %171
+        %197 = OpIAdd %18 %196 %60
+               OpStore %171 %197
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %198 = OpLoad %18 %42
+        %199 = OpIAdd %18 %198 %60
+               OpStore %42 %199
+               OpBranch %163
+        %165 = OpLabel
+        %200 = OpAccessChain %41 %62 %28
+        %201 = OpLoad %18 %200
+        %202 = OpAccessChain %41 %62 %35
+        %203 = OpLoad %18 %202
+        %204 = OpIMul %18 %203 %86
+        %205 = OpIAdd %18 %201 %204
+        %206 = OpAccessChain %57 %55 %205
+               OpStore %206 %60
+               OpBranch %161
+        %207 = OpLabel
+        %209 = OpLoad %18 %67
+        %210 = OpLoad %18 %74
+        %211 = OpSMod %18 %209 %210
+               OpStore %208 %211
+        %212 = OpLoad %18 %74
+        %213 = OpLoad %18 %67
+        %214 = OpIAdd %18 %213 %212
+               OpStore %67 %214
+        %215 = OpLoad %18 %208
+        %216 = OpSGreaterThanEqual %50 %215 %19
+               OpSelectionMerge %218 None
+               OpBranchConditional %216 %217 %218
+        %217 = OpLabel
+        %219 = OpAccessChain %41 %62 %28
+        %220 = OpLoad %18 %219
+        %221 = OpSGreaterThan %50 %220 %19
+               OpBranch %218
+        %218 = OpLabel
+        %222 = OpPhi %50 %216 %207 %221 %217
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %223 %224
+        %223 = OpLabel
+        %225 = OpAccessChain %41 %62 %28
+        %226 = OpLoad %18 %225
+        %227 = OpISub %18 %226 %82
+        %228 = OpAccessChain %41 %62 %35
+        %229 = OpLoad %18 %228
+        %230 = OpIMul %18 %229 %86
+        %231 = OpIAdd %18 %227 %230
+        %232 = OpAccessChain %57 %55 %231
+        %233 = OpLoad %18 %232
+        %234 = OpIEqual %50 %233 %19
+               OpBranch %224
+        %224 = OpLabel
+        %235 = OpPhi %50 %222 %218 %234 %223
+               OpSelectionMerge %237 None
+               OpBranchConditional %235 %236 %237
+        %236 = OpLabel
+        %238 = OpLoad %18 %208
+        %239 = OpISub %18 %238 %60
+               OpStore %208 %239
+        %240 = OpAccessChain %41 %62 %28
+        %241 = OpLoad %18 %240
+        %242 = OpAccessChain %41 %62 %35
+        %243 = OpLoad %18 %242
+        %244 = OpIMul %18 %243 %86
+        %245 = OpIAdd %18 %241 %244
+        %246 = OpAccessChain %57 %55 %245
+               OpStore %246 %60
+        %247 = OpAccessChain %41 %62 %28
+        %248 = OpLoad %18 %247
+        %249 = OpISub %18 %248 %60
+        %250 = OpAccessChain %41 %62 %35
+        %251 = OpLoad %18 %250
+        %252 = OpIMul %18 %251 %86
+        %253 = OpIAdd %18 %249 %252
+        %254 = OpAccessChain %57 %55 %253
+               OpStore %254 %60
+        %255 = OpAccessChain %41 %62 %28
+        %256 = OpLoad %18 %255
+        %257 = OpISub %18 %256 %82
+        %258 = OpAccessChain %41 %62 %35
+        %259 = OpLoad %18 %258
+        %260 = OpIMul %18 %259 %86
+        %261 = OpIAdd %18 %257 %260
+        %262 = OpAccessChain %57 %55 %261
+               OpStore %262 %60
+        %263 = OpAccessChain %41 %62 %28
+        %264 = OpLoad %18 %263
+        %265 = OpISub %18 %264 %82
+        %266 = OpAccessChain %41 %62 %28
+               OpStore %266 %265
+               OpBranch %237
+        %237 = OpLabel
+        %267 = OpLoad %18 %208
+        %268 = OpSGreaterThanEqual %50 %267 %19
+               OpSelectionMerge %270 None
+               OpBranchConditional %268 %269 %270
+        %269 = OpLabel
+        %271 = OpAccessChain %41 %62 %35
+        %272 = OpLoad %18 %271
+        %273 = OpSGreaterThan %50 %272 %19
+               OpBranch %270
+        %270 = OpLabel
+        %274 = OpPhi %50 %268 %237 %273 %269
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+        %277 = OpAccessChain %41 %62 %28
+        %278 = OpLoad %18 %277
+        %279 = OpAccessChain %41 %62 %35
+        %280 = OpLoad %18 %279
+        %281 = OpISub %18 %280 %82
+        %282 = OpIMul %18 %281 %86
+        %283 = OpIAdd %18 %278 %282
+        %284 = OpAccessChain %57 %55 %283
+        %285 = OpLoad %18 %284
+        %286 = OpIEqual %50 %285 %19
+               OpBranch %276
+        %276 = OpLabel
+        %287 = OpPhi %50 %274 %270 %286 %275
+               OpSelectionMerge %289 None
+               OpBranchConditional %287 %288 %289
+        %288 = OpLabel
+        %290 = OpLoad %18 %208
+        %291 = OpISub %18 %290 %60
+               OpStore %208 %291
+        %292 = OpAccessChain %41 %62 %28
+        %293 = OpLoad %18 %292
+        %294 = OpAccessChain %41 %62 %35
+        %295 = OpLoad %18 %294
+        %296 = OpIMul %18 %295 %86
+        %297 = OpIAdd %18 %293 %296
+        %298 = OpAccessChain %57 %55 %297
+               OpStore %298 %60
+        %299 = OpAccessChain %41 %62 %28
+        %300 = OpLoad %18 %299
+        %301 = OpAccessChain %41 %62 %35
+        %302 = OpLoad %18 %301
+        %303 = OpISub %18 %302 %60
+        %304 = OpIMul %18 %303 %86
+        %305 = OpIAdd %18 %300 %304
+        %306 = OpAccessChain %57 %55 %305
+               OpStore %306 %60
+        %307 = OpAccessChain %41 %62 %28
+        %308 = OpLoad %18 %307
+        %309 = OpAccessChain %41 %62 %35
+        %310 = OpLoad %18 %309
+        %311 = OpISub %18 %310 %82
+        %312 = OpIMul %18 %311 %86
+        %313 = OpIAdd %18 %308 %312
+        %314 = OpAccessChain %57 %55 %313
+               OpStore %314 %60
+        %315 = OpAccessChain %41 %62 %35
+        %316 = OpLoad %18 %315
+        %317 = OpISub %18 %316 %82
+        %318 = OpAccessChain %41 %62 %35
+               OpStore %318 %317
+               OpBranch %289
+        %289 = OpLabel
+        %319 = OpLoad %18 %208
+        %320 = OpSGreaterThanEqual %50 %319 %19
+               OpSelectionMerge %322 None
+               OpBranchConditional %320 %321 %322
+        %321 = OpLabel
+        %323 = OpAccessChain %41 %62 %28
+        %324 = OpLoad %18 %323
+        %325 = OpSLessThan %50 %324 %119
+               OpBranch %322
+        %322 = OpLabel
+        %326 = OpPhi %50 %320 %289 %325 %321
+               OpSelectionMerge %328 None
+               OpBranchConditional %326 %327 %328
+        %327 = OpLabel
+        %329 = OpAccessChain %41 %62 %28
+        %330 = OpLoad %18 %329
+        %331 = OpIAdd %18 %330 %82
+        %332 = OpAccessChain %41 %62 %35
+        %333 = OpLoad %18 %332
+        %334 = OpIMul %18 %333 %86
+        %335 = OpIAdd %18 %331 %334
+        %336 = OpAccessChain %57 %55 %335
+        %337 = OpLoad %18 %336
+        %338 = OpIEqual %50 %337 %19
+               OpBranch %328
+        %328 = OpLabel
+        %339 = OpPhi %50 %326 %322 %338 %327
+               OpSelectionMerge %341 None
+               OpBranchConditional %339 %340 %341
+        %340 = OpLabel
+        %342 = OpLoad %18 %208
+        %343 = OpISub %18 %342 %60
+               OpStore %208 %343
+        %344 = OpAccessChain %41 %62 %28
+        %345 = OpLoad %18 %344
+        %346 = OpAccessChain %41 %62 %35
+        %347 = OpLoad %18 %346
+        %348 = OpIMul %18 %347 %86
+        %349 = OpIAdd %18 %345 %348
+        %350 = OpAccessChain %57 %55 %349
+               OpStore %350 %60
+        %351 = OpAccessChain %41 %62 %28
+        %352 = OpLoad %18 %351
+        %353 = OpIAdd %18 %352 %60
+        %354 = OpAccessChain %41 %62 %35
+        %355 = OpLoad %18 %354
+        %356 = OpIMul %18 %355 %86
+        %357 = OpIAdd %18 %353 %356
+        %358 = OpAccessChain %57 %55 %357
+               OpStore %358 %60
+        %359 = OpAccessChain %41 %62 %28
+        %360 = OpLoad %18 %359
+        %361 = OpIAdd %18 %360 %82
+        %362 = OpAccessChain %41 %62 %35
+        %363 = OpLoad %18 %362
+        %364 = OpIMul %18 %363 %86
+        %365 = OpIAdd %18 %361 %364
+        %366 = OpAccessChain %57 %55 %365
+               OpStore %366 %60
+        %367 = OpAccessChain %41 %62 %28
+        %368 = OpLoad %18 %367
+        %369 = OpIAdd %18 %368 %82
+        %370 = OpAccessChain %41 %62 %28
+               OpStore %370 %369
+               OpBranch %341
+        %341 = OpLabel
+        %371 = OpLoad %18 %208
+        %372 = OpSGreaterThanEqual %50 %371 %19
+               OpSelectionMerge %374 None
+               OpBranchConditional %372 %373 %374
+        %373 = OpLabel
+        %375 = OpAccessChain %41 %62 %35
+        %376 = OpLoad %18 %375
+        %377 = OpSLessThan %50 %376 %119
+               OpBranch %374
+        %374 = OpLabel
+        %378 = OpPhi %50 %372 %341 %377 %373
+               OpSelectionMerge %380 None
+               OpBranchConditional %378 %379 %380
+        %379 = OpLabel
+        %381 = OpAccessChain %41 %62 %28
+        %382 = OpLoad %18 %381
+        %383 = OpAccessChain %41 %62 %35
+        %384 = OpLoad %18 %383
+        %385 = OpIAdd %18 %384 %82
+        %386 = OpIMul %18 %385 %86
+        %387 = OpIAdd %18 %382 %386
+        %388 = OpAccessChain %57 %55 %387
+        %389 = OpLoad %18 %388
+        %390 = OpIEqual %50 %389 %19
+               OpBranch %380
+        %380 = OpLabel
+        %391 = OpPhi %50 %378 %374 %390 %379
+               OpSelectionMerge %393 None
+               OpBranchConditional %391 %392 %393
+        %392 = OpLabel
+        %394 = OpLoad %18 %208
+        %395 = OpISub %18 %394 %60
+               OpStore %208 %395
+        %396 = OpAccessChain %41 %62 %28
+        %397 = OpLoad %18 %396
+        %398 = OpAccessChain %41 %62 %35
+        %399 = OpLoad %18 %398
+        %400 = OpIMul %18 %399 %86
+        %401 = OpIAdd %18 %397 %400
+        %402 = OpAccessChain %57 %55 %401
+               OpStore %402 %60
+        %403 = OpAccessChain %41 %62 %28
+        %404 = OpLoad %18 %403
+        %405 = OpAccessChain %41 %62 %35
+        %406 = OpLoad %18 %405
+        %407 = OpIAdd %18 %406 %60
+        %408 = OpIMul %18 %407 %86
+        %409 = OpIAdd %18 %404 %408
+        %410 = OpAccessChain %57 %55 %409
+               OpStore %410 %60
+        %411 = OpAccessChain %41 %62 %28
+        %412 = OpLoad %18 %411
+        %413 = OpAccessChain %41 %62 %35
+        %414 = OpLoad %18 %413
+        %415 = OpIAdd %18 %414 %82
+        %416 = OpIMul %18 %415 %86
+        %417 = OpIAdd %18 %412 %416
+        %418 = OpAccessChain %57 %55 %417
+               OpStore %418 %60
+        %419 = OpAccessChain %41 %62 %35
+        %420 = OpLoad %18 %419
+        %421 = OpIAdd %18 %420 %82
+        %422 = OpAccessChain %41 %62 %35
+               OpStore %422 %421
+               OpBranch %393
+        %393 = OpLabel
+               OpBranch %161
+        %161 = OpLabel
+        %423 = OpAccessChain %41 %26 %35
+        %424 = OpLoad %18 %423
+        %425 = OpIMul %18 %424 %86
+        %426 = OpAccessChain %41 %26 %28
+        %427 = OpLoad %18 %426
+        %428 = OpIAdd %18 %425 %427
+        %429 = OpAccessChain %57 %55 %428
+        %430 = OpLoad %18 %429
+        %431 = OpIEqual %50 %430 %60
+               OpSelectionMerge %433 None
+               OpBranchConditional %431 %432 %433
+        %432 = OpLabel
+               OpStore %435 %437
+               OpReturn
+        %433 = OpLabel
+               OpBranch %71
+         %71 = OpLabel
+        %439 = OpLoad %50 %65
+        %740 = OpAccessChain %41 %208
+               OpBranchConditional %439 %68 %70
+         %70 = OpLabel
+        %741 = OpAccessChain %41 %740
+               OpStore %435 %441
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composite-phi.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composite-phi.amber
new file mode 100644 (file)
index 0000000..a0d1e68
--- /dev/null
@@ -0,0 +1,539 @@
+#!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 id used by OpPhi hidden in composite
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 290
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %85 %137
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %66 "c"
+               OpName %73 "buf0"
+               OpMemberName %73 0 "resolution"
+               OpName %75 ""
+               OpName %85 "gl_FragCoord"
+               OpName %137 "_GLF_color"
+               OpMemberDecorate %73 0 Offset 0
+               OpDecorate %73 Block
+               OpDecorate %75 DescriptorSet 0
+               OpDecorate %75 Binding 0
+               OpDecorate %85 BuiltIn FragCoord
+               OpDecorate %137 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypePointer Function %6
+         %14 = OpConstant %6 -0.5
+         %15 = OpTypeInt 32 1
+         %18 = OpConstant %15 1
+         %25 = OpConstant %15 800
+         %26 = OpTypeBool
+         %29 = OpConstant %15 32
+         %31 = OpConstant %15 0
+         %35 = OpConstant %6 0.400000006
+         %44 = OpConstant %6 0.00999999978
+         %48 = OpConstant %6 100
+         %64 = OpTypeVector %6 3
+         %65 = OpTypePointer Function %64
+         %67 = OpConstant %6 7
+         %68 = OpConstant %6 8
+         %69 = OpConstant %6 9
+         %70 = OpConstantComposite %64 %67 %68 %69
+         %72 = OpTypeVector %6 2
+         %73 = OpTypeStruct %72
+         %74 = OpTypePointer Uniform %73
+         %75 = OpVariable %74 Uniform
+         %76 = OpTypeInt 32 0
+         %77 = OpConstant %76 0
+         %78 = OpTypePointer Uniform %6
+         %83 = OpTypeVector %6 4
+         %84 = OpTypePointer Input %83
+         %85 = OpVariable %84 Input
+         %87 = OpTypePointer Input %6
+         %95 = OpConstant %76 1
+        %107 = OpConstant %76 2
+        %116 = OpConstant %15 3
+        %121 = OpConstant %6 1
+        %136 = OpTypePointer Output %83
+        %137 = OpVariable %136 Output
+        %149 = OpConstantFalse %26
+        %152 = OpConstantTrue %26
+        %261 = OpUndef %6
+        %289 = OpConstant %6 0.125
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %66 = OpVariable %65 Function
+               OpStore %66 %70
+         %79 = OpAccessChain %78 %75 %31 %77
+         %80 = OpLoad %6 %79
+         %81 = OpFMul %6 %80 %289
+         %82 = OpExtInst %6 %1 Round %81
+         %88 = OpAccessChain %87 %85 %77
+         %89 = OpLoad %6 %88
+               OpSelectionMerge %199 None
+               OpSwitch %77 %161
+        %161 = OpLabel
+               OpBranch %162
+        %162 = OpLabel
+        %248 = OpPhi %6 %14 %161 %251 %192
+        %247 = OpPhi %15 %18 %161 %194 %192
+        %165 = OpSLessThan %26 %247 %25
+               OpLoopMerge %195 %192 None
+               OpBranchConditional %165 %166 %195
+        %166 = OpLabel
+        %168 = OpSMod %15 %247 %29
+        %169 = OpIEqual %26 %168 %31
+               OpSelectionMerge %184 None
+               OpBranchConditional %169 %170 %173
+        %170 = OpLabel
+        %172 = OpFAdd %6 %248 %35
+               OpBranch %184
+        %173 = OpLabel
+        %175 = OpConvertSToF %6 %247
+        %177 = OpExtInst %6 %1 Round %82
+        %178 = OpFMod %6 %175 %177
+        %179 = OpFOrdLessThanEqual %26 %178 %44
+               OpSelectionMerge %183 None
+               OpBranchConditional %179 %180 %183
+        %180 = OpLabel
+        %182 = OpFAdd %6 %248 %48
+               OpBranch %183
+        %183 = OpLabel
+        %252 = OpPhi %6 %248 %173 %182 %180
+               OpBranch %184
+        %184 = OpLabel
+        %251 = OpPhi %6 %172 %170 %252 %183
+        %186 = OpConvertSToF %6 %247
+        %188 = OpFOrdGreaterThanEqual %26 %186 %89
+               OpSelectionMerge %191 None
+               OpBranchConditional %188 %189 %191
+        %189 = OpLabel
+               OpBranch %195
+        %191 = OpLabel
+               OpBranch %192
+        %192 = OpLabel
+        %194 = OpIAdd %15 %247 %18
+               OpBranch %162
+        %195 = OpLabel
+        %259 = OpPhi %6 %261 %162 %251 %189
+        %257 = OpPhi %6 %248 %162 %251 %189
+        %253 = OpPhi %26 %149 %162 %152 %189
+               OpSelectionMerge %197 None
+               OpBranchConditional %253 %199 %197
+        %197 = OpLabel
+               OpBranch %199
+        %199 = OpLabel
+        %258 = OpPhi %6 %259 %195 %257 %197
+         %93 = OpAccessChain %7 %66 %77
+               OpStore %93 %258
+         %96 = OpAccessChain %87 %85 %95
+         %97 = OpLoad %6 %96
+               OpSelectionMerge %245 None
+               OpSwitch %77 %207
+        %207 = OpLabel
+               OpBranch %208
+        %208 = OpLabel
+        %265 = OpPhi %6 %14 %207 %268 %238
+        %264 = OpPhi %15 %18 %207 %240 %238
+        %211 = OpSLessThan %26 %264 %25
+               OpLoopMerge %241 %238 None
+               OpBranchConditional %211 %212 %241
+        %212 = OpLabel
+        %214 = OpSMod %15 %264 %29
+        %215 = OpIEqual %26 %214 %31
+               OpSelectionMerge %230 None
+               OpBranchConditional %215 %216 %219
+        %216 = OpLabel
+        %218 = OpFAdd %6 %265 %35
+               OpBranch %230
+        %219 = OpLabel
+        %221 = OpConvertSToF %6 %264
+        %223 = OpExtInst %6 %1 Round %82
+        %224 = OpFMod %6 %221 %223
+        %225 = OpFOrdLessThanEqual %26 %224 %44
+               OpSelectionMerge %229 None
+               OpBranchConditional %225 %226 %229
+        %226 = OpLabel
+        %228 = OpFAdd %6 %265 %48
+               OpBranch %229
+        %229 = OpLabel
+        %269 = OpPhi %6 %265 %219 %228 %226
+               OpBranch %230
+        %230 = OpLabel
+        %268 = OpPhi %6 %218 %216 %269 %229
+        %232 = OpConvertSToF %6 %264
+        %234 = OpFOrdGreaterThanEqual %26 %232 %97
+               OpSelectionMerge %237 None
+               OpBranchConditional %234 %235 %237
+        %235 = OpLabel
+               OpBranch %241
+        %237 = OpLabel
+               OpBranch %238
+        %238 = OpLabel
+        %240 = OpIAdd %15 %264 %18
+               OpBranch %208
+        %241 = OpLabel
+        %276 = OpPhi %6 %261 %208 %268 %235
+        %274 = OpPhi %6 %265 %208 %268 %235
+        %270 = OpPhi %26 %149 %208 %152 %235
+               OpSelectionMerge %243 None
+               OpBranchConditional %270 %245 %243
+        %243 = OpLabel
+               OpBranch %245
+        %245 = OpLabel
+        %275 = OpPhi %6 %276 %241 %274 %243
+        %101 = OpAccessChain %7 %66 %95
+               OpStore %101 %275
+        %103 = OpLoad %6 %93
+        %105 = OpLoad %6 %101
+        %106 = OpFAdd %6 %103 %105
+        %108 = OpAccessChain %7 %66 %107
+               OpStore %108 %106
+               OpBranch %110
+        %110 = OpLabel
+        %285 = OpPhi %15 %31 %245 %135 %113
+        %117 = OpSLessThan %26 %285 %116
+               OpLoopMerge %112 %113 None
+               OpBranchConditional %117 %111 %112
+        %111 = OpLabel
+        %119 = OpAccessChain %7 %66 %285
+        %120 = OpLoad %6 %119
+        %122 = OpFOrdGreaterThanEqual %26 %120 %121
+               OpSelectionMerge %124 None
+               OpBranchConditional %122 %123 %124
+        %123 = OpLabel
+        %128 = OpLoad %6 %119
+        %131 = OpLoad %6 %119
+        %132 = OpFMul %6 %128 %131
+               OpStore %119 %132
+               OpBranch %124
+        %124 = OpLabel
+               OpBranch %113
+        %113 = OpLabel
+        %135 = OpIAdd %15 %285 %18
+               OpBranch %110
+        %112 = OpLabel
+        %138 = OpLoad %64 %66
+        %139 = OpExtInst %64 %1 FAbs %138
+        %140 = OpExtInst %64 %1 Normalize %139
+        %141 = OpCompositeExtract %6 %140 0
+        %142 = OpCompositeExtract %6 %140 1
+        %143 = OpCompositeExtract %6 %140 2
+        %144 = OpCompositeConstruct %83 %141 %142 %143 %121
+               OpStore %137 %144
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 505
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %85 %137
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %66 "c"
+               OpName %73 "buf0"
+               OpMemberName %73 0 "resolution"
+               OpName %75 ""
+               OpName %85 "gl_FragCoord"
+               OpName %137 "_GLF_color"
+               OpMemberDecorate %73 0 Offset 0
+               OpDecorate %73 Block
+               OpDecorate %75 DescriptorSet 0
+               OpDecorate %75 Binding 0
+               OpDecorate %85 BuiltIn FragCoord
+               OpDecorate %137 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypePointer Function %6
+         %14 = OpConstant %6 -0.5
+         %15 = OpTypeInt 32 1
+         %18 = OpConstant %15 1
+         %25 = OpConstant %15 800
+         %26 = OpTypeBool
+         %29 = OpConstant %15 32
+         %31 = OpConstant %15 0
+         %35 = OpConstant %6 0.400000006
+         %44 = OpConstant %6 0.00999999978
+         %48 = OpConstant %6 100
+         %64 = OpTypeVector %6 3
+         %65 = OpTypePointer Function %64
+         %67 = OpConstant %6 7
+         %68 = OpConstant %6 8
+         %69 = OpConstant %6 9
+         %70 = OpConstantComposite %64 %67 %68 %69
+         %72 = OpTypeVector %6 2
+         %73 = OpTypeStruct %72
+         %74 = OpTypePointer Uniform %73
+         %75 = OpVariable %74 Uniform
+         %76 = OpTypeInt 32 0
+         %77 = OpConstant %76 0
+         %78 = OpTypePointer Uniform %6
+         %83 = OpTypeVector %6 4
+         %84 = OpTypePointer Input %83
+         %85 = OpVariable %84 Input
+         %87 = OpTypePointer Input %6
+         %95 = OpConstant %76 1
+        %107 = OpConstant %76 2
+        %116 = OpConstant %15 3
+        %121 = OpConstant %6 1
+        %136 = OpTypePointer Output %83
+        %137 = OpVariable %136 Output
+        %149 = OpConstantFalse %26
+        %152 = OpConstantTrue %26
+        %261 = OpUndef %6
+        %289 = OpConstant %6 0.125
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+         %66 = OpVariable %65 Function
+               OpStore %66 %70
+         %79 = OpAccessChain %78 %75 %31 %77
+         %80 = OpLoad %6 %79
+        %390 = OpCompositeConstruct %72 %121 %80
+         %81 = OpFMul %6 %80 %289
+         %82 = OpExtInst %6 %1 Round %81
+        %410 = OpCompositeConstruct %72 %261 %14
+         %88 = OpAccessChain %87 %85 %77
+         %89 = OpLoad %6 %88
+               OpSelectionMerge %199 None
+               OpSwitch %77 %161
+        %161 = OpLabel
+               OpBranch %162
+        %162 = OpLabel
+        %248 = OpPhi %6 %14 %161 %251 %192
+        %247 = OpPhi %15 %18 %161 %194 %192
+        %165 = OpSLessThan %26 %247 %25
+               OpLoopMerge %195 %192 None
+               OpBranchConditional %165 %166 %195
+        %166 = OpLabel
+        %168 = OpSMod %15 %247 %29
+        %169 = OpIEqual %26 %168 %31
+               OpSelectionMerge %184 None
+               OpBranchConditional %169 %170 %173
+        %170 = OpLabel
+        %172 = OpFAdd %6 %248 %35
+               OpBranch %184
+        %173 = OpLabel
+        %175 = OpConvertSToF %6 %247
+        %177 = OpExtInst %6 %1 Round %82
+        %178 = OpFMod %6 %175 %177
+        %179 = OpFOrdLessThanEqual %26 %178 %44
+               OpSelectionMerge %183 None
+               OpBranchConditional %179 %180 %183
+        %180 = OpLabel
+        %182 = OpFAdd %6 %248 %48
+               OpBranch %183
+        %183 = OpLabel
+        %252 = OpPhi %6 %248 %173 %182 %180
+               OpBranch %184
+        %184 = OpLabel
+        %251 = OpPhi %6 %172 %170 %252 %183
+        %186 = OpConvertSToF %6 %247
+        %188 = OpFOrdGreaterThanEqual %26 %186 %89
+               OpSelectionMerge %191 None
+               OpBranchConditional %188 %189 %191
+        %189 = OpLabel
+               OpBranch %195
+        %191 = OpLabel
+               OpBranch %192
+        %192 = OpLabel
+        %194 = OpIAdd %15 %247 %18
+               OpBranch %162
+        %195 = OpLabel
+        %259 = OpPhi %6 %261 %162 %251 %189
+        %257 = OpPhi %6 %248 %162 %251 %189
+        %253 = OpPhi %26 %149 %162 %152 %189
+               OpSelectionMerge %197 None
+               OpBranchConditional %253 %199 %197
+        %197 = OpLabel
+               OpBranch %199
+        %199 = OpLabel
+        %258 = OpPhi %6 %259 %195 %257 %197
+         %93 = OpAccessChain %7 %66 %77
+        %415 = OpCompositeConstruct %83 %257 %35 %259 %35
+        %460 = OpCompositeConstruct %64 %390 %14
+               OpStore %93 %258
+         %96 = OpAccessChain %87 %85 %95
+         %97 = OpLoad %6 %96
+               OpSelectionMerge %245 None
+               OpSwitch %77 %207
+        %207 = OpLabel
+        %417 = OpCompositeConstruct %83 %410 %261 %248
+        %504 = OpCompositeExtract %6 %460 2
+               OpBranch %208
+        %208 = OpLabel
+        %265 = OpPhi %6 %504 %207 %268 %238
+        %264 = OpPhi %15 %18 %207 %240 %238
+        %211 = OpSLessThan %26 %264 %25
+               OpLoopMerge %241 %238 None
+               OpBranchConditional %211 %212 %241
+        %212 = OpLabel
+        %214 = OpSMod %15 %264 %29
+        %215 = OpIEqual %26 %214 %31
+               OpSelectionMerge %230 None
+               OpBranchConditional %215 %216 %219
+        %216 = OpLabel
+        %218 = OpFAdd %6 %265 %35
+               OpBranch %230
+        %219 = OpLabel
+        %221 = OpConvertSToF %6 %264
+        %223 = OpExtInst %6 %1 Round %82
+        %224 = OpFMod %6 %221 %223
+        %225 = OpFOrdLessThanEqual %26 %224 %44
+               OpSelectionMerge %229 None
+               OpBranchConditional %225 %226 %229
+        %226 = OpLabel
+        %228 = OpFAdd %6 %265 %48
+               OpBranch %229
+        %229 = OpLabel
+        %269 = OpPhi %6 %265 %219 %228 %226
+               OpBranch %230
+        %230 = OpLabel
+        %268 = OpPhi %6 %218 %216 %269 %229
+        %232 = OpConvertSToF %6 %264
+        %234 = OpFOrdGreaterThanEqual %26 %232 %97
+               OpSelectionMerge %237 None
+               OpBranchConditional %234 %235 %237
+        %235 = OpLabel
+               OpBranch %241
+        %237 = OpLabel
+               OpBranch %238
+        %238 = OpLabel
+        %240 = OpIAdd %15 %264 %18
+               OpBranch %208
+        %241 = OpLabel
+        %276 = OpPhi %6 %261 %208 %268 %235
+        %274 = OpPhi %6 %265 %208 %268 %235
+        %270 = OpPhi %26 %149 %208 %152 %235
+               OpSelectionMerge %243 None
+               OpBranchConditional %270 %245 %243
+        %243 = OpLabel
+               OpBranch %245
+        %245 = OpLabel
+        %275 = OpPhi %6 %276 %241 %274 %243
+        %101 = OpAccessChain %7 %66 %95
+               OpStore %101 %275
+        %103 = OpLoad %6 %93
+        %105 = OpLoad %6 %101
+        %106 = OpFAdd %6 %103 %105
+        %108 = OpAccessChain %7 %66 %107
+               OpStore %108 %106
+               OpBranch %110
+        %110 = OpLabel
+        %285 = OpPhi %15 %31 %245 %135 %113
+        %117 = OpSLessThan %26 %285 %116
+               OpLoopMerge %112 %113 None
+               OpBranchConditional %117 %111 %112
+        %111 = OpLabel
+        %119 = OpAccessChain %7 %66 %285
+        %120 = OpLoad %6 %119
+        %122 = OpFOrdGreaterThanEqual %26 %120 %121
+               OpSelectionMerge %124 None
+               OpBranchConditional %122 %123 %124
+        %123 = OpLabel
+        %128 = OpLoad %6 %119
+        %131 = OpLoad %6 %119
+        %132 = OpFMul %6 %128 %131
+               OpStore %119 %132
+               OpBranch %124
+        %124 = OpLabel
+               OpBranch %113
+        %113 = OpLabel
+        %135 = OpIAdd %15 %285 %18
+               OpBranch %110
+        %112 = OpLabel
+        %138 = OpLoad %64 %66
+        %139 = OpExtInst %64 %1 FAbs %138
+        %140 = OpExtInst %64 %1 Normalize %139
+        %141 = OpCompositeExtract %6 %140 0
+        %142 = OpCompositeExtract %6 %140 1
+        %143 = OpCompositeExtract %6 %140 2
+        %144 = OpCompositeConstruct %83 %141 %142 %143 %121
+               OpStore %137 %144
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composite2.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composite2.amber
new file mode 100644 (file)
index 0000000..3d8dc6e
--- /dev/null
@@ -0,0 +1,301 @@
+#!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 where an id is hidden inside a composite
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 107
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %74
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %74 "_GLF_color"
+               OpName %100 "indexable"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %74 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %27 = OpTypeInt 32 0
+         %32 = OpConstant %6 10
+         %47 = OpConstant %18 10
+         %51 = OpConstant %18 100
+         %60 = OpTypeBool
+         %62 = OpConstant %18 4
+         %65 = OpConstant %18 1000
+         %71 = OpConstant %18 1
+         %73 = OpTypePointer Output %10
+         %74 = OpVariable %73 Output
+         %75 = OpConstant %27 16
+         %76 = OpTypeArray %10 %75
+         %77 = OpConstant %6 0
+         %78 = OpConstant %6 1
+         %79 = OpConstantComposite %10 %77 %77 %77 %78
+         %80 = OpConstant %6 0.5
+         %81 = OpConstantComposite %10 %80 %77 %77 %78
+         %82 = OpConstantComposite %10 %77 %80 %77 %78
+         %83 = OpConstantComposite %10 %80 %80 %77 %78
+         %84 = OpConstantComposite %10 %77 %77 %80 %78
+         %85 = OpConstantComposite %10 %80 %77 %80 %78
+         %86 = OpConstantComposite %10 %77 %80 %80 %78
+         %87 = OpConstantComposite %10 %80 %80 %80 %78
+         %88 = OpConstantComposite %10 %78 %77 %77 %78
+         %89 = OpConstantComposite %10 %77 %78 %77 %78
+         %90 = OpConstantComposite %10 %78 %78 %77 %78
+         %91 = OpConstantComposite %10 %77 %77 %78 %78
+         %92 = OpConstantComposite %10 %78 %77 %78 %78
+         %93 = OpConstantComposite %10 %77 %78 %78 %78
+         %94 = OpConstantComposite %10 %78 %78 %78 %78
+         %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94
+         %97 = OpConstant %18 16
+         %99 = OpTypePointer Function %76
+        %101 = OpTypePointer Function %10
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %100 = OpVariable %99 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+         %31 = OpCompositeExtract %6 %23 0
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %37 = OpCompositeExtract %6 %23 1
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %48 = OpIMul %18 %39 %47
+         %49 = OpIAdd %18 %34 %48
+               OpBranch %53
+         %53 = OpLabel
+        %106 = OpPhi %18 %51 %5 %69 %54
+        %104 = OpPhi %18 %19 %5 %72 %54
+         %61 = OpSLessThan %60 %104 %49
+               OpLoopMerge %55 %54 None
+               OpBranchConditional %61 %54 %55
+         %54 = OpLabel
+         %64 = OpIMul %18 %62 %106
+         %67 = OpISub %18 %65 %106
+         %68 = OpIMul %18 %64 %67
+         %69 = OpSDiv %18 %68 %65
+         %72 = OpIAdd %18 %104 %71
+               OpBranch %53
+         %55 = OpLabel
+         %98 = OpSMod %18 %106 %97
+               OpStore %100 %95
+        %102 = OpAccessChain %101 %100 %98
+        %103 = OpLoad %10 %102
+               OpStore %74 %103
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 395
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %74
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %74 "_GLF_color"
+               OpName %100 "indexable"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %74 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %27 = OpTypeInt 32 0
+         %32 = OpConstant %6 10
+         %47 = OpConstant %18 10
+         %51 = OpConstant %18 100
+         %60 = OpTypeBool
+         %62 = OpConstant %18 4
+         %65 = OpConstant %18 1000
+         %71 = OpConstant %18 1
+         %73 = OpTypePointer Output %10
+         %74 = OpVariable %73 Output
+         %75 = OpConstant %27 16
+         %76 = OpTypeArray %10 %75
+         %77 = OpConstant %6 0
+         %78 = OpConstant %6 1
+         %79 = OpConstantComposite %10 %77 %77 %77 %78
+         %80 = OpConstant %6 0.5
+         %81 = OpConstantComposite %10 %80 %77 %77 %78
+         %82 = OpConstantComposite %10 %77 %80 %77 %78
+         %83 = OpConstantComposite %10 %80 %80 %77 %78
+         %84 = OpConstantComposite %10 %77 %77 %80 %78
+         %85 = OpConstantComposite %10 %80 %77 %80 %78
+         %86 = OpConstantComposite %10 %77 %80 %80 %78
+         %87 = OpConstantComposite %10 %80 %80 %80 %78
+         %88 = OpConstantComposite %10 %78 %77 %77 %78
+         %89 = OpConstantComposite %10 %77 %78 %77 %78
+         %90 = OpConstantComposite %10 %78 %78 %77 %78
+         %91 = OpConstantComposite %10 %77 %77 %78 %78
+         %92 = OpConstantComposite %10 %78 %77 %78 %78
+         %93 = OpConstantComposite %10 %77 %78 %78 %78
+         %94 = OpConstantComposite %10 %78 %78 %78 %78
+         %95 = OpConstantComposite %76 %79 %81 %82 %83 %84 %85 %86 %87 %79 %88 %89 %90 %91 %92 %93 %94
+         %97 = OpConstant %18 16
+         %99 = OpTypePointer Function %76
+        %101 = OpTypePointer Function %10
+        %213 = OpConstantComposite %7 %77 %77
+        %246 = OpConstant %6 0.5
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %100 = OpVariable %99 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+        %341 = OpCompositeConstruct %10 %77 %14 %246
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+         %31 = OpCompositeExtract %6 %23 0
+        %388 = OpCompositeExtract %6 %341 3
+        %343 = OpCompositeConstruct %10 %388 %32 %213
+        %394 = OpCompositeExtract %6 %343 1
+         %33 = OpFMul %6 %31 %394
+         %34 = OpConvertFToS %18 %33
+         %37 = OpCompositeExtract %6 %23 1
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %48 = OpIMul %18 %39 %47
+         %49 = OpIAdd %18 %34 %48
+               OpBranch %53
+         %53 = OpLabel
+        %106 = OpPhi %18 %51 %5 %69 %54
+        %104 = OpPhi %18 %19 %5 %72 %54
+         %61 = OpSLessThan %60 %104 %49
+               OpLoopMerge %55 %54 None
+               OpBranchConditional %61 %54 %55
+         %54 = OpLabel
+         %64 = OpIMul %18 %62 %106
+         %67 = OpISub %18 %65 %106
+         %68 = OpIMul %18 %64 %67
+         %69 = OpSDiv %18 %68 %65
+         %72 = OpIAdd %18 %104 %71
+               OpBranch %53
+         %55 = OpLabel
+         %98 = OpSMod %18 %106 %97
+               OpStore %100 %95
+        %102 = OpAccessChain %101 %100 %98
+        %103 = OpLoad %10 %102
+               OpStore %74 %103
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composites.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-composites.amber
new file mode 100644 (file)
index 0000000..7bd38eb
--- /dev/null
@@ -0,0 +1,665 @@
+#!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 obfuscates an id via composites
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 366
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %246 %268
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %246 "gl_FragCoord"
+               OpName %249 "buf0"
+               OpMemberName %249 0 "resolution"
+               OpName %251 ""
+               OpName %268 "_GLF_color"
+               OpDecorate %246 BuiltIn FragCoord
+               OpMemberDecorate %249 0 Offset 0
+               OpDecorate %249 Block
+               OpDecorate %251 DescriptorSet 0
+               OpDecorate %251 Binding 0
+               OpDecorate %268 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeInt 32 1
+          %7 = OpTypeVector %6 2
+          %9 = OpTypeFloat 32
+         %10 = OpTypeVector %9 4
+         %20 = OpTypeInt 32 0
+         %22 = OpTypePointer Function %6
+         %25 = OpConstant %6 256
+         %26 = OpTypeBool
+         %28 = OpConstant %20 0
+         %31 = OpConstant %20 256
+         %32 = OpTypeArray %6 %31
+         %33 = OpConstant %6 115
+         %34 = OpConstant %6 133
+         %35 = OpConstant %6 150
+         %36 = OpConstant %6 164
+         %37 = OpConstant %6 176
+         %38 = OpConstant %6 184
+         %39 = OpConstant %6 190
+         %40 = OpConstant %6 192
+         %41 = OpConstant %6 191
+         %42 = OpConstant %6 187
+         %43 = OpConstant %6 181
+         %44 = OpConstant %6 172
+         %45 = OpConstant %6 163
+         %46 = OpConstant %6 153
+         %47 = OpConstant %6 143
+         %48 = OpConstant %6 134
+         %49 = OpConstant %6 126
+         %50 = OpConstant %6 120
+         %51 = OpConstant %6 116
+         %52 = OpConstant %6 114
+         %53 = OpConstant %6 117
+         %54 = OpConstant %6 121
+         %55 = OpConstant %6 127
+         %56 = OpConstant %6 141
+         %57 = OpConstant %6 148
+         %58 = OpConstant %6 154
+         %59 = OpConstant %6 159
+         %60 = OpConstant %6 162
+         %61 = OpConstant %6 161
+         %62 = OpConstant %6 157
+         %63 = OpConstant %6 151
+         %64 = OpConstant %6 124
+         %65 = OpConstant %6 113
+         %66 = OpConstant %6 103
+         %67 = OpConstant %6 94
+         %68 = OpConstant %6 87
+         %69 = OpConstant %6 82
+         %70 = OpConstant %6 79
+         %71 = OpConstant %6 80
+         %72 = OpConstant %6 84
+         %73 = OpConstant %6 91
+         %74 = OpConstant %6 101
+         %75 = OpConstant %6 130
+         %76 = OpConstant %6 146
+         %77 = OpConstant %6 182
+         %78 = OpConstant %6 199
+         %79 = OpConstant %6 215
+         %80 = OpConstant %6 229
+         %81 = OpConstant %6 240
+         %82 = OpConstant %6 249
+         %83 = OpConstant %6 254
+         %84 = OpConstant %6 250
+         %85 = OpConstant %6 243
+         %86 = OpConstant %6 233
+         %87 = OpConstant %6 223
+         %88 = OpConstant %6 212
+         %89 = OpConstant %6 200
+         %90 = OpConstant %6 180
+         %91 = OpConstant %6 166
+         %92 = OpConstant %6 169
+         %93 = OpConstant %6 174
+         %94 = OpConstant %6 179
+         %95 = OpConstant %6 185
+         %96 = OpConstant %6 193
+         %97 = OpConstant %6 195
+         %98 = OpConstant %6 188
+         %99 = OpConstant %6 171
+        %100 = OpConstant %6 149
+        %101 = OpConstant %6 137
+        %102 = OpConstant %6 125
+        %103 = OpConstant %6 105
+        %104 = OpConstant %6 97
+        %105 = OpConstant %6 93
+        %106 = OpConstant %6 98
+        %107 = OpConstant %6 106
+        %108 = OpConstant %6 145
+        %109 = OpConstant %6 177
+        %110 = OpConstant %6 208
+        %111 = OpConstant %6 221
+        %112 = OpConstant %6 231
+        %113 = OpConstant %6 239
+        %114 = OpConstant %6 244
+        %115 = OpConstant %6 242
+        %116 = OpConstant %6 236
+        %117 = OpConstant %6 228
+        %118 = OpConstant %6 218
+        %119 = OpConstant %6 207
+        %120 = OpConstant %6 194
+        %121 = OpConstant %6 158
+        %122 = OpConstant %6 135
+        %123 = OpConstant %6 132
+        %124 = OpConstant %6 131
+        %125 = OpConstant %6 138
+        %126 = OpConstant %6 147
+        %127 = OpConstant %6 155
+        %128 = OpConstant %6 152
+        %129 = OpConstant %6 139
+        %130 = OpConstant %6 129
+        %131 = OpConstant %6 118
+        %132 = OpConstant %6 68
+        %133 = OpConstant %6 58
+        %134 = OpConstant %6 49
+        %135 = OpConstant %6 43
+        %136 = OpConstant %6 40
+        %137 = OpConstant %6 41
+        %138 = OpConstant %6 44
+        %139 = OpConstant %6 51
+        %140 = OpConstant %6 61
+        %141 = OpConstant %6 73
+        %142 = OpConstant %6 119
+        %143 = OpConstant %6 173
+        %144 = OpConstant %6 186
+        %145 = OpConstant %6 128
+        %146 = OpConstant %6 104
+        %147 = OpConstant %6 86
+        %148 = OpConstant %6 81
+        %149 = OpConstant %6 77
+        %150 = OpConstant %6 76
+        %151 = OpConstant %6 89
+        %152 = OpConstant %6 102
+        %153 = OpConstant %6 92
+        %154 = OpConstant %6 83
+        %155 = OpConstant %6 62
+        %156 = OpConstant %6 50
+        %157 = OpConstant %6 38
+        %158 = OpConstant %6 26
+        %159 = OpConstant %6 16
+        %160 = OpConstant %6 8
+        %161 = OpConstant %6 2
+        %162 = OpConstant %6 0
+        %163 = OpConstant %6 4
+        %164 = OpConstant %6 11
+        %165 = OpConstant %6 21
+        %166 = OpConstant %6 33
+        %167 = OpConstant %6 48
+        %168 = OpConstant %6 64
+        %169 = OpConstant %6 144
+        %170 = OpConstant %6 123
+        %171 = OpConstant %6 112
+        %172 = OpConstant %6 100
+        %173 = OpConstant %6 90
+        %174 = OpConstant %6 65
+        %175 = OpConstant %6 67
+        %176 = OpConstant %6 70
+        %177 = OpConstant %6 75
+        %178 = OpConstant %6 95
+        %179 = OpConstant %6 88
+        %180 = OpConstant %6 69
+        %181 = OpConstant %6 47
+        %182 = OpConstant %6 36
+        %183 = OpConstant %6 18
+        %184 = OpConstant %6 13
+        %185 = OpConstant %6 15
+        %186 = OpConstant %6 22
+        %187 = OpConstant %6 32
+        %188 = OpConstant %6 45
+        %189 = OpConstant %6 60
+        %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
+        %193 = OpTypePointer Function %32
+        %215 = OpConstant %9 15
+        %231 = OpConstant %9 1
+        %236 = OpConstant %6 1
+        %238 = OpConstant %9 0
+        %239 = OpConstantComposite %10 %238 %238 %238 %231
+        %242 = OpTypeVector %9 2
+        %245 = OpTypePointer Input %10
+        %246 = OpVariable %245 Input
+        %249 = OpTypeStruct %242
+        %250 = OpTypePointer Uniform %249
+        %251 = OpVariable %250 Uniform
+        %252 = OpTypePointer Uniform %242
+        %259 = OpConstant %9 256
+        %267 = OpTypePointer Output %10
+        %268 = OpVariable %267 Output
+        %277 = OpConstantFalse %26
+        %280 = OpConstantTrue %26
+        %363 = OpUndef %10
+        %365 = OpConstant %9 0.0666666701
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %285 = OpVariable %193 Function
+        %286 = OpVariable %193 Function
+        %288 = OpVariable %193 Function
+        %247 = OpLoad %10 %246
+        %248 = OpVectorShuffle %242 %247 %247 0 1
+        %253 = OpAccessChain %252 %251 %162
+        %254 = OpLoad %242 %253
+        %255 = OpFDiv %242 %248 %254
+        %258 = OpCompositeExtract %9 %255 0
+        %260 = OpFMul %9 %258 %259
+        %261 = OpConvertFToS %6 %260
+        %263 = OpCompositeExtract %9 %255 1
+        %264 = OpFMul %9 %263 %259
+        %265 = OpConvertFToS %6 %264
+        %266 = OpCompositeConstruct %7 %261 %265
+               OpSelectionMerge %341 None
+               OpSwitch %28 %291
+        %291 = OpLabel
+               OpBranch %292
+        %292 = OpLabel
+        %355 = OpPhi %7 %266 %291 %354 %337
+        %295 = OpCompositeExtract %6 %355 1
+        %296 = OpINotEqual %26 %295 %25
+               OpLoopMerge %338 %337 None
+               OpBranchConditional %296 %297 %338
+        %297 = OpLabel
+        %299 = OpCompositeExtract %6 %355 0
+               OpStore %285 %190
+        %302 = OpAccessChain %22 %285 %295
+        %303 = OpLoad %6 %302
+        %304 = OpIAdd %6 %303 %185
+        %305 = OpSLessThan %26 %299 %304
+               OpSelectionMerge %315 None
+               OpBranchConditional %305 %306 %315
+        %306 = OpLabel
+               OpStore %286 %190
+        %311 = OpAccessChain %22 %286 %295
+        %312 = OpLoad %6 %311
+        %313 = OpISub %6 %312 %185
+        %314 = OpSGreaterThan %26 %299 %313
+               OpBranch %315
+        %315 = OpLabel
+        %316 = OpPhi %26 %305 %297 %314 %306
+               OpSelectionMerge %333 None
+               OpBranchConditional %316 %317 %333
+        %317 = OpLabel
+               OpStore %288 %190
+        %322 = OpAccessChain %22 %288 %295
+        %323 = OpLoad %6 %322
+        %324 = OpISub %6 %299 %323
+        %325 = OpConvertSToF %9 %324
+        %326 = OpExtInst %9 %1 FAbs %325
+        %327 = OpFSub %9 %215 %326
+        %328 = OpFMul %9 %327 %365
+        %332 = OpCompositeConstruct %10 %328 %328 %328 %231
+               OpBranch %338
+        %333 = OpLabel
+        %336 = OpIAdd %6 %295 %236
+        %354 = OpCompositeInsert %7 %336 %355 1
+               OpBranch %337
+        %337 = OpLabel
+               OpBranch %292
+        %338 = OpLabel
+        %361 = OpPhi %10 %363 %292 %332 %317
+        %357 = OpPhi %26 %277 %292 %280 %317
+               OpSelectionMerge %340 None
+               OpBranchConditional %357 %341 %340
+        %340 = OpLabel
+               OpBranch %341
+        %341 = OpLabel
+        %360 = OpPhi %10 %361 %338 %239 %340
+               OpStore %268 %360
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 2249
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %246 %268
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %246 "gl_FragCoord"
+               OpName %249 "buf0"
+               OpMemberName %249 0 "resolution"
+               OpName %251 ""
+               OpName %268 "_GLF_color"
+               OpDecorate %246 BuiltIn FragCoord
+               OpMemberDecorate %249 0 Offset 0
+               OpDecorate %249 Block
+               OpDecorate %251 DescriptorSet 0
+               OpDecorate %251 Binding 0
+               OpDecorate %268 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeInt 32 1
+          %7 = OpTypeVector %6 2
+          %9 = OpTypeFloat 32
+         %10 = OpTypeVector %9 4
+         %20 = OpTypeInt 32 0
+         %22 = OpTypePointer Function %6
+         %25 = OpConstant %6 256
+         %26 = OpTypeBool
+         %28 = OpConstant %20 0
+         %31 = OpConstant %20 256
+         %32 = OpTypeArray %6 %31
+         %33 = OpConstant %6 115
+         %34 = OpConstant %6 133
+         %35 = OpConstant %6 150
+         %36 = OpConstant %6 164
+         %37 = OpConstant %6 176
+         %38 = OpConstant %6 184
+         %39 = OpConstant %6 190
+         %40 = OpConstant %6 192
+         %41 = OpConstant %6 191
+         %42 = OpConstant %6 187
+         %43 = OpConstant %6 181
+         %44 = OpConstant %6 172
+         %45 = OpConstant %6 163
+         %46 = OpConstant %6 153
+         %47 = OpConstant %6 143
+         %48 = OpConstant %6 134
+         %49 = OpConstant %6 126
+         %50 = OpConstant %6 120
+         %51 = OpConstant %6 116
+         %52 = OpConstant %6 114
+         %53 = OpConstant %6 117
+         %54 = OpConstant %6 121
+         %55 = OpConstant %6 127
+         %56 = OpConstant %6 141
+         %57 = OpConstant %6 148
+         %58 = OpConstant %6 154
+         %59 = OpConstant %6 159
+         %60 = OpConstant %6 162
+         %61 = OpConstant %6 161
+         %62 = OpConstant %6 157
+         %63 = OpConstant %6 151
+         %64 = OpConstant %6 124
+         %65 = OpConstant %6 113
+         %66 = OpConstant %6 103
+         %67 = OpConstant %6 94
+         %68 = OpConstant %6 87
+         %69 = OpConstant %6 82
+         %70 = OpConstant %6 79
+         %71 = OpConstant %6 80
+         %72 = OpConstant %6 84
+         %73 = OpConstant %6 91
+         %74 = OpConstant %6 101
+         %75 = OpConstant %6 130
+         %76 = OpConstant %6 146
+         %77 = OpConstant %6 182
+         %78 = OpConstant %6 199
+         %79 = OpConstant %6 215
+         %80 = OpConstant %6 229
+         %81 = OpConstant %6 240
+         %82 = OpConstant %6 249
+         %83 = OpConstant %6 254
+         %84 = OpConstant %6 250
+         %85 = OpConstant %6 243
+         %86 = OpConstant %6 233
+         %87 = OpConstant %6 223
+         %88 = OpConstant %6 212
+         %89 = OpConstant %6 200
+         %90 = OpConstant %6 180
+         %91 = OpConstant %6 166
+         %92 = OpConstant %6 169
+         %93 = OpConstant %6 174
+         %94 = OpConstant %6 179
+         %95 = OpConstant %6 185
+         %96 = OpConstant %6 193
+         %97 = OpConstant %6 195
+         %98 = OpConstant %6 188
+         %99 = OpConstant %6 171
+        %100 = OpConstant %6 149
+        %101 = OpConstant %6 137
+        %102 = OpConstant %6 125
+        %103 = OpConstant %6 105
+        %104 = OpConstant %6 97
+        %105 = OpConstant %6 93
+        %106 = OpConstant %6 98
+        %107 = OpConstant %6 106
+        %108 = OpConstant %6 145
+        %109 = OpConstant %6 177
+        %110 = OpConstant %6 208
+        %111 = OpConstant %6 221
+        %112 = OpConstant %6 231
+        %113 = OpConstant %6 239
+        %114 = OpConstant %6 244
+        %115 = OpConstant %6 242
+        %116 = OpConstant %6 236
+        %117 = OpConstant %6 228
+        %118 = OpConstant %6 218
+        %119 = OpConstant %6 207
+        %120 = OpConstant %6 194
+        %121 = OpConstant %6 158
+        %122 = OpConstant %6 135
+        %123 = OpConstant %6 132
+        %124 = OpConstant %6 131
+        %125 = OpConstant %6 138
+        %126 = OpConstant %6 147
+        %127 = OpConstant %6 155
+        %128 = OpConstant %6 152
+        %129 = OpConstant %6 139
+        %130 = OpConstant %6 129
+        %131 = OpConstant %6 118
+        %132 = OpConstant %6 68
+        %133 = OpConstant %6 58
+        %134 = OpConstant %6 49
+        %135 = OpConstant %6 43
+        %136 = OpConstant %6 40
+        %137 = OpConstant %6 41
+        %138 = OpConstant %6 44
+        %139 = OpConstant %6 51
+        %140 = OpConstant %6 61
+        %141 = OpConstant %6 73
+        %142 = OpConstant %6 119
+        %143 = OpConstant %6 173
+        %144 = OpConstant %6 186
+        %145 = OpConstant %6 128
+        %146 = OpConstant %6 104
+        %147 = OpConstant %6 86
+        %148 = OpConstant %6 81
+        %149 = OpConstant %6 77
+        %150 = OpConstant %6 76
+        %151 = OpConstant %6 89
+        %152 = OpConstant %6 102
+        %153 = OpConstant %6 92
+        %154 = OpConstant %6 83
+        %155 = OpConstant %6 62
+        %156 = OpConstant %6 50
+        %157 = OpConstant %6 38
+        %158 = OpConstant %6 26
+        %159 = OpConstant %6 16
+        %160 = OpConstant %6 8
+        %161 = OpConstant %6 2
+        %162 = OpConstant %6 0
+        %163 = OpConstant %6 4
+        %164 = OpConstant %6 11
+        %165 = OpConstant %6 21
+        %166 = OpConstant %6 33
+        %167 = OpConstant %6 48
+        %168 = OpConstant %6 64
+        %169 = OpConstant %6 144
+        %170 = OpConstant %6 123
+        %171 = OpConstant %6 112
+        %172 = OpConstant %6 100
+        %173 = OpConstant %6 90
+        %174 = OpConstant %6 65
+        %175 = OpConstant %6 67
+        %176 = OpConstant %6 70
+        %177 = OpConstant %6 75
+        %178 = OpConstant %6 95
+        %179 = OpConstant %6 88
+        %180 = OpConstant %6 69
+        %181 = OpConstant %6 47
+        %182 = OpConstant %6 36
+        %183 = OpConstant %6 18
+        %184 = OpConstant %6 13
+        %185 = OpConstant %6 15
+        %186 = OpConstant %6 22
+        %187 = OpConstant %6 32
+        %188 = OpConstant %6 45
+        %189 = OpConstant %6 60
+        %190 = OpConstantComposite %32 %33 %34 %35 %36 %37 %38 %39 %40 %41 %42 %43 %44 %45 %46 %47 %48 %49 %50 %51 %52 %52 %53 %54 %55 %48 %56 %57 %58 %59 %60 %45 %61 %62 %63 %47 %48 %64 %65 %66 %67 %68 %69 %70 %71 %72 %73 %74 %52 %75 %76 %36 %77 %78 %79 %80 %81 %82 %83 %25 %83 %84 %85 %86 %87 %88 %89 %39 %90 %44 %91 %45 %61 %60 %36 %92 %93 %94 %95 %39 %96 %97 %97 %40 %98 %90 %99 %61 %100 %101 %102 %52 %103 %104 %105 %73 %105 %106 %107 %53 %75 %108 %61 %109 %96 %110 %111 %112 %113 %85 %114 %115 %116 %117 %118 %119 %120 %43 %92 %121 %57 %56 %122 %123 %124 %123 %122 %125 %47 %126 %63 %58 %127 %127 %128 %76 %129 %130 %131 %107 %105 %71 %132 %133 %134 %135 %136 %137 %138 %139 %140 %141 %68 %66 %142 %48 %100 %60 %143 %43 %144 %98 %144 %43 %93 %36 %46 %56 %145 %51 %146 %67 %147 %148 %149 %150 %149 %71 %72 %151 %67 %106 %152 %146 %146 %152 %106 %153 %154 %141 %155 %156 %157 %158 %159 %160 %161 %162 %162 %163 %164 %165 %166 %167 %168 %148 %106 %52 %130 %56 %63 %121 %61 %61 %121 %128 %169 %48 %170 %171 %172 %173 %148 %141 %132 %174 %174 %175 %176 %177 %148 %68 %153 %104 %74 %66 %152 %172 %178 %179 %70 %180 %133 %181 %182 %158 %183 %184 %164 %164 %185 %186 %187 %188 %189 %149 %67
+        %193 = OpTypePointer Function %32
+        %215 = OpConstant %9 15
+        %231 = OpConstant %9 1
+        %236 = OpConstant %6 1
+        %238 = OpConstant %9 0
+        %239 = OpConstantComposite %10 %238 %238 %238 %231
+        %242 = OpTypeVector %9 2
+        %245 = OpTypePointer Input %10
+        %246 = OpVariable %245 Input
+        %249 = OpTypeStruct %242
+        %250 = OpTypePointer Uniform %249
+        %251 = OpVariable %250 Uniform
+        %252 = OpTypePointer Uniform %242
+        %259 = OpConstant %9 256
+        %267 = OpTypePointer Output %10
+        %268 = OpVariable %267 Output
+        %277 = OpConstantFalse %26
+        %280 = OpConstantTrue %26
+        %363 = OpUndef %10
+        %365 = OpConstant %9 0.0666666701
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %285 = OpVariable %193 Function
+        %286 = OpVariable %193 Function
+        %288 = OpVariable %193 Function
+        %247 = OpLoad %10 %246
+        %248 = OpVectorShuffle %242 %247 %247 0 1
+        %253 = OpAccessChain %252 %251 %162
+        %254 = OpLoad %242 %253
+        %255 = OpFDiv %242 %248 %254
+        %588 = OpCompositeConstruct %10 %254 %215 %215
+        %474 = OpSNegate %6 %69
+        %258 = OpCompositeExtract %9 %255 0
+        %260 = OpFMul %9 %258 %259
+       %2248 = OpCompositeExtract %9 %588 2
+        %593 = OpCompositeConstruct %242 %238 %2248
+        %547 = OpISub %6 %50 %162
+        %261 = OpConvertFToS %6 %260
+        %263 = OpCompositeExtract %9 %255 1
+        %264 = OpFMul %9 %263 %259
+        %265 = OpConvertFToS %6 %264
+        %266 = OpCompositeConstruct %7 %261 %265
+               OpSelectionMerge %341 None
+               OpSwitch %28 %291
+        %291 = OpLabel
+               OpBranch %292
+        %292 = OpLabel
+        %355 = OpPhi %7 %266 %291 %354 %337
+        %295 = OpCompositeExtract %6 %355 1
+        %296 = OpINotEqual %26 %295 %25
+               OpLoopMerge %338 %337 None
+               OpBranchConditional %296 %297 %338
+        %297 = OpLabel
+        %299 = OpCompositeExtract %6 %355 0
+               OpStore %285 %190
+        %302 = OpAccessChain %22 %285 %295
+        %303 = OpLoad %6 %302
+        %304 = OpIAdd %6 %303 %185
+        %305 = OpSLessThan %26 %299 %304
+               OpSelectionMerge %315 None
+               OpBranchConditional %305 %306 %315
+        %306 = OpLabel
+               OpStore %286 %190
+        %311 = OpAccessChain %22 %286 %295
+        %312 = OpLoad %6 %311
+        %313 = OpISub %6 %312 %185
+        %314 = OpSGreaterThan %26 %299 %313
+               OpBranch %315
+        %315 = OpLabel
+        %316 = OpPhi %26 %305 %297 %314 %306
+               OpSelectionMerge %333 None
+               OpBranchConditional %316 %317 %333
+        %317 = OpLabel
+               OpStore %288 %190
+        %322 = OpAccessChain %22 %288 %295
+        %323 = OpLoad %6 %322
+        %324 = OpISub %6 %299 %323
+        %325 = OpConvertSToF %9 %324
+        %639 = OpCompositeConstruct %249 %593
+        %495 = OpIAdd %6 %73 %114
+        %326 = OpExtInst %9 %1 FAbs %325
+       %2247 = OpCompositeExtract %9 %639 0 1
+        %327 = OpFSub %9 %2247 %326
+        %328 = OpFMul %9 %327 %365
+        %332 = OpCompositeConstruct %10 %328 %328 %328 %231
+               OpBranch %338
+        %333 = OpLabel
+        %336 = OpIAdd %6 %295 %236
+        %354 = OpCompositeInsert %7 %336 %355 1
+               OpBranch %337
+        %337 = OpLabel
+               OpBranch %292
+        %338 = OpLabel
+        %361 = OpPhi %10 %363 %292 %332 %317
+        %357 = OpPhi %26 %277 %292 %280 %317
+               OpSelectionMerge %340 None
+               OpBranchConditional %357 %341 %340
+        %340 = OpLabel
+               OpBranch %341
+        %341 = OpLabel
+        %360 = OpPhi %10 %361 %338 %239 %340
+               OpStore %268 %360
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-copy-object.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-copy-object.amber
new file mode 100644 (file)
index 0000000..7286518
--- /dev/null
@@ -0,0 +1,1308 @@
+#!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 features extra OpCopyObject instructions
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 442
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %435
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %9 "pos"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %26 "ipos"
+               OpName %42 "i"
+               OpName %55 "map"
+               OpName %62 "p"
+               OpName %65 "canwalk"
+               OpName %67 "v"
+               OpName %74 "directions"
+               OpName %171 "j"
+               OpName %208 "d"
+               OpName %435 "_GLF_color"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %435 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %24 = OpTypeVector %18 2
+         %25 = OpTypePointer Function %24
+         %27 = OpTypeInt 32 0
+         %28 = OpConstant %27 0
+         %29 = OpTypePointer Function %6
+         %32 = OpConstant %6 16
+         %35 = OpConstant %27 1
+         %41 = OpTypePointer Function %18
+         %49 = OpConstant %18 256
+         %50 = OpTypeBool
+         %52 = OpConstant %27 256
+         %53 = OpTypeArray %18 %52
+         %54 = OpTypePointer Private %53
+         %55 = OpVariable %54 Private
+         %57 = OpTypePointer Private %18
+         %60 = OpConstant %18 1
+         %63 = OpConstantComposite %24 %19 %19
+         %64 = OpTypePointer Function %50
+         %66 = OpConstantTrue %50
+         %82 = OpConstant %18 2
+         %86 = OpConstant %18 16
+        %119 = OpConstant %18 14
+        %162 = OpConstantFalse %50
+        %169 = OpConstant %18 8
+        %434 = OpTypePointer Output %10
+        %435 = OpVariable %434 Output
+        %436 = OpConstant %6 1
+        %437 = OpConstantComposite %10 %436 %436 %436 %436
+        %440 = OpConstant %6 0
+        %441 = OpConstantComposite %10 %440 %440 %440 %436
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+          %9 = OpVariable %8 Function
+         %26 = OpVariable %25 Function
+         %42 = OpVariable %41 Function
+         %62 = OpVariable %25 Function
+         %65 = OpVariable %64 Function
+         %67 = OpVariable %41 Function
+         %74 = OpVariable %41 Function
+        %171 = OpVariable %41 Function
+        %208 = OpVariable %41 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+               OpStore %9 %23
+         %30 = OpAccessChain %29 %9 %28
+         %31 = OpLoad %6 %30
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %36 = OpAccessChain %29 %9 %35
+         %37 = OpLoad %6 %36
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %40 = OpCompositeConstruct %24 %34 %39
+               OpStore %26 %40
+               OpStore %42 %19
+               OpBranch %43
+         %43 = OpLabel
+               OpLoopMerge %45 %46 None
+               OpBranch %47
+         %47 = OpLabel
+         %48 = OpLoad %18 %42
+         %51 = OpSLessThan %50 %48 %49
+               OpBranchConditional %51 %44 %45
+         %44 = OpLabel
+         %56 = OpLoad %18 %42
+         %58 = OpAccessChain %57 %55 %56
+               OpStore %58 %19
+               OpBranch %46
+         %46 = OpLabel
+         %59 = OpLoad %18 %42
+         %61 = OpIAdd %18 %59 %60
+               OpStore %42 %61
+               OpBranch %43
+         %45 = OpLabel
+               OpStore %62 %63
+               OpStore %65 %66
+               OpStore %67 %19
+               OpBranch %68
+         %68 = OpLabel
+               OpLoopMerge %70 %71 None
+               OpBranch %69
+         %69 = OpLabel
+         %72 = OpLoad %18 %67
+         %73 = OpIAdd %18 %72 %60
+               OpStore %67 %73
+               OpStore %74 %19
+         %75 = OpAccessChain %41 %62 %28
+         %76 = OpLoad %18 %75
+         %77 = OpSGreaterThan %50 %76 %19
+               OpSelectionMerge %79 None
+               OpBranchConditional %77 %78 %79
+         %78 = OpLabel
+         %80 = OpAccessChain %41 %62 %28
+         %81 = OpLoad %18 %80
+         %83 = OpISub %18 %81 %82
+         %84 = OpAccessChain %41 %62 %35
+         %85 = OpLoad %18 %84
+         %87 = OpIMul %18 %85 %86
+         %88 = OpIAdd %18 %83 %87
+         %89 = OpAccessChain %57 %55 %88
+         %90 = OpLoad %18 %89
+         %91 = OpIEqual %50 %90 %19
+               OpBranch %79
+         %79 = OpLabel
+         %92 = OpPhi %50 %77 %69 %91 %78
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpLoad %18 %74
+         %96 = OpIAdd %18 %95 %60
+               OpStore %74 %96
+               OpBranch %94
+         %94 = OpLabel
+         %97 = OpAccessChain %41 %62 %35
+         %98 = OpLoad %18 %97
+         %99 = OpSGreaterThan %50 %98 %19
+               OpSelectionMerge %101 None
+               OpBranchConditional %99 %100 %101
+        %100 = OpLabel
+        %102 = OpAccessChain %41 %62 %28
+        %103 = OpLoad %18 %102
+        %104 = OpAccessChain %41 %62 %35
+        %105 = OpLoad %18 %104
+        %106 = OpISub %18 %105 %82
+        %107 = OpIMul %18 %106 %86
+        %108 = OpIAdd %18 %103 %107
+        %109 = OpAccessChain %57 %55 %108
+        %110 = OpLoad %18 %109
+        %111 = OpIEqual %50 %110 %19
+               OpBranch %101
+        %101 = OpLabel
+        %112 = OpPhi %50 %99 %94 %111 %100
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %115 = OpLoad %18 %74
+        %116 = OpIAdd %18 %115 %60
+               OpStore %74 %116
+               OpBranch %114
+        %114 = OpLabel
+        %117 = OpAccessChain %41 %62 %28
+        %118 = OpLoad %18 %117
+        %120 = OpSLessThan %50 %118 %119
+               OpSelectionMerge %122 None
+               OpBranchConditional %120 %121 %122
+        %121 = OpLabel
+        %123 = OpAccessChain %41 %62 %28
+        %124 = OpLoad %18 %123
+        %125 = OpIAdd %18 %124 %82
+        %126 = OpAccessChain %41 %62 %35
+        %127 = OpLoad %18 %126
+        %128 = OpIMul %18 %127 %86
+        %129 = OpIAdd %18 %125 %128
+        %130 = OpAccessChain %57 %55 %129
+        %131 = OpLoad %18 %130
+        %132 = OpIEqual %50 %131 %19
+               OpBranch %122
+        %122 = OpLabel
+        %133 = OpPhi %50 %120 %114 %132 %121
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %134 %135
+        %134 = OpLabel
+        %136 = OpLoad %18 %74
+        %137 = OpIAdd %18 %136 %60
+               OpStore %74 %137
+               OpBranch %135
+        %135 = OpLabel
+        %138 = OpAccessChain %41 %62 %35
+        %139 = OpLoad %18 %138
+        %140 = OpSLessThan %50 %139 %119
+               OpSelectionMerge %142 None
+               OpBranchConditional %140 %141 %142
+        %141 = OpLabel
+        %143 = OpAccessChain %41 %62 %28
+        %144 = OpLoad %18 %143
+        %145 = OpAccessChain %41 %62 %35
+        %146 = OpLoad %18 %145
+        %147 = OpIAdd %18 %146 %82
+        %148 = OpIMul %18 %147 %86
+        %149 = OpIAdd %18 %144 %148
+        %150 = OpAccessChain %57 %55 %149
+        %151 = OpLoad %18 %150
+        %152 = OpIEqual %50 %151 %19
+               OpBranch %142
+        %142 = OpLabel
+        %153 = OpPhi %50 %140 %135 %152 %141
+               OpSelectionMerge %155 None
+               OpBranchConditional %153 %154 %155
+        %154 = OpLabel
+        %156 = OpLoad %18 %74
+        %157 = OpIAdd %18 %156 %60
+               OpStore %74 %157
+               OpBranch %155
+        %155 = OpLabel
+        %158 = OpLoad %18 %74
+        %159 = OpIEqual %50 %158 %19
+               OpSelectionMerge %161 None
+               OpBranchConditional %159 %160 %207
+        %160 = OpLabel
+               OpStore %65 %162
+               OpStore %42 %19
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %18 %42
+        %170 = OpSLessThan %50 %168 %169
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %171 %19
+               OpBranch %172
+        %172 = OpLabel
+               OpLoopMerge %174 %175 None
+               OpBranch %176
+        %176 = OpLabel
+        %177 = OpLoad %18 %171
+        %178 = OpSLessThan %50 %177 %169
+               OpBranchConditional %178 %173 %174
+        %173 = OpLabel
+        %179 = OpLoad %18 %171
+        %180 = OpIMul %18 %179 %82
+        %181 = OpLoad %18 %42
+        %182 = OpIMul %18 %181 %82
+        %183 = OpIMul %18 %182 %86
+        %184 = OpIAdd %18 %180 %183
+        %185 = OpAccessChain %57 %55 %184
+        %186 = OpLoad %18 %185
+        %187 = OpIEqual %50 %186 %19
+               OpSelectionMerge %189 None
+               OpBranchConditional %187 %188 %189
+        %188 = OpLabel
+        %190 = OpLoad %18 %171
+        %191 = OpIMul %18 %190 %82
+        %192 = OpAccessChain %41 %62 %28
+               OpStore %192 %191
+        %193 = OpLoad %18 %42
+        %194 = OpIMul %18 %193 %82
+        %195 = OpAccessChain %41 %62 %35
+               OpStore %195 %194
+               OpStore %65 %66
+               OpBranch %189
+        %189 = OpLabel
+               OpBranch %175
+        %175 = OpLabel
+        %196 = OpLoad %18 %171
+        %197 = OpIAdd %18 %196 %60
+               OpStore %171 %197
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %198 = OpLoad %18 %42
+        %199 = OpIAdd %18 %198 %60
+               OpStore %42 %199
+               OpBranch %163
+        %165 = OpLabel
+        %200 = OpAccessChain %41 %62 %28
+        %201 = OpLoad %18 %200
+        %202 = OpAccessChain %41 %62 %35
+        %203 = OpLoad %18 %202
+        %204 = OpIMul %18 %203 %86
+        %205 = OpIAdd %18 %201 %204
+        %206 = OpAccessChain %57 %55 %205
+               OpStore %206 %60
+               OpBranch %161
+        %207 = OpLabel
+        %209 = OpLoad %18 %67
+        %210 = OpLoad %18 %74
+        %211 = OpSMod %18 %209 %210
+               OpStore %208 %211
+        %212 = OpLoad %18 %74
+        %213 = OpLoad %18 %67
+        %214 = OpIAdd %18 %213 %212
+               OpStore %67 %214
+        %215 = OpLoad %18 %208
+        %216 = OpSGreaterThanEqual %50 %215 %19
+               OpSelectionMerge %218 None
+               OpBranchConditional %216 %217 %218
+        %217 = OpLabel
+        %219 = OpAccessChain %41 %62 %28
+        %220 = OpLoad %18 %219
+        %221 = OpSGreaterThan %50 %220 %19
+               OpBranch %218
+        %218 = OpLabel
+        %222 = OpPhi %50 %216 %207 %221 %217
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %223 %224
+        %223 = OpLabel
+        %225 = OpAccessChain %41 %62 %28
+        %226 = OpLoad %18 %225
+        %227 = OpISub %18 %226 %82
+        %228 = OpAccessChain %41 %62 %35
+        %229 = OpLoad %18 %228
+        %230 = OpIMul %18 %229 %86
+        %231 = OpIAdd %18 %227 %230
+        %232 = OpAccessChain %57 %55 %231
+        %233 = OpLoad %18 %232
+        %234 = OpIEqual %50 %233 %19
+               OpBranch %224
+        %224 = OpLabel
+        %235 = OpPhi %50 %222 %218 %234 %223
+               OpSelectionMerge %237 None
+               OpBranchConditional %235 %236 %237
+        %236 = OpLabel
+        %238 = OpLoad %18 %208
+        %239 = OpISub %18 %238 %60
+               OpStore %208 %239
+        %240 = OpAccessChain %41 %62 %28
+        %241 = OpLoad %18 %240
+        %242 = OpAccessChain %41 %62 %35
+        %243 = OpLoad %18 %242
+        %244 = OpIMul %18 %243 %86
+        %245 = OpIAdd %18 %241 %244
+        %246 = OpAccessChain %57 %55 %245
+               OpStore %246 %60
+        %247 = OpAccessChain %41 %62 %28
+        %248 = OpLoad %18 %247
+        %249 = OpISub %18 %248 %60
+        %250 = OpAccessChain %41 %62 %35
+        %251 = OpLoad %18 %250
+        %252 = OpIMul %18 %251 %86
+        %253 = OpIAdd %18 %249 %252
+        %254 = OpAccessChain %57 %55 %253
+               OpStore %254 %60
+        %255 = OpAccessChain %41 %62 %28
+        %256 = OpLoad %18 %255
+        %257 = OpISub %18 %256 %82
+        %258 = OpAccessChain %41 %62 %35
+        %259 = OpLoad %18 %258
+        %260 = OpIMul %18 %259 %86
+        %261 = OpIAdd %18 %257 %260
+        %262 = OpAccessChain %57 %55 %261
+               OpStore %262 %60
+        %263 = OpAccessChain %41 %62 %28
+        %264 = OpLoad %18 %263
+        %265 = OpISub %18 %264 %82
+        %266 = OpAccessChain %41 %62 %28
+               OpStore %266 %265
+               OpBranch %237
+        %237 = OpLabel
+        %267 = OpLoad %18 %208
+        %268 = OpSGreaterThanEqual %50 %267 %19
+               OpSelectionMerge %270 None
+               OpBranchConditional %268 %269 %270
+        %269 = OpLabel
+        %271 = OpAccessChain %41 %62 %35
+        %272 = OpLoad %18 %271
+        %273 = OpSGreaterThan %50 %272 %19
+               OpBranch %270
+        %270 = OpLabel
+        %274 = OpPhi %50 %268 %237 %273 %269
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+        %277 = OpAccessChain %41 %62 %28
+        %278 = OpLoad %18 %277
+        %279 = OpAccessChain %41 %62 %35
+        %280 = OpLoad %18 %279
+        %281 = OpISub %18 %280 %82
+        %282 = OpIMul %18 %281 %86
+        %283 = OpIAdd %18 %278 %282
+        %284 = OpAccessChain %57 %55 %283
+        %285 = OpLoad %18 %284
+        %286 = OpIEqual %50 %285 %19
+               OpBranch %276
+        %276 = OpLabel
+        %287 = OpPhi %50 %274 %270 %286 %275
+               OpSelectionMerge %289 None
+               OpBranchConditional %287 %288 %289
+        %288 = OpLabel
+        %290 = OpLoad %18 %208
+        %291 = OpISub %18 %290 %60
+               OpStore %208 %291
+        %292 = OpAccessChain %41 %62 %28
+        %293 = OpLoad %18 %292
+        %294 = OpAccessChain %41 %62 %35
+        %295 = OpLoad %18 %294
+        %296 = OpIMul %18 %295 %86
+        %297 = OpIAdd %18 %293 %296
+        %298 = OpAccessChain %57 %55 %297
+               OpStore %298 %60
+        %299 = OpAccessChain %41 %62 %28
+        %300 = OpLoad %18 %299
+        %301 = OpAccessChain %41 %62 %35
+        %302 = OpLoad %18 %301
+        %303 = OpISub %18 %302 %60
+        %304 = OpIMul %18 %303 %86
+        %305 = OpIAdd %18 %300 %304
+        %306 = OpAccessChain %57 %55 %305
+               OpStore %306 %60
+        %307 = OpAccessChain %41 %62 %28
+        %308 = OpLoad %18 %307
+        %309 = OpAccessChain %41 %62 %35
+        %310 = OpLoad %18 %309
+        %311 = OpISub %18 %310 %82
+        %312 = OpIMul %18 %311 %86
+        %313 = OpIAdd %18 %308 %312
+        %314 = OpAccessChain %57 %55 %313
+               OpStore %314 %60
+        %315 = OpAccessChain %41 %62 %35
+        %316 = OpLoad %18 %315
+        %317 = OpISub %18 %316 %82
+        %318 = OpAccessChain %41 %62 %35
+               OpStore %318 %317
+               OpBranch %289
+        %289 = OpLabel
+        %319 = OpLoad %18 %208
+        %320 = OpSGreaterThanEqual %50 %319 %19
+               OpSelectionMerge %322 None
+               OpBranchConditional %320 %321 %322
+        %321 = OpLabel
+        %323 = OpAccessChain %41 %62 %28
+        %324 = OpLoad %18 %323
+        %325 = OpSLessThan %50 %324 %119
+               OpBranch %322
+        %322 = OpLabel
+        %326 = OpPhi %50 %320 %289 %325 %321
+               OpSelectionMerge %328 None
+               OpBranchConditional %326 %327 %328
+        %327 = OpLabel
+        %329 = OpAccessChain %41 %62 %28
+        %330 = OpLoad %18 %329
+        %331 = OpIAdd %18 %330 %82
+        %332 = OpAccessChain %41 %62 %35
+        %333 = OpLoad %18 %332
+        %334 = OpIMul %18 %333 %86
+        %335 = OpIAdd %18 %331 %334
+        %336 = OpAccessChain %57 %55 %335
+        %337 = OpLoad %18 %336
+        %338 = OpIEqual %50 %337 %19
+               OpBranch %328
+        %328 = OpLabel
+        %339 = OpPhi %50 %326 %322 %338 %327
+               OpSelectionMerge %341 None
+               OpBranchConditional %339 %340 %341
+        %340 = OpLabel
+        %342 = OpLoad %18 %208
+        %343 = OpISub %18 %342 %60
+               OpStore %208 %343
+        %344 = OpAccessChain %41 %62 %28
+        %345 = OpLoad %18 %344
+        %346 = OpAccessChain %41 %62 %35
+        %347 = OpLoad %18 %346
+        %348 = OpIMul %18 %347 %86
+        %349 = OpIAdd %18 %345 %348
+        %350 = OpAccessChain %57 %55 %349
+               OpStore %350 %60
+        %351 = OpAccessChain %41 %62 %28
+        %352 = OpLoad %18 %351
+        %353 = OpIAdd %18 %352 %60
+        %354 = OpAccessChain %41 %62 %35
+        %355 = OpLoad %18 %354
+        %356 = OpIMul %18 %355 %86
+        %357 = OpIAdd %18 %353 %356
+        %358 = OpAccessChain %57 %55 %357
+               OpStore %358 %60
+        %359 = OpAccessChain %41 %62 %28
+        %360 = OpLoad %18 %359
+        %361 = OpIAdd %18 %360 %82
+        %362 = OpAccessChain %41 %62 %35
+        %363 = OpLoad %18 %362
+        %364 = OpIMul %18 %363 %86
+        %365 = OpIAdd %18 %361 %364
+        %366 = OpAccessChain %57 %55 %365
+               OpStore %366 %60
+        %367 = OpAccessChain %41 %62 %28
+        %368 = OpLoad %18 %367
+        %369 = OpIAdd %18 %368 %82
+        %370 = OpAccessChain %41 %62 %28
+               OpStore %370 %369
+               OpBranch %341
+        %341 = OpLabel
+        %371 = OpLoad %18 %208
+        %372 = OpSGreaterThanEqual %50 %371 %19
+               OpSelectionMerge %374 None
+               OpBranchConditional %372 %373 %374
+        %373 = OpLabel
+        %375 = OpAccessChain %41 %62 %35
+        %376 = OpLoad %18 %375
+        %377 = OpSLessThan %50 %376 %119
+               OpBranch %374
+        %374 = OpLabel
+        %378 = OpPhi %50 %372 %341 %377 %373
+               OpSelectionMerge %380 None
+               OpBranchConditional %378 %379 %380
+        %379 = OpLabel
+        %381 = OpAccessChain %41 %62 %28
+        %382 = OpLoad %18 %381
+        %383 = OpAccessChain %41 %62 %35
+        %384 = OpLoad %18 %383
+        %385 = OpIAdd %18 %384 %82
+        %386 = OpIMul %18 %385 %86
+        %387 = OpIAdd %18 %382 %386
+        %388 = OpAccessChain %57 %55 %387
+        %389 = OpLoad %18 %388
+        %390 = OpIEqual %50 %389 %19
+               OpBranch %380
+        %380 = OpLabel
+        %391 = OpPhi %50 %378 %374 %390 %379
+               OpSelectionMerge %393 None
+               OpBranchConditional %391 %392 %393
+        %392 = OpLabel
+        %394 = OpLoad %18 %208
+        %395 = OpISub %18 %394 %60
+               OpStore %208 %395
+        %396 = OpAccessChain %41 %62 %28
+        %397 = OpLoad %18 %396
+        %398 = OpAccessChain %41 %62 %35
+        %399 = OpLoad %18 %398
+        %400 = OpIMul %18 %399 %86
+        %401 = OpIAdd %18 %397 %400
+        %402 = OpAccessChain %57 %55 %401
+               OpStore %402 %60
+        %403 = OpAccessChain %41 %62 %28
+        %404 = OpLoad %18 %403
+        %405 = OpAccessChain %41 %62 %35
+        %406 = OpLoad %18 %405
+        %407 = OpIAdd %18 %406 %60
+        %408 = OpIMul %18 %407 %86
+        %409 = OpIAdd %18 %404 %408
+        %410 = OpAccessChain %57 %55 %409
+               OpStore %410 %60
+        %411 = OpAccessChain %41 %62 %28
+        %412 = OpLoad %18 %411
+        %413 = OpAccessChain %41 %62 %35
+        %414 = OpLoad %18 %413
+        %415 = OpIAdd %18 %414 %82
+        %416 = OpIMul %18 %415 %86
+        %417 = OpIAdd %18 %412 %416
+        %418 = OpAccessChain %57 %55 %417
+               OpStore %418 %60
+        %419 = OpAccessChain %41 %62 %35
+        %420 = OpLoad %18 %419
+        %421 = OpIAdd %18 %420 %82
+        %422 = OpAccessChain %41 %62 %35
+               OpStore %422 %421
+               OpBranch %393
+        %393 = OpLabel
+               OpBranch %161
+        %161 = OpLabel
+        %423 = OpAccessChain %41 %26 %35
+        %424 = OpLoad %18 %423
+        %425 = OpIMul %18 %424 %86
+        %426 = OpAccessChain %41 %26 %28
+        %427 = OpLoad %18 %426
+        %428 = OpIAdd %18 %425 %427
+        %429 = OpAccessChain %57 %55 %428
+        %430 = OpLoad %18 %429
+        %431 = OpIEqual %50 %430 %60
+               OpSelectionMerge %433 None
+               OpBranchConditional %431 %432 %433
+        %432 = OpLabel
+               OpStore %435 %437
+               OpReturn
+        %433 = OpLabel
+               OpBranch %71
+         %71 = OpLabel
+        %439 = OpLoad %50 %65
+               OpBranchConditional %439 %68 %70
+         %70 = OpLabel
+               OpStore %435 %441
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 978
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %435
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %9 "pos"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %26 "ipos"
+               OpName %42 "i"
+               OpName %55 "map"
+               OpName %62 "p"
+               OpName %65 "canwalk"
+               OpName %67 "v"
+               OpName %74 "directions"
+               OpName %171 "j"
+               OpName %208 "d"
+               OpName %435 "_GLF_color"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %435 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %24 = OpTypeVector %18 2
+         %25 = OpTypePointer Function %24
+         %27 = OpTypeInt 32 0
+         %28 = OpConstant %27 0
+         %29 = OpTypePointer Function %6
+         %32 = OpConstant %6 16
+         %35 = OpConstant %27 1
+         %41 = OpTypePointer Function %18
+         %49 = OpConstant %18 256
+         %50 = OpTypeBool
+         %52 = OpConstant %27 256
+         %53 = OpTypeArray %18 %52
+         %54 = OpTypePointer Private %53
+         %55 = OpVariable %54 Private
+         %57 = OpTypePointer Private %18
+         %60 = OpConstant %18 1
+         %63 = OpConstantComposite %24 %19 %19
+         %64 = OpTypePointer Function %50
+         %66 = OpConstantTrue %50
+         %82 = OpConstant %18 2
+         %86 = OpConstant %18 16
+        %119 = OpConstant %18 14
+        %162 = OpConstantFalse %50
+        %169 = OpConstant %18 8
+        %434 = OpTypePointer Output %10
+        %435 = OpVariable %434 Output
+        %436 = OpConstant %6 1
+        %437 = OpConstantComposite %10 %436 %436 %436 %436
+        %440 = OpConstant %6 0
+        %441 = OpConstantComposite %10 %440 %440 %440 %436
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+          %9 = OpVariable %8 Function
+         %26 = OpVariable %25 Function
+         %42 = OpVariable %41 Function
+         %62 = OpVariable %25 Function
+         %65 = OpVariable %64 Function
+         %67 = OpVariable %41 Function
+         %74 = OpVariable %41 Function
+        %171 = OpVariable %41 Function
+        %208 = OpVariable %41 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+               OpStore %9 %23
+         %30 = OpAccessChain %29 %9 %28
+         %31 = OpLoad %6 %30
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %36 = OpAccessChain %29 %9 %35
+         %37 = OpLoad %6 %36
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %40 = OpCompositeConstruct %24 %34 %39
+               OpStore %26 %40
+               OpStore %42 %19
+               OpBranch %43
+         %43 = OpLabel
+               OpLoopMerge %45 %46 None
+               OpBranch %47
+         %47 = OpLabel
+         %48 = OpLoad %18 %42
+         %51 = OpSLessThan %50 %48 %49
+               OpBranchConditional %51 %44 %45
+         %44 = OpLabel
+         %56 = OpLoad %18 %42
+         %58 = OpAccessChain %57 %55 %56
+               OpStore %58 %19
+               OpBranch %46
+         %46 = OpLabel
+         %59 = OpLoad %18 %42
+         %61 = OpIAdd %18 %59 %60
+               OpStore %42 %61
+               OpBranch %43
+         %45 = OpLabel
+               OpStore %62 %63
+               OpStore %65 %66
+               OpStore %67 %19
+               OpBranch %68
+         %68 = OpLabel
+               OpLoopMerge %70 %71 None
+               OpBranch %69
+         %69 = OpLabel
+         %72 = OpLoad %18 %67
+         %73 = OpIAdd %18 %72 %60
+               OpStore %67 %73
+               OpStore %74 %19
+         %75 = OpAccessChain %41 %62 %28
+         %76 = OpLoad %18 %75
+         %77 = OpSGreaterThan %50 %76 %19
+               OpSelectionMerge %79 None
+               OpBranchConditional %77 %78 %79
+         %78 = OpLabel
+         %80 = OpAccessChain %41 %62 %28
+         %81 = OpLoad %18 %80
+         %83 = OpISub %18 %81 %82
+         %84 = OpAccessChain %41 %62 %35
+         %85 = OpLoad %18 %84
+         %87 = OpIMul %18 %85 %86
+         %88 = OpIAdd %18 %83 %87
+         %89 = OpAccessChain %57 %55 %88
+         %90 = OpLoad %18 %89
+         %91 = OpIEqual %50 %90 %19
+               OpBranch %79
+         %79 = OpLabel
+         %92 = OpPhi %50 %77 %69 %91 %78
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpLoad %18 %74
+         %96 = OpIAdd %18 %95 %60
+               OpStore %74 %96
+               OpBranch %94
+         %94 = OpLabel
+         %97 = OpAccessChain %41 %62 %35
+         %98 = OpLoad %18 %97
+         %99 = OpSGreaterThan %50 %98 %19
+               OpSelectionMerge %101 None
+               OpBranchConditional %99 %100 %101
+        %100 = OpLabel
+        %102 = OpAccessChain %41 %62 %28
+        %103 = OpLoad %18 %102
+        %104 = OpAccessChain %41 %62 %35
+        %105 = OpLoad %18 %104
+        %106 = OpISub %18 %105 %82
+        %107 = OpIMul %18 %106 %86
+        %108 = OpIAdd %18 %103 %107
+        %109 = OpAccessChain %57 %55 %108
+        %110 = OpLoad %18 %109
+        %111 = OpIEqual %50 %110 %19
+               OpBranch %101
+        %101 = OpLabel
+        %112 = OpPhi %50 %99 %94 %111 %100
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %115 = OpLoad %18 %74
+        %116 = OpIAdd %18 %115 %60
+               OpStore %74 %116
+               OpBranch %114
+        %114 = OpLabel
+        %117 = OpAccessChain %41 %62 %28
+        %118 = OpLoad %18 %117
+        %120 = OpSLessThan %50 %118 %119
+               OpSelectionMerge %122 None
+               OpBranchConditional %120 %121 %122
+        %121 = OpLabel
+        %123 = OpAccessChain %41 %62 %28
+        %124 = OpLoad %18 %123
+        %125 = OpIAdd %18 %124 %82
+        %126 = OpAccessChain %41 %62 %35
+        %127 = OpLoad %18 %126
+        %128 = OpIMul %18 %127 %86
+        %129 = OpIAdd %18 %125 %128
+        %130 = OpAccessChain %57 %55 %129
+        %131 = OpLoad %18 %130
+        %132 = OpIEqual %50 %131 %19
+               OpBranch %122
+        %122 = OpLabel
+        %133 = OpPhi %50 %120 %114 %132 %121
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %134 %135
+        %134 = OpLabel
+        %136 = OpLoad %18 %74
+        %137 = OpIAdd %18 %136 %60
+               OpStore %74 %137
+               OpBranch %135
+        %135 = OpLabel
+        %138 = OpAccessChain %41 %62 %35
+        %139 = OpLoad %18 %138
+        %140 = OpSLessThan %50 %139 %119
+               OpSelectionMerge %142 None
+               OpBranchConditional %140 %141 %142
+        %141 = OpLabel
+        %143 = OpAccessChain %41 %62 %28
+        %144 = OpLoad %18 %143
+        %145 = OpAccessChain %41 %62 %35
+        %146 = OpLoad %18 %145
+        %147 = OpIAdd %18 %146 %82
+        %148 = OpIMul %18 %147 %86
+        %149 = OpIAdd %18 %144 %148
+        %150 = OpAccessChain %57 %55 %149
+        %151 = OpLoad %18 %150
+        %152 = OpIEqual %50 %151 %19
+               OpBranch %142
+        %142 = OpLabel
+        %153 = OpPhi %50 %140 %135 %152 %141
+               OpSelectionMerge %155 None
+               OpBranchConditional %153 %154 %155
+        %154 = OpLabel
+        %156 = OpLoad %18 %74
+        %157 = OpIAdd %18 %156 %60
+               OpStore %74 %157
+               OpBranch %155
+        %155 = OpLabel
+        %158 = OpLoad %18 %74
+        %159 = OpIEqual %50 %158 %19
+               OpSelectionMerge %161 None
+               OpBranchConditional %159 %160 %207
+        %160 = OpLabel
+               OpStore %65 %162
+               OpStore %42 %19
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %18 %42
+        %170 = OpSLessThan %50 %168 %169
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %171 %19
+               OpBranch %172
+        %172 = OpLabel
+               OpLoopMerge %174 %175 None
+               OpBranch %176
+        %176 = OpLabel
+        %177 = OpLoad %18 %171
+        %178 = OpSLessThan %50 %177 %169
+               OpBranchConditional %178 %173 %174
+        %173 = OpLabel
+        %179 = OpLoad %18 %171
+        %180 = OpIMul %18 %179 %82
+        %181 = OpLoad %18 %42
+        %182 = OpIMul %18 %181 %82
+        %183 = OpIMul %18 %182 %86
+        %184 = OpIAdd %18 %180 %183
+        %185 = OpAccessChain %57 %55 %184
+        %186 = OpLoad %18 %185
+        %187 = OpIEqual %50 %186 %19
+               OpSelectionMerge %189 None
+               OpBranchConditional %187 %188 %189
+        %188 = OpLabel
+        %190 = OpLoad %18 %171
+        %191 = OpIMul %18 %190 %82
+        %192 = OpAccessChain %41 %62 %28
+               OpStore %192 %191
+        %193 = OpLoad %18 %42
+        %194 = OpIMul %18 %193 %82
+        %195 = OpAccessChain %41 %62 %35
+               OpStore %195 %194
+               OpStore %65 %66
+               OpBranch %189
+        %189 = OpLabel
+               OpBranch %175
+        %175 = OpLabel
+        %196 = OpLoad %18 %171
+        %197 = OpIAdd %18 %196 %60
+               OpStore %171 %197
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %198 = OpLoad %18 %42
+        %199 = OpIAdd %18 %198 %60
+               OpStore %42 %199
+               OpBranch %163
+        %165 = OpLabel
+        %200 = OpAccessChain %41 %62 %28
+        %201 = OpLoad %18 %200
+        %202 = OpAccessChain %41 %62 %35
+        %203 = OpLoad %18 %202
+        %204 = OpIMul %18 %203 %86
+        %205 = OpIAdd %18 %201 %204
+        %206 = OpAccessChain %57 %55 %205
+               OpStore %206 %60
+               OpBranch %161
+        %207 = OpLabel
+        %209 = OpLoad %18 %67
+        %210 = OpLoad %18 %74
+        %211 = OpSMod %18 %209 %210
+               OpStore %208 %211
+        %212 = OpLoad %18 %74
+        %213 = OpLoad %18 %67
+        %214 = OpIAdd %18 %213 %212
+               OpStore %67 %214
+        %215 = OpLoad %18 %208
+        %216 = OpSGreaterThanEqual %50 %215 %19
+               OpSelectionMerge %218 None
+               OpBranchConditional %216 %217 %218
+        %217 = OpLabel
+        %219 = OpAccessChain %41 %62 %28
+        %220 = OpLoad %18 %219
+        %221 = OpSGreaterThan %50 %220 %19
+               OpBranch %218
+        %218 = OpLabel
+        %222 = OpPhi %50 %216 %207 %221 %217
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %223 %224
+        %223 = OpLabel
+        %225 = OpAccessChain %41 %62 %28
+        %226 = OpLoad %18 %225
+        %227 = OpISub %18 %226 %82
+        %228 = OpAccessChain %41 %62 %35
+        %229 = OpLoad %18 %228
+        %230 = OpIMul %18 %229 %86
+        %231 = OpIAdd %18 %227 %230
+        %232 = OpAccessChain %57 %55 %231
+        %233 = OpLoad %18 %232
+        %234 = OpIEqual %50 %233 %19
+               OpBranch %224
+        %224 = OpLabel
+        %235 = OpPhi %50 %222 %218 %234 %223
+               OpSelectionMerge %237 None
+               OpBranchConditional %235 %236 %237
+        %236 = OpLabel
+        %238 = OpLoad %18 %208
+        %239 = OpISub %18 %238 %60
+               OpStore %208 %239
+        %240 = OpAccessChain %41 %62 %28
+        %241 = OpLoad %18 %240
+        %242 = OpAccessChain %41 %62 %35
+        %243 = OpLoad %18 %242
+        %244 = OpIMul %18 %243 %86
+        %245 = OpIAdd %18 %241 %244
+        %246 = OpAccessChain %57 %55 %245
+               OpStore %246 %60
+        %247 = OpAccessChain %41 %62 %28
+        %248 = OpLoad %18 %247
+        %249 = OpISub %18 %248 %60
+        %250 = OpAccessChain %41 %62 %35
+        %251 = OpLoad %18 %250
+        %252 = OpIMul %18 %251 %86
+        %253 = OpIAdd %18 %249 %252
+        %254 = OpAccessChain %57 %55 %253
+               OpStore %254 %60
+        %255 = OpAccessChain %41 %62 %28
+        %256 = OpLoad %18 %255
+        %257 = OpISub %18 %256 %82
+        %258 = OpAccessChain %41 %62 %35
+        %259 = OpLoad %18 %258
+        %260 = OpIMul %18 %259 %86
+        %261 = OpIAdd %18 %257 %260
+        %262 = OpAccessChain %57 %55 %261
+               OpStore %262 %60
+        %263 = OpAccessChain %41 %62 %28
+        %264 = OpLoad %18 %263
+        %265 = OpISub %18 %264 %82
+        %266 = OpAccessChain %41 %62 %28
+               OpStore %266 %265
+               OpBranch %237
+        %237 = OpLabel
+        %267 = OpLoad %18 %208
+        %268 = OpSGreaterThanEqual %50 %267 %19
+               OpSelectionMerge %270 None
+               OpBranchConditional %268 %269 %270
+        %269 = OpLabel
+        %271 = OpAccessChain %41 %62 %35
+        %272 = OpLoad %18 %271
+        %273 = OpSGreaterThan %50 %272 %19
+               OpBranch %270
+        %270 = OpLabel
+        %274 = OpPhi %50 %268 %237 %273 %269
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+        %277 = OpAccessChain %41 %62 %28
+        %278 = OpLoad %18 %277
+        %279 = OpAccessChain %41 %62 %35
+        %280 = OpLoad %18 %279
+        %281 = OpISub %18 %280 %82
+        %282 = OpIMul %18 %281 %86
+        %283 = OpIAdd %18 %278 %282
+        %284 = OpAccessChain %57 %55 %283
+        %285 = OpLoad %18 %284
+        %286 = OpIEqual %50 %285 %19
+               OpBranch %276
+        %276 = OpLabel
+        %287 = OpPhi %50 %274 %270 %286 %275
+               OpSelectionMerge %289 None
+               OpBranchConditional %287 %288 %289
+        %288 = OpLabel
+        %290 = OpLoad %18 %208
+        %291 = OpISub %18 %290 %60
+               OpStore %208 %291
+        %292 = OpAccessChain %41 %62 %28
+        %293 = OpLoad %18 %292
+        %294 = OpAccessChain %41 %62 %35
+        %295 = OpLoad %18 %294
+        %296 = OpIMul %18 %295 %86
+        %297 = OpIAdd %18 %293 %296
+        %298 = OpAccessChain %57 %55 %297
+               OpStore %298 %60
+        %299 = OpAccessChain %41 %62 %28
+        %300 = OpLoad %18 %299
+        %301 = OpAccessChain %41 %62 %35
+        %302 = OpLoad %18 %301
+        %303 = OpISub %18 %302 %60
+        %304 = OpIMul %18 %303 %86
+        %305 = OpIAdd %18 %300 %304
+        %306 = OpAccessChain %57 %55 %305
+               OpStore %306 %60
+        %307 = OpAccessChain %41 %62 %28
+        %308 = OpLoad %18 %307
+        %309 = OpAccessChain %41 %62 %35
+        %310 = OpLoad %18 %309
+        %311 = OpISub %18 %310 %82
+        %312 = OpIMul %18 %311 %86
+        %313 = OpIAdd %18 %308 %312
+        %314 = OpAccessChain %57 %55 %313
+               OpStore %314 %60
+        %315 = OpAccessChain %41 %62 %35
+        %316 = OpLoad %18 %315
+        %317 = OpISub %18 %316 %82
+        %318 = OpAccessChain %41 %62 %35
+               OpStore %318 %317
+               OpBranch %289
+        %289 = OpLabel
+        %319 = OpLoad %18 %208
+        %320 = OpSGreaterThanEqual %50 %319 %19
+               OpSelectionMerge %322 None
+               OpBranchConditional %320 %321 %322
+        %321 = OpLabel
+        %323 = OpAccessChain %41 %62 %28
+        %324 = OpLoad %18 %323
+        %325 = OpSLessThan %50 %324 %119
+               OpBranch %322
+        %322 = OpLabel
+        %326 = OpPhi %50 %320 %289 %325 %321
+               OpSelectionMerge %328 None
+               OpBranchConditional %326 %327 %328
+        %327 = OpLabel
+        %329 = OpAccessChain %41 %62 %28
+        %330 = OpLoad %18 %329
+        %331 = OpIAdd %18 %330 %82
+        %332 = OpAccessChain %41 %62 %35
+        %333 = OpLoad %18 %332
+        %334 = OpIMul %18 %333 %86
+        %335 = OpIAdd %18 %331 %334
+        %336 = OpAccessChain %57 %55 %335
+        %337 = OpLoad %18 %336
+        %338 = OpIEqual %50 %337 %19
+               OpBranch %328
+        %328 = OpLabel
+        %339 = OpPhi %50 %326 %322 %338 %327
+               OpSelectionMerge %341 None
+               OpBranchConditional %339 %340 %341
+        %340 = OpLabel
+        %342 = OpLoad %18 %208
+        %343 = OpISub %18 %342 %60
+               OpStore %208 %343
+        %344 = OpAccessChain %41 %62 %28
+        %345 = OpLoad %18 %344
+        %346 = OpAccessChain %41 %62 %35
+        %347 = OpLoad %18 %346
+        %348 = OpIMul %18 %347 %86
+        %349 = OpIAdd %18 %345 %348
+        %350 = OpAccessChain %57 %55 %349
+               OpStore %350 %60
+        %351 = OpAccessChain %41 %62 %28
+        %352 = OpLoad %18 %351
+        %353 = OpIAdd %18 %352 %60
+        %354 = OpAccessChain %41 %62 %35
+        %355 = OpLoad %18 %354
+        %356 = OpIMul %18 %355 %86
+        %357 = OpIAdd %18 %353 %356
+        %358 = OpAccessChain %57 %55 %357
+               OpStore %358 %60
+        %359 = OpAccessChain %41 %62 %28
+        %360 = OpLoad %18 %359
+        %361 = OpIAdd %18 %360 %82
+        %362 = OpAccessChain %41 %62 %35
+        %363 = OpLoad %18 %362
+        %364 = OpIMul %18 %363 %86
+        %365 = OpIAdd %18 %361 %364
+        %366 = OpAccessChain %57 %55 %365
+               OpStore %366 %60
+        %367 = OpAccessChain %41 %62 %28
+        %368 = OpLoad %18 %367
+        %369 = OpIAdd %18 %368 %82
+        %370 = OpAccessChain %41 %62 %28
+               OpStore %370 %369
+               OpBranch %341
+        %341 = OpLabel
+        %371 = OpLoad %18 %208
+        %372 = OpSGreaterThanEqual %50 %371 %19
+               OpSelectionMerge %374 None
+               OpBranchConditional %372 %373 %374
+        %373 = OpLabel
+        %375 = OpAccessChain %41 %62 %35
+        %376 = OpLoad %18 %375
+        %377 = OpSLessThan %50 %376 %119
+               OpBranch %374
+        %374 = OpLabel
+        %378 = OpPhi %50 %372 %341 %377 %373
+               OpSelectionMerge %380 None
+               OpBranchConditional %378 %379 %380
+        %379 = OpLabel
+        %381 = OpAccessChain %41 %62 %28
+        %382 = OpLoad %18 %381
+        %383 = OpAccessChain %41 %62 %35
+        %384 = OpLoad %18 %383
+        %385 = OpIAdd %18 %384 %82
+        %386 = OpIMul %18 %385 %86
+        %387 = OpIAdd %18 %382 %386
+        %388 = OpAccessChain %57 %55 %387
+        %389 = OpLoad %18 %388
+        %390 = OpIEqual %50 %389 %19
+               OpBranch %380
+        %380 = OpLabel
+        %391 = OpPhi %50 %378 %374 %390 %379
+               OpSelectionMerge %393 None
+               OpBranchConditional %391 %392 %393
+        %392 = OpLabel
+        %394 = OpLoad %18 %208
+        %395 = OpISub %18 %394 %60
+               OpStore %208 %395
+        %396 = OpAccessChain %41 %62 %28
+        %397 = OpLoad %18 %396
+        %398 = OpAccessChain %41 %62 %35
+        %399 = OpLoad %18 %398
+        %400 = OpIMul %18 %399 %86
+        %401 = OpIAdd %18 %397 %400
+        %402 = OpAccessChain %57 %55 %401
+               OpStore %402 %60
+        %403 = OpAccessChain %41 %62 %28
+        %404 = OpLoad %18 %403
+        %405 = OpAccessChain %41 %62 %35
+        %406 = OpLoad %18 %405
+        %407 = OpIAdd %18 %406 %60
+        %408 = OpIMul %18 %407 %86
+        %409 = OpIAdd %18 %404 %408
+        %410 = OpAccessChain %57 %55 %409
+               OpStore %410 %60
+        %411 = OpAccessChain %41 %62 %28
+        %412 = OpLoad %18 %411
+        %413 = OpAccessChain %41 %62 %35
+        %414 = OpLoad %18 %413
+        %415 = OpIAdd %18 %414 %82
+        %416 = OpIMul %18 %415 %86
+        %417 = OpIAdd %18 %412 %416
+        %418 = OpAccessChain %57 %55 %417
+               OpStore %418 %60
+        %419 = OpAccessChain %41 %62 %35
+        %420 = OpLoad %18 %419
+        %421 = OpIAdd %18 %420 %82
+        %422 = OpAccessChain %41 %62 %35
+               OpStore %422 %421
+               OpBranch %393
+        %393 = OpLabel
+               OpBranch %161
+        %161 = OpLabel
+        %423 = OpAccessChain %41 %26 %35
+        %424 = OpLoad %18 %423
+        %425 = OpIMul %18 %424 %86
+        %426 = OpAccessChain %41 %26 %28
+        %427 = OpLoad %18 %426
+        %428 = OpIAdd %18 %425 %427
+        %429 = OpAccessChain %57 %55 %428
+        %430 = OpLoad %18 %429
+        %431 = OpIEqual %50 %430 %60
+               OpSelectionMerge %433 None
+               OpBranchConditional %431 %432 %433
+        %432 = OpLabel
+               OpStore %435 %437
+               OpReturn
+        %433 = OpLabel
+               OpBranch %71
+         %71 = OpLabel
+        %439 = OpLoad %50 %65
+        %976 = OpCopyObject %41 %67
+               OpBranchConditional %439 %68 %70
+         %70 = OpLabel
+        %728 = OpCopyObject %41 %171
+        %977 = OpCopyObject %41 %976
+               OpStore %435 %441
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-dead-break-and-unroll.amber
new file mode 100644 (file)
index 0000000..6bf3d19
--- /dev/null
@@ -0,0 +1,1316 @@
+#!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 a dead break and an Unroll annotation
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 442
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %435
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %9 "pos"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %26 "ipos"
+               OpName %42 "i"
+               OpName %55 "map"
+               OpName %62 "p"
+               OpName %65 "canwalk"
+               OpName %67 "v"
+               OpName %74 "directions"
+               OpName %171 "j"
+               OpName %208 "d"
+               OpName %435 "_GLF_color"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %435 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %24 = OpTypeVector %18 2
+         %25 = OpTypePointer Function %24
+         %27 = OpTypeInt 32 0
+         %28 = OpConstant %27 0
+         %29 = OpTypePointer Function %6
+         %32 = OpConstant %6 16
+         %35 = OpConstant %27 1
+         %41 = OpTypePointer Function %18
+         %49 = OpConstant %18 256
+         %50 = OpTypeBool
+         %52 = OpConstant %27 256
+         %53 = OpTypeArray %18 %52
+         %54 = OpTypePointer Private %53
+         %55 = OpVariable %54 Private
+         %57 = OpTypePointer Private %18
+         %60 = OpConstant %18 1
+         %63 = OpConstantComposite %24 %19 %19
+         %64 = OpTypePointer Function %50
+         %66 = OpConstantTrue %50
+         %82 = OpConstant %18 2
+         %86 = OpConstant %18 16
+        %119 = OpConstant %18 14
+        %162 = OpConstantFalse %50
+        %169 = OpConstant %18 8
+        %434 = OpTypePointer Output %10
+        %435 = OpVariable %434 Output
+        %436 = OpConstant %6 1
+        %437 = OpConstantComposite %10 %436 %436 %436 %436
+        %440 = OpConstant %6 0
+        %441 = OpConstantComposite %10 %440 %440 %440 %436
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+          %9 = OpVariable %8 Function
+         %26 = OpVariable %25 Function
+         %42 = OpVariable %41 Function
+         %62 = OpVariable %25 Function
+         %65 = OpVariable %64 Function
+         %67 = OpVariable %41 Function
+         %74 = OpVariable %41 Function
+        %171 = OpVariable %41 Function
+        %208 = OpVariable %41 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+         %23 = OpFDiv %7 %14 %22
+               OpStore %9 %23
+         %30 = OpAccessChain %29 %9 %28
+         %31 = OpLoad %6 %30
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %36 = OpAccessChain %29 %9 %35
+         %37 = OpLoad %6 %36
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %40 = OpCompositeConstruct %24 %34 %39
+               OpStore %26 %40
+               OpStore %42 %19
+               OpBranch %43
+         %43 = OpLabel
+               OpLoopMerge %45 %46 None
+               OpBranch %47
+         %47 = OpLabel
+         %48 = OpLoad %18 %42
+         %51 = OpSLessThan %50 %48 %49
+               OpBranchConditional %51 %44 %45
+         %44 = OpLabel
+         %56 = OpLoad %18 %42
+         %58 = OpAccessChain %57 %55 %56
+               OpStore %58 %19
+               OpBranch %46
+         %46 = OpLabel
+         %59 = OpLoad %18 %42
+         %61 = OpIAdd %18 %59 %60
+               OpStore %42 %61
+               OpBranch %43
+         %45 = OpLabel
+               OpStore %62 %63
+               OpStore %65 %66
+               OpStore %67 %19
+               OpBranch %68
+         %68 = OpLabel
+               OpLoopMerge %70 %71 None
+               OpBranch %69
+         %69 = OpLabel
+         %72 = OpLoad %18 %67
+         %73 = OpIAdd %18 %72 %60
+               OpStore %67 %73
+               OpStore %74 %19
+         %75 = OpAccessChain %41 %62 %28
+         %76 = OpLoad %18 %75
+         %77 = OpSGreaterThan %50 %76 %19
+               OpSelectionMerge %79 None
+               OpBranchConditional %77 %78 %79
+         %78 = OpLabel
+         %80 = OpAccessChain %41 %62 %28
+         %81 = OpLoad %18 %80
+         %83 = OpISub %18 %81 %82
+         %84 = OpAccessChain %41 %62 %35
+         %85 = OpLoad %18 %84
+         %87 = OpIMul %18 %85 %86
+         %88 = OpIAdd %18 %83 %87
+         %89 = OpAccessChain %57 %55 %88
+         %90 = OpLoad %18 %89
+         %91 = OpIEqual %50 %90 %19
+               OpBranch %79
+         %79 = OpLabel
+         %92 = OpPhi %50 %77 %69 %91 %78
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpLoad %18 %74
+         %96 = OpIAdd %18 %95 %60
+               OpStore %74 %96
+               OpBranch %94
+         %94 = OpLabel
+         %97 = OpAccessChain %41 %62 %35
+         %98 = OpLoad %18 %97
+         %99 = OpSGreaterThan %50 %98 %19
+               OpSelectionMerge %101 None
+               OpBranchConditional %99 %100 %101
+        %100 = OpLabel
+        %102 = OpAccessChain %41 %62 %28
+        %103 = OpLoad %18 %102
+        %104 = OpAccessChain %41 %62 %35
+        %105 = OpLoad %18 %104
+        %106 = OpISub %18 %105 %82
+        %107 = OpIMul %18 %106 %86
+        %108 = OpIAdd %18 %103 %107
+        %109 = OpAccessChain %57 %55 %108
+        %110 = OpLoad %18 %109
+        %111 = OpIEqual %50 %110 %19
+               OpBranch %101
+        %101 = OpLabel
+        %112 = OpPhi %50 %99 %94 %111 %100
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %115 = OpLoad %18 %74
+        %116 = OpIAdd %18 %115 %60
+               OpStore %74 %116
+               OpBranch %114
+        %114 = OpLabel
+        %117 = OpAccessChain %41 %62 %28
+        %118 = OpLoad %18 %117
+        %120 = OpSLessThan %50 %118 %119
+               OpSelectionMerge %122 None
+               OpBranchConditional %120 %121 %122
+        %121 = OpLabel
+        %123 = OpAccessChain %41 %62 %28
+        %124 = OpLoad %18 %123
+        %125 = OpIAdd %18 %124 %82
+        %126 = OpAccessChain %41 %62 %35
+        %127 = OpLoad %18 %126
+        %128 = OpIMul %18 %127 %86
+        %129 = OpIAdd %18 %125 %128
+        %130 = OpAccessChain %57 %55 %129
+        %131 = OpLoad %18 %130
+        %132 = OpIEqual %50 %131 %19
+               OpBranch %122
+        %122 = OpLabel
+        %133 = OpPhi %50 %120 %114 %132 %121
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %134 %135
+        %134 = OpLabel
+        %136 = OpLoad %18 %74
+        %137 = OpIAdd %18 %136 %60
+               OpStore %74 %137
+               OpBranch %135
+        %135 = OpLabel
+        %138 = OpAccessChain %41 %62 %35
+        %139 = OpLoad %18 %138
+        %140 = OpSLessThan %50 %139 %119
+               OpSelectionMerge %142 None
+               OpBranchConditional %140 %141 %142
+        %141 = OpLabel
+        %143 = OpAccessChain %41 %62 %28
+        %144 = OpLoad %18 %143
+        %145 = OpAccessChain %41 %62 %35
+        %146 = OpLoad %18 %145
+        %147 = OpIAdd %18 %146 %82
+        %148 = OpIMul %18 %147 %86
+        %149 = OpIAdd %18 %144 %148
+        %150 = OpAccessChain %57 %55 %149
+        %151 = OpLoad %18 %150
+        %152 = OpIEqual %50 %151 %19
+               OpBranch %142
+        %142 = OpLabel
+        %153 = OpPhi %50 %140 %135 %152 %141
+               OpSelectionMerge %155 None
+               OpBranchConditional %153 %154 %155
+        %154 = OpLabel
+        %156 = OpLoad %18 %74
+        %157 = OpIAdd %18 %156 %60
+               OpStore %74 %157
+               OpBranch %155
+        %155 = OpLabel
+        %158 = OpLoad %18 %74
+        %159 = OpIEqual %50 %158 %19
+               OpSelectionMerge %161 None
+               OpBranchConditional %159 %160 %207
+        %160 = OpLabel
+               OpStore %65 %162
+               OpStore %42 %19
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %18 %42
+        %170 = OpSLessThan %50 %168 %169
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %171 %19
+               OpBranch %172
+        %172 = OpLabel
+               OpLoopMerge %174 %175 None
+               OpBranch %176
+        %176 = OpLabel
+        %177 = OpLoad %18 %171
+        %178 = OpSLessThan %50 %177 %169
+               OpBranchConditional %178 %173 %174
+        %173 = OpLabel
+        %179 = OpLoad %18 %171
+        %180 = OpIMul %18 %179 %82
+        %181 = OpLoad %18 %42
+        %182 = OpIMul %18 %181 %82
+        %183 = OpIMul %18 %182 %86
+        %184 = OpIAdd %18 %180 %183
+        %185 = OpAccessChain %57 %55 %184
+        %186 = OpLoad %18 %185
+        %187 = OpIEqual %50 %186 %19
+               OpSelectionMerge %189 None
+               OpBranchConditional %187 %188 %189
+        %188 = OpLabel
+        %190 = OpLoad %18 %171
+        %191 = OpIMul %18 %190 %82
+        %192 = OpAccessChain %41 %62 %28
+               OpStore %192 %191
+        %193 = OpLoad %18 %42
+        %194 = OpIMul %18 %193 %82
+        %195 = OpAccessChain %41 %62 %35
+               OpStore %195 %194
+               OpStore %65 %66
+               OpBranch %189
+        %189 = OpLabel
+               OpBranch %175
+        %175 = OpLabel
+        %196 = OpLoad %18 %171
+        %197 = OpIAdd %18 %196 %60
+               OpStore %171 %197
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %198 = OpLoad %18 %42
+        %199 = OpIAdd %18 %198 %60
+               OpStore %42 %199
+               OpBranch %163
+        %165 = OpLabel
+        %200 = OpAccessChain %41 %62 %28
+        %201 = OpLoad %18 %200
+        %202 = OpAccessChain %41 %62 %35
+        %203 = OpLoad %18 %202
+        %204 = OpIMul %18 %203 %86
+        %205 = OpIAdd %18 %201 %204
+        %206 = OpAccessChain %57 %55 %205
+               OpStore %206 %60
+               OpBranch %161
+        %207 = OpLabel
+        %209 = OpLoad %18 %67
+        %210 = OpLoad %18 %74
+        %211 = OpSMod %18 %209 %210
+               OpStore %208 %211
+        %212 = OpLoad %18 %74
+        %213 = OpLoad %18 %67
+        %214 = OpIAdd %18 %213 %212
+               OpStore %67 %214
+        %215 = OpLoad %18 %208
+        %216 = OpSGreaterThanEqual %50 %215 %19
+               OpSelectionMerge %218 None
+               OpBranchConditional %216 %217 %218
+        %217 = OpLabel
+        %219 = OpAccessChain %41 %62 %28
+        %220 = OpLoad %18 %219
+        %221 = OpSGreaterThan %50 %220 %19
+               OpBranch %218
+        %218 = OpLabel
+        %222 = OpPhi %50 %216 %207 %221 %217
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %223 %224
+        %223 = OpLabel
+        %225 = OpAccessChain %41 %62 %28
+        %226 = OpLoad %18 %225
+        %227 = OpISub %18 %226 %82
+        %228 = OpAccessChain %41 %62 %35
+        %229 = OpLoad %18 %228
+        %230 = OpIMul %18 %229 %86
+        %231 = OpIAdd %18 %227 %230
+        %232 = OpAccessChain %57 %55 %231
+        %233 = OpLoad %18 %232
+        %234 = OpIEqual %50 %233 %19
+               OpBranch %224
+        %224 = OpLabel
+        %235 = OpPhi %50 %222 %218 %234 %223
+               OpSelectionMerge %237 None
+               OpBranchConditional %235 %236 %237
+        %236 = OpLabel
+        %238 = OpLoad %18 %208
+        %239 = OpISub %18 %238 %60
+               OpStore %208 %239
+        %240 = OpAccessChain %41 %62 %28
+        %241 = OpLoad %18 %240
+        %242 = OpAccessChain %41 %62 %35
+        %243 = OpLoad %18 %242
+        %244 = OpIMul %18 %243 %86
+        %245 = OpIAdd %18 %241 %244
+        %246 = OpAccessChain %57 %55 %245
+               OpStore %246 %60
+        %247 = OpAccessChain %41 %62 %28
+        %248 = OpLoad %18 %247
+        %249 = OpISub %18 %248 %60
+        %250 = OpAccessChain %41 %62 %35
+        %251 = OpLoad %18 %250
+        %252 = OpIMul %18 %251 %86
+        %253 = OpIAdd %18 %249 %252
+        %254 = OpAccessChain %57 %55 %253
+               OpStore %254 %60
+        %255 = OpAccessChain %41 %62 %28
+        %256 = OpLoad %18 %255
+        %257 = OpISub %18 %256 %82
+        %258 = OpAccessChain %41 %62 %35
+        %259 = OpLoad %18 %258
+        %260 = OpIMul %18 %259 %86
+        %261 = OpIAdd %18 %257 %260
+        %262 = OpAccessChain %57 %55 %261
+               OpStore %262 %60
+        %263 = OpAccessChain %41 %62 %28
+        %264 = OpLoad %18 %263
+        %265 = OpISub %18 %264 %82
+        %266 = OpAccessChain %41 %62 %28
+               OpStore %266 %265
+               OpBranch %237
+        %237 = OpLabel
+        %267 = OpLoad %18 %208
+        %268 = OpSGreaterThanEqual %50 %267 %19
+               OpSelectionMerge %270 None
+               OpBranchConditional %268 %269 %270
+        %269 = OpLabel
+        %271 = OpAccessChain %41 %62 %35
+        %272 = OpLoad %18 %271
+        %273 = OpSGreaterThan %50 %272 %19
+               OpBranch %270
+        %270 = OpLabel
+        %274 = OpPhi %50 %268 %237 %273 %269
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+        %277 = OpAccessChain %41 %62 %28
+        %278 = OpLoad %18 %277
+        %279 = OpAccessChain %41 %62 %35
+        %280 = OpLoad %18 %279
+        %281 = OpISub %18 %280 %82
+        %282 = OpIMul %18 %281 %86
+        %283 = OpIAdd %18 %278 %282
+        %284 = OpAccessChain %57 %55 %283
+        %285 = OpLoad %18 %284
+        %286 = OpIEqual %50 %285 %19
+               OpBranch %276
+        %276 = OpLabel
+        %287 = OpPhi %50 %274 %270 %286 %275
+               OpSelectionMerge %289 None
+               OpBranchConditional %287 %288 %289
+        %288 = OpLabel
+        %290 = OpLoad %18 %208
+        %291 = OpISub %18 %290 %60
+               OpStore %208 %291
+        %292 = OpAccessChain %41 %62 %28
+        %293 = OpLoad %18 %292
+        %294 = OpAccessChain %41 %62 %35
+        %295 = OpLoad %18 %294
+        %296 = OpIMul %18 %295 %86
+        %297 = OpIAdd %18 %293 %296
+        %298 = OpAccessChain %57 %55 %297
+               OpStore %298 %60
+        %299 = OpAccessChain %41 %62 %28
+        %300 = OpLoad %18 %299
+        %301 = OpAccessChain %41 %62 %35
+        %302 = OpLoad %18 %301
+        %303 = OpISub %18 %302 %60
+        %304 = OpIMul %18 %303 %86
+        %305 = OpIAdd %18 %300 %304
+        %306 = OpAccessChain %57 %55 %305
+               OpStore %306 %60
+        %307 = OpAccessChain %41 %62 %28
+        %308 = OpLoad %18 %307
+        %309 = OpAccessChain %41 %62 %35
+        %310 = OpLoad %18 %309
+        %311 = OpISub %18 %310 %82
+        %312 = OpIMul %18 %311 %86
+        %313 = OpIAdd %18 %308 %312
+        %314 = OpAccessChain %57 %55 %313
+               OpStore %314 %60
+        %315 = OpAccessChain %41 %62 %35
+        %316 = OpLoad %18 %315
+        %317 = OpISub %18 %316 %82
+        %318 = OpAccessChain %41 %62 %35
+               OpStore %318 %317
+               OpBranch %289
+        %289 = OpLabel
+        %319 = OpLoad %18 %208
+        %320 = OpSGreaterThanEqual %50 %319 %19
+               OpSelectionMerge %322 None
+               OpBranchConditional %320 %321 %322
+        %321 = OpLabel
+        %323 = OpAccessChain %41 %62 %28
+        %324 = OpLoad %18 %323
+        %325 = OpSLessThan %50 %324 %119
+               OpBranch %322
+        %322 = OpLabel
+        %326 = OpPhi %50 %320 %289 %325 %321
+               OpSelectionMerge %328 None
+               OpBranchConditional %326 %327 %328
+        %327 = OpLabel
+        %329 = OpAccessChain %41 %62 %28
+        %330 = OpLoad %18 %329
+        %331 = OpIAdd %18 %330 %82
+        %332 = OpAccessChain %41 %62 %35
+        %333 = OpLoad %18 %332
+        %334 = OpIMul %18 %333 %86
+        %335 = OpIAdd %18 %331 %334
+        %336 = OpAccessChain %57 %55 %335
+        %337 = OpLoad %18 %336
+        %338 = OpIEqual %50 %337 %19
+               OpBranch %328
+        %328 = OpLabel
+        %339 = OpPhi %50 %326 %322 %338 %327
+               OpSelectionMerge %341 None
+               OpBranchConditional %339 %340 %341
+        %340 = OpLabel
+        %342 = OpLoad %18 %208
+        %343 = OpISub %18 %342 %60
+               OpStore %208 %343
+        %344 = OpAccessChain %41 %62 %28
+        %345 = OpLoad %18 %344
+        %346 = OpAccessChain %41 %62 %35
+        %347 = OpLoad %18 %346
+        %348 = OpIMul %18 %347 %86
+        %349 = OpIAdd %18 %345 %348
+        %350 = OpAccessChain %57 %55 %349
+               OpStore %350 %60
+        %351 = OpAccessChain %41 %62 %28
+        %352 = OpLoad %18 %351
+        %353 = OpIAdd %18 %352 %60
+        %354 = OpAccessChain %41 %62 %35
+        %355 = OpLoad %18 %354
+        %356 = OpIMul %18 %355 %86
+        %357 = OpIAdd %18 %353 %356
+        %358 = OpAccessChain %57 %55 %357
+               OpStore %358 %60
+        %359 = OpAccessChain %41 %62 %28
+        %360 = OpLoad %18 %359
+        %361 = OpIAdd %18 %360 %82
+        %362 = OpAccessChain %41 %62 %35
+        %363 = OpLoad %18 %362
+        %364 = OpIMul %18 %363 %86
+        %365 = OpIAdd %18 %361 %364
+        %366 = OpAccessChain %57 %55 %365
+               OpStore %366 %60
+        %367 = OpAccessChain %41 %62 %28
+        %368 = OpLoad %18 %367
+        %369 = OpIAdd %18 %368 %82
+        %370 = OpAccessChain %41 %62 %28
+               OpStore %370 %369
+               OpBranch %341
+        %341 = OpLabel
+        %371 = OpLoad %18 %208
+        %372 = OpSGreaterThanEqual %50 %371 %19
+               OpSelectionMerge %374 None
+               OpBranchConditional %372 %373 %374
+        %373 = OpLabel
+        %375 = OpAccessChain %41 %62 %35
+        %376 = OpLoad %18 %375
+        %377 = OpSLessThan %50 %376 %119
+               OpBranch %374
+        %374 = OpLabel
+        %378 = OpPhi %50 %372 %341 %377 %373
+               OpSelectionMerge %380 None
+               OpBranchConditional %378 %379 %380
+        %379 = OpLabel
+        %381 = OpAccessChain %41 %62 %28
+        %382 = OpLoad %18 %381
+        %383 = OpAccessChain %41 %62 %35
+        %384 = OpLoad %18 %383
+        %385 = OpIAdd %18 %384 %82
+        %386 = OpIMul %18 %385 %86
+        %387 = OpIAdd %18 %382 %386
+        %388 = OpAccessChain %57 %55 %387
+        %389 = OpLoad %18 %388
+        %390 = OpIEqual %50 %389 %19
+               OpBranch %380
+        %380 = OpLabel
+        %391 = OpPhi %50 %378 %374 %390 %379
+               OpSelectionMerge %393 None
+               OpBranchConditional %391 %392 %393
+        %392 = OpLabel
+        %394 = OpLoad %18 %208
+        %395 = OpISub %18 %394 %60
+               OpStore %208 %395
+        %396 = OpAccessChain %41 %62 %28
+        %397 = OpLoad %18 %396
+        %398 = OpAccessChain %41 %62 %35
+        %399 = OpLoad %18 %398
+        %400 = OpIMul %18 %399 %86
+        %401 = OpIAdd %18 %397 %400
+        %402 = OpAccessChain %57 %55 %401
+               OpStore %402 %60
+        %403 = OpAccessChain %41 %62 %28
+        %404 = OpLoad %18 %403
+        %405 = OpAccessChain %41 %62 %35
+        %406 = OpLoad %18 %405
+        %407 = OpIAdd %18 %406 %60
+        %408 = OpIMul %18 %407 %86
+        %409 = OpIAdd %18 %404 %408
+        %410 = OpAccessChain %57 %55 %409
+               OpStore %410 %60
+        %411 = OpAccessChain %41 %62 %28
+        %412 = OpLoad %18 %411
+        %413 = OpAccessChain %41 %62 %35
+        %414 = OpLoad %18 %413
+        %415 = OpIAdd %18 %414 %82
+        %416 = OpIMul %18 %415 %86
+        %417 = OpIAdd %18 %412 %416
+        %418 = OpAccessChain %57 %55 %417
+               OpStore %418 %60
+        %419 = OpAccessChain %41 %62 %35
+        %420 = OpLoad %18 %419
+        %421 = OpIAdd %18 %420 %82
+        %422 = OpAccessChain %41 %62 %35
+               OpStore %422 %421
+               OpBranch %393
+        %393 = OpLabel
+               OpBranch %161
+        %161 = OpLabel
+        %423 = OpAccessChain %41 %26 %35
+        %424 = OpLoad %18 %423
+        %425 = OpIMul %18 %424 %86
+        %426 = OpAccessChain %41 %26 %28
+        %427 = OpLoad %18 %426
+        %428 = OpIAdd %18 %425 %427
+        %429 = OpAccessChain %57 %55 %428
+        %430 = OpLoad %18 %429
+        %431 = OpIEqual %50 %430 %60
+               OpSelectionMerge %433 None
+               OpBranchConditional %431 %432 %433
+        %432 = OpLabel
+               OpStore %435 %437
+               OpReturn
+        %433 = OpLabel
+               OpBranch %71
+         %71 = OpLabel
+        %439 = OpLoad %50 %65
+               OpBranchConditional %439 %68 %70
+         %70 = OpLabel
+               OpStore %435 %441
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 761
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %12 %435
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %9 "pos"
+               OpName %12 "gl_FragCoord"
+               OpName %15 "buf0"
+               OpMemberName %15 0 "resolution"
+               OpName %17 ""
+               OpName %26 "ipos"
+               OpName %42 "i"
+               OpName %55 "map"
+               OpName %62 "p"
+               OpName %65 "canwalk"
+               OpName %67 "v"
+               OpName %74 "directions"
+               OpName %171 "j"
+               OpName %208 "d"
+               OpName %435 "_GLF_color"
+               OpDecorate %12 BuiltIn FragCoord
+               OpMemberDecorate %15 0 Offset 0
+               OpDecorate %15 Block
+               OpDecorate %17 DescriptorSet 0
+               OpDecorate %17 Binding 0
+               OpDecorate %435 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+         %10 = OpTypeVector %6 4
+         %11 = OpTypePointer Input %10
+         %12 = OpVariable %11 Input
+         %15 = OpTypeStruct %7
+         %16 = OpTypePointer Uniform %15
+         %17 = OpVariable %16 Uniform
+         %18 = OpTypeInt 32 1
+         %19 = OpConstant %18 0
+         %20 = OpTypePointer Uniform %7
+         %24 = OpTypeVector %18 2
+         %25 = OpTypePointer Function %24
+         %27 = OpTypeInt 32 0
+         %28 = OpConstant %27 0
+         %29 = OpTypePointer Function %6
+         %32 = OpConstant %6 16
+         %35 = OpConstant %27 1
+         %41 = OpTypePointer Function %18
+         %49 = OpConstant %18 256
+         %50 = OpTypeBool
+         %52 = OpConstant %27 256
+         %53 = OpTypeArray %18 %52
+         %54 = OpTypePointer Private %53
+         %55 = OpVariable %54 Private
+         %57 = OpTypePointer Private %18
+         %60 = OpConstant %18 1
+         %63 = OpConstantComposite %24 %19 %19
+         %64 = OpTypePointer Function %50
+         %66 = OpConstantTrue %50
+         %82 = OpConstant %18 2
+         %86 = OpConstant %18 16
+        %119 = OpConstant %18 14
+        %162 = OpConstantFalse %50
+        %169 = OpConstant %18 8
+        %434 = OpTypePointer Output %10
+        %435 = OpVariable %434 Output
+        %436 = OpConstant %6 1
+        %437 = OpConstantComposite %10 %436 %436 %436 %436
+        %440 = OpConstant %6 0
+        %441 = OpConstantComposite %10 %440 %440 %440 %436
+        %551 = OpTypeMatrix %10 2
+        %555 = OpTypePointer Private %551
+        %556 = OpConstantComposite %10 %440 %440 %440 %440
+        %557 = OpConstantComposite %551 %556 %556
+        %558 = OpVariable %555 Private %557
+        %760 = OpConstantNull %50
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+          %9 = OpVariable %8 Function
+         %26 = OpVariable %25 Function
+         %42 = OpVariable %41 Function
+         %62 = OpVariable %25 Function
+         %65 = OpVariable %64 Function
+         %67 = OpVariable %41 Function
+         %74 = OpVariable %41 Function
+        %171 = OpVariable %41 Function
+        %208 = OpVariable %41 Function
+         %13 = OpLoad %10 %12
+         %14 = OpVectorShuffle %7 %13 %13 0 1
+        %564 = OpISub %18 %49 %119
+         %21 = OpAccessChain %20 %17 %19
+         %22 = OpLoad %7 %21
+        %566 = OpSNegate %18 %564
+         %23 = OpFDiv %7 %14 %22
+               OpStore %9 %23
+         %30 = OpAccessChain %29 %9 %28
+         %31 = OpLoad %6 %30
+         %33 = OpFMul %6 %31 %32
+         %34 = OpConvertFToS %18 %33
+         %36 = OpAccessChain %29 %9 %35
+         %37 = OpLoad %6 %36
+         %38 = OpFMul %6 %37 %32
+         %39 = OpConvertFToS %18 %38
+         %40 = OpCompositeConstruct %24 %34 %39
+               OpStore %26 %40
+               OpStore %42 %19
+               OpBranch %43
+         %43 = OpLabel
+               OpLoopMerge %45 %46 None
+               OpBranch %47
+         %47 = OpLabel
+         %48 = OpLoad %18 %42
+         %51 = OpSLessThan %50 %48 %49
+               OpBranchConditional %51 %44 %45
+         %44 = OpLabel
+         %56 = OpLoad %18 %42
+         %58 = OpAccessChain %57 %55 %56
+               OpStore %58 %19
+               OpBranch %46
+         %46 = OpLabel
+         %59 = OpLoad %18 %42
+         %61 = OpIAdd %18 %59 %60
+               OpStore %42 %61
+               OpBranch %43
+         %45 = OpLabel
+               OpStore %62 %63
+               OpStore %65 %66
+               OpStore %67 %19
+               OpBranch %68
+         %68 = OpLabel
+               OpLoopMerge %70 %71 None
+               OpBranch %69
+         %69 = OpLabel
+         %72 = OpLoad %18 %67
+         %73 = OpIAdd %18 %72 %60
+               OpStore %67 %73
+               OpStore %74 %19
+         %75 = OpAccessChain %41 %62 %28
+         %76 = OpLoad %18 %75
+         %77 = OpSGreaterThan %50 %76 %19
+               OpSelectionMerge %79 None
+               OpBranchConditional %77 %78 %79
+         %78 = OpLabel
+         %80 = OpAccessChain %41 %62 %28
+         %81 = OpLoad %18 %80
+         %83 = OpISub %18 %81 %82
+         %84 = OpAccessChain %41 %62 %35
+         %85 = OpLoad %18 %84
+         %87 = OpIMul %18 %85 %86
+         %88 = OpIAdd %18 %83 %87
+         %89 = OpAccessChain %57 %55 %88
+         %90 = OpLoad %18 %89
+         %91 = OpIEqual %50 %90 %19
+               OpBranch %79
+         %79 = OpLabel
+         %92 = OpPhi %50 %77 %69 %91 %78
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpLoad %18 %74
+         %96 = OpIAdd %18 %95 %60
+               OpStore %74 %96
+               OpBranch %94
+         %94 = OpLabel
+         %97 = OpAccessChain %41 %62 %35
+         %98 = OpLoad %18 %97
+         %99 = OpSGreaterThan %50 %98 %19
+               OpSelectionMerge %101 None
+               OpBranchConditional %99 %100 %101
+        %100 = OpLabel
+        %102 = OpAccessChain %41 %62 %28
+        %103 = OpLoad %18 %102
+        %104 = OpAccessChain %41 %62 %35
+        %105 = OpLoad %18 %104
+        %106 = OpISub %18 %105 %82
+        %107 = OpIMul %18 %106 %86
+        %108 = OpIAdd %18 %103 %107
+        %109 = OpAccessChain %57 %55 %108
+        %110 = OpLoad %18 %109
+        %111 = OpIEqual %50 %110 %19
+               OpBranch %101
+        %101 = OpLabel
+        %112 = OpPhi %50 %99 %94 %111 %100
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %115 = OpLoad %18 %74
+        %116 = OpIAdd %18 %115 %60
+               OpStore %74 %116
+               OpBranch %114
+        %114 = OpLabel
+        %117 = OpAccessChain %41 %62 %28
+        %118 = OpLoad %18 %117
+        %120 = OpSLessThan %50 %118 %119
+               OpSelectionMerge %122 None
+               OpBranchConditional %120 %121 %122
+        %121 = OpLabel
+        %123 = OpAccessChain %41 %62 %28
+        %124 = OpLoad %18 %123
+        %125 = OpIAdd %18 %124 %82
+        %126 = OpAccessChain %41 %62 %35
+        %127 = OpLoad %18 %126
+        %128 = OpIMul %18 %127 %86
+        %129 = OpIAdd %18 %125 %128
+        %130 = OpAccessChain %57 %55 %129
+        %131 = OpLoad %18 %130
+        %132 = OpIEqual %50 %131 %19
+               OpBranch %122
+        %122 = OpLabel
+        %133 = OpPhi %50 %120 %114 %132 %121
+               OpSelectionMerge %135 None
+               OpBranchConditional %133 %134 %135
+        %134 = OpLabel
+        %136 = OpLoad %18 %74
+        %137 = OpIAdd %18 %136 %60
+               OpStore %74 %137
+               OpBranch %135
+        %135 = OpLabel
+        %594 = OpISub %18 %49 %566
+        %138 = OpAccessChain %41 %62 %35
+        %139 = OpLoad %18 %138
+        %140 = OpSLessThan %50 %139 %119
+               OpSelectionMerge %142 None
+               OpBranchConditional %140 %141 %142
+        %141 = OpLabel
+        %143 = OpAccessChain %41 %62 %28
+        %144 = OpLoad %18 %143
+        %145 = OpAccessChain %41 %62 %35
+        %146 = OpLoad %18 %145
+        %147 = OpIAdd %18 %146 %82
+        %148 = OpIMul %18 %147 %86
+        %149 = OpIAdd %18 %144 %148
+        %150 = OpAccessChain %57 %55 %149
+        %151 = OpLoad %18 %150
+        %152 = OpIEqual %50 %151 %19
+               OpBranch %142
+        %142 = OpLabel
+        %153 = OpPhi %50 %140 %135 %152 %141
+               OpSelectionMerge %155 None
+               OpBranchConditional %153 %154 %155
+        %154 = OpLabel
+        %156 = OpLoad %18 %74
+        %157 = OpIAdd %18 %156 %60
+               OpStore %74 %157
+               OpBranch %155
+        %155 = OpLabel
+        %158 = OpLoad %18 %74
+        %159 = OpIEqual %50 %158 %19
+               OpSelectionMerge %161 None
+               OpBranchConditional %159 %160 %207
+        %160 = OpLabel
+               OpStore %65 %162
+               OpStore %42 %19
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %18 %42
+        %170 = OpSLessThan %50 %168 %169
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %171 %19
+        %609 = OpISub %18 %594 %168
+               OpStore %558 %557
+               OpBranchConditional %760 %166 %172
+        %172 = OpLabel
+               OpLoopMerge %174 %175 Unroll
+               OpBranch %176
+        %176 = OpLabel
+        %177 = OpLoad %18 %171
+        %178 = OpSLessThan %50 %177 %169
+               OpBranchConditional %178 %173 %174
+        %173 = OpLabel
+        %179 = OpLoad %18 %171
+        %180 = OpIMul %18 %179 %82
+        %181 = OpLoad %18 %42
+        %182 = OpIMul %18 %181 %82
+        %183 = OpIMul %18 %182 %86
+        %184 = OpIAdd %18 %180 %183
+        %185 = OpAccessChain %57 %55 %184
+        %186 = OpLoad %18 %185
+        %187 = OpIEqual %50 %186 %19
+               OpSelectionMerge %189 None
+               OpBranchConditional %187 %188 %189
+        %188 = OpLabel
+        %190 = OpLoad %18 %171
+        %191 = OpIMul %18 %190 %82
+        %192 = OpAccessChain %41 %62 %28
+               OpStore %192 %191
+        %193 = OpLoad %18 %42
+        %194 = OpIMul %18 %193 %82
+        %195 = OpAccessChain %41 %62 %35
+               OpStore %195 %194
+               OpStore %65 %66
+               OpBranch %189
+        %189 = OpLabel
+               OpBranch %175
+        %175 = OpLabel
+        %196 = OpLoad %18 %171
+        %197 = OpIAdd %18 %196 %60
+               OpStore %171 %197
+               OpBranch %172
+        %174 = OpLabel
+               OpBranch %166
+        %166 = OpLabel
+        %198 = OpLoad %18 %42
+        %199 = OpIAdd %18 %198 %60
+               OpStore %42 %199
+               OpBranch %163
+        %165 = OpLabel
+        %200 = OpAccessChain %41 %62 %28
+        %201 = OpLoad %18 %200
+        %202 = OpAccessChain %41 %62 %35
+        %203 = OpLoad %18 %202
+        %204 = OpIMul %18 %203 %86
+        %205 = OpIAdd %18 %201 %204
+        %206 = OpAccessChain %57 %55 %205
+               OpStore %206 %60
+               OpBranch %161
+        %207 = OpLabel
+        %209 = OpLoad %18 %67
+        %210 = OpLoad %18 %74
+        %211 = OpSMod %18 %209 %210
+               OpStore %208 %211
+        %212 = OpLoad %18 %74
+        %213 = OpLoad %18 %67
+        %214 = OpIAdd %18 %213 %212
+               OpStore %67 %214
+        %215 = OpLoad %18 %208
+        %216 = OpSGreaterThanEqual %50 %215 %19
+               OpSelectionMerge %218 None
+               OpBranchConditional %216 %217 %218
+        %217 = OpLabel
+        %219 = OpAccessChain %41 %62 %28
+        %220 = OpLoad %18 %219
+        %221 = OpSGreaterThan %50 %220 %19
+               OpBranch %218
+        %218 = OpLabel
+        %222 = OpPhi %50 %216 %207 %221 %217
+               OpSelectionMerge %224 None
+               OpBranchConditional %222 %223 %224
+        %223 = OpLabel
+        %225 = OpAccessChain %41 %62 %28
+        %226 = OpLoad %18 %225
+        %227 = OpISub %18 %226 %82
+        %228 = OpAccessChain %41 %62 %35
+        %229 = OpLoad %18 %228
+        %230 = OpIMul %18 %229 %86
+        %231 = OpIAdd %18 %227 %230
+        %232 = OpAccessChain %57 %55 %231
+        %233 = OpLoad %18 %232
+        %234 = OpIEqual %50 %233 %19
+               OpBranch %224
+        %224 = OpLabel
+        %235 = OpPhi %50 %222 %218 %234 %223
+               OpSelectionMerge %237 None
+               OpBranchConditional %235 %236 %237
+        %236 = OpLabel
+        %238 = OpLoad %18 %208
+        %239 = OpISub %18 %238 %60
+               OpStore %208 %239
+        %240 = OpAccessChain %41 %62 %28
+        %241 = OpLoad %18 %240
+        %242 = OpAccessChain %41 %62 %35
+        %243 = OpLoad %18 %242
+        %244 = OpIMul %18 %243 %86
+        %245 = OpIAdd %18 %241 %244
+        %246 = OpAccessChain %57 %55 %245
+               OpStore %246 %60
+        %247 = OpAccessChain %41 %62 %28
+        %248 = OpLoad %18 %247
+        %249 = OpISub %18 %248 %60
+        %250 = OpAccessChain %41 %62 %35
+        %251 = OpLoad %18 %250
+        %252 = OpIMul %18 %251 %86
+        %253 = OpIAdd %18 %249 %252
+        %254 = OpAccessChain %57 %55 %253
+               OpStore %254 %60
+        %255 = OpAccessChain %41 %62 %28
+        %256 = OpLoad %18 %255
+        %257 = OpISub %18 %256 %82
+        %258 = OpAccessChain %41 %62 %35
+        %259 = OpLoad %18 %258
+        %260 = OpIMul %18 %259 %86
+        %261 = OpIAdd %18 %257 %260
+        %262 = OpAccessChain %57 %55 %261
+               OpStore %262 %60
+        %263 = OpAccessChain %41 %62 %28
+        %264 = OpLoad %18 %263
+        %265 = OpISub %18 %264 %82
+        %266 = OpAccessChain %41 %62 %28
+               OpStore %266 %265
+               OpBranch %237
+        %237 = OpLabel
+        %267 = OpLoad %18 %208
+        %268 = OpSGreaterThanEqual %50 %267 %19
+               OpSelectionMerge %270 None
+               OpBranchConditional %268 %269 %270
+        %269 = OpLabel
+        %271 = OpAccessChain %41 %62 %35
+        %272 = OpLoad %18 %271
+        %273 = OpSGreaterThan %50 %272 %19
+               OpBranch %270
+        %270 = OpLabel
+        %274 = OpPhi %50 %268 %237 %273 %269
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+        %277 = OpAccessChain %41 %62 %28
+        %278 = OpLoad %18 %277
+        %279 = OpAccessChain %41 %62 %35
+        %280 = OpLoad %18 %279
+        %281 = OpISub %18 %280 %82
+        %282 = OpIMul %18 %281 %86
+        %283 = OpIAdd %18 %278 %282
+        %284 = OpAccessChain %57 %55 %283
+        %285 = OpLoad %18 %284
+        %286 = OpIEqual %50 %285 %19
+               OpBranch %276
+        %276 = OpLabel
+        %287 = OpPhi %50 %274 %270 %286 %275
+               OpSelectionMerge %289 None
+               OpBranchConditional %287 %288 %289
+        %288 = OpLabel
+        %290 = OpLoad %18 %208
+        %291 = OpISub %18 %290 %60
+               OpStore %208 %291
+        %292 = OpAccessChain %41 %62 %28
+        %293 = OpLoad %18 %292
+        %294 = OpAccessChain %41 %62 %35
+        %295 = OpLoad %18 %294
+        %296 = OpIMul %18 %295 %86
+        %297 = OpIAdd %18 %293 %296
+        %298 = OpAccessChain %57 %55 %297
+               OpStore %298 %60
+        %299 = OpAccessChain %41 %62 %28
+        %300 = OpLoad %18 %299
+        %301 = OpAccessChain %41 %62 %35
+        %302 = OpLoad %18 %301
+        %303 = OpISub %18 %302 %60
+        %304 = OpIMul %18 %303 %86
+        %305 = OpIAdd %18 %300 %304
+        %306 = OpAccessChain %57 %55 %305
+               OpStore %306 %60
+        %307 = OpAccessChain %41 %62 %28
+        %308 = OpLoad %18 %307
+        %309 = OpAccessChain %41 %62 %35
+        %310 = OpLoad %18 %309
+        %311 = OpISub %18 %310 %82
+        %312 = OpIMul %18 %311 %86
+        %313 = OpIAdd %18 %308 %312
+        %314 = OpAccessChain %57 %55 %313
+               OpStore %314 %60
+        %315 = OpAccessChain %41 %62 %35
+        %316 = OpLoad %18 %315
+        %317 = OpISub %18 %316 %82
+        %318 = OpAccessChain %41 %62 %35
+               OpStore %318 %317
+               OpBranch %289
+        %289 = OpLabel
+        %319 = OpLoad %18 %208
+        %320 = OpSGreaterThanEqual %50 %319 %19
+               OpSelectionMerge %322 None
+               OpBranchConditional %320 %321 %322
+        %321 = OpLabel
+        %323 = OpAccessChain %41 %62 %28
+        %324 = OpLoad %18 %323
+        %325 = OpSLessThan %50 %324 %119
+               OpBranch %322
+        %322 = OpLabel
+        %326 = OpPhi %50 %320 %289 %325 %321
+               OpSelectionMerge %328 None
+               OpBranchConditional %326 %327 %328
+        %327 = OpLabel
+        %329 = OpAccessChain %41 %62 %28
+        %330 = OpLoad %18 %329
+        %331 = OpIAdd %18 %330 %82
+        %332 = OpAccessChain %41 %62 %35
+        %333 = OpLoad %18 %332
+        %334 = OpIMul %18 %333 %86
+        %335 = OpIAdd %18 %331 %334
+        %336 = OpAccessChain %57 %55 %335
+        %337 = OpLoad %18 %336
+        %338 = OpIEqual %50 %337 %19
+               OpBranch %328
+        %328 = OpLabel
+        %339 = OpPhi %50 %326 %322 %338 %327
+               OpSelectionMerge %341 None
+               OpBranchConditional %339 %340 %341
+        %340 = OpLabel
+        %342 = OpLoad %18 %208
+        %343 = OpISub %18 %342 %60
+               OpStore %208 %343
+        %344 = OpAccessChain %41 %62 %28
+        %345 = OpLoad %18 %344
+        %346 = OpAccessChain %41 %62 %35
+        %347 = OpLoad %18 %346
+        %348 = OpIMul %18 %347 %86
+        %349 = OpIAdd %18 %345 %348
+        %350 = OpAccessChain %57 %55 %349
+               OpStore %350 %60
+        %351 = OpAccessChain %41 %62 %28
+        %352 = OpLoad %18 %351
+        %353 = OpIAdd %18 %352 %60
+        %354 = OpAccessChain %41 %62 %35
+        %355 = OpLoad %18 %354
+        %356 = OpIMul %18 %355 %86
+        %357 = OpIAdd %18 %353 %356
+        %358 = OpAccessChain %57 %55 %357
+               OpStore %358 %60
+        %359 = OpAccessChain %41 %62 %28
+        %360 = OpLoad %18 %359
+        %361 = OpIAdd %18 %360 %82
+        %362 = OpAccessChain %41 %62 %35
+        %363 = OpLoad %18 %362
+        %364 = OpIMul %18 %363 %86
+        %365 = OpIAdd %18 %361 %364
+        %366 = OpAccessChain %57 %55 %365
+               OpStore %366 %60
+        %367 = OpAccessChain %41 %62 %28
+        %368 = OpLoad %18 %367
+        %369 = OpIAdd %18 %368 %82
+        %370 = OpAccessChain %41 %62 %28
+               OpStore %370 %369
+               OpBranch %341
+        %341 = OpLabel
+        %371 = OpLoad %18 %208
+        %372 = OpSGreaterThanEqual %50 %371 %19
+               OpSelectionMerge %374 None
+               OpBranchConditional %372 %373 %374
+        %373 = OpLabel
+        %375 = OpAccessChain %41 %62 %35
+        %376 = OpLoad %18 %375
+        %377 = OpSLessThan %50 %376 %119
+               OpBranch %374
+        %374 = OpLabel
+        %378 = OpPhi %50 %372 %341 %377 %373
+               OpSelectionMerge %380 None
+               OpBranchConditional %378 %379 %380
+        %379 = OpLabel
+        %381 = OpAccessChain %41 %62 %28
+        %382 = OpLoad %18 %381
+        %383 = OpAccessChain %41 %62 %35
+        %384 = OpLoad %18 %383
+        %385 = OpIAdd %18 %384 %82
+        %386 = OpIMul %18 %385 %86
+        %387 = OpIAdd %18 %382 %386
+        %388 = OpAccessChain %57 %55 %387
+        %389 = OpLoad %18 %388
+        %390 = OpIEqual %50 %389 %19
+               OpBranch %380
+        %380 = OpLabel
+        %391 = OpPhi %50 %378 %374 %390 %379
+               OpSelectionMerge %393 None
+               OpBranchConditional %391 %392 %393
+        %392 = OpLabel
+        %394 = OpLoad %18 %208
+        %395 = OpISub %18 %394 %60
+               OpStore %208 %395
+        %396 = OpAccessChain %41 %62 %28
+        %397 = OpLoad %18 %396
+        %398 = OpAccessChain %41 %62 %35
+        %399 = OpLoad %18 %398
+        %400 = OpIMul %18 %399 %86
+        %401 = OpIAdd %18 %397 %400
+        %402 = OpAccessChain %57 %55 %401
+               OpStore %402 %60
+        %403 = OpAccessChain %41 %62 %28
+        %404 = OpLoad %18 %403
+        %405 = OpAccessChain %41 %62 %35
+        %406 = OpLoad %18 %405
+        %407 = OpIAdd %18 %406 %60
+        %408 = OpIMul %18 %407 %86
+        %409 = OpIAdd %18 %404 %408
+        %410 = OpAccessChain %57 %55 %409
+               OpStore %410 %60
+        %411 = OpAccessChain %41 %62 %28
+        %412 = OpLoad %18 %411
+        %413 = OpAccessChain %41 %62 %35
+        %414 = OpLoad %18 %413
+        %415 = OpIAdd %18 %414 %82
+        %416 = OpIMul %18 %415 %86
+        %417 = OpIAdd %18 %412 %416
+        %418 = OpAccessChain %57 %55 %417
+               OpStore %418 %60
+        %419 = OpAccessChain %41 %62 %35
+        %420 = OpLoad %18 %419
+        %421 = OpIAdd %18 %420 %82
+        %422 = OpAccessChain %41 %62 %35
+               OpStore %422 %421
+               OpBranch %393
+        %393 = OpLabel
+               OpBranch %161
+        %161 = OpLabel
+        %423 = OpAccessChain %41 %26 %35
+        %424 = OpLoad %18 %423
+        %425 = OpIMul %18 %424 %86
+        %426 = OpAccessChain %41 %26 %28
+        %427 = OpLoad %18 %426
+        %428 = OpIAdd %18 %425 %427
+        %429 = OpAccessChain %57 %55 %428
+        %430 = OpLoad %18 %429
+        %431 = OpIEqual %50 %430 %60
+               OpSelectionMerge %433 None
+               OpBranchConditional %431 %432 %433
+        %432 = OpLabel
+               OpStore %435 %437
+               OpReturn
+        %433 = OpLabel
+               OpBranch %71
+         %71 = OpLabel
+        %439 = OpLoad %50 %65
+               OpBranchConditional %439 %68 %70
+         %70 = OpLabel
+               OpStore %435 %441
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-declare-bvec4.amber
new file mode 100644 (file)
index 0000000..f23fdd9
--- /dev/null
@@ -0,0 +1,601 @@
+#!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 except one declares a bvec4
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 189
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %165 %180
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %15 "collision(vf2;vf4;"
+               OpName %13 "pos"
+               OpName %14 "quad"
+               OpName %19 "match(vf2;"
+               OpName %18 "pos"
+               OpName %69 "res"
+               OpName %75 "i"
+               OpName %105 "param"
+               OpName %107 "param"
+               OpName %109 "indexable"
+               OpName %135 "indexable"
+               OpName %140 "indexable"
+               OpName %154 "indexable"
+               OpName %163 "lin"
+               OpName %165 "gl_FragCoord"
+               OpName %168 "buf0"
+               OpMemberName %168 0 "resolution"
+               OpName %170 ""
+               OpName %180 "_GLF_color"
+               OpName %181 "param"
+               OpName %185 "index"
+               OpName %188 "state"
+               OpDecorate %165 BuiltIn FragCoord
+               OpMemberDecorate %168 0 Offset 0
+               OpDecorate %168 Block
+               OpDecorate %170 DescriptorSet 0
+               OpDecorate %170 Binding 0
+               OpDecorate %180 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+          %9 = OpTypeVector %6 4
+         %10 = OpTypePointer Function %9
+         %11 = OpTypeBool
+         %12 = OpTypeFunction %11 %8 %10
+         %17 = OpTypeFunction %9 %8
+         %21 = OpTypeInt 32 0
+         %22 = OpConstant %21 0
+         %23 = OpTypePointer Function %6
+         %31 = OpConstantFalse %11
+         %33 = OpConstant %21 1
+         %46 = OpConstant %21 2
+         %58 = OpConstant %21 3
+         %66 = OpConstantTrue %11
+         %70 = OpConstant %6 0.5
+         %71 = OpConstant %6 1
+         %72 = OpConstantComposite %9 %70 %70 %71 %71
+         %73 = OpTypeInt 32 1
+         %74 = OpTypePointer Function %73
+         %76 = OpConstant %73 0
+         %83 = OpConstant %73 8
+         %85 = OpConstant %21 8
+         %86 = OpTypeArray %9 %85
+         %87 = OpConstant %6 4
+         %88 = OpConstant %6 20
+         %89 = OpConstantComposite %9 %87 %87 %88 %87
+         %90 = OpConstantComposite %9 %87 %87 %87 %88
+         %91 = OpConstantComposite %9 %87 %88 %88 %87
+         %92 = OpConstant %6 8
+         %93 = OpConstantComposite %9 %88 %87 %87 %92
+         %94 = OpConstant %6 6
+         %95 = OpConstant %6 2
+         %96 = OpConstantComposite %9 %92 %94 %87 %95
+         %97 = OpConstant %6 12
+         %98 = OpConstantComposite %9 %95 %97 %95 %87
+         %99 = OpConstant %6 16
+        %100 = OpConstantComposite %9 %99 %95 %87 %87
+        %101 = OpConstant %6 22
+        %102 = OpConstantComposite %9 %97 %101 %87 %87
+        %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+        %108 = OpTypePointer Function %86
+        %115 = OpConstant %21 16
+        %116 = OpTypeArray %9 %115
+        %117 = OpConstant %6 0
+        %118 = OpConstantComposite %9 %117 %117 %117 %71
+        %119 = OpConstantComposite %9 %70 %117 %117 %71
+        %120 = OpConstantComposite %9 %117 %70 %117 %71
+        %121 = OpConstantComposite %9 %70 %70 %117 %71
+        %122 = OpConstantComposite %9 %117 %117 %70 %71
+        %123 = OpConstantComposite %9 %70 %117 %70 %71
+        %124 = OpConstantComposite %9 %117 %70 %70 %71
+        %125 = OpConstantComposite %9 %70 %70 %70 %71
+        %126 = OpConstantComposite %9 %71 %117 %117 %71
+        %127 = OpConstantComposite %9 %117 %71 %117 %71
+        %128 = OpConstantComposite %9 %71 %71 %117 %71
+        %129 = OpConstantComposite %9 %117 %117 %71 %71
+        %130 = OpConstantComposite %9 %71 %117 %71 %71
+        %131 = OpConstantComposite %9 %117 %71 %71 %71
+        %132 = OpConstantComposite %9 %71 %71 %71 %71
+        %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+        %146 = OpConstant %73 9
+        %149 = OpConstant %73 11
+        %151 = OpConstant %73 16
+        %153 = OpTypePointer Function %116
+        %158 = OpConstant %73 1
+        %164 = OpTypePointer Input %9
+        %165 = OpVariable %164 Input
+        %168 = OpTypeStruct %7
+        %169 = OpTypePointer Uniform %168
+        %170 = OpVariable %169 Uniform
+        %171 = OpTypePointer Uniform %7
+        %176 = OpConstant %6 32
+        %179 = OpTypePointer Output %9
+        %180 = OpVariable %179 Output
+        %184 = OpTypePointer Private %73
+        %185 = OpVariable %184 Private
+        %186 = OpTypeArray %73 %115
+        %187 = OpTypePointer Private %186
+        %188 = OpVariable %187 Private
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %163 = OpVariable %8 Function
+        %181 = OpVariable %8 Function
+        %166 = OpLoad %9 %165
+        %167 = OpVectorShuffle %7 %166 %166 0 1
+        %172 = OpAccessChain %171 %170 %76
+        %173 = OpLoad %7 %172
+        %174 = OpFDiv %7 %167 %173
+               OpStore %163 %174
+        %175 = OpLoad %7 %163
+        %177 = OpVectorTimesScalar %7 %175 %176
+        %178 = OpExtInst %7 %1 Floor %177
+               OpStore %163 %178
+        %182 = OpLoad %7 %163
+               OpStore %181 %182
+        %183 = OpFunctionCall %9 %19 %181
+               OpStore %180 %183
+               OpReturn
+               OpFunctionEnd
+         %15 = OpFunction %11 None %12
+         %13 = OpFunctionParameter %8
+         %14 = OpFunctionParameter %10
+         %16 = OpLabel
+         %24 = OpAccessChain %23 %13 %22
+         %25 = OpLoad %6 %24
+         %26 = OpAccessChain %23 %14 %22
+         %27 = OpLoad %6 %26
+         %28 = OpFOrdLessThan %11 %25 %27
+               OpSelectionMerge %30 None
+               OpBranchConditional %28 %29 %30
+         %29 = OpLabel
+               OpReturnValue %31
+         %30 = OpLabel
+         %34 = OpAccessChain %23 %13 %33
+         %35 = OpLoad %6 %34
+         %36 = OpAccessChain %23 %14 %33
+         %37 = OpLoad %6 %36
+         %38 = OpFOrdLessThan %11 %35 %37
+               OpSelectionMerge %40 None
+               OpBranchConditional %38 %39 %40
+         %39 = OpLabel
+               OpReturnValue %31
+         %40 = OpLabel
+         %42 = OpAccessChain %23 %13 %22
+         %43 = OpLoad %6 %42
+         %44 = OpAccessChain %23 %14 %22
+         %45 = OpLoad %6 %44
+         %47 = OpAccessChain %23 %14 %46
+         %48 = OpLoad %6 %47
+         %49 = OpFAdd %6 %45 %48
+         %50 = OpFOrdGreaterThan %11 %43 %49
+               OpSelectionMerge %52 None
+               OpBranchConditional %50 %51 %52
+         %51 = OpLabel
+               OpReturnValue %31
+         %52 = OpLabel
+         %54 = OpAccessChain %23 %13 %33
+         %55 = OpLoad %6 %54
+         %56 = OpAccessChain %23 %14 %33
+         %57 = OpLoad %6 %56
+         %59 = OpAccessChain %23 %14 %58
+         %60 = OpLoad %6 %59
+         %61 = OpFAdd %6 %57 %60
+         %62 = OpFOrdGreaterThan %11 %55 %61
+               OpSelectionMerge %64 None
+               OpBranchConditional %62 %63 %64
+         %63 = OpLabel
+               OpReturnValue %31
+         %64 = OpLabel
+               OpReturnValue %66
+               OpFunctionEnd
+         %19 = OpFunction %9 None %17
+         %18 = OpFunctionParameter %8
+         %20 = OpLabel
+         %69 = OpVariable %10 Function
+         %75 = OpVariable %74 Function
+        %105 = OpVariable %8 Function
+        %107 = OpVariable %10 Function
+        %109 = OpVariable %108 Function
+        %135 = OpVariable %108 Function
+        %140 = OpVariable %108 Function
+        %154 = OpVariable %153 Function
+               OpStore %69 %72
+               OpStore %75 %76
+               OpBranch %77
+         %77 = OpLabel
+               OpLoopMerge %79 %80 None
+               OpBranch %81
+         %81 = OpLabel
+         %82 = OpLoad %73 %75
+         %84 = OpSLessThan %11 %82 %83
+               OpBranchConditional %84 %78 %79
+         %78 = OpLabel
+        %104 = OpLoad %73 %75
+        %106 = OpLoad %7 %18
+               OpStore %105 %106
+               OpStore %109 %103
+        %110 = OpAccessChain %10 %109 %104
+        %111 = OpLoad %9 %110
+               OpStore %107 %111
+        %112 = OpFunctionCall %11 %15 %105 %107
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %134 = OpLoad %73 %75
+               OpStore %135 %103
+        %136 = OpAccessChain %23 %135 %134 %22
+        %137 = OpLoad %6 %136
+        %138 = OpConvertFToS %73 %137
+        %139 = OpLoad %73 %75
+               OpStore %140 %103
+        %141 = OpAccessChain %23 %140 %139 %33
+        %142 = OpLoad %6 %141
+        %143 = OpConvertFToS %73 %142
+        %144 = OpIMul %73 %138 %143
+        %145 = OpLoad %73 %75
+        %147 = OpIMul %73 %145 %146
+        %148 = OpIAdd %73 %144 %147
+        %150 = OpIAdd %73 %148 %149
+        %152 = OpSMod %73 %150 %151
+               OpStore %154 %133
+        %155 = OpAccessChain %10 %154 %152
+        %156 = OpLoad %9 %155
+               OpStore %69 %156
+               OpBranch %114
+        %114 = OpLabel
+               OpBranch %80
+         %80 = OpLabel
+        %157 = OpLoad %73 %75
+        %159 = OpIAdd %73 %157 %158
+               OpStore %75 %159
+               OpBranch %77
+         %79 = OpLabel
+        %160 = OpLoad %9 %69
+               OpReturnValue %160
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 366
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %165 %180
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %15 "collision(vf2;vf4;"
+               OpName %13 "pos"
+               OpName %14 "quad"
+               OpName %19 "match(vf2;"
+               OpName %18 "pos"
+               OpName %69 "res"
+               OpName %75 "i"
+               OpName %105 "param"
+               OpName %107 "param"
+               OpName %109 "indexable"
+               OpName %135 "indexable"
+               OpName %140 "indexable"
+               OpName %154 "indexable"
+               OpName %163 "lin"
+               OpName %165 "gl_FragCoord"
+               OpName %168 "buf0"
+               OpMemberName %168 0 "resolution"
+               OpName %170 ""
+               OpName %180 "_GLF_color"
+               OpName %181 "param"
+               OpName %185 "index"
+               OpName %188 "state"
+               OpDecorate %165 BuiltIn FragCoord
+               OpMemberDecorate %168 0 Offset 0
+               OpDecorate %168 Block
+               OpDecorate %170 DescriptorSet 0
+               OpDecorate %170 Binding 0
+               OpDecorate %180 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %8 = OpTypePointer Function %7
+          %9 = OpTypeVector %6 4
+         %10 = OpTypePointer Function %9
+         %11 = OpTypeBool
+         %12 = OpTypeFunction %11 %8 %10
+         %17 = OpTypeFunction %9 %8
+         %21 = OpTypeInt 32 0
+         %22 = OpConstant %21 0
+         %23 = OpTypePointer Function %6
+         %31 = OpConstantFalse %11
+         %33 = OpConstant %21 1
+         %46 = OpConstant %21 2
+         %58 = OpConstant %21 3
+         %66 = OpConstantTrue %11
+         %70 = OpConstant %6 0.5
+         %71 = OpConstant %6 1
+         %72 = OpConstantComposite %9 %70 %70 %71 %71
+         %73 = OpTypeInt 32 1
+         %74 = OpTypePointer Function %73
+         %76 = OpConstant %73 0
+         %83 = OpConstant %73 8
+         %85 = OpConstant %21 8
+         %86 = OpTypeArray %9 %85
+         %87 = OpConstant %6 4
+         %88 = OpConstant %6 20
+         %89 = OpConstantComposite %9 %87 %87 %88 %87
+         %90 = OpConstantComposite %9 %87 %87 %87 %88
+         %91 = OpConstantComposite %9 %87 %88 %88 %87
+         %92 = OpConstant %6 8
+         %93 = OpConstantComposite %9 %88 %87 %87 %92
+         %94 = OpConstant %6 6
+         %95 = OpConstant %6 2
+         %96 = OpConstantComposite %9 %92 %94 %87 %95
+         %97 = OpConstant %6 12
+         %98 = OpConstantComposite %9 %95 %97 %95 %87
+         %99 = OpConstant %6 16
+        %100 = OpConstantComposite %9 %99 %95 %87 %87
+        %101 = OpConstant %6 22
+        %102 = OpConstantComposite %9 %97 %101 %87 %87
+        %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+        %108 = OpTypePointer Function %86
+        %115 = OpConstant %21 16
+        %116 = OpTypeArray %9 %115
+        %117 = OpConstant %6 0
+        %118 = OpConstantComposite %9 %117 %117 %117 %71
+        %119 = OpConstantComposite %9 %70 %117 %117 %71
+        %120 = OpConstantComposite %9 %117 %70 %117 %71
+        %121 = OpConstantComposite %9 %70 %70 %117 %71
+        %122 = OpConstantComposite %9 %117 %117 %70 %71
+        %123 = OpConstantComposite %9 %70 %117 %70 %71
+        %124 = OpConstantComposite %9 %117 %70 %70 %71
+        %125 = OpConstantComposite %9 %70 %70 %70 %71
+        %126 = OpConstantComposite %9 %71 %117 %117 %71
+        %127 = OpConstantComposite %9 %117 %71 %117 %71
+        %128 = OpConstantComposite %9 %71 %71 %117 %71
+        %129 = OpConstantComposite %9 %117 %117 %71 %71
+        %130 = OpConstantComposite %9 %71 %117 %71 %71
+        %131 = OpConstantComposite %9 %117 %71 %71 %71
+        %132 = OpConstantComposite %9 %71 %71 %71 %71
+        %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+        %146 = OpConstant %73 9
+        %149 = OpConstant %73 11
+        %151 = OpConstant %73 16
+        %153 = OpTypePointer Function %116
+        %158 = OpConstant %73 1
+        %164 = OpTypePointer Input %9
+        %165 = OpVariable %164 Input
+        %168 = OpTypeStruct %7
+        %169 = OpTypePointer Uniform %168
+        %170 = OpVariable %169 Uniform
+        %171 = OpTypePointer Uniform %7
+        %176 = OpConstant %6 32
+        %179 = OpTypePointer Output %9
+        %180 = OpVariable %179 Output
+        %184 = OpTypePointer Private %73
+        %185 = OpVariable %184 Private
+        %186 = OpTypeArray %73 %115
+        %187 = OpTypePointer Private %186
+        %188 = OpVariable %187 Private
+        %313 = OpTypeVector %11 4
+        %363 = OpTypePointer Function %313
+        %364 = OpConstantComposite %313 %31 %31 %31 %31
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %163 = OpVariable %8 Function
+        %181 = OpVariable %8 Function
+        %166 = OpLoad %9 %165
+        %167 = OpVectorShuffle %7 %166 %166 0 1
+        %172 = OpAccessChain %171 %170 %76
+        %173 = OpLoad %7 %172
+        %174 = OpFDiv %7 %167 %173
+               OpStore %163 %174
+        %175 = OpLoad %7 %163
+        %177 = OpVectorTimesScalar %7 %175 %176
+        %178 = OpExtInst %7 %1 Floor %177
+               OpStore %163 %178
+        %182 = OpLoad %7 %163
+               OpStore %181 %182
+        %183 = OpFunctionCall %9 %19 %181
+               OpStore %180 %183
+               OpReturn
+               OpFunctionEnd
+         %15 = OpFunction %11 None %12
+         %13 = OpFunctionParameter %8
+         %14 = OpFunctionParameter %10
+         %16 = OpLabel
+        %365 = OpVariable %363 Function %364
+         %24 = OpAccessChain %23 %13 %22
+         %25 = OpLoad %6 %24
+         %26 = OpAccessChain %23 %14 %22
+         %27 = OpLoad %6 %26
+         %28 = OpFOrdLessThan %11 %25 %27
+               OpSelectionMerge %30 None
+               OpBranchConditional %28 %29 %30
+         %29 = OpLabel
+               OpReturnValue %31
+         %30 = OpLabel
+         %34 = OpAccessChain %23 %13 %33
+         %35 = OpLoad %6 %34
+         %36 = OpAccessChain %23 %14 %33
+         %37 = OpLoad %6 %36
+         %38 = OpFOrdLessThan %11 %35 %37
+               OpSelectionMerge %40 None
+               OpBranchConditional %38 %39 %40
+         %39 = OpLabel
+               OpReturnValue %31
+         %40 = OpLabel
+         %42 = OpAccessChain %23 %13 %22
+         %43 = OpLoad %6 %42
+         %44 = OpAccessChain %23 %14 %22
+         %45 = OpLoad %6 %44
+         %47 = OpAccessChain %23 %14 %46
+         %48 = OpLoad %6 %47
+         %49 = OpFAdd %6 %45 %48
+         %50 = OpFOrdGreaterThan %11 %43 %49
+               OpSelectionMerge %52 None
+               OpBranchConditional %50 %51 %52
+         %51 = OpLabel
+               OpReturnValue %31
+         %52 = OpLabel
+         %54 = OpAccessChain %23 %13 %33
+         %55 = OpLoad %6 %54
+         %56 = OpAccessChain %23 %14 %33
+         %57 = OpLoad %6 %56
+         %59 = OpAccessChain %23 %14 %58
+         %60 = OpLoad %6 %59
+         %61 = OpFAdd %6 %57 %60
+         %62 = OpFOrdGreaterThan %11 %55 %61
+               OpSelectionMerge %64 None
+               OpBranchConditional %62 %63 %64
+         %63 = OpLabel
+               OpReturnValue %31
+         %64 = OpLabel
+               OpReturnValue %66
+               OpFunctionEnd
+         %19 = OpFunction %9 None %17
+         %18 = OpFunctionParameter %8
+         %20 = OpLabel
+         %69 = OpVariable %10 Function
+         %75 = OpVariable %74 Function
+        %105 = OpVariable %8 Function
+        %107 = OpVariable %10 Function
+        %109 = OpVariable %108 Function
+        %135 = OpVariable %108 Function
+        %140 = OpVariable %108 Function
+        %154 = OpVariable %153 Function
+               OpStore %69 %72
+               OpStore %75 %76
+               OpBranch %77
+         %77 = OpLabel
+               OpLoopMerge %79 %80 None
+               OpBranch %81
+         %81 = OpLabel
+         %82 = OpLoad %73 %75
+         %84 = OpSLessThan %11 %82 %83
+               OpBranchConditional %84 %78 %79
+         %78 = OpLabel
+        %104 = OpLoad %73 %75
+        %106 = OpLoad %7 %18
+               OpStore %105 %106
+               OpStore %109 %103
+        %110 = OpAccessChain %10 %109 %104
+        %111 = OpLoad %9 %110
+               OpStore %107 %111
+        %112 = OpFunctionCall %11 %15 %105 %107
+               OpSelectionMerge %114 None
+               OpBranchConditional %112 %113 %114
+        %113 = OpLabel
+        %134 = OpLoad %73 %75
+               OpStore %135 %103
+        %136 = OpAccessChain %23 %135 %134 %22
+        %137 = OpLoad %6 %136
+        %138 = OpConvertFToS %73 %137
+        %139 = OpLoad %73 %75
+               OpStore %140 %103
+        %141 = OpAccessChain %23 %140 %139 %33
+        %142 = OpLoad %6 %141
+        %143 = OpConvertFToS %73 %142
+        %144 = OpIMul %73 %138 %143
+        %145 = OpLoad %73 %75
+        %147 = OpIMul %73 %145 %146
+        %148 = OpIAdd %73 %144 %147
+        %150 = OpIAdd %73 %148 %149
+        %152 = OpSMod %73 %150 %151
+               OpStore %154 %133
+        %155 = OpAccessChain %10 %154 %152
+        %156 = OpLoad %9 %155
+               OpStore %69 %156
+               OpBranch %114
+        %114 = OpLabel
+               OpBranch %80
+         %80 = OpLabel
+        %157 = OpLoad %73 %75
+        %159 = OpIAdd %73 %157 %158
+               OpStore %75 %159
+               OpBranch %77
+         %79 = OpLabel
+        %160 = OpLoad %9 %69
+               OpReturnValue %160
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
diff --git a/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber b/external/vulkancts/data/vulkan/amber/graphicsfuzz/spv-null-in-phi-and-unroll.amber
new file mode 100644 (file)
index 0000000..0928e15
--- /dev/null
@@ -0,0 +1,452 @@
+#!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 that uses null for 0 and an Unroll annotation
+
+# The test passes because both shaders render the same image.
+
+SHADER vertex reference_vertex_shader PASSTHROUGH
+
+SHADER fragment reference_fragment_shader SPIRV-ASM
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 295
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %165 %180
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %165 "gl_FragCoord"
+               OpName %168 "buf0"
+               OpMemberName %168 0 "resolution"
+               OpName %170 ""
+               OpName %180 "_GLF_color"
+               OpDecorate %165 BuiltIn FragCoord
+               OpMemberDecorate %168 0 Offset 0
+               OpDecorate %168 Block
+               OpDecorate %170 DescriptorSet 0
+               OpDecorate %170 Binding 0
+               OpDecorate %180 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %9 = OpTypeVector %6 4
+         %10 = OpTypePointer Function %9
+         %11 = OpTypeBool
+         %21 = OpTypeInt 32 0
+         %22 = OpConstant %21 0
+         %23 = OpTypePointer Function %6
+         %31 = OpConstantFalse %11
+         %33 = OpConstant %21 1
+         %66 = OpConstantTrue %11
+         %70 = OpConstant %6 0.5
+         %71 = OpConstant %6 1
+         %72 = OpConstantComposite %9 %70 %70 %71 %71
+         %73 = OpTypeInt 32 1
+         %76 = OpConstant %73 0
+         %83 = OpConstant %73 8
+         %85 = OpConstant %21 8
+         %86 = OpTypeArray %9 %85
+         %87 = OpConstant %6 4
+         %88 = OpConstant %6 20
+         %89 = OpConstantComposite %9 %87 %87 %88 %87
+         %90 = OpConstantComposite %9 %87 %87 %87 %88
+         %91 = OpConstantComposite %9 %87 %88 %88 %87
+         %92 = OpConstant %6 8
+         %93 = OpConstantComposite %9 %88 %87 %87 %92
+         %94 = OpConstant %6 6
+         %95 = OpConstant %6 2
+         %96 = OpConstantComposite %9 %92 %94 %87 %95
+         %97 = OpConstant %6 12
+         %98 = OpConstantComposite %9 %95 %97 %95 %87
+         %99 = OpConstant %6 16
+        %100 = OpConstantComposite %9 %99 %95 %87 %87
+        %101 = OpConstant %6 22
+        %102 = OpConstantComposite %9 %97 %101 %87 %87
+        %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+        %108 = OpTypePointer Function %86
+        %115 = OpConstant %21 16
+        %116 = OpTypeArray %9 %115
+        %117 = OpConstant %6 0
+        %118 = OpConstantComposite %9 %117 %117 %117 %71
+        %119 = OpConstantComposite %9 %70 %117 %117 %71
+        %120 = OpConstantComposite %9 %117 %70 %117 %71
+        %121 = OpConstantComposite %9 %70 %70 %117 %71
+        %122 = OpConstantComposite %9 %117 %117 %70 %71
+        %123 = OpConstantComposite %9 %70 %117 %70 %71
+        %124 = OpConstantComposite %9 %117 %70 %70 %71
+        %125 = OpConstantComposite %9 %70 %70 %70 %71
+        %126 = OpConstantComposite %9 %71 %117 %117 %71
+        %127 = OpConstantComposite %9 %117 %71 %117 %71
+        %128 = OpConstantComposite %9 %71 %71 %117 %71
+        %129 = OpConstantComposite %9 %117 %117 %71 %71
+        %130 = OpConstantComposite %9 %71 %117 %71 %71
+        %131 = OpConstantComposite %9 %117 %71 %71 %71
+        %132 = OpConstantComposite %9 %71 %71 %71 %71
+        %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+        %146 = OpConstant %73 9
+        %149 = OpConstant %73 11
+        %151 = OpConstant %73 16
+        %153 = OpTypePointer Function %116
+        %158 = OpConstant %73 1
+        %164 = OpTypePointer Input %9
+        %165 = OpVariable %164 Input
+        %168 = OpTypeStruct %7
+        %169 = OpTypePointer Uniform %168
+        %170 = OpVariable %169 Uniform
+        %171 = OpTypePointer Uniform %7
+        %176 = OpConstant %6 32
+        %179 = OpTypePointer Output %9
+        %180 = OpVariable %179 Output
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %199 = OpVariable %108 Function
+        %200 = OpVariable %108 Function
+        %201 = OpVariable %108 Function
+        %202 = OpVariable %153 Function
+        %166 = OpLoad %9 %165
+        %167 = OpVectorShuffle %7 %166 %166 0 1
+        %172 = OpAccessChain %171 %170 %76
+        %173 = OpLoad %7 %172
+        %174 = OpFDiv %7 %167 %173
+        %177 = OpVectorTimesScalar %7 %174 %176
+        %178 = OpExtInst %7 %1 Floor %177
+               OpBranch %205
+        %205 = OpLabel
+        %290 = OpPhi %9 %72 %5 %294 %233
+        %289 = OpPhi %73 %76 %5 %235 %233
+        %208 = OpSLessThan %11 %289 %83
+               OpLoopMerge %236 %233 None
+               OpBranchConditional %208 %209 %236
+        %209 = OpLabel
+               OpStore %199 %103
+        %212 = OpAccessChain %10 %199 %289
+        %213 = OpLoad %9 %212
+               OpSelectionMerge %277 None
+               OpSwitch %22 %242
+        %242 = OpLabel
+        %244 = OpCompositeExtract %6 %178 0
+        %246 = OpCompositeExtract %6 %213 0
+        %247 = OpFOrdLessThan %11 %244 %246
+               OpSelectionMerge %249 None
+               OpBranchConditional %247 %248 %249
+        %248 = OpLabel
+               OpBranch %277
+        %249 = OpLabel
+        %251 = OpCompositeExtract %6 %178 1
+        %253 = OpCompositeExtract %6 %213 1
+        %254 = OpFOrdLessThan %11 %251 %253
+               OpSelectionMerge %256 None
+               OpBranchConditional %254 %255 %256
+        %255 = OpLabel
+               OpBranch %277
+        %256 = OpLabel
+        %262 = OpCompositeExtract %6 %213 2
+        %263 = OpFAdd %6 %246 %262
+        %264 = OpFOrdGreaterThan %11 %244 %263
+               OpSelectionMerge %266 None
+               OpBranchConditional %264 %265 %266
+        %265 = OpLabel
+               OpBranch %277
+        %266 = OpLabel
+        %272 = OpCompositeExtract %6 %213 3
+        %273 = OpFAdd %6 %253 %272
+        %274 = OpFOrdGreaterThan %11 %251 %273
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+               OpBranch %277
+        %276 = OpLabel
+               OpBranch %277
+        %277 = OpLabel
+        %291 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276
+               OpSelectionMerge %232 None
+               OpBranchConditional %291 %215 %232
+        %215 = OpLabel
+               OpStore %200 %103
+        %217 = OpAccessChain %23 %200 %289 %22
+        %218 = OpLoad %6 %217
+        %219 = OpConvertFToS %73 %218
+               OpStore %201 %103
+        %221 = OpAccessChain %23 %201 %289 %33
+        %222 = OpLoad %6 %221
+        %223 = OpConvertFToS %73 %222
+        %224 = OpIMul %73 %219 %223
+        %226 = OpIMul %73 %289 %146
+        %227 = OpIAdd %73 %224 %226
+        %228 = OpIAdd %73 %227 %149
+        %229 = OpSMod %73 %228 %151
+               OpStore %202 %133
+        %230 = OpAccessChain %10 %202 %229
+        %231 = OpLoad %9 %230
+               OpBranch %232
+        %232 = OpLabel
+        %294 = OpPhi %9 %290 %277 %231 %215
+               OpBranch %233
+        %233 = OpLabel
+        %235 = OpIAdd %73 %289 %158
+               OpBranch %205
+        %236 = OpLabel
+               OpStore %180 %290
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for reference
+
+# resolution
+BUFFER reference_resolution DATA_TYPE vec2<float> 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
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 426
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %4 "main" %165 %180
+               OpExecutionMode %4 OriginUpperLeft
+               OpSource ESSL 320
+               OpName %4 "main"
+               OpName %165 "gl_FragCoord"
+               OpName %168 "buf0"
+               OpMemberName %168 0 "resolution"
+               OpName %170 ""
+               OpName %180 "_GLF_color"
+               OpDecorate %165 BuiltIn FragCoord
+               OpMemberDecorate %168 0 Offset 0
+               OpDecorate %168 Block
+               OpDecorate %170 DescriptorSet 0
+               OpDecorate %170 Binding 0
+               OpDecorate %180 Location 0
+          %2 = OpTypeVoid
+          %3 = OpTypeFunction %2
+          %6 = OpTypeFloat 32
+          %7 = OpTypeVector %6 2
+          %9 = OpTypeVector %6 4
+         %10 = OpTypePointer Function %9
+         %11 = OpTypeBool
+         %21 = OpTypeInt 32 0
+         %22 = OpConstant %21 0
+         %23 = OpTypePointer Function %6
+         %31 = OpConstantFalse %11
+         %33 = OpConstant %21 1
+         %66 = OpConstantTrue %11
+         %70 = OpConstant %6 0.5
+         %71 = OpConstant %6 1
+         %72 = OpConstantComposite %9 %70 %70 %71 %71
+         %73 = OpTypeInt 32 1
+         %76 = OpConstant %73 0
+         %83 = OpConstant %73 8
+         %85 = OpConstant %21 8
+         %86 = OpTypeArray %9 %85
+         %87 = OpConstant %6 4
+         %88 = OpConstant %6 20
+         %89 = OpConstantComposite %9 %87 %87 %88 %87
+         %90 = OpConstantComposite %9 %87 %87 %87 %88
+         %91 = OpConstantComposite %9 %87 %88 %88 %87
+         %92 = OpConstant %6 8
+         %93 = OpConstantComposite %9 %88 %87 %87 %92
+         %94 = OpConstant %6 6
+         %95 = OpConstant %6 2
+         %96 = OpConstantComposite %9 %92 %94 %87 %95
+         %97 = OpConstant %6 12
+         %98 = OpConstantComposite %9 %95 %97 %95 %87
+         %99 = OpConstant %6 16
+        %100 = OpConstantComposite %9 %99 %95 %87 %87
+        %101 = OpConstant %6 22
+        %102 = OpConstantComposite %9 %97 %101 %87 %87
+        %103 = OpConstantComposite %86 %89 %90 %91 %93 %96 %98 %100 %102
+        %108 = OpTypePointer Function %86
+        %115 = OpConstant %21 16
+        %116 = OpTypeArray %9 %115
+        %117 = OpConstant %6 0
+        %118 = OpConstantComposite %9 %117 %117 %117 %71
+        %119 = OpConstantComposite %9 %70 %117 %117 %71
+        %120 = OpConstantComposite %9 %117 %70 %117 %71
+        %121 = OpConstantComposite %9 %70 %70 %117 %71
+        %122 = OpConstantComposite %9 %117 %117 %70 %71
+        %123 = OpConstantComposite %9 %70 %117 %70 %71
+        %124 = OpConstantComposite %9 %117 %70 %70 %71
+        %125 = OpConstantComposite %9 %70 %70 %70 %71
+        %126 = OpConstantComposite %9 %71 %117 %117 %71
+        %127 = OpConstantComposite %9 %117 %71 %117 %71
+        %128 = OpConstantComposite %9 %71 %71 %117 %71
+        %129 = OpConstantComposite %9 %117 %117 %71 %71
+        %130 = OpConstantComposite %9 %71 %117 %71 %71
+        %131 = OpConstantComposite %9 %117 %71 %71 %71
+        %132 = OpConstantComposite %9 %71 %71 %71 %71
+        %133 = OpConstantComposite %116 %118 %119 %120 %121 %122 %123 %124 %125 %118 %126 %127 %128 %129 %130 %131 %132
+        %146 = OpConstant %73 9
+        %149 = OpConstant %73 11
+        %151 = OpConstant %73 16
+        %153 = OpTypePointer Function %116
+        %158 = OpConstant %73 1
+        %164 = OpTypePointer Input %9
+        %165 = OpVariable %164 Input
+        %168 = OpTypeStruct %7
+        %169 = OpTypePointer Uniform %168
+        %170 = OpVariable %169 Uniform
+        %171 = OpTypePointer Uniform %7
+        %176 = OpConstant %6 32
+        %179 = OpTypePointer Output %9
+        %180 = OpVariable %179 Output
+        %425 = OpConstantNull %73
+          %4 = OpFunction %2 None %3
+          %5 = OpLabel
+        %199 = OpVariable %108 Function
+        %200 = OpVariable %108 Function
+        %201 = OpVariable %108 Function
+        %202 = OpVariable %153 Function
+        %166 = OpLoad %9 %165
+        %167 = OpVectorShuffle %7 %166 %166 0 1
+        %172 = OpAccessChain %171 %170 %76
+        %173 = OpLoad %7 %172
+        %174 = OpFDiv %7 %167 %173
+        %177 = OpVectorTimesScalar %7 %174 %176
+        %178 = OpExtInst %7 %1 Floor %177
+               OpBranch %205
+        %205 = OpLabel
+        %290 = OpPhi %9 %72 %5 %294 %233
+        %289 = OpPhi %73 %425 %5 %235 %233
+        %208 = OpSLessThan %11 %289 %83
+               OpLoopMerge %236 %233 Unroll
+               OpBranchConditional %208 %209 %236
+        %209 = OpLabel
+               OpStore %199 %103
+        %212 = OpAccessChain %10 %199 %289
+        %213 = OpLoad %9 %212
+               OpSelectionMerge %277 None
+               OpSwitch %22 %242
+        %242 = OpLabel
+        %244 = OpCompositeExtract %6 %178 0
+        %246 = OpCompositeExtract %6 %213 0
+        %247 = OpFOrdLessThan %11 %244 %246
+               OpSelectionMerge %249 None
+               OpBranchConditional %247 %248 %249
+        %248 = OpLabel
+               OpBranch %277
+        %249 = OpLabel
+        %251 = OpCompositeExtract %6 %178 1
+        %253 = OpCompositeExtract %6 %213 1
+        %254 = OpFOrdLessThan %11 %251 %253
+               OpSelectionMerge %256 None
+               OpBranchConditional %254 %255 %256
+        %255 = OpLabel
+               OpBranch %277
+        %256 = OpLabel
+        %262 = OpCompositeExtract %6 %213 2
+        %263 = OpFAdd %6 %246 %262
+        %264 = OpFOrdGreaterThan %11 %244 %263
+               OpSelectionMerge %266 None
+               OpBranchConditional %264 %265 %266
+        %265 = OpLabel
+               OpBranch %277
+        %266 = OpLabel
+        %272 = OpCompositeExtract %6 %213 3
+        %273 = OpFAdd %6 %253 %272
+        %274 = OpFOrdGreaterThan %11 %251 %273
+               OpSelectionMerge %276 None
+               OpBranchConditional %274 %275 %276
+        %275 = OpLabel
+               OpBranch %277
+        %276 = OpLabel
+               OpBranch %277
+        %277 = OpLabel
+        %291 = OpPhi %11 %31 %248 %31 %255 %31 %265 %31 %275 %66 %276
+               OpSelectionMerge %232 None
+               OpBranchConditional %291 %215 %232
+        %215 = OpLabel
+               OpStore %200 %103
+        %217 = OpAccessChain %23 %200 %289 %22
+        %218 = OpLoad %6 %217
+        %219 = OpConvertFToS %73 %218
+               OpStore %201 %103
+        %221 = OpAccessChain %23 %201 %289 %33
+        %222 = OpLoad %6 %221
+        %223 = OpConvertFToS %73 %222
+        %224 = OpIMul %73 %219 %223
+        %226 = OpIMul %73 %289 %146
+        %227 = OpIAdd %73 %224 %226
+        %228 = OpIAdd %73 %227 %149
+        %229 = OpSMod %73 %228 %151
+               OpStore %202 %133
+        %230 = OpAccessChain %10 %202 %229
+        %231 = OpLoad %9 %230
+               OpBranch %232
+        %232 = OpLabel
+        %294 = OpPhi %9 %290 %277 %231 %215
+               OpBranch %233
+        %233 = OpLabel
+        %235 = OpIAdd %73 %289 %158
+               OpBranch %205
+        %236 = OpLabel
+               OpStore %180 %290
+               OpReturn
+               OpFunctionEnd
+END
+
+# uniforms for variant
+
+# resolution
+BUFFER variant_resolution DATA_TYPE vec2<float> 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
index 86833e8..ce8b595 100644 (file)
@@ -704691,6 +704691,14 @@ dEQP-VK.graphicsfuzz.returned-boolean-in-vector
 dEQP-VK.graphicsfuzz.set-color-in-one-iteration-while-loop
 dEQP-VK.graphicsfuzz.similar-nested-ifs
 dEQP-VK.graphicsfuzz.smoothstep-after-loop
+dEQP-VK.graphicsfuzz.spv-access-chains
+dEQP-VK.graphicsfuzz.spv-composite-phi
+dEQP-VK.graphicsfuzz.spv-composite2
+dEQP-VK.graphicsfuzz.spv-composites
+dEQP-VK.graphicsfuzz.spv-copy-object
+dEQP-VK.graphicsfuzz.spv-dead-break-and-unroll
+dEQP-VK.graphicsfuzz.spv-declare-bvec4
+dEQP-VK.graphicsfuzz.spv-null-in-phi-and-unroll
 dEQP-VK.graphicsfuzz.stable-binarysearch-tree-with-loop-read-write-global
 dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-injected-conditional-true
 dEQP-VK.graphicsfuzz.stable-colorgrid-modulo-true-conditional-simple-loop