#!amber # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # A test for a bug found by the GraphicsFuzz project. # Short description: Equivalent shaders, one with more complex branching # The test passes because both shaders render the same image. SHADER vertex reference_vertex_shader PASSTHROUGH SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 ; Bound: 381 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %243 %369 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %12 "merge(i1;i1;i1;" OpName %9 "from" OpName %10 "mid" OpName %11 "to" OpName %14 "mergeSort(" OpName %16 "k" OpName %18 "i" OpName %20 "j" OpName %41 "data" OpName %52 "temp" OpName %87 "i" OpName %104 "low" OpName %106 "high" OpName %108 "m" OpName %117 "i" OpName %127 "from" OpName %129 "mid" OpName %134 "to" OpName %143 "param" OpName %145 "param" OpName %147 "param" OpName %156 "i" OpName %159 "buf0" OpMemberName %159 0 "injectionSwitch" OpName %161 "" OpName %225 "j" OpName %243 "gl_FragCoord" OpName %254 "grey" OpName %369 "_GLF_color" OpName %378 "buf1" OpMemberName %378 0 "resolution" OpName %380 "" OpMemberDecorate %159 0 Offset 0 OpDecorate %159 Block OpDecorate %161 DescriptorSet 0 OpDecorate %161 Binding 0 OpDecorate %243 BuiltIn FragCoord OpDecorate %369 Location 0 OpMemberDecorate %378 0 Offset 0 OpDecorate %378 Block OpDecorate %380 DescriptorSet 0 OpDecorate %380 Binding 1 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypePointer Function %6 %8 = OpTypeFunction %2 %7 %7 %7 %22 = OpConstant %6 1 %31 = OpTypeBool %37 = OpTypeInt 32 0 %38 = OpConstant %37 10 %39 = OpTypeArray %6 %38 %40 = OpTypePointer Private %39 %41 = OpVariable %40 Private %43 = OpTypePointer Private %6 %52 = OpVariable %40 Private %74 = OpConstant %6 10 %105 = OpConstant %6 0 %107 = OpConstant %6 9 %136 = OpConstant %6 2 %157 = OpTypeFloat 32 %158 = OpTypeVector %157 2 %159 = OpTypeStruct %158 %160 = OpTypePointer Uniform %159 %161 = OpVariable %160 Uniform %162 = OpConstant %37 0 %163 = OpTypePointer Uniform %157 %184 = OpConstant %6 4 %188 = OpConstant %6 3 %201 = OpConstant %6 -1 %205 = OpConstant %6 -2 %209 = OpConstant %6 -3 %213 = OpConstant %6 -4 %217 = OpConstant %6 -5 %241 = OpTypeVector %157 4 %242 = OpTypePointer Input %241 %243 = OpVariable %242 Input %244 = OpConstant %37 1 %245 = OpTypePointer Input %157 %249 = OpConstant %6 30 %253 = OpTypePointer Function %157 %255 = OpConstant %157 0.5 %259 = OpConstant %157 10 %266 = OpConstant %6 60 %279 = OpConstant %6 90 %292 = OpConstant %6 120 %305 = OpConstant %6 150 %314 = OpConstant %6 180 %318 = OpConstant %6 5 %328 = OpConstant %6 210 %332 = OpConstant %6 6 %342 = OpConstant %6 240 %346 = OpConstant %6 7 %356 = OpConstant %6 270 %360 = OpConstant %6 8 %368 = OpTypePointer Output %241 %369 = OpVariable %368 Output %371 = OpTypeVector %157 3 %373 = OpConstant %157 1 %378 = OpTypeStruct %158 %379 = OpTypePointer Uniform %378 %380 = OpVariable %379 Uniform %4 = OpFunction %2 None %3 %5 = OpLabel %156 = OpVariable %7 Function %225 = OpVariable %7 Function %254 = OpVariable %253 Function %164 = OpAccessChain %163 %161 %105 %162 %165 = OpLoad %157 %164 %166 = OpConvertFToS %6 %165 OpStore %156 %166 OpBranch %167 %167 = OpLabel OpLoopMerge %169 %170 None OpBranch %168 %168 = OpLabel %171 = OpLoad %6 %156 OpSelectionMerge %182 None OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 %172 = OpLabel %183 = OpLoad %6 %156 %185 = OpAccessChain %43 %41 %183 OpStore %185 %184 OpBranch %182 %173 = OpLabel %187 = OpLoad %6 %156 %189 = OpAccessChain %43 %41 %187 OpStore %189 %188 OpBranch %182 %174 = OpLabel %191 = OpLoad %6 %156 %192 = OpAccessChain %43 %41 %191 OpStore %192 %136 OpBranch %182 %175 = OpLabel %194 = OpLoad %6 %156 %195 = OpAccessChain %43 %41 %194 OpStore %195 %22 OpBranch %182 %176 = OpLabel %197 = OpLoad %6 %156 %198 = OpAccessChain %43 %41 %197 OpStore %198 %105 OpBranch %182 %177 = OpLabel %200 = OpLoad %6 %156 %202 = OpAccessChain %43 %41 %200 OpStore %202 %201 OpBranch %182 %178 = OpLabel %204 = OpLoad %6 %156 %206 = OpAccessChain %43 %41 %204 OpStore %206 %205 OpBranch %182 %179 = OpLabel %208 = OpLoad %6 %156 %210 = OpAccessChain %43 %41 %208 OpStore %210 %209 OpBranch %182 %180 = OpLabel %212 = OpLoad %6 %156 %214 = OpAccessChain %43 %41 %212 OpStore %214 %213 OpBranch %182 %181 = OpLabel %216 = OpLoad %6 %156 %218 = OpAccessChain %43 %41 %216 OpStore %218 %217 OpBranch %182 %182 = OpLabel %221 = OpLoad %6 %156 %222 = OpIAdd %6 %221 %22 OpStore %156 %222 OpBranch %170 %170 = OpLabel %223 = OpLoad %6 %156 %224 = OpSLessThan %31 %223 %74 OpBranchConditional %224 %167 %169 %169 = OpLabel OpStore %225 %105 OpBranch %226 %226 = OpLabel OpLoopMerge %228 %229 None OpBranch %230 %230 = OpLabel %231 = OpLoad %6 %225 %232 = OpSLessThan %31 %231 %74 OpBranchConditional %232 %227 %228 %227 = OpLabel %233 = OpLoad %6 %225 %234 = OpLoad %6 %225 %235 = OpAccessChain %43 %41 %234 %236 = OpLoad %6 %235 %237 = OpAccessChain %43 %52 %233 OpStore %237 %236 OpBranch %229 %229 = OpLabel %238 = OpLoad %6 %225 %239 = OpIAdd %6 %238 %22 OpStore %225 %239 OpBranch %226 %228 = OpLabel %240 = OpFunctionCall %2 %14 %246 = OpAccessChain %245 %243 %244 %247 = OpLoad %157 %246 %248 = OpConvertFToS %6 %247 %250 = OpSLessThan %31 %248 %249 OpSelectionMerge %252 None OpBranchConditional %250 %251 %262 %251 = OpLabel %256 = OpAccessChain %43 %41 %105 %257 = OpLoad %6 %256 %258 = OpConvertSToF %157 %257 %260 = OpFDiv %157 %258 %259 %261 = OpFAdd %157 %255 %260 OpStore %254 %261 OpBranch %252 %262 = OpLabel %263 = OpAccessChain %245 %243 %244 %264 = OpLoad %157 %263 %265 = OpConvertFToS %6 %264 %267 = OpSLessThan %31 %265 %266 OpSelectionMerge %269 None OpBranchConditional %267 %268 %275 %268 = OpLabel %270 = OpAccessChain %43 %41 %22 %271 = OpLoad %6 %270 %272 = OpConvertSToF %157 %271 %273 = OpFDiv %157 %272 %259 %274 = OpFAdd %157 %255 %273 OpStore %254 %274 OpBranch %269 %275 = OpLabel %276 = OpAccessChain %245 %243 %244 %277 = OpLoad %157 %276 %278 = OpConvertFToS %6 %277 %280 = OpSLessThan %31 %278 %279 OpSelectionMerge %282 None OpBranchConditional %280 %281 %288 %281 = OpLabel %283 = OpAccessChain %43 %41 %136 %284 = OpLoad %6 %283 %285 = OpConvertSToF %157 %284 %286 = OpFDiv %157 %285 %259 %287 = OpFAdd %157 %255 %286 OpStore %254 %287 OpBranch %282 %288 = OpLabel %289 = OpAccessChain %245 %243 %244 %290 = OpLoad %157 %289 %291 = OpConvertFToS %6 %290 %293 = OpSLessThan %31 %291 %292 OpSelectionMerge %295 None OpBranchConditional %293 %294 %301 %294 = OpLabel %296 = OpAccessChain %43 %41 %188 %297 = OpLoad %6 %296 %298 = OpConvertSToF %157 %297 %299 = OpFDiv %157 %298 %259 %300 = OpFAdd %157 %255 %299 OpStore %254 %300 OpBranch %295 %301 = OpLabel %302 = OpAccessChain %245 %243 %244 %303 = OpLoad %157 %302 %304 = OpConvertFToS %6 %303 %306 = OpSLessThan %31 %304 %305 OpSelectionMerge %308 None OpBranchConditional %306 %307 %310 %307 = OpLabel OpKill %310 = OpLabel %311 = OpAccessChain %245 %243 %244 %312 = OpLoad %157 %311 %313 = OpConvertFToS %6 %312 %315 = OpSLessThan %31 %313 %314 OpSelectionMerge %317 None OpBranchConditional %315 %316 %324 %316 = OpLabel %319 = OpAccessChain %43 %41 %318 %320 = OpLoad %6 %319 %321 = OpConvertSToF %157 %320 %322 = OpFDiv %157 %321 %259 %323 = OpFAdd %157 %255 %322 OpStore %254 %323 OpBranch %317 %324 = OpLabel %325 = OpAccessChain %245 %243 %244 %326 = OpLoad %157 %325 %327 = OpConvertFToS %6 %326 %329 = OpSLessThan %31 %327 %328 OpSelectionMerge %331 None OpBranchConditional %329 %330 %338 %330 = OpLabel %333 = OpAccessChain %43 %41 %332 %334 = OpLoad %6 %333 %335 = OpConvertSToF %157 %334 %336 = OpFDiv %157 %335 %259 %337 = OpFAdd %157 %255 %336 OpStore %254 %337 OpBranch %331 %338 = OpLabel %339 = OpAccessChain %245 %243 %244 %340 = OpLoad %157 %339 %341 = OpConvertFToS %6 %340 %343 = OpSLessThan %31 %341 %342 OpSelectionMerge %345 None OpBranchConditional %343 %344 %352 %344 = OpLabel %347 = OpAccessChain %43 %41 %346 %348 = OpLoad %6 %347 %349 = OpConvertSToF %157 %348 %350 = OpFDiv %157 %349 %259 %351 = OpFAdd %157 %255 %350 OpStore %254 %351 OpBranch %345 %352 = OpLabel %353 = OpAccessChain %245 %243 %244 %354 = OpLoad %157 %353 %355 = OpConvertFToS %6 %354 %357 = OpSLessThan %31 %355 %356 OpSelectionMerge %359 None OpBranchConditional %357 %358 %366 %358 = OpLabel %361 = OpAccessChain %43 %41 %360 %362 = OpLoad %6 %361 %363 = OpConvertSToF %157 %362 %364 = OpFDiv %157 %363 %259 %365 = OpFAdd %157 %255 %364 OpStore %254 %365 OpBranch %359 %366 = OpLabel OpKill %359 = OpLabel OpBranch %345 %345 = OpLabel OpBranch %331 %331 = OpLabel OpBranch %317 %317 = OpLabel OpBranch %308 %308 = OpLabel OpBranch %295 %295 = OpLabel OpBranch %282 %282 = OpLabel OpBranch %269 %269 = OpLabel OpBranch %252 %252 = OpLabel %370 = OpLoad %157 %254 %372 = OpCompositeConstruct %371 %370 %370 %370 %374 = OpCompositeExtract %157 %372 0 %375 = OpCompositeExtract %157 %372 1 %376 = OpCompositeExtract %157 %372 2 %377 = OpCompositeConstruct %241 %374 %375 %376 %373 OpStore %369 %377 OpReturn OpFunctionEnd %12 = OpFunction %2 None %8 %9 = OpFunctionParameter %7 %10 = OpFunctionParameter %7 %11 = OpFunctionParameter %7 %13 = OpLabel %16 = OpVariable %7 Function %18 = OpVariable %7 Function %20 = OpVariable %7 Function %87 = OpVariable %7 Function %17 = OpLoad %6 %9 OpStore %16 %17 %19 = OpLoad %6 %9 OpStore %18 %19 %21 = OpLoad %6 %10 %23 = OpIAdd %6 %21 %22 OpStore %20 %23 OpBranch %24 %24 = OpLabel OpLoopMerge %26 %27 None OpBranch %28 %28 = OpLabel %29 = OpLoad %6 %18 %30 = OpLoad %6 %10 %32 = OpSLessThanEqual %31 %29 %30 %33 = OpLoad %6 %20 %34 = OpLoad %6 %11 %35 = OpSLessThanEqual %31 %33 %34 %36 = OpLogicalAnd %31 %32 %35 OpBranchConditional %36 %25 %26 %25 = OpLabel %42 = OpLoad %6 %18 %44 = OpAccessChain %43 %41 %42 %45 = OpLoad %6 %44 %46 = OpLoad %6 %20 %47 = OpAccessChain %43 %41 %46 %48 = OpLoad %6 %47 %49 = OpSLessThan %31 %45 %48 OpSelectionMerge %51 None OpBranchConditional %49 %50 %60 %50 = OpLabel %53 = OpLoad %6 %16 %54 = OpIAdd %6 %53 %22 OpStore %16 %54 %55 = OpLoad %6 %18 %56 = OpIAdd %6 %55 %22 OpStore %18 %56 %57 = OpAccessChain %43 %41 %55 %58 = OpLoad %6 %57 %59 = OpAccessChain %43 %52 %53 OpStore %59 %58 OpBranch %51 %60 = OpLabel %61 = OpLoad %6 %16 %62 = OpIAdd %6 %61 %22 OpStore %16 %62 %63 = OpLoad %6 %20 %64 = OpIAdd %6 %63 %22 OpStore %20 %64 %65 = OpAccessChain %43 %41 %63 %66 = OpLoad %6 %65 %67 = OpAccessChain %43 %52 %61 OpStore %67 %66 OpBranch %51 %51 = OpLabel OpBranch %27 %27 = OpLabel OpBranch %24 %26 = OpLabel OpBranch %68 %68 = OpLabel OpLoopMerge %70 %71 None OpBranch %72 %72 = OpLabel %73 = OpLoad %6 %18 %75 = OpSLessThan %31 %73 %74 %76 = OpLoad %6 %18 %77 = OpLoad %6 %10 %78 = OpSLessThanEqual %31 %76 %77 %79 = OpLogicalAnd %31 %75 %78 OpBranchConditional %79 %69 %70 %69 = OpLabel %80 = OpLoad %6 %16 %81 = OpIAdd %6 %80 %22 OpStore %16 %81 %82 = OpLoad %6 %18 %83 = OpIAdd %6 %82 %22 OpStore %18 %83 %84 = OpAccessChain %43 %41 %82 %85 = OpLoad %6 %84 %86 = OpAccessChain %43 %52 %80 OpStore %86 %85 OpBranch %71 %71 = OpLabel OpBranch %68 %70 = OpLabel %88 = OpLoad %6 %9 OpStore %87 %88 OpBranch %89 %89 = OpLabel OpLoopMerge %91 %92 None OpBranch %93 %93 = OpLabel %94 = OpLoad %6 %87 %95 = OpLoad %6 %11 %96 = OpSLessThanEqual %31 %94 %95 OpBranchConditional %96 %90 %91 %90 = OpLabel %97 = OpLoad %6 %87 %98 = OpLoad %6 %87 %99 = OpAccessChain %43 %52 %98 %100 = OpLoad %6 %99 %101 = OpAccessChain %43 %41 %97 OpStore %101 %100 OpBranch %92 %92 = OpLabel %102 = OpLoad %6 %87 %103 = OpIAdd %6 %102 %22 OpStore %87 %103 OpBranch %89 %91 = OpLabel OpReturn OpFunctionEnd %14 = OpFunction %2 None %3 %15 = OpLabel %104 = OpVariable %7 Function %106 = OpVariable %7 Function %108 = OpVariable %7 Function %117 = OpVariable %7 Function %127 = OpVariable %7 Function %129 = OpVariable %7 Function %134 = OpVariable %7 Function %143 = OpVariable %7 Function %145 = OpVariable %7 Function %147 = OpVariable %7 Function OpStore %104 %105 OpStore %106 %107 OpStore %108 %22 OpBranch %109 %109 = OpLabel OpLoopMerge %111 %112 None OpBranch %113 %113 = OpLabel %114 = OpLoad %6 %108 %115 = OpLoad %6 %106 %116 = OpSLessThanEqual %31 %114 %115 OpBranchConditional %116 %110 %111 %110 = OpLabel %118 = OpLoad %6 %104 OpStore %117 %118 OpBranch %119 %119 = OpLabel OpLoopMerge %121 %122 None OpBranch %123 %123 = OpLabel %124 = OpLoad %6 %117 %125 = OpLoad %6 %106 %126 = OpSLessThan %31 %124 %125 OpBranchConditional %126 %120 %121 %120 = OpLabel %128 = OpLoad %6 %117 OpStore %127 %128 %130 = OpLoad %6 %117 %131 = OpLoad %6 %108 %132 = OpIAdd %6 %130 %131 %133 = OpISub %6 %132 %22 OpStore %129 %133 %135 = OpLoad %6 %117 %137 = OpLoad %6 %108 %138 = OpIMul %6 %136 %137 %139 = OpIAdd %6 %135 %138 %140 = OpISub %6 %139 %22 %141 = OpLoad %6 %106 %142 = OpExtInst %6 %1 SMin %140 %141 OpStore %134 %142 %144 = OpLoad %6 %127 OpStore %143 %144 %146 = OpLoad %6 %129 OpStore %145 %146 %148 = OpLoad %6 %134 OpStore %147 %148 %149 = OpFunctionCall %2 %12 %143 %145 %147 OpBranch %122 %122 = OpLabel %150 = OpLoad %6 %108 %151 = OpIMul %6 %136 %150 %152 = OpLoad %6 %117 %153 = OpIAdd %6 %152 %151 OpStore %117 %153 OpBranch %119 %121 = OpLabel OpBranch %112 %112 = OpLabel %154 = OpLoad %6 %108 %155 = OpIMul %6 %136 %154 OpStore %108 %155 OpBranch %109 %111 = OpLabel OpReturn OpFunctionEnd END # uniforms for reference # injectionSwitch BUFFER reference_injectionSwitch DATA_TYPE vec2 DATA 0.0 1.0 END # resolution BUFFER reference_resolution DATA_TYPE vec2 DATA 256.0 256.0 END BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM PIPELINE graphics reference_pipeline ATTACH reference_vertex_shader ATTACH reference_fragment_shader FRAMEBUFFER_SIZE 256 256 BIND BUFFER reference_framebuffer AS color LOCATION 0 BIND BUFFER reference_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 END CLEAR_COLOR reference_pipeline 0 0 0 255 CLEAR reference_pipeline RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256 SHADER vertex variant_vertex_shader PASSTHROUGH SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0 ; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 ; Bound: 534 ; Schema: 0 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Fragment %4 "main" %243 %369 OpExecutionMode %4 OriginUpperLeft OpSource ESSL 320 OpName %4 "main" OpName %12 "merge(i1;i1;i1;" OpName %9 "from" OpName %10 "mid" OpName %11 "to" OpName %14 "mergeSort(" OpName %16 "k" OpName %18 "i" OpName %20 "j" OpName %41 "data" OpName %52 "temp" OpName %87 "i" OpName %104 "low" OpName %106 "high" OpName %108 "m" OpName %117 "i" OpName %127 "from" OpName %129 "mid" OpName %134 "to" OpName %143 "param" OpName %145 "param" OpName %147 "param" OpName %156 "i" OpName %159 "buf0" OpMemberName %159 0 "injectionSwitch" OpName %161 "" OpName %225 "j" OpName %243 "gl_FragCoord" OpName %254 "grey" OpName %369 "_GLF_color" OpName %378 "buf1" OpMemberName %378 0 "resolution" OpName %380 "" OpMemberDecorate %159 0 Offset 0 OpDecorate %159 Block OpDecorate %161 DescriptorSet 0 OpDecorate %161 Binding 0 OpDecorate %243 BuiltIn FragCoord OpDecorate %369 Location 0 OpMemberDecorate %378 0 Offset 0 OpDecorate %378 Block OpDecorate %380 DescriptorSet 0 OpDecorate %380 Binding 1 %2 = OpTypeVoid %3 = OpTypeFunction %2 %6 = OpTypeInt 32 1 %7 = OpTypePointer Function %6 %8 = OpTypeFunction %2 %7 %7 %7 %22 = OpConstant %6 1 %31 = OpTypeBool %37 = OpTypeInt 32 0 %38 = OpConstant %37 10 %39 = OpTypeArray %6 %38 %40 = OpTypePointer Private %39 %41 = OpVariable %40 Private %43 = OpTypePointer Private %6 %52 = OpVariable %40 Private %74 = OpConstant %6 10 %105 = OpConstant %6 0 %107 = OpConstant %6 9 %136 = OpConstant %6 2 %157 = OpTypeFloat 32 %158 = OpTypeVector %157 2 %159 = OpTypeStruct %158 %160 = OpTypePointer Uniform %159 %161 = OpVariable %160 Uniform %162 = OpConstant %37 0 %163 = OpTypePointer Uniform %157 %184 = OpConstant %6 4 %188 = OpConstant %6 3 %201 = OpConstant %6 -1 %205 = OpConstant %6 -2 %209 = OpConstant %6 -3 %213 = OpConstant %6 -4 %217 = OpConstant %6 -5 %241 = OpTypeVector %157 4 %242 = OpTypePointer Input %241 %243 = OpVariable %242 Input %244 = OpConstant %37 1 %245 = OpTypePointer Input %157 %249 = OpConstant %6 30 %253 = OpTypePointer Function %157 %255 = OpConstant %157 0.5 %259 = OpConstant %157 10 %266 = OpConstant %6 60 %279 = OpConstant %6 90 %292 = OpConstant %6 120 %305 = OpConstant %6 150 %314 = OpConstant %6 180 %318 = OpConstant %6 5 %328 = OpConstant %6 210 %332 = OpConstant %6 6 %342 = OpConstant %6 240 %346 = OpConstant %6 7 %356 = OpConstant %6 270 %360 = OpConstant %6 8 %368 = OpTypePointer Output %241 %369 = OpVariable %368 Output %371 = OpTypeVector %157 3 %373 = OpConstant %157 1 %378 = OpTypeStruct %158 %379 = OpTypePointer Uniform %378 %380 = OpVariable %379 Uniform %533 = OpConstantTrue %31 %4 = OpFunction %2 None %3 %5 = OpLabel %156 = OpVariable %7 Function %225 = OpVariable %7 Function %254 = OpVariable %253 Function %164 = OpAccessChain %163 %161 %105 %162 %165 = OpLoad %157 %164 %166 = OpConvertFToS %6 %165 OpStore %156 %166 OpBranch %167 %167 = OpLabel OpLoopMerge %169 %170 None OpBranch %168 %168 = OpLabel %171 = OpLoad %6 %156 OpSelectionMerge %182 None OpSwitch %171 %182 0 %172 1 %173 2 %174 3 %175 4 %176 5 %177 6 %178 7 %179 8 %180 9 %181 %172 = OpLabel %183 = OpLoad %6 %156 %185 = OpAccessChain %43 %41 %183 OpStore %185 %184 OpBranch %182 %173 = OpLabel %187 = OpLoad %6 %156 %189 = OpAccessChain %43 %41 %187 OpStore %189 %188 OpBranch %182 %174 = OpLabel %191 = OpLoad %6 %156 %192 = OpAccessChain %43 %41 %191 OpStore %192 %136 OpBranch %182 %175 = OpLabel %194 = OpLoad %6 %156 %195 = OpAccessChain %43 %41 %194 OpStore %195 %22 OpBranch %182 %176 = OpLabel %197 = OpLoad %6 %156 %198 = OpAccessChain %43 %41 %197 OpStore %198 %105 OpBranch %182 %177 = OpLabel %200 = OpLoad %6 %156 %202 = OpAccessChain %43 %41 %200 OpStore %202 %201 OpBranch %182 %178 = OpLabel %204 = OpLoad %6 %156 %206 = OpAccessChain %43 %41 %204 OpStore %206 %205 OpBranch %182 %179 = OpLabel %208 = OpLoad %6 %156 %210 = OpAccessChain %43 %41 %208 OpStore %210 %209 OpBranch %182 %180 = OpLabel %212 = OpLoad %6 %156 %214 = OpAccessChain %43 %41 %212 OpStore %214 %213 OpBranch %182 %181 = OpLabel %216 = OpLoad %6 %156 %218 = OpAccessChain %43 %41 %216 OpStore %218 %217 OpBranchConditional %533 %182 %170 %182 = OpLabel %221 = OpLoad %6 %156 %222 = OpIAdd %6 %221 %22 OpStore %156 %222 OpBranchConditional %533 %170 %170 %170 = OpLabel %223 = OpLoad %6 %156 %224 = OpSLessThan %31 %223 %74 OpBranchConditional %224 %167 %169 %169 = OpLabel OpStore %225 %105 OpBranch %226 %226 = OpLabel OpLoopMerge %228 %229 None OpBranch %230 %230 = OpLabel %231 = OpLoad %6 %225 %232 = OpSLessThan %31 %231 %74 OpBranchConditional %232 %227 %228 %227 = OpLabel %233 = OpLoad %6 %225 %234 = OpLoad %6 %225 %235 = OpAccessChain %43 %41 %234 %236 = OpLoad %6 %235 %237 = OpAccessChain %43 %52 %233 OpStore %237 %236 OpBranch %229 %229 = OpLabel %238 = OpLoad %6 %225 %239 = OpIAdd %6 %238 %22 OpStore %225 %239 OpBranch %226 %228 = OpLabel %240 = OpFunctionCall %2 %14 %246 = OpAccessChain %245 %243 %244 %247 = OpLoad %157 %246 %248 = OpConvertFToS %6 %247 %250 = OpSLessThan %31 %248 %249 OpSelectionMerge %252 None OpBranchConditional %250 %251 %262 %251 = OpLabel %256 = OpAccessChain %43 %41 %105 %257 = OpLoad %6 %256 %258 = OpConvertSToF %157 %257 %260 = OpFDiv %157 %258 %259 %261 = OpFAdd %157 %255 %260 OpStore %254 %261 OpBranch %252 %262 = OpLabel %263 = OpAccessChain %245 %243 %244 %264 = OpLoad %157 %263 %265 = OpConvertFToS %6 %264 %267 = OpSLessThan %31 %265 %266 OpSelectionMerge %269 None OpBranchConditional %267 %268 %275 %268 = OpLabel %270 = OpAccessChain %43 %41 %22 %271 = OpLoad %6 %270 %272 = OpConvertSToF %157 %271 %273 = OpFDiv %157 %272 %259 %274 = OpFAdd %157 %255 %273 OpStore %254 %274 OpBranch %269 %275 = OpLabel %276 = OpAccessChain %245 %243 %244 %277 = OpLoad %157 %276 %278 = OpConvertFToS %6 %277 %280 = OpSLessThan %31 %278 %279 OpSelectionMerge %282 None OpBranchConditional %280 %281 %288 %281 = OpLabel %283 = OpAccessChain %43 %41 %136 %284 = OpLoad %6 %283 %285 = OpConvertSToF %157 %284 %286 = OpFDiv %157 %285 %259 %287 = OpFAdd %157 %255 %286 OpStore %254 %287 OpBranch %282 %288 = OpLabel %289 = OpAccessChain %245 %243 %244 %290 = OpLoad %157 %289 %291 = OpConvertFToS %6 %290 %293 = OpSLessThan %31 %291 %292 OpSelectionMerge %295 None OpBranchConditional %293 %294 %301 %294 = OpLabel %296 = OpAccessChain %43 %41 %188 %297 = OpLoad %6 %296 %298 = OpConvertSToF %157 %297 %299 = OpFDiv %157 %298 %259 %300 = OpFAdd %157 %255 %299 OpStore %254 %300 OpBranch %295 %301 = OpLabel %302 = OpAccessChain %245 %243 %244 %303 = OpLoad %157 %302 %304 = OpConvertFToS %6 %303 %306 = OpSLessThan %31 %304 %305 OpSelectionMerge %308 None OpBranchConditional %306 %307 %310 %307 = OpLabel OpKill %310 = OpLabel %311 = OpAccessChain %245 %243 %244 %312 = OpLoad %157 %311 %313 = OpConvertFToS %6 %312 %315 = OpSLessThan %31 %313 %314 OpSelectionMerge %317 None OpBranchConditional %315 %316 %324 %316 = OpLabel %319 = OpAccessChain %43 %41 %318 %320 = OpLoad %6 %319 %321 = OpConvertSToF %157 %320 %322 = OpFDiv %157 %321 %259 %323 = OpFAdd %157 %255 %322 OpStore %254 %323 OpBranch %317 %324 = OpLabel %325 = OpAccessChain %245 %243 %244 %326 = OpLoad %157 %325 %327 = OpConvertFToS %6 %326 %329 = OpSLessThan %31 %327 %328 OpSelectionMerge %331 None OpBranchConditional %329 %330 %338 %330 = OpLabel %333 = OpAccessChain %43 %41 %332 %334 = OpLoad %6 %333 %335 = OpConvertSToF %157 %334 %336 = OpFDiv %157 %335 %259 %337 = OpFAdd %157 %255 %336 OpStore %254 %337 OpBranch %331 %338 = OpLabel %339 = OpAccessChain %245 %243 %244 %340 = OpLoad %157 %339 %341 = OpConvertFToS %6 %340 %343 = OpSLessThan %31 %341 %342 OpSelectionMerge %345 None OpBranchConditional %343 %344 %352 %344 = OpLabel %347 = OpAccessChain %43 %41 %346 %348 = OpLoad %6 %347 %349 = OpConvertSToF %157 %348 %350 = OpFDiv %157 %349 %259 %351 = OpFAdd %157 %255 %350 OpStore %254 %351 OpBranch %345 %352 = OpLabel %353 = OpAccessChain %245 %243 %244 %354 = OpLoad %157 %353 %355 = OpConvertFToS %6 %354 %357 = OpSLessThan %31 %355 %356 OpSelectionMerge %359 None OpBranchConditional %357 %358 %366 %358 = OpLabel %361 = OpAccessChain %43 %41 %360 %362 = OpLoad %6 %361 %363 = OpConvertSToF %157 %362 %364 = OpFDiv %157 %363 %259 %365 = OpFAdd %157 %255 %364 OpStore %254 %365 OpBranch %359 %366 = OpLabel OpKill %359 = OpLabel OpBranch %345 %345 = OpLabel OpBranch %331 %331 = OpLabel OpBranch %317 %317 = OpLabel OpBranch %308 %308 = OpLabel OpBranch %295 %295 = OpLabel OpBranch %282 %282 = OpLabel OpBranch %269 %269 = OpLabel OpBranch %252 %252 = OpLabel %370 = OpLoad %157 %254 %372 = OpCompositeConstruct %371 %370 %370 %370 %374 = OpCompositeExtract %157 %372 0 %375 = OpCompositeExtract %157 %372 1 %376 = OpCompositeExtract %157 %372 2 %377 = OpCompositeConstruct %241 %374 %375 %376 %373 OpStore %369 %377 OpReturn OpFunctionEnd %12 = OpFunction %2 None %8 %9 = OpFunctionParameter %7 %10 = OpFunctionParameter %7 %11 = OpFunctionParameter %7 %13 = OpLabel %16 = OpVariable %7 Function %18 = OpVariable %7 Function %20 = OpVariable %7 Function %87 = OpVariable %7 Function %17 = OpLoad %6 %9 OpStore %16 %17 %19 = OpLoad %6 %9 OpStore %18 %19 %21 = OpLoad %6 %10 %23 = OpIAdd %6 %21 %22 OpStore %20 %23 OpBranch %24 %24 = OpLabel OpLoopMerge %26 %27 None OpBranch %28 %28 = OpLabel %29 = OpLoad %6 %18 %30 = OpLoad %6 %10 %32 = OpSLessThanEqual %31 %29 %30 %33 = OpLoad %6 %20 %34 = OpLoad %6 %11 %35 = OpSLessThanEqual %31 %33 %34 %36 = OpLogicalAnd %31 %32 %35 OpBranchConditional %36 %25 %26 %25 = OpLabel %42 = OpLoad %6 %18 %44 = OpAccessChain %43 %41 %42 %45 = OpLoad %6 %44 %46 = OpLoad %6 %20 %47 = OpAccessChain %43 %41 %46 %48 = OpLoad %6 %47 %49 = OpSLessThan %31 %45 %48 OpSelectionMerge %51 None OpBranchConditional %49 %50 %60 %50 = OpLabel %53 = OpLoad %6 %16 %54 = OpIAdd %6 %53 %22 OpStore %16 %54 %55 = OpLoad %6 %18 %56 = OpIAdd %6 %55 %22 OpStore %18 %56 %57 = OpAccessChain %43 %41 %55 %58 = OpLoad %6 %57 %59 = OpAccessChain %43 %52 %53 OpStore %59 %58 OpBranch %51 %60 = OpLabel %61 = OpLoad %6 %16 %62 = OpIAdd %6 %61 %22 OpStore %16 %62 %63 = OpLoad %6 %20 %64 = OpIAdd %6 %63 %22 OpStore %20 %64 %65 = OpAccessChain %43 %41 %63 %66 = OpLoad %6 %65 %67 = OpAccessChain %43 %52 %61 OpStore %67 %66 OpBranch %51 %51 = OpLabel OpBranch %27 %27 = OpLabel OpBranch %24 %26 = OpLabel OpBranch %68 %68 = OpLabel OpLoopMerge %70 %71 None OpBranch %72 %72 = OpLabel %73 = OpLoad %6 %18 %75 = OpSLessThan %31 %73 %74 %76 = OpLoad %6 %18 %77 = OpLoad %6 %10 %78 = OpSLessThanEqual %31 %76 %77 %79 = OpLogicalAnd %31 %75 %78 OpBranchConditional %79 %69 %70 %69 = OpLabel %80 = OpLoad %6 %16 %81 = OpIAdd %6 %80 %22 OpStore %16 %81 %82 = OpLoad %6 %18 %83 = OpIAdd %6 %82 %22 OpStore %18 %83 %84 = OpAccessChain %43 %41 %82 %85 = OpLoad %6 %84 %86 = OpAccessChain %43 %52 %80 OpStore %86 %85 OpBranch %71 %71 = OpLabel OpBranch %68 %70 = OpLabel %88 = OpLoad %6 %9 OpStore %87 %88 OpBranch %89 %89 = OpLabel OpLoopMerge %91 %92 None OpBranch %93 %93 = OpLabel %94 = OpLoad %6 %87 %95 = OpLoad %6 %11 %96 = OpSLessThanEqual %31 %94 %95 OpBranchConditional %96 %90 %91 %90 = OpLabel %97 = OpLoad %6 %87 %98 = OpLoad %6 %87 %99 = OpAccessChain %43 %52 %98 %100 = OpLoad %6 %99 %101 = OpAccessChain %43 %41 %97 OpStore %101 %100 OpBranch %92 %92 = OpLabel %102 = OpLoad %6 %87 %103 = OpIAdd %6 %102 %22 OpStore %87 %103 OpBranch %89 %91 = OpLabel OpReturn OpFunctionEnd %14 = OpFunction %2 None %3 %15 = OpLabel %104 = OpVariable %7 Function %106 = OpVariable %7 Function %108 = OpVariable %7 Function %117 = OpVariable %7 Function %127 = OpVariable %7 Function %129 = OpVariable %7 Function %134 = OpVariable %7 Function %143 = OpVariable %7 Function %145 = OpVariable %7 Function %147 = OpVariable %7 Function OpStore %104 %105 OpStore %106 %107 OpStore %108 %22 OpBranch %109 %109 = OpLabel OpLoopMerge %111 %112 None OpBranch %113 %113 = OpLabel %114 = OpLoad %6 %108 %115 = OpLoad %6 %106 %116 = OpSLessThanEqual %31 %114 %115 OpBranchConditional %116 %110 %111 %110 = OpLabel %118 = OpLoad %6 %104 OpStore %117 %118 OpBranch %119 %119 = OpLabel OpLoopMerge %121 %122 None OpBranch %123 %123 = OpLabel %124 = OpLoad %6 %117 %125 = OpLoad %6 %106 %126 = OpSLessThan %31 %124 %125 OpBranchConditional %126 %120 %121 %120 = OpLabel %128 = OpLoad %6 %117 OpStore %127 %128 %130 = OpLoad %6 %117 %131 = OpLoad %6 %108 %132 = OpIAdd %6 %130 %131 %133 = OpISub %6 %132 %22 OpStore %129 %133 %135 = OpLoad %6 %117 %137 = OpLoad %6 %108 %138 = OpIMul %6 %136 %137 %139 = OpIAdd %6 %135 %138 %140 = OpISub %6 %139 %22 %141 = OpLoad %6 %106 %142 = OpExtInst %6 %1 SMin %140 %141 OpStore %134 %142 %144 = OpLoad %6 %127 OpStore %143 %144 %146 = OpLoad %6 %129 OpStore %145 %146 %148 = OpLoad %6 %134 OpStore %147 %148 %149 = OpFunctionCall %2 %12 %143 %145 %147 OpBranch %122 %122 = OpLabel %150 = OpLoad %6 %108 %151 = OpIMul %6 %136 %150 %152 = OpLoad %6 %117 %153 = OpIAdd %6 %152 %151 OpStore %117 %153 OpBranch %119 %121 = OpLabel OpBranch %112 %112 = OpLabel %154 = OpLoad %6 %108 %155 = OpIMul %6 %136 %154 OpStore %108 %155 OpBranch %109 %111 = OpLabel OpReturn OpFunctionEnd END # uniforms for variant # injectionSwitch BUFFER variant_injectionSwitch DATA_TYPE vec2 DATA 0.0 1.0 END # resolution BUFFER variant_resolution DATA_TYPE vec2 DATA 256.0 256.0 END BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM PIPELINE graphics variant_pipeline ATTACH variant_vertex_shader ATTACH variant_fragment_shader FRAMEBUFFER_SIZE 256 256 BIND BUFFER variant_framebuffer AS color LOCATION 0 BIND BUFFER variant_injectionSwitch AS uniform DESCRIPTOR_SET 0 BINDING 0 BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 1 END CLEAR_COLOR variant_pipeline 0 0 0 255 CLEAR variant_pipeline RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005