Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / graphicsfuzz / stable-colorgrid-modulo-float-mat-determinant-clamp.amber
1 #!amber
2
3 # Copyright 2020 Google LLC
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17
18 # A test for a bug found by the GraphicsFuzz project.
19
20 # Short description: A fragment shader with clamped float in determinant matrix
21
22 # The test passes because both shaders render the same image.
23
24 SHADER vertex reference_vertex_shader PASSTHROUGH
25
26 # reference_fragment_shader is derived from the following GLSL:
27 # #version 320 es
28 # precision highp float;
29 #
30 # precision highp int;
31 #
32 # layout(location = 0) out vec4 _GLF_color;
33 #
34 # layout(set = 0, binding = 0) uniform buf0
35 # {
36 #  vec2 resolution;
37 # };
38 # float compute_value(float limit, float thirty_two)
39 # {
40 #  float result = -0.5;
41 #  for (int i = 1; i < 800; i++)
42 #  {
43 #    if ((i % 32) == 0)
44 #    {
45 #      result += 0.4;
46 #    }
47 #    else
48 #    {
49 #      if (mod(float(i), round(thirty_two)) <= 0.01)
50 #      {
51 #        result += 100.0;
52 #      }
53 #    }
54 #    if (float(i) >= limit)
55 #    {
56 #      return result;
57 #    }
58 #  }
59 #  return result;
60 # }
61 # void main()
62 # {
63 #  vec3 c = vec3(7.0, 8.0, 9.0);
64 #  float thirty_two = round(resolution.x / 8.0);
65 #  c.x = compute_value(gl_FragCoord.x, thirty_two);
66 #  c.y = compute_value(gl_FragCoord.y, thirty_two);
67 #  c.z = c.x + c.y;
68 #  for (int i = 0; i < 3; i++)
69 #  {
70 #    if (c[i] >= 1.0)
71 #    {
72 #      c[i] = c[i] * c[i];
73 #    }
74 #  }
75 #  _GLF_color = vec4(normalize(abs(c)), 1.0);
76 # }
77 SHADER fragment reference_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
78 ; SPIR-V
79 ; Version: 1.0
80 ; Generator: Khronos Glslang Reference Front End; 10
81 ; Bound: 145
82 ; Schema: 0
83                OpCapability Shader
84           %1 = OpExtInstImport "GLSL.std.450"
85                OpMemoryModel Logical GLSL450
86                OpEntryPoint Fragment %4 "main" %85 %137
87                OpExecutionMode %4 OriginUpperLeft
88                OpSource ESSL 320
89                OpName %4 "main"
90                OpName %11 "compute_value(f1;f1;"
91                OpName %9 "limit"
92                OpName %10 "thirty_two"
93                OpName %13 "result"
94                OpName %17 "i"
95                OpName %66 "c"
96                OpName %71 "thirty_two"
97                OpName %73 "buf0"
98                OpMemberName %73 0 "resolution"
99                OpName %75 ""
100                OpName %85 "gl_FragCoord"
101                OpName %86 "param"
102                OpName %90 "param"
103                OpName %94 "param"
104                OpName %98 "param"
105                OpName %109 "i"
106                OpName %137 "_GLF_color"
107                OpMemberDecorate %73 0 Offset 0
108                OpDecorate %73 Block
109                OpDecorate %75 DescriptorSet 0
110                OpDecorate %75 Binding 0
111                OpDecorate %85 BuiltIn FragCoord
112                OpDecorate %137 Location 0
113           %2 = OpTypeVoid
114           %3 = OpTypeFunction %2
115           %6 = OpTypeFloat 32
116           %7 = OpTypePointer Function %6
117           %8 = OpTypeFunction %6 %7 %7
118          %14 = OpConstant %6 -0.5
119          %15 = OpTypeInt 32 1
120          %16 = OpTypePointer Function %15
121          %18 = OpConstant %15 1
122          %25 = OpConstant %15 800
123          %26 = OpTypeBool
124          %29 = OpConstant %15 32
125          %31 = OpConstant %15 0
126          %35 = OpConstant %6 0.400000006
127          %44 = OpConstant %6 0.00999999978
128          %48 = OpConstant %6 100
129          %64 = OpTypeVector %6 3
130          %65 = OpTypePointer Function %64
131          %67 = OpConstant %6 7
132          %68 = OpConstant %6 8
133          %69 = OpConstant %6 9
134          %70 = OpConstantComposite %64 %67 %68 %69
135          %72 = OpTypeVector %6 2
136          %73 = OpTypeStruct %72
137          %74 = OpTypePointer Uniform %73
138          %75 = OpVariable %74 Uniform
139          %76 = OpTypeInt 32 0
140          %77 = OpConstant %76 0
141          %78 = OpTypePointer Uniform %6
142          %83 = OpTypeVector %6 4
143          %84 = OpTypePointer Input %83
144          %85 = OpVariable %84 Input
145          %87 = OpTypePointer Input %6
146          %95 = OpConstant %76 1
147         %107 = OpConstant %76 2
148         %116 = OpConstant %15 3
149         %121 = OpConstant %6 1
150         %136 = OpTypePointer Output %83
151         %137 = OpVariable %136 Output
152           %4 = OpFunction %2 None %3
153           %5 = OpLabel
154          %66 = OpVariable %65 Function
155          %71 = OpVariable %7 Function
156          %86 = OpVariable %7 Function
157          %90 = OpVariable %7 Function
158          %94 = OpVariable %7 Function
159          %98 = OpVariable %7 Function
160         %109 = OpVariable %16 Function
161                OpStore %66 %70
162          %79 = OpAccessChain %78 %75 %31 %77
163          %80 = OpLoad %6 %79
164          %81 = OpFDiv %6 %80 %68
165          %82 = OpExtInst %6 %1 Round %81
166                OpStore %71 %82
167          %88 = OpAccessChain %87 %85 %77
168          %89 = OpLoad %6 %88
169                OpStore %86 %89
170          %91 = OpLoad %6 %71
171                OpStore %90 %91
172          %92 = OpFunctionCall %6 %11 %86 %90
173          %93 = OpAccessChain %7 %66 %77
174                OpStore %93 %92
175          %96 = OpAccessChain %87 %85 %95
176          %97 = OpLoad %6 %96
177                OpStore %94 %97
178          %99 = OpLoad %6 %71
179                OpStore %98 %99
180         %100 = OpFunctionCall %6 %11 %94 %98
181         %101 = OpAccessChain %7 %66 %95
182                OpStore %101 %100
183         %102 = OpAccessChain %7 %66 %77
184         %103 = OpLoad %6 %102
185         %104 = OpAccessChain %7 %66 %95
186         %105 = OpLoad %6 %104
187         %106 = OpFAdd %6 %103 %105
188         %108 = OpAccessChain %7 %66 %107
189                OpStore %108 %106
190                OpStore %109 %31
191                OpBranch %110
192         %110 = OpLabel
193                OpLoopMerge %112 %113 None
194                OpBranch %114
195         %114 = OpLabel
196         %115 = OpLoad %15 %109
197         %117 = OpSLessThan %26 %115 %116
198                OpBranchConditional %117 %111 %112
199         %111 = OpLabel
200         %118 = OpLoad %15 %109
201         %119 = OpAccessChain %7 %66 %118
202         %120 = OpLoad %6 %119
203         %122 = OpFOrdGreaterThanEqual %26 %120 %121
204                OpSelectionMerge %124 None
205                OpBranchConditional %122 %123 %124
206         %123 = OpLabel
207         %125 = OpLoad %15 %109
208         %126 = OpLoad %15 %109
209         %127 = OpAccessChain %7 %66 %126
210         %128 = OpLoad %6 %127
211         %129 = OpLoad %15 %109
212         %130 = OpAccessChain %7 %66 %129
213         %131 = OpLoad %6 %130
214         %132 = OpFMul %6 %128 %131
215         %133 = OpAccessChain %7 %66 %125
216                OpStore %133 %132
217                OpBranch %124
218         %124 = OpLabel
219                OpBranch %113
220         %113 = OpLabel
221         %134 = OpLoad %15 %109
222         %135 = OpIAdd %15 %134 %18
223                OpStore %109 %135
224                OpBranch %110
225         %112 = OpLabel
226         %138 = OpLoad %64 %66
227         %139 = OpExtInst %64 %1 FAbs %138
228         %140 = OpExtInst %64 %1 Normalize %139
229         %141 = OpCompositeExtract %6 %140 0
230         %142 = OpCompositeExtract %6 %140 1
231         %143 = OpCompositeExtract %6 %140 2
232         %144 = OpCompositeConstruct %83 %141 %142 %143 %121
233                OpStore %137 %144
234                OpReturn
235                OpFunctionEnd
236          %11 = OpFunction %6 None %8
237           %9 = OpFunctionParameter %7
238          %10 = OpFunctionParameter %7
239          %12 = OpLabel
240          %13 = OpVariable %7 Function
241          %17 = OpVariable %16 Function
242                OpStore %13 %14
243                OpStore %17 %18
244                OpBranch %19
245          %19 = OpLabel
246                OpLoopMerge %21 %22 None
247                OpBranch %23
248          %23 = OpLabel
249          %24 = OpLoad %15 %17
250          %27 = OpSLessThan %26 %24 %25
251                OpBranchConditional %27 %20 %21
252          %20 = OpLabel
253          %28 = OpLoad %15 %17
254          %30 = OpSMod %15 %28 %29
255          %32 = OpIEqual %26 %30 %31
256                OpSelectionMerge %34 None
257                OpBranchConditional %32 %33 %38
258          %33 = OpLabel
259          %36 = OpLoad %6 %13
260          %37 = OpFAdd %6 %36 %35
261                OpStore %13 %37
262                OpBranch %34
263          %38 = OpLabel
264          %39 = OpLoad %15 %17
265          %40 = OpConvertSToF %6 %39
266          %41 = OpLoad %6 %10
267          %42 = OpExtInst %6 %1 Round %41
268          %43 = OpFMod %6 %40 %42
269          %45 = OpFOrdLessThanEqual %26 %43 %44
270                OpSelectionMerge %47 None
271                OpBranchConditional %45 %46 %47
272          %46 = OpLabel
273          %49 = OpLoad %6 %13
274          %50 = OpFAdd %6 %49 %48
275                OpStore %13 %50
276                OpBranch %47
277          %47 = OpLabel
278                OpBranch %34
279          %34 = OpLabel
280          %51 = OpLoad %15 %17
281          %52 = OpConvertSToF %6 %51
282          %53 = OpLoad %6 %9
283          %54 = OpFOrdGreaterThanEqual %26 %52 %53
284                OpSelectionMerge %56 None
285                OpBranchConditional %54 %55 %56
286          %55 = OpLabel
287          %57 = OpLoad %6 %13
288                OpReturnValue %57
289          %56 = OpLabel
290                OpBranch %22
291          %22 = OpLabel
292          %59 = OpLoad %15 %17
293          %60 = OpIAdd %15 %59 %18
294                OpStore %17 %60
295                OpBranch %19
296          %21 = OpLabel
297          %61 = OpLoad %6 %13
298                OpReturnValue %61
299                OpFunctionEnd
300 END
301
302 # uniforms for reference
303
304 # resolution
305 BUFFER reference_resolution DATA_TYPE vec2<float> STD140 DATA
306  256.0 256.0
307 END
308
309 BUFFER reference_framebuffer FORMAT B8G8R8A8_UNORM
310
311 PIPELINE graphics reference_pipeline
312   ATTACH reference_vertex_shader
313   ATTACH reference_fragment_shader
314   FRAMEBUFFER_SIZE 256 256
315   BIND BUFFER reference_framebuffer AS color LOCATION 0
316   BIND BUFFER reference_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
317 END
318 CLEAR_COLOR reference_pipeline 0 0 0 255
319
320 CLEAR reference_pipeline
321 RUN reference_pipeline DRAW_RECT POS 0 0 SIZE 256 256
322
323
324 SHADER vertex variant_vertex_shader PASSTHROUGH
325
326 # variant_fragment_shader is derived from the following GLSL:
327 # #version 320 es
328 # precision highp float;
329 #
330 # precision highp int;
331 #
332 # layout(location = 0) out vec4 _GLF_color;
333 #
334 # layout(set = 0, binding = 0) uniform buf0
335 # {
336 #   vec2 resolution;
337 # };
338 # float compute_value(float limit, float thirty_two)
339 # {
340 #  float result = -0.5;
341 #  for (int i = 1; i < 800; i++)
342 #  {
343 #    if ((i % 32) == 0)
344 #    {
345 #      result += 0.4;
346 #    }
347 #    else
348 #    {
349 #      if (mod(float(i), round(thirty_two)) <= 0.01)
350 #      {
351 #        result += 100.0;
352 #      }
353 #    }
354 #    if (float(i) >= limit)
355 #    {
356 #      // clamp_a == 1.0
357 #      float clamp_a = clamp((1.0), (1.0), ((gl_FragCoord.y < 0.0) ? (-1.0) : (false ? exp(result) : 1.0)));
358 #      // det_a == 1.0
359 #      float det_a = determinant(mat4(1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, clamp_a));
360 #      // Type casting matrix to float takes the first value in matrix.
361 #      // float_a == result
362 #      float float_a = float(mat4x3(((result) / det_a), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0));
363 #      // Returns result.
364 #      return float_a;
365 #    }
366 #  }
367 #  return result;
368 # }
369 # void main()
370 # {
371 #  vec3 c = vec3(7.0, 8.0, 9.0);
372 #  float thirty_two = round(resolution.x / 8.0);
373 #  c.x = compute_value(gl_FragCoord.x, thirty_two);
374 #  c.y = compute_value(gl_FragCoord.y, thirty_two);
375 #  c.z = c.x + c.y;
376 #  for (int i = 0; i < 3; i++)
377 #  {
378 #    if (c[i] >= 1.0)
379 #    {
380 #      c[i] = c[i] * c[i];
381 #    }
382 #  }
383 #  _GLF_color = vec4(normalize(abs(c)), 1.0);
384 # }
385 SHADER fragment variant_fragment_shader SPIRV-ASM TARGET_ENV spv1.0
386 ; SPIR-V
387 ; Version: 1.0
388 ; Generator: Khronos Glslang Reference Front End; 10
389 ; Bound: 185
390 ; Schema: 0
391                OpCapability Shader
392           %1 = OpExtInstImport "GLSL.std.450"
393                OpMemoryModel Logical GLSL450
394                OpEntryPoint Fragment %4 "main" %61 %177
395                OpExecutionMode %4 OriginUpperLeft
396                OpSource ESSL 320
397                OpName %4 "main"
398                OpName %11 "compute_value(f1;f1;"
399                OpName %9 "limit"
400                OpName %10 "thirty_two"
401                OpName %13 "result"
402                OpName %17 "i"
403                OpName %57 "clamp_a"
404                OpName %61 "gl_FragCoord"
405                OpName %84 "det_a"
406                OpName %93 "float_a"
407                OpName %113 "c"
408                OpName %118 "thirty_two"
409                OpName %120 "buf0"
410                OpMemberName %120 0 "resolution"
411                OpName %122 ""
412                OpName %129 "param"
413                OpName %132 "param"
414                OpName %136 "param"
415                OpName %139 "param"
416                OpName %150 "i"
417                OpName %177 "_GLF_color"
418                OpDecorate %61 BuiltIn FragCoord
419                OpMemberDecorate %120 0 Offset 0
420                OpDecorate %120 Block
421                OpDecorate %122 DescriptorSet 0
422                OpDecorate %122 Binding 0
423                OpDecorate %177 Location 0
424           %2 = OpTypeVoid
425           %3 = OpTypeFunction %2
426           %6 = OpTypeFloat 32
427           %7 = OpTypePointer Function %6
428           %8 = OpTypeFunction %6 %7 %7
429          %14 = OpConstant %6 -0.5
430          %15 = OpTypeInt 32 1
431          %16 = OpTypePointer Function %15
432          %18 = OpConstant %15 1
433          %25 = OpConstant %15 800
434          %26 = OpTypeBool
435          %29 = OpConstant %15 32
436          %31 = OpConstant %15 0
437          %35 = OpConstant %6 0.400000006
438          %44 = OpConstant %6 0.00999999978
439          %48 = OpConstant %6 100
440          %58 = OpConstant %6 1
441          %59 = OpTypeVector %6 4
442          %60 = OpTypePointer Input %59
443          %61 = OpVariable %60 Input
444          %62 = OpTypeInt 32 0
445          %63 = OpConstant %62 1
446          %64 = OpTypePointer Input %6
447          %67 = OpConstant %6 0
448          %72 = OpConstant %6 -1
449          %74 = OpConstantFalse %26
450          %86 = OpTypeMatrix %59 4
451          %97 = OpTypeVector %6 3
452          %98 = OpTypeMatrix %97 4
453         %112 = OpTypePointer Function %97
454         %114 = OpConstant %6 7
455         %115 = OpConstant %6 8
456         %116 = OpConstant %6 9
457         %117 = OpConstantComposite %97 %114 %115 %116
458         %119 = OpTypeVector %6 2
459         %120 = OpTypeStruct %119
460         %121 = OpTypePointer Uniform %120
461         %122 = OpVariable %121 Uniform
462         %123 = OpConstant %62 0
463         %124 = OpTypePointer Uniform %6
464         %148 = OpConstant %62 2
465         %157 = OpConstant %15 3
466         %176 = OpTypePointer Output %59
467         %177 = OpVariable %176 Output
468           %4 = OpFunction %2 None %3
469           %5 = OpLabel
470         %113 = OpVariable %112 Function
471         %118 = OpVariable %7 Function
472         %129 = OpVariable %7 Function
473         %132 = OpVariable %7 Function
474         %136 = OpVariable %7 Function
475         %139 = OpVariable %7 Function
476         %150 = OpVariable %16 Function
477                OpStore %113 %117
478         %125 = OpAccessChain %124 %122 %31 %123
479         %126 = OpLoad %6 %125
480         %127 = OpFDiv %6 %126 %115
481         %128 = OpExtInst %6 %1 Round %127
482                OpStore %118 %128
483         %130 = OpAccessChain %64 %61 %123
484         %131 = OpLoad %6 %130
485                OpStore %129 %131
486         %133 = OpLoad %6 %118
487                OpStore %132 %133
488         %134 = OpFunctionCall %6 %11 %129 %132
489         %135 = OpAccessChain %7 %113 %123
490                OpStore %135 %134
491         %137 = OpAccessChain %64 %61 %63
492         %138 = OpLoad %6 %137
493                OpStore %136 %138
494         %140 = OpLoad %6 %118
495                OpStore %139 %140
496         %141 = OpFunctionCall %6 %11 %136 %139
497         %142 = OpAccessChain %7 %113 %63
498                OpStore %142 %141
499         %143 = OpAccessChain %7 %113 %123
500         %144 = OpLoad %6 %143
501         %145 = OpAccessChain %7 %113 %63
502         %146 = OpLoad %6 %145
503         %147 = OpFAdd %6 %144 %146
504         %149 = OpAccessChain %7 %113 %148
505                OpStore %149 %147
506                OpStore %150 %31
507                OpBranch %151
508         %151 = OpLabel
509                OpLoopMerge %153 %154 None
510                OpBranch %155
511         %155 = OpLabel
512         %156 = OpLoad %15 %150
513         %158 = OpSLessThan %26 %156 %157
514                OpBranchConditional %158 %152 %153
515         %152 = OpLabel
516         %159 = OpLoad %15 %150
517         %160 = OpAccessChain %7 %113 %159
518         %161 = OpLoad %6 %160
519         %162 = OpFOrdGreaterThanEqual %26 %161 %58
520                OpSelectionMerge %164 None
521                OpBranchConditional %162 %163 %164
522         %163 = OpLabel
523         %165 = OpLoad %15 %150
524         %166 = OpLoad %15 %150
525         %167 = OpAccessChain %7 %113 %166
526         %168 = OpLoad %6 %167
527         %169 = OpLoad %15 %150
528         %170 = OpAccessChain %7 %113 %169
529         %171 = OpLoad %6 %170
530         %172 = OpFMul %6 %168 %171
531         %173 = OpAccessChain %7 %113 %165
532                OpStore %173 %172
533                OpBranch %164
534         %164 = OpLabel
535                OpBranch %154
536         %154 = OpLabel
537         %174 = OpLoad %15 %150
538         %175 = OpIAdd %15 %174 %18
539                OpStore %150 %175
540                OpBranch %151
541         %153 = OpLabel
542         %178 = OpLoad %97 %113
543         %179 = OpExtInst %97 %1 FAbs %178
544         %180 = OpExtInst %97 %1 Normalize %179
545         %181 = OpCompositeExtract %6 %180 0
546         %182 = OpCompositeExtract %6 %180 1
547         %183 = OpCompositeExtract %6 %180 2
548         %184 = OpCompositeConstruct %59 %181 %182 %183 %58
549                OpStore %177 %184
550                OpReturn
551                OpFunctionEnd
552          %11 = OpFunction %6 None %8
553           %9 = OpFunctionParameter %7
554          %10 = OpFunctionParameter %7
555          %12 = OpLabel
556          %13 = OpVariable %7 Function
557          %17 = OpVariable %16 Function
558          %57 = OpVariable %7 Function
559          %69 = OpVariable %7 Function
560          %75 = OpVariable %7 Function
561          %84 = OpVariable %7 Function
562          %93 = OpVariable %7 Function
563                OpStore %13 %14
564                OpStore %17 %18
565                OpBranch %19
566          %19 = OpLabel
567                OpLoopMerge %21 %22 None
568                OpBranch %23
569          %23 = OpLabel
570          %24 = OpLoad %15 %17
571          %27 = OpSLessThan %26 %24 %25
572                OpBranchConditional %27 %20 %21
573          %20 = OpLabel
574          %28 = OpLoad %15 %17
575          %30 = OpSMod %15 %28 %29
576          %32 = OpIEqual %26 %30 %31
577                OpSelectionMerge %34 None
578                OpBranchConditional %32 %33 %38
579          %33 = OpLabel
580          %36 = OpLoad %6 %13
581          %37 = OpFAdd %6 %36 %35
582                OpStore %13 %37
583                OpBranch %34
584          %38 = OpLabel
585          %39 = OpLoad %15 %17
586          %40 = OpConvertSToF %6 %39
587          %41 = OpLoad %6 %10
588          %42 = OpExtInst %6 %1 Round %41
589          %43 = OpFMod %6 %40 %42
590          %45 = OpFOrdLessThanEqual %26 %43 %44
591                OpSelectionMerge %47 None
592                OpBranchConditional %45 %46 %47
593          %46 = OpLabel
594          %49 = OpLoad %6 %13
595          %50 = OpFAdd %6 %49 %48
596                OpStore %13 %50
597                OpBranch %47
598          %47 = OpLabel
599                OpBranch %34
600          %34 = OpLabel
601          %51 = OpLoad %15 %17
602          %52 = OpConvertSToF %6 %51
603          %53 = OpLoad %6 %9
604          %54 = OpFOrdGreaterThanEqual %26 %52 %53
605                OpSelectionMerge %56 None
606                OpBranchConditional %54 %55 %56
607          %55 = OpLabel
608          %65 = OpAccessChain %64 %61 %63
609          %66 = OpLoad %6 %65
610          %68 = OpFOrdLessThan %26 %66 %67
611                OpSelectionMerge %71 None
612                OpBranchConditional %68 %70 %73
613          %70 = OpLabel
614                OpStore %69 %72
615                OpBranch %71
616          %73 = OpLabel
617                OpSelectionMerge %77 None
618                OpBranchConditional %74 %76 %80
619          %76 = OpLabel
620          %78 = OpLoad %6 %13
621          %79 = OpExtInst %6 %1 Exp %78
622                OpStore %75 %79
623                OpBranch %77
624          %80 = OpLabel
625                OpStore %75 %58
626                OpBranch %77
627          %77 = OpLabel
628          %81 = OpLoad %6 %75
629                OpStore %69 %81
630                OpBranch %71
631          %71 = OpLabel
632          %82 = OpLoad %6 %69
633          %83 = OpExtInst %6 %1 FClamp %58 %58 %82
634                OpStore %57 %83
635          %85 = OpLoad %6 %57
636          %87 = OpCompositeConstruct %59 %58 %58 %58 %58
637          %88 = OpCompositeConstruct %59 %67 %58 %58 %67
638          %89 = OpCompositeConstruct %59 %67 %67 %58 %67
639          %90 = OpCompositeConstruct %59 %67 %67 %67 %85
640          %91 = OpCompositeConstruct %86 %87 %88 %89 %90
641          %92 = OpExtInst %6 %1 Determinant %91
642                OpStore %84 %92
643          %94 = OpLoad %6 %13
644          %95 = OpLoad %6 %84
645          %96 = OpFDiv %6 %94 %95
646          %99 = OpCompositeConstruct %97 %96 %67 %67
647         %100 = OpCompositeConstruct %97 %67 %67 %67
648         %101 = OpCompositeConstruct %97 %67 %58 %58
649         %102 = OpCompositeConstruct %97 %58 %67 %58
650         %103 = OpCompositeConstruct %98 %99 %100 %101 %102
651         %104 = OpCompositeExtract %6 %103 0 0
652                OpStore %93 %104
653         %105 = OpLoad %6 %93
654                OpReturnValue %105
655          %56 = OpLabel
656                OpBranch %22
657          %22 = OpLabel
658         %107 = OpLoad %15 %17
659         %108 = OpIAdd %15 %107 %18
660                OpStore %17 %108
661                OpBranch %19
662          %21 = OpLabel
663         %109 = OpLoad %6 %13
664                OpReturnValue %109
665                OpFunctionEnd
666 END
667
668 # uniforms for variant
669
670 # resolution
671 BUFFER variant_resolution DATA_TYPE vec2<float> STD140 DATA
672  256.0 256.0
673 END
674
675 BUFFER variant_framebuffer FORMAT B8G8R8A8_UNORM
676
677 PIPELINE graphics variant_pipeline
678   ATTACH variant_vertex_shader
679   ATTACH variant_fragment_shader
680   FRAMEBUFFER_SIZE 256 256
681   BIND BUFFER variant_framebuffer AS color LOCATION 0
682   BIND BUFFER variant_resolution AS uniform DESCRIPTOR_SET 0 BINDING 0
683 END
684 CLEAR_COLOR variant_pipeline 0 0 0 255
685
686 CLEAR variant_pipeline
687 RUN variant_pipeline DRAW_RECT POS 0 0 SIZE 256 256
688
689 EXPECT reference_framebuffer EQ_HISTOGRAM_EMD_BUFFER variant_framebuffer TOLERANCE 0.005