1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_tests.py
3 //
4 // Copyright (c) 2022 Google LLC.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17
18 #include "../diff_test_utils.h"
19
20 #include "gtest/gtest.h"
21
22 namespace spvtools {
23 namespace diff {
24 namespace {
25
26 // Test where variable set/binding/location decorations are different between
27 // src and dst fragment shaders.
28 constexpr char kSrc[] = R"(OpCapability Shader
29 OpMemoryModel Logical GLSL450
30 OpEntryPoint Fragment %63 "main" %4 %22
31 OpExecutionMode %63 OriginUpperLeft
32 OpSource GLSL 450
33 OpName %4 "_ue"
34 OpName %8 "_uf"
35 OpName %11 "_ug"
36 OpName %12 "_uA"
37 OpMemberName %12 0 "_ux"
38 OpName %14 "_uc"
39 OpName %15 "_uB"
40 OpMemberName %15 0 "_ux"
41 OpName %20 "_ud"
42 OpName %22 "_ucol"
43 OpName %26 "ANGLEDepthRangeParams"
44 OpMemberName %26 0 "near"
45 OpMemberName %26 1 "far"
46 OpMemberName %26 2 "diff"
47 OpMemberName %26 3 "reserved"
48 OpName %27 "ANGLEUniformBlock"
49 OpMemberName %27 0 "viewport"
50 OpMemberName %27 1 "clipDistancesEnabled"
51 OpMemberName %27 2 "xfbActiveUnpaused"
52 OpMemberName %27 3 "xfbVerticesPerInstance"
53 OpMemberName %27 4 "numSamples"
54 OpMemberName %27 5 "xfbBufferOffsets"
55 OpMemberName %27 6 "acbBufferOffsets"
56 OpMemberName %27 7 "depthRange"
57 OpName %29 "ANGLEUniforms"
58 OpName %33 "_uc"
59 OpName %32 "_uh"
60 OpName %49 "_ux"
61 OpName %50 "_uy"
62 OpName %48 "_ui"
63 OpName %63 "main"
64 OpName %65 "param"
65 OpName %68 "param"
66 OpName %73 "param"
67 OpDecorate %4 Location 0
68 OpDecorate %8 RelaxedPrecision
69 OpDecorate %8 DescriptorSet 0
70 OpDecorate %8 Binding 0
71 OpDecorate %11 DescriptorSet 0
72 OpDecorate %11 Binding 1
73 OpMemberDecorate %12 0 Offset 0
74 OpMemberDecorate %12 0 RelaxedPrecision
75 OpDecorate %12 Block
76 OpDecorate %14 DescriptorSet 0
77 OpDecorate %14 Binding 2
78 OpMemberDecorate %15 0 Offset 0
79 OpMemberDecorate %15 0 RelaxedPrecision
80 OpDecorate %15 BufferBlock
81 OpDecorate %20 DescriptorSet 0
82 OpDecorate %20 Binding 3
83 OpDecorate %22 RelaxedPrecision
84 OpDecorate %22 Location 0
85 OpMemberDecorate %26 0 Offset 0
86 OpMemberDecorate %26 1 Offset 4
87 OpMemberDecorate %26 2 Offset 8
88 OpMemberDecorate %26 3 Offset 12
89 OpMemberDecorate %27 0 Offset 0
90 OpMemberDecorate %27 1 Offset 16
91 OpMemberDecorate %27 2 Offset 20
92 OpMemberDecorate %27 3 Offset 24
93 OpMemberDecorate %27 4 Offset 28
94 OpMemberDecorate %27 5 Offset 32
95 OpMemberDecorate %27 6 Offset 48
96 OpMemberDecorate %27 7 Offset 64
97 OpMemberDecorate %27 2 RelaxedPrecision
98 OpMemberDecorate %27 4 RelaxedPrecision
99 OpDecorate %27 Block
100 OpDecorate %29 DescriptorSet 0
101 OpDecorate %29 Binding 4
102 OpDecorate %32 RelaxedPrecision
103 OpDecorate %33 RelaxedPrecision
104 OpDecorate %36 RelaxedPrecision
105 OpDecorate %37 RelaxedPrecision
106 OpDecorate %38 RelaxedPrecision
107 OpDecorate %39 RelaxedPrecision
108 OpDecorate %41 RelaxedPrecision
109 OpDecorate %42 RelaxedPrecision
110 OpDecorate %43 RelaxedPrecision
111 OpDecorate %48 RelaxedPrecision
112 OpDecorate %49 RelaxedPrecision
113 OpDecorate %50 RelaxedPrecision
114 OpDecorate %52 RelaxedPrecision
115 OpDecorate %53 RelaxedPrecision
116 OpDecorate %54 RelaxedPrecision
117 OpDecorate %55 RelaxedPrecision
118 OpDecorate %56 RelaxedPrecision
119 OpDecorate %57 RelaxedPrecision
120 OpDecorate %58 RelaxedPrecision
121 OpDecorate %59 RelaxedPrecision
122 OpDecorate %60 RelaxedPrecision
123 OpDecorate %67 RelaxedPrecision
124 OpDecorate %68 RelaxedPrecision
125 OpDecorate %72 RelaxedPrecision
126 OpDecorate %73 RelaxedPrecision
127 OpDecorate %75 RelaxedPrecision
128 OpDecorate %76 RelaxedPrecision
129 OpDecorate %77 RelaxedPrecision
130 OpDecorate %80 RelaxedPrecision
131 OpDecorate %81 RelaxedPrecision
132 %1 = OpTypeFloat 32
133 %2 = OpTypeVector %1 4
134 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
135 %6 = OpTypeSampledImage %5
136 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
137 %12 = OpTypeStruct %2
138 %15 = OpTypeStruct %2
139 %16 = OpTypeInt 32 0
140 %17 = OpConstant %16 2
141 %18 = OpTypeArray %15 %17
142 %23 = OpTypeInt 32 1
143 %24 = OpTypeVector %23 4
144 %25 = OpTypeVector %16 4
145 %26 = OpTypeStruct %1 %1 %1 %1
146 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
147 %35 = OpTypeVector %1 2
148 %40 = OpTypeVector %23 2
149 %61 = OpTypeVoid
150 %69 = OpConstant %16 0
151 %78 = OpConstant %16 1
152 %3 = OpTypePointer Input %2
153 %7 = OpTypePointer UniformConstant %6
154 %10 = OpTypePointer UniformConstant %9
155 %13 = OpTypePointer Uniform %12
156 %19 = OpTypePointer Uniform %18
157 %21 = OpTypePointer Output %2
158 %28 = OpTypePointer Uniform %27
159 %30 = OpTypePointer Function %2
160 %70 = OpTypePointer Uniform %2
161 %31 = OpTypeFunction %2 %30
162 %47 = OpTypeFunction %2 %30 %30
163 %62 = OpTypeFunction %61
164 %4 = OpVariable %3 Input
165 %8 = OpVariable %7 UniformConstant
166 %11 = OpVariable %10 UniformConstant
167 %14 = OpVariable %13 Uniform
168 %20 = OpVariable %19 Uniform
169 %22 = OpVariable %21 Output
170 %29 = OpVariable %28 Uniform
171 %32 = OpFunction %2 None %31
172 %33 = OpFunctionParameter %30
173 %34 = OpLabel
174 %36 = OpLoad %6 %8
175 %37 = OpLoad %2 %33
176 %38 = OpVectorShuffle %35 %37 %37 0 1
177 %39 = OpImageSampleImplicitLod %2 %36 %38
178 %41 = OpLoad %2 %33
179 %42 = OpVectorShuffle %35 %41 %41 2 3
180 %43 = OpConvertFToS %40 %42
181 %44 = OpLoad %9 %11
182 %45 = OpImageRead %2 %44 %43
183 %46 = OpFAdd %2 %39 %45
184 OpReturnValue %46
185 OpFunctionEnd
186 %48 = OpFunction %2 None %47
187 %49 = OpFunctionParameter %30
188 %50 = OpFunctionParameter %30
189 %51 = OpLabel
190 %52 = OpLoad %2 %49
191 %53 = OpVectorShuffle %35 %52 %52 0 1
192 %54 = OpLoad %2 %50
193 %55 = OpVectorShuffle %35 %54 %54 2 3
194 %56 = OpCompositeExtract %1 %53 0
195 %57 = OpCompositeExtract %1 %53 1
196 %58 = OpCompositeExtract %1 %55 0
197 %59 = OpCompositeExtract %1 %55 1
198 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
199 OpReturnValue %60
200 OpFunctionEnd
201 %63 = OpFunction %61 None %62
202 %64 = OpLabel
203 %65 = OpVariable %30 Function
204 %68 = OpVariable %30 Function
205 %73 = OpVariable %30 Function
206 %66 = OpLoad %2 %4
207 OpStore %65 %66
208 %67 = OpFunctionCall %2 %32 %65
209 %71 = OpAccessChain %70 %14 %69
210 %72 = OpLoad %2 %71
211 OpStore %68 %72
212 %74 = OpAccessChain %70 %20 %69 %69
213 %75 = OpLoad %2 %74
214 OpStore %73 %75
215 %76 = OpFunctionCall %2 %48 %68 %73
216 %77 = OpFAdd %2 %67 %76
217 %79 = OpAccessChain %70 %20 %78 %69
218 %80 = OpLoad %2 %79
219 %81 = OpFAdd %2 %77 %80
220 OpStore %22 %81
221 OpReturn
222 OpFunctionEnd
223 )";
224 constexpr char kDst[] = R"(OpCapability Shader
225 OpMemoryModel Logical GLSL450
226 OpEntryPoint Fragment %63 "main" %4 %22
227 OpExecutionMode %63 OriginUpperLeft
228 OpSource GLSL 450
229 OpName %4 "_ue"
230 OpName %8 "_uf"
231 OpName %11 "_ug"
232 OpName %12 "_uA"
233 OpMemberName %12 0 "_ux"
234 OpName %14 "_uc"
235 OpName %15 "_uB"
236 OpMemberName %15 0 "_ux"
237 OpName %20 "_ud"
238 OpName %22 "_ucol"
239 OpName %26 "ANGLEDepthRangeParams"
240 OpMemberName %26 0 "near"
241 OpMemberName %26 1 "far"
242 OpMemberName %26 2 "diff"
243 OpMemberName %26 3 "reserved"
244 OpName %27 "ANGLEUniformBlock"
245 OpMemberName %27 0 "viewport"
246 OpMemberName %27 1 "clipDistancesEnabled"
247 OpMemberName %27 2 "xfbActiveUnpaused"
248 OpMemberName %27 3 "xfbVerticesPerInstance"
249 OpMemberName %27 4 "numSamples"
250 OpMemberName %27 5 "xfbBufferOffsets"
251 OpMemberName %27 6 "acbBufferOffsets"
252 OpMemberName %27 7 "depthRange"
253 OpName %29 "ANGLEUniforms"
254 OpName %33 "_uc"
255 OpName %32 "_uh"
256 OpName %49 "_ux"
257 OpName %50 "_uy"
258 OpName %48 "_ui"
259 OpName %63 "main"
260 OpName %65 "param"
261 OpName %68 "param"
262 OpName %73 "param"
263 OpDecorate %4 Location 1
264 OpDecorate %8 RelaxedPrecision
265 OpDecorate %8 DescriptorSet 2
266 OpDecorate %8 Binding 0
267 OpDecorate %11 DescriptorSet 3
268 OpDecorate %11 Binding 0
269 OpMemberDecorate %12 0 Offset 0
270 OpMemberDecorate %12 0 RelaxedPrecision
271 OpDecorate %12 Block
272 OpDecorate %14 DescriptorSet 3
273 OpDecorate %14 Binding 1
274 OpMemberDecorate %15 0 Offset 0
275 OpMemberDecorate %15 0 RelaxedPrecision
276 OpDecorate %15 BufferBlock
277 OpDecorate %20 DescriptorSet 3
278 OpDecorate %20 Binding 2
279 OpDecorate %22 RelaxedPrecision
280 OpDecorate %22 Location 1
281 OpMemberDecorate %26 0 Offset 0
282 OpMemberDecorate %26 1 Offset 4
283 OpMemberDecorate %26 2 Offset 8
284 OpMemberDecorate %26 3 Offset 12
285 OpMemberDecorate %27 0 Offset 0
286 OpMemberDecorate %27 1 Offset 16
287 OpMemberDecorate %27 2 Offset 20
288 OpMemberDecorate %27 3 Offset 24
289 OpMemberDecorate %27 4 Offset 28
290 OpMemberDecorate %27 5 Offset 32
291 OpMemberDecorate %27 6 Offset 48
292 OpMemberDecorate %27 7 Offset 64
293 OpMemberDecorate %27 2 RelaxedPrecision
294 OpMemberDecorate %27 4 RelaxedPrecision
295 OpDecorate %27 Block
296 OpDecorate %29 DescriptorSet 0
297 OpDecorate %29 Binding 0
298 OpDecorate %32 RelaxedPrecision
299 OpDecorate %33 RelaxedPrecision
300 OpDecorate %36 RelaxedPrecision
301 OpDecorate %37 RelaxedPrecision
302 OpDecorate %38 RelaxedPrecision
303 OpDecorate %39 RelaxedPrecision
304 OpDecorate %41 RelaxedPrecision
305 OpDecorate %42 RelaxedPrecision
306 OpDecorate %43 RelaxedPrecision
307 OpDecorate %48 RelaxedPrecision
308 OpDecorate %49 RelaxedPrecision
309 OpDecorate %50 RelaxedPrecision
310 OpDecorate %52 RelaxedPrecision
311 OpDecorate %53 RelaxedPrecision
312 OpDecorate %54 RelaxedPrecision
313 OpDecorate %55 RelaxedPrecision
314 OpDecorate %56 RelaxedPrecision
315 OpDecorate %57 RelaxedPrecision
316 OpDecorate %58 RelaxedPrecision
317 OpDecorate %59 RelaxedPrecision
318 OpDecorate %60 RelaxedPrecision
319 OpDecorate %67 RelaxedPrecision
320 OpDecorate %68 RelaxedPrecision
321 OpDecorate %72 RelaxedPrecision
322 OpDecorate %73 RelaxedPrecision
323 OpDecorate %75 RelaxedPrecision
324 OpDecorate %76 RelaxedPrecision
325 OpDecorate %77 RelaxedPrecision
326 OpDecorate %80 RelaxedPrecision
327 OpDecorate %81 RelaxedPrecision
328 %1 = OpTypeFloat 32
329 %2 = OpTypeVector %1 4
330 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
331 %6 = OpTypeSampledImage %5
332 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
333 %12 = OpTypeStruct %2
334 %15 = OpTypeStruct %2
335 %16 = OpTypeInt 32 0
336 %17 = OpConstant %16 2
337 %18 = OpTypeArray %15 %17
338 %23 = OpTypeInt 32 1
339 %24 = OpTypeVector %23 4
340 %25 = OpTypeVector %16 4
341 %26 = OpTypeStruct %1 %1 %1 %1
342 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
343 %35 = OpTypeVector %1 2
344 %40 = OpTypeVector %23 2
345 %61 = OpTypeVoid
346 %69 = OpConstant %16 0
347 %78 = OpConstant %16 1
348 %82 = OpTypePointer Private %2
349 %3 = OpTypePointer Input %2
350 %7 = OpTypePointer UniformConstant %6
351 %10 = OpTypePointer UniformConstant %9
352 %13 = OpTypePointer Uniform %12
353 %19 = OpTypePointer Uniform %18
354 %83 = OpTypePointer Private %2
355 %21 = OpTypePointer Output %2
356 %28 = OpTypePointer Uniform %27
357 %30 = OpTypePointer Function %2
358 %70 = OpTypePointer Uniform %2
359 %31 = OpTypeFunction %2 %30
360 %47 = OpTypeFunction %2 %30 %30
361 %62 = OpTypeFunction %61
362 %4 = OpVariable %3 Input
363 %8 = OpVariable %7 UniformConstant
364 %11 = OpVariable %10 UniformConstant
365 %14 = OpVariable %13 Uniform
366 %20 = OpVariable %19 Uniform
367 %22 = OpVariable %21 Output
368 %29 = OpVariable %28 Uniform
369 %84 = OpConstant %23 0
370 %85 = OpConstant %1 0.5
371 %32 = OpFunction %2 None %31
372 %33 = OpFunctionParameter %30
373 %34 = OpLabel
374 %36 = OpLoad %6 %8
375 %37 = OpLoad %2 %33
376 %38 = OpVectorShuffle %35 %37 %37 0 1
377 %39 = OpImageSampleImplicitLod %2 %36 %38
378 %41 = OpLoad %2 %33
379 %42 = OpVectorShuffle %35 %41 %41 2 3
380 %43 = OpConvertFToS %40 %42
381 %44 = OpLoad %9 %11
382 %45 = OpImageRead %2 %44 %43
383 %46 = OpFAdd %2 %39 %45
384 OpReturnValue %46
385 OpFunctionEnd
386 %48 = OpFunction %2 None %47
387 %49 = OpFunctionParameter %30
388 %50 = OpFunctionParameter %30
389 %51 = OpLabel
390 %52 = OpLoad %2 %49
391 %53 = OpVectorShuffle %35 %52 %52 0 1
392 %54 = OpLoad %2 %50
393 %55 = OpVectorShuffle %35 %54 %54 2 3
394 %56 = OpCompositeExtract %1 %53 0
395 %57 = OpCompositeExtract %1 %53 1
396 %58 = OpCompositeExtract %1 %55 0
397 %59 = OpCompositeExtract %1 %55 1
398 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
399 OpReturnValue %60
400 OpFunctionEnd
401 %63 = OpFunction %61 None %62
402 %64 = OpLabel
403 %65 = OpVariable %30 Function
404 %68 = OpVariable %30 Function
405 %73 = OpVariable %30 Function
406 %66 = OpLoad %2 %4
407 OpStore %65 %66
408 %67 = OpFunctionCall %2 %32 %65
409 %71 = OpAccessChain %70 %14 %69
410 %72 = OpLoad %2 %71
411 OpStore %68 %72
412 %74 = OpAccessChain %70 %20 %69 %69
413 %75 = OpLoad %2 %74
414 OpStore %73 %75
415 %76 = OpFunctionCall %2 %48 %68 %73
416 %77 = OpFAdd %2 %67 %76
417 %79 = OpAccessChain %70 %20 %78 %69
418 %80 = OpLoad %2 %79
419 %81 = OpFAdd %2 %77 %80
420 OpStore %22 %81
421 OpReturn
422 OpFunctionEnd
423 )";
424
TEST(DiffTest,DifferentDecorationsFragment)425 TEST(DiffTest, DifferentDecorationsFragment) {
426 constexpr char kDiff[] = R"( ; SPIR-V
427 ; Version: 1.6
428 ; Generator: Khronos SPIR-V Tools Assembler; 0
429 -; Bound: 82
430 +; Bound: 86
431 ; Schema: 0
432 OpCapability Shader
433 OpMemoryModel Logical GLSL450
434 OpEntryPoint Fragment %63 "main" %4 %22
435 OpExecutionMode %63 OriginUpperLeft
436 OpSource GLSL 450
437 OpName %4 "_ue"
438 OpName %8 "_uf"
439 OpName %11 "_ug"
440 OpName %12 "_uA"
441 OpMemberName %12 0 "_ux"
442 OpName %14 "_uc"
443 OpName %15 "_uB"
444 OpMemberName %15 0 "_ux"
445 OpName %20 "_ud"
446 OpName %22 "_ucol"
447 OpName %26 "ANGLEDepthRangeParams"
448 OpMemberName %26 0 "near"
449 OpMemberName %26 1 "far"
450 OpMemberName %26 2 "diff"
451 OpMemberName %26 3 "reserved"
452 OpName %27 "ANGLEUniformBlock"
453 OpMemberName %27 0 "viewport"
454 OpMemberName %27 1 "clipDistancesEnabled"
455 OpMemberName %27 2 "xfbActiveUnpaused"
456 OpMemberName %27 3 "xfbVerticesPerInstance"
457 OpMemberName %27 4 "numSamples"
458 OpMemberName %27 5 "xfbBufferOffsets"
459 OpMemberName %27 6 "acbBufferOffsets"
460 OpMemberName %27 7 "depthRange"
461 OpName %29 "ANGLEUniforms"
462 OpName %33 "_uc"
463 OpName %32 "_uh"
464 OpName %49 "_ux"
465 OpName %50 "_uy"
466 OpName %48 "_ui"
467 OpName %63 "main"
468 OpName %65 "param"
469 OpName %68 "param"
470 OpName %73 "param"
471 -OpDecorate %4 Location 0
472 +OpDecorate %4 Location 1
473 OpDecorate %8 RelaxedPrecision
474 -OpDecorate %8 DescriptorSet 0
475 +OpDecorate %8 DescriptorSet 2
476 OpDecorate %8 Binding 0
477 -OpDecorate %11 DescriptorSet 0
478 +OpDecorate %11 DescriptorSet 3
479 -OpDecorate %11 Binding 1
480 +OpDecorate %11 Binding 0
481 OpMemberDecorate %12 0 Offset 0
482 OpMemberDecorate %12 0 RelaxedPrecision
483 OpDecorate %12 Block
484 -OpDecorate %14 DescriptorSet 0
485 +OpDecorate %14 DescriptorSet 3
486 -OpDecorate %14 Binding 2
487 +OpDecorate %14 Binding 1
488 OpMemberDecorate %15 0 Offset 0
489 OpMemberDecorate %15 0 RelaxedPrecision
490 OpDecorate %15 BufferBlock
491 -OpDecorate %20 DescriptorSet 0
492 +OpDecorate %20 DescriptorSet 3
493 -OpDecorate %20 Binding 3
494 +OpDecorate %20 Binding 2
495 OpDecorate %22 RelaxedPrecision
496 -OpDecorate %22 Location 0
497 +OpDecorate %22 Location 1
498 OpMemberDecorate %26 0 Offset 0
499 OpMemberDecorate %26 1 Offset 4
500 OpMemberDecorate %26 2 Offset 8
501 OpMemberDecorate %26 3 Offset 12
502 OpMemberDecorate %27 0 Offset 0
503 OpMemberDecorate %27 1 Offset 16
504 OpMemberDecorate %27 2 Offset 20
505 OpMemberDecorate %27 3 Offset 24
506 OpMemberDecorate %27 4 Offset 28
507 OpMemberDecorate %27 5 Offset 32
508 OpMemberDecorate %27 6 Offset 48
509 OpMemberDecorate %27 7 Offset 64
510 OpMemberDecorate %27 2 RelaxedPrecision
511 OpMemberDecorate %27 4 RelaxedPrecision
512 OpDecorate %27 Block
513 OpDecorate %29 DescriptorSet 0
514 -OpDecorate %29 Binding 4
515 +OpDecorate %29 Binding 0
516 OpDecorate %32 RelaxedPrecision
517 OpDecorate %33 RelaxedPrecision
518 OpDecorate %36 RelaxedPrecision
519 OpDecorate %37 RelaxedPrecision
520 OpDecorate %38 RelaxedPrecision
521 OpDecorate %39 RelaxedPrecision
522 OpDecorate %41 RelaxedPrecision
523 OpDecorate %42 RelaxedPrecision
524 OpDecorate %43 RelaxedPrecision
525 OpDecorate %48 RelaxedPrecision
526 OpDecorate %49 RelaxedPrecision
527 OpDecorate %50 RelaxedPrecision
528 OpDecorate %52 RelaxedPrecision
529 OpDecorate %53 RelaxedPrecision
530 OpDecorate %54 RelaxedPrecision
531 OpDecorate %55 RelaxedPrecision
532 OpDecorate %56 RelaxedPrecision
533 OpDecorate %57 RelaxedPrecision
534 OpDecorate %58 RelaxedPrecision
535 OpDecorate %59 RelaxedPrecision
536 OpDecorate %60 RelaxedPrecision
537 OpDecorate %67 RelaxedPrecision
538 OpDecorate %68 RelaxedPrecision
539 OpDecorate %72 RelaxedPrecision
540 OpDecorate %73 RelaxedPrecision
541 OpDecorate %75 RelaxedPrecision
542 OpDecorate %76 RelaxedPrecision
543 OpDecorate %77 RelaxedPrecision
544 OpDecorate %80 RelaxedPrecision
545 OpDecorate %81 RelaxedPrecision
546 %1 = OpTypeFloat 32
547 %2 = OpTypeVector %1 4
548 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
549 %6 = OpTypeSampledImage %5
550 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
551 %12 = OpTypeStruct %2
552 %15 = OpTypeStruct %2
553 %16 = OpTypeInt 32 0
554 %17 = OpConstant %16 2
555 %18 = OpTypeArray %15 %17
556 %23 = OpTypeInt 32 1
557 %24 = OpTypeVector %23 4
558 %25 = OpTypeVector %16 4
559 %26 = OpTypeStruct %1 %1 %1 %1
560 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
561 %35 = OpTypeVector %1 2
562 %40 = OpTypeVector %23 2
563 %61 = OpTypeVoid
564 %69 = OpConstant %16 0
565 %78 = OpConstant %16 1
566 +%82 = OpTypePointer Private %2
567 %3 = OpTypePointer Input %2
568 %7 = OpTypePointer UniformConstant %6
569 %10 = OpTypePointer UniformConstant %9
570 %13 = OpTypePointer Uniform %12
571 %19 = OpTypePointer Uniform %18
572 +%83 = OpTypePointer Private %2
573 %21 = OpTypePointer Output %2
574 %28 = OpTypePointer Uniform %27
575 %30 = OpTypePointer Function %2
576 %70 = OpTypePointer Uniform %2
577 %31 = OpTypeFunction %2 %30
578 %47 = OpTypeFunction %2 %30 %30
579 %62 = OpTypeFunction %61
580 %4 = OpVariable %3 Input
581 %8 = OpVariable %7 UniformConstant
582 %11 = OpVariable %10 UniformConstant
583 %14 = OpVariable %13 Uniform
584 %20 = OpVariable %19 Uniform
585 %22 = OpVariable %21 Output
586 %29 = OpVariable %28 Uniform
587 +%84 = OpConstant %23 0
588 +%85 = OpConstant %1 0.5
589 %32 = OpFunction %2 None %31
590 %33 = OpFunctionParameter %30
591 %34 = OpLabel
592 %36 = OpLoad %6 %8
593 %37 = OpLoad %2 %33
594 %38 = OpVectorShuffle %35 %37 %37 0 1
595 %39 = OpImageSampleImplicitLod %2 %36 %38
596 %41 = OpLoad %2 %33
597 %42 = OpVectorShuffle %35 %41 %41 2 3
598 %43 = OpConvertFToS %40 %42
599 %44 = OpLoad %9 %11
600 %45 = OpImageRead %2 %44 %43
601 %46 = OpFAdd %2 %39 %45
602 OpReturnValue %46
603 OpFunctionEnd
604 %48 = OpFunction %2 None %47
605 %49 = OpFunctionParameter %30
606 %50 = OpFunctionParameter %30
607 %51 = OpLabel
608 %52 = OpLoad %2 %49
609 %53 = OpVectorShuffle %35 %52 %52 0 1
610 %54 = OpLoad %2 %50
611 %55 = OpVectorShuffle %35 %54 %54 2 3
612 %56 = OpCompositeExtract %1 %53 0
613 %57 = OpCompositeExtract %1 %53 1
614 %58 = OpCompositeExtract %1 %55 0
615 %59 = OpCompositeExtract %1 %55 1
616 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
617 OpReturnValue %60
618 OpFunctionEnd
619 %63 = OpFunction %61 None %62
620 %64 = OpLabel
621 %65 = OpVariable %30 Function
622 %68 = OpVariable %30 Function
623 %73 = OpVariable %30 Function
624 %66 = OpLoad %2 %4
625 OpStore %65 %66
626 %67 = OpFunctionCall %2 %32 %65
627 %71 = OpAccessChain %70 %14 %69
628 %72 = OpLoad %2 %71
629 OpStore %68 %72
630 %74 = OpAccessChain %70 %20 %69 %69
631 %75 = OpLoad %2 %74
632 OpStore %73 %75
633 %76 = OpFunctionCall %2 %48 %68 %73
634 %77 = OpFAdd %2 %67 %76
635 %79 = OpAccessChain %70 %20 %78 %69
636 %80 = OpLoad %2 %79
637 %81 = OpFAdd %2 %77 %80
638 OpStore %22 %81
639 OpReturn
640 OpFunctionEnd
641 )";
642 Options options;
643 DoStringDiffTest(kSrc, kDst, kDiff, options);
644 }
645
TEST(DiffTest,DifferentDecorationsFragmentNoDebug)646 TEST(DiffTest, DifferentDecorationsFragmentNoDebug) {
647 constexpr char kSrcNoDebug[] = R"(OpCapability Shader
648 OpMemoryModel Logical GLSL450
649 OpEntryPoint Fragment %63 "main" %4 %22
650 OpExecutionMode %63 OriginUpperLeft
651 OpSource GLSL 450
652 OpDecorate %4 Location 0
653 OpDecorate %8 RelaxedPrecision
654 OpDecorate %8 DescriptorSet 0
655 OpDecorate %8 Binding 0
656 OpDecorate %11 DescriptorSet 0
657 OpDecorate %11 Binding 1
658 OpMemberDecorate %12 0 Offset 0
659 OpMemberDecorate %12 0 RelaxedPrecision
660 OpDecorate %12 Block
661 OpDecorate %14 DescriptorSet 0
662 OpDecorate %14 Binding 2
663 OpMemberDecorate %15 0 Offset 0
664 OpMemberDecorate %15 0 RelaxedPrecision
665 OpDecorate %15 BufferBlock
666 OpDecorate %20 DescriptorSet 0
667 OpDecorate %20 Binding 3
668 OpDecorate %22 RelaxedPrecision
669 OpDecorate %22 Location 0
670 OpMemberDecorate %26 0 Offset 0
671 OpMemberDecorate %26 1 Offset 4
672 OpMemberDecorate %26 2 Offset 8
673 OpMemberDecorate %26 3 Offset 12
674 OpMemberDecorate %27 0 Offset 0
675 OpMemberDecorate %27 1 Offset 16
676 OpMemberDecorate %27 2 Offset 20
677 OpMemberDecorate %27 3 Offset 24
678 OpMemberDecorate %27 4 Offset 28
679 OpMemberDecorate %27 5 Offset 32
680 OpMemberDecorate %27 6 Offset 48
681 OpMemberDecorate %27 7 Offset 64
682 OpMemberDecorate %27 2 RelaxedPrecision
683 OpMemberDecorate %27 4 RelaxedPrecision
684 OpDecorate %27 Block
685 OpDecorate %29 DescriptorSet 0
686 OpDecorate %29 Binding 4
687 OpDecorate %32 RelaxedPrecision
688 OpDecorate %33 RelaxedPrecision
689 OpDecorate %36 RelaxedPrecision
690 OpDecorate %37 RelaxedPrecision
691 OpDecorate %38 RelaxedPrecision
692 OpDecorate %39 RelaxedPrecision
693 OpDecorate %41 RelaxedPrecision
694 OpDecorate %42 RelaxedPrecision
695 OpDecorate %43 RelaxedPrecision
696 OpDecorate %48 RelaxedPrecision
697 OpDecorate %49 RelaxedPrecision
698 OpDecorate %50 RelaxedPrecision
699 OpDecorate %52 RelaxedPrecision
700 OpDecorate %53 RelaxedPrecision
701 OpDecorate %54 RelaxedPrecision
702 OpDecorate %55 RelaxedPrecision
703 OpDecorate %56 RelaxedPrecision
704 OpDecorate %57 RelaxedPrecision
705 OpDecorate %58 RelaxedPrecision
706 OpDecorate %59 RelaxedPrecision
707 OpDecorate %60 RelaxedPrecision
708 OpDecorate %67 RelaxedPrecision
709 OpDecorate %68 RelaxedPrecision
710 OpDecorate %72 RelaxedPrecision
711 OpDecorate %73 RelaxedPrecision
712 OpDecorate %75 RelaxedPrecision
713 OpDecorate %76 RelaxedPrecision
714 OpDecorate %77 RelaxedPrecision
715 OpDecorate %80 RelaxedPrecision
716 OpDecorate %81 RelaxedPrecision
717 %1 = OpTypeFloat 32
718 %2 = OpTypeVector %1 4
719 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
720 %6 = OpTypeSampledImage %5
721 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
722 %12 = OpTypeStruct %2
723 %15 = OpTypeStruct %2
724 %16 = OpTypeInt 32 0
725 %17 = OpConstant %16 2
726 %18 = OpTypeArray %15 %17
727 %23 = OpTypeInt 32 1
728 %24 = OpTypeVector %23 4
729 %25 = OpTypeVector %16 4
730 %26 = OpTypeStruct %1 %1 %1 %1
731 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
732 %35 = OpTypeVector %1 2
733 %40 = OpTypeVector %23 2
734 %61 = OpTypeVoid
735 %69 = OpConstant %16 0
736 %78 = OpConstant %16 1
737 %3 = OpTypePointer Input %2
738 %7 = OpTypePointer UniformConstant %6
739 %10 = OpTypePointer UniformConstant %9
740 %13 = OpTypePointer Uniform %12
741 %19 = OpTypePointer Uniform %18
742 %21 = OpTypePointer Output %2
743 %28 = OpTypePointer Uniform %27
744 %30 = OpTypePointer Function %2
745 %70 = OpTypePointer Uniform %2
746 %31 = OpTypeFunction %2 %30
747 %47 = OpTypeFunction %2 %30 %30
748 %62 = OpTypeFunction %61
749 %4 = OpVariable %3 Input
750 %8 = OpVariable %7 UniformConstant
751 %11 = OpVariable %10 UniformConstant
752 %14 = OpVariable %13 Uniform
753 %20 = OpVariable %19 Uniform
754 %22 = OpVariable %21 Output
755 %29 = OpVariable %28 Uniform
756 %32 = OpFunction %2 None %31
757 %33 = OpFunctionParameter %30
758 %34 = OpLabel
759 %36 = OpLoad %6 %8
760 %37 = OpLoad %2 %33
761 %38 = OpVectorShuffle %35 %37 %37 0 1
762 %39 = OpImageSampleImplicitLod %2 %36 %38
763 %41 = OpLoad %2 %33
764 %42 = OpVectorShuffle %35 %41 %41 2 3
765 %43 = OpConvertFToS %40 %42
766 %44 = OpLoad %9 %11
767 %45 = OpImageRead %2 %44 %43
768 %46 = OpFAdd %2 %39 %45
769 OpReturnValue %46
770 OpFunctionEnd
771 %48 = OpFunction %2 None %47
772 %49 = OpFunctionParameter %30
773 %50 = OpFunctionParameter %30
774 %51 = OpLabel
775 %52 = OpLoad %2 %49
776 %53 = OpVectorShuffle %35 %52 %52 0 1
777 %54 = OpLoad %2 %50
778 %55 = OpVectorShuffle %35 %54 %54 2 3
779 %56 = OpCompositeExtract %1 %53 0
780 %57 = OpCompositeExtract %1 %53 1
781 %58 = OpCompositeExtract %1 %55 0
782 %59 = OpCompositeExtract %1 %55 1
783 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
784 OpReturnValue %60
785 OpFunctionEnd
786 %63 = OpFunction %61 None %62
787 %64 = OpLabel
788 %65 = OpVariable %30 Function
789 %68 = OpVariable %30 Function
790 %73 = OpVariable %30 Function
791 %66 = OpLoad %2 %4
792 OpStore %65 %66
793 %67 = OpFunctionCall %2 %32 %65
794 %71 = OpAccessChain %70 %14 %69
795 %72 = OpLoad %2 %71
796 OpStore %68 %72
797 %74 = OpAccessChain %70 %20 %69 %69
798 %75 = OpLoad %2 %74
799 OpStore %73 %75
800 %76 = OpFunctionCall %2 %48 %68 %73
801 %77 = OpFAdd %2 %67 %76
802 %79 = OpAccessChain %70 %20 %78 %69
803 %80 = OpLoad %2 %79
804 %81 = OpFAdd %2 %77 %80
805 OpStore %22 %81
806 OpReturn
807 OpFunctionEnd
808
809 )";
810 constexpr char kDstNoDebug[] = R"(OpCapability Shader
811 OpMemoryModel Logical GLSL450
812 OpEntryPoint Fragment %63 "main" %4 %22
813 OpExecutionMode %63 OriginUpperLeft
814 OpSource GLSL 450
815 OpDecorate %4 Location 1
816 OpDecorate %8 RelaxedPrecision
817 OpDecorate %8 DescriptorSet 2
818 OpDecorate %8 Binding 0
819 OpDecorate %11 DescriptorSet 3
820 OpDecorate %11 Binding 0
821 OpMemberDecorate %12 0 Offset 0
822 OpMemberDecorate %12 0 RelaxedPrecision
823 OpDecorate %12 Block
824 OpDecorate %14 DescriptorSet 3
825 OpDecorate %14 Binding 1
826 OpMemberDecorate %15 0 Offset 0
827 OpMemberDecorate %15 0 RelaxedPrecision
828 OpDecorate %15 BufferBlock
829 OpDecorate %20 DescriptorSet 3
830 OpDecorate %20 Binding 2
831 OpDecorate %22 RelaxedPrecision
832 OpDecorate %22 Location 1
833 OpMemberDecorate %26 0 Offset 0
834 OpMemberDecorate %26 1 Offset 4
835 OpMemberDecorate %26 2 Offset 8
836 OpMemberDecorate %26 3 Offset 12
837 OpMemberDecorate %27 0 Offset 0
838 OpMemberDecorate %27 1 Offset 16
839 OpMemberDecorate %27 2 Offset 20
840 OpMemberDecorate %27 3 Offset 24
841 OpMemberDecorate %27 4 Offset 28
842 OpMemberDecorate %27 5 Offset 32
843 OpMemberDecorate %27 6 Offset 48
844 OpMemberDecorate %27 7 Offset 64
845 OpMemberDecorate %27 2 RelaxedPrecision
846 OpMemberDecorate %27 4 RelaxedPrecision
847 OpDecorate %27 Block
848 OpDecorate %29 DescriptorSet 0
849 OpDecorate %29 Binding 0
850 OpDecorate %32 RelaxedPrecision
851 OpDecorate %33 RelaxedPrecision
852 OpDecorate %36 RelaxedPrecision
853 OpDecorate %37 RelaxedPrecision
854 OpDecorate %38 RelaxedPrecision
855 OpDecorate %39 RelaxedPrecision
856 OpDecorate %41 RelaxedPrecision
857 OpDecorate %42 RelaxedPrecision
858 OpDecorate %43 RelaxedPrecision
859 OpDecorate %48 RelaxedPrecision
860 OpDecorate %49 RelaxedPrecision
861 OpDecorate %50 RelaxedPrecision
862 OpDecorate %52 RelaxedPrecision
863 OpDecorate %53 RelaxedPrecision
864 OpDecorate %54 RelaxedPrecision
865 OpDecorate %55 RelaxedPrecision
866 OpDecorate %56 RelaxedPrecision
867 OpDecorate %57 RelaxedPrecision
868 OpDecorate %58 RelaxedPrecision
869 OpDecorate %59 RelaxedPrecision
870 OpDecorate %60 RelaxedPrecision
871 OpDecorate %67 RelaxedPrecision
872 OpDecorate %68 RelaxedPrecision
873 OpDecorate %72 RelaxedPrecision
874 OpDecorate %73 RelaxedPrecision
875 OpDecorate %75 RelaxedPrecision
876 OpDecorate %76 RelaxedPrecision
877 OpDecorate %77 RelaxedPrecision
878 OpDecorate %80 RelaxedPrecision
879 OpDecorate %81 RelaxedPrecision
880 %1 = OpTypeFloat 32
881 %2 = OpTypeVector %1 4
882 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
883 %6 = OpTypeSampledImage %5
884 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
885 %12 = OpTypeStruct %2
886 %15 = OpTypeStruct %2
887 %16 = OpTypeInt 32 0
888 %17 = OpConstant %16 2
889 %18 = OpTypeArray %15 %17
890 %23 = OpTypeInt 32 1
891 %24 = OpTypeVector %23 4
892 %25 = OpTypeVector %16 4
893 %26 = OpTypeStruct %1 %1 %1 %1
894 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
895 %35 = OpTypeVector %1 2
896 %40 = OpTypeVector %23 2
897 %61 = OpTypeVoid
898 %69 = OpConstant %16 0
899 %78 = OpConstant %16 1
900 %82 = OpTypePointer Private %2
901 %3 = OpTypePointer Input %2
902 %7 = OpTypePointer UniformConstant %6
903 %10 = OpTypePointer UniformConstant %9
904 %13 = OpTypePointer Uniform %12
905 %19 = OpTypePointer Uniform %18
906 %83 = OpTypePointer Private %2
907 %21 = OpTypePointer Output %2
908 %28 = OpTypePointer Uniform %27
909 %30 = OpTypePointer Function %2
910 %70 = OpTypePointer Uniform %2
911 %31 = OpTypeFunction %2 %30
912 %47 = OpTypeFunction %2 %30 %30
913 %62 = OpTypeFunction %61
914 %4 = OpVariable %3 Input
915 %8 = OpVariable %7 UniformConstant
916 %11 = OpVariable %10 UniformConstant
917 %14 = OpVariable %13 Uniform
918 %20 = OpVariable %19 Uniform
919 %22 = OpVariable %21 Output
920 %29 = OpVariable %28 Uniform
921 %84 = OpConstant %23 0
922 %85 = OpConstant %1 0.5
923 %32 = OpFunction %2 None %31
924 %33 = OpFunctionParameter %30
925 %34 = OpLabel
926 %36 = OpLoad %6 %8
927 %37 = OpLoad %2 %33
928 %38 = OpVectorShuffle %35 %37 %37 0 1
929 %39 = OpImageSampleImplicitLod %2 %36 %38
930 %41 = OpLoad %2 %33
931 %42 = OpVectorShuffle %35 %41 %41 2 3
932 %43 = OpConvertFToS %40 %42
933 %44 = OpLoad %9 %11
934 %45 = OpImageRead %2 %44 %43
935 %46 = OpFAdd %2 %39 %45
936 OpReturnValue %46
937 OpFunctionEnd
938 %48 = OpFunction %2 None %47
939 %49 = OpFunctionParameter %30
940 %50 = OpFunctionParameter %30
941 %51 = OpLabel
942 %52 = OpLoad %2 %49
943 %53 = OpVectorShuffle %35 %52 %52 0 1
944 %54 = OpLoad %2 %50
945 %55 = OpVectorShuffle %35 %54 %54 2 3
946 %56 = OpCompositeExtract %1 %53 0
947 %57 = OpCompositeExtract %1 %53 1
948 %58 = OpCompositeExtract %1 %55 0
949 %59 = OpCompositeExtract %1 %55 1
950 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
951 OpReturnValue %60
952 OpFunctionEnd
953 %63 = OpFunction %61 None %62
954 %64 = OpLabel
955 %65 = OpVariable %30 Function
956 %68 = OpVariable %30 Function
957 %73 = OpVariable %30 Function
958 %66 = OpLoad %2 %4
959 OpStore %65 %66
960 %67 = OpFunctionCall %2 %32 %65
961 %71 = OpAccessChain %70 %14 %69
962 %72 = OpLoad %2 %71
963 OpStore %68 %72
964 %74 = OpAccessChain %70 %20 %69 %69
965 %75 = OpLoad %2 %74
966 OpStore %73 %75
967 %76 = OpFunctionCall %2 %48 %68 %73
968 %77 = OpFAdd %2 %67 %76
969 %79 = OpAccessChain %70 %20 %78 %69
970 %80 = OpLoad %2 %79
971 %81 = OpFAdd %2 %77 %80
972 OpStore %22 %81
973 OpReturn
974 OpFunctionEnd
975 )";
976 constexpr char kDiff[] = R"( ; SPIR-V
977 ; Version: 1.6
978 ; Generator: Khronos SPIR-V Tools Assembler; 0
979 -; Bound: 82
980 +; Bound: 92
981 ; Schema: 0
982 OpCapability Shader
983 OpMemoryModel Logical GLSL450
984 OpEntryPoint Fragment %63 "main" %4 %22
985 OpExecutionMode %63 OriginUpperLeft
986 OpSource GLSL 450
987 -OpDecorate %4 Location 0
988 +OpDecorate %4 Location 1
989 OpDecorate %8 RelaxedPrecision
990 -OpDecorate %8 DescriptorSet 0
991 +OpDecorate %8 DescriptorSet 2
992 OpDecorate %8 Binding 0
993 -OpDecorate %11 DescriptorSet 0
994 +OpDecorate %11 DescriptorSet 3
995 -OpDecorate %11 Binding 1
996 +OpDecorate %11 Binding 0
997 OpMemberDecorate %12 0 Offset 0
998 OpMemberDecorate %12 0 RelaxedPrecision
999 OpDecorate %12 Block
1000 +OpDecorate %82 DescriptorSet 3
1001 +OpDecorate %82 Binding 1
1002 -OpDecorate %14 DescriptorSet 0
1003 +OpDecorate %14 DescriptorSet 3
1004 OpDecorate %14 Binding 2
1005 OpMemberDecorate %15 0 Offset 0
1006 OpMemberDecorate %15 0 RelaxedPrecision
1007 OpDecorate %15 BufferBlock
1008 -OpDecorate %20 DescriptorSet 0
1009 -OpDecorate %20 Binding 3
1010 OpDecorate %22 RelaxedPrecision
1011 -OpDecorate %22 Location 0
1012 +OpDecorate %22 Location 1
1013 OpMemberDecorate %26 0 Offset 0
1014 OpMemberDecorate %26 1 Offset 4
1015 OpMemberDecorate %26 2 Offset 8
1016 OpMemberDecorate %26 3 Offset 12
1017 OpMemberDecorate %27 0 Offset 0
1018 OpMemberDecorate %27 1 Offset 16
1019 OpMemberDecorate %27 2 Offset 20
1020 OpMemberDecorate %27 3 Offset 24
1021 OpMemberDecorate %27 4 Offset 28
1022 OpMemberDecorate %27 5 Offset 32
1023 OpMemberDecorate %27 6 Offset 48
1024 OpMemberDecorate %27 7 Offset 64
1025 OpMemberDecorate %27 2 RelaxedPrecision
1026 OpMemberDecorate %27 4 RelaxedPrecision
1027 OpDecorate %27 Block
1028 -OpDecorate %29 DescriptorSet 0
1029 -OpDecorate %29 Binding 4
1030 +OpDecorate %83 DescriptorSet 0
1031 +OpDecorate %83 Binding 0
1032 OpDecorate %32 RelaxedPrecision
1033 -OpDecorate %33 RelaxedPrecision
1034 +OpDecorate %84 RelaxedPrecision
1035 OpDecorate %36 RelaxedPrecision
1036 OpDecorate %37 RelaxedPrecision
1037 OpDecorate %38 RelaxedPrecision
1038 OpDecorate %39 RelaxedPrecision
1039 OpDecorate %41 RelaxedPrecision
1040 OpDecorate %42 RelaxedPrecision
1041 OpDecorate %43 RelaxedPrecision
1042 OpDecorate %48 RelaxedPrecision
1043 -OpDecorate %49 RelaxedPrecision
1044 -OpDecorate %50 RelaxedPrecision
1045 +OpDecorate %85 RelaxedPrecision
1046 +OpDecorate %86 RelaxedPrecision
1047 OpDecorate %52 RelaxedPrecision
1048 OpDecorate %53 RelaxedPrecision
1049 OpDecorate %54 RelaxedPrecision
1050 OpDecorate %55 RelaxedPrecision
1051 OpDecorate %56 RelaxedPrecision
1052 OpDecorate %57 RelaxedPrecision
1053 OpDecorate %58 RelaxedPrecision
1054 OpDecorate %59 RelaxedPrecision
1055 OpDecorate %60 RelaxedPrecision
1056 OpDecorate %67 RelaxedPrecision
1057 OpDecorate %68 RelaxedPrecision
1058 OpDecorate %72 RelaxedPrecision
1059 OpDecorate %73 RelaxedPrecision
1060 OpDecorate %75 RelaxedPrecision
1061 OpDecorate %76 RelaxedPrecision
1062 OpDecorate %77 RelaxedPrecision
1063 OpDecorate %80 RelaxedPrecision
1064 OpDecorate %81 RelaxedPrecision
1065 %1 = OpTypeFloat 32
1066 %2 = OpTypeVector %1 4
1067 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
1068 %6 = OpTypeSampledImage %5
1069 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
1070 %12 = OpTypeStruct %2
1071 %15 = OpTypeStruct %2
1072 %16 = OpTypeInt 32 0
1073 %17 = OpConstant %16 2
1074 %18 = OpTypeArray %15 %17
1075 %23 = OpTypeInt 32 1
1076 %24 = OpTypeVector %23 4
1077 %25 = OpTypeVector %16 4
1078 %26 = OpTypeStruct %1 %1 %1 %1
1079 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
1080 %35 = OpTypeVector %1 2
1081 %40 = OpTypeVector %23 2
1082 %61 = OpTypeVoid
1083 %69 = OpConstant %16 0
1084 %78 = OpConstant %16 1
1085 +%88 = OpTypePointer Private %2
1086 %3 = OpTypePointer Input %2
1087 %7 = OpTypePointer UniformConstant %6
1088 %10 = OpTypePointer UniformConstant %9
1089 %13 = OpTypePointer Uniform %12
1090 %19 = OpTypePointer Uniform %18
1091 +%89 = OpTypePointer Private %2
1092 %21 = OpTypePointer Output %2
1093 %28 = OpTypePointer Uniform %27
1094 %30 = OpTypePointer Function %2
1095 %70 = OpTypePointer Uniform %2
1096 %31 = OpTypeFunction %2 %30
1097 %47 = OpTypeFunction %2 %30 %30
1098 %62 = OpTypeFunction %61
1099 %4 = OpVariable %3 Input
1100 %8 = OpVariable %7 UniformConstant
1101 %11 = OpVariable %10 UniformConstant
1102 +%82 = OpVariable %13 Uniform
1103 -%14 = OpVariable %13 Uniform
1104 +%14 = OpVariable %19 Uniform
1105 -%20 = OpVariable %19 Uniform
1106 %22 = OpVariable %21 Output
1107 -%29 = OpVariable %28 Uniform
1108 +%83 = OpVariable %28 Uniform
1109 +%90 = OpConstant %23 0
1110 +%91 = OpConstant %1 0.5
1111 %32 = OpFunction %2 None %31
1112 -%33 = OpFunctionParameter %30
1113 +%84 = OpFunctionParameter %30
1114 %34 = OpLabel
1115 %36 = OpLoad %6 %8
1116 -%37 = OpLoad %2 %33
1117 +%37 = OpLoad %2 %84
1118 %38 = OpVectorShuffle %35 %37 %37 0 1
1119 %39 = OpImageSampleImplicitLod %2 %36 %38
1120 -%41 = OpLoad %2 %33
1121 +%41 = OpLoad %2 %84
1122 %42 = OpVectorShuffle %35 %41 %41 2 3
1123 %43 = OpConvertFToS %40 %42
1124 %44 = OpLoad %9 %11
1125 %45 = OpImageRead %2 %44 %43
1126 %46 = OpFAdd %2 %39 %45
1127 OpReturnValue %46
1128 OpFunctionEnd
1129 %48 = OpFunction %2 None %47
1130 -%49 = OpFunctionParameter %30
1131 -%50 = OpFunctionParameter %30
1132 +%85 = OpFunctionParameter %30
1133 +%86 = OpFunctionParameter %30
1134 %51 = OpLabel
1135 -%52 = OpLoad %2 %49
1136 +%52 = OpLoad %2 %85
1137 %53 = OpVectorShuffle %35 %52 %52 0 1
1138 -%54 = OpLoad %2 %50
1139 +%54 = OpLoad %2 %86
1140 %55 = OpVectorShuffle %35 %54 %54 2 3
1141 %56 = OpCompositeExtract %1 %53 0
1142 %57 = OpCompositeExtract %1 %53 1
1143 %58 = OpCompositeExtract %1 %55 0
1144 %59 = OpCompositeExtract %1 %55 1
1145 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
1146 OpReturnValue %60
1147 OpFunctionEnd
1148 %63 = OpFunction %61 None %62
1149 %64 = OpLabel
1150 %65 = OpVariable %30 Function
1151 %68 = OpVariable %30 Function
1152 %73 = OpVariable %30 Function
1153 %66 = OpLoad %2 %4
1154 OpStore %65 %66
1155 %67 = OpFunctionCall %2 %32 %65
1156 -%71 = OpAccessChain %70 %14 %69
1157 +%87 = OpAccessChain %70 %82 %69
1158 -%72 = OpLoad %2 %71
1159 +%72 = OpLoad %2 %87
1160 OpStore %68 %72
1161 -%74 = OpAccessChain %70 %20 %69 %69
1162 +%74 = OpAccessChain %70 %14 %69 %69
1163 %75 = OpLoad %2 %74
1164 OpStore %73 %75
1165 %76 = OpFunctionCall %2 %48 %68 %73
1166 %77 = OpFAdd %2 %67 %76
1167 -%79 = OpAccessChain %70 %20 %78 %69
1168 +%79 = OpAccessChain %70 %14 %78 %69
1169 %80 = OpLoad %2 %79
1170 %81 = OpFAdd %2 %77 %80
1171 OpStore %22 %81
1172 OpReturn
1173 OpFunctionEnd
1174 )";
1175 Options options;
1176 DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options);
1177 }
1178
TEST(DiffTest,DifferentDecorationsFragmentIgnoreLocation)1179 TEST(DiffTest, DifferentDecorationsFragmentIgnoreLocation) {
1180 constexpr char kDiff[] = R"( ; SPIR-V
1181 ; Version: 1.6
1182 ; Generator: Khronos SPIR-V Tools Assembler; 0
1183 -; Bound: 82
1184 +; Bound: 86
1185 ; Schema: 0
1186 OpCapability Shader
1187 OpMemoryModel Logical GLSL450
1188 OpEntryPoint Fragment %63 "main" %4 %22
1189 OpExecutionMode %63 OriginUpperLeft
1190 OpSource GLSL 450
1191 OpName %4 "_ue"
1192 OpName %8 "_uf"
1193 OpName %11 "_ug"
1194 OpName %12 "_uA"
1195 OpMemberName %12 0 "_ux"
1196 OpName %14 "_uc"
1197 OpName %15 "_uB"
1198 OpMemberName %15 0 "_ux"
1199 OpName %20 "_ud"
1200 OpName %22 "_ucol"
1201 OpName %26 "ANGLEDepthRangeParams"
1202 OpMemberName %26 0 "near"
1203 OpMemberName %26 1 "far"
1204 OpMemberName %26 2 "diff"
1205 OpMemberName %26 3 "reserved"
1206 OpName %27 "ANGLEUniformBlock"
1207 OpMemberName %27 0 "viewport"
1208 OpMemberName %27 1 "clipDistancesEnabled"
1209 OpMemberName %27 2 "xfbActiveUnpaused"
1210 OpMemberName %27 3 "xfbVerticesPerInstance"
1211 OpMemberName %27 4 "numSamples"
1212 OpMemberName %27 5 "xfbBufferOffsets"
1213 OpMemberName %27 6 "acbBufferOffsets"
1214 OpMemberName %27 7 "depthRange"
1215 OpName %29 "ANGLEUniforms"
1216 OpName %33 "_uc"
1217 OpName %32 "_uh"
1218 OpName %49 "_ux"
1219 OpName %50 "_uy"
1220 OpName %48 "_ui"
1221 OpName %63 "main"
1222 OpName %65 "param"
1223 OpName %68 "param"
1224 OpName %73 "param"
1225 -OpDecorate %4 Location 0
1226 +OpDecorate %4 Location 1
1227 OpDecorate %8 RelaxedPrecision
1228 -OpDecorate %8 DescriptorSet 0
1229 +OpDecorate %8 DescriptorSet 2
1230 OpDecorate %8 Binding 0
1231 -OpDecorate %11 DescriptorSet 0
1232 +OpDecorate %11 DescriptorSet 3
1233 -OpDecorate %11 Binding 1
1234 +OpDecorate %11 Binding 0
1235 OpMemberDecorate %12 0 Offset 0
1236 OpMemberDecorate %12 0 RelaxedPrecision
1237 OpDecorate %12 Block
1238 -OpDecorate %14 DescriptorSet 0
1239 +OpDecorate %14 DescriptorSet 3
1240 -OpDecorate %14 Binding 2
1241 +OpDecorate %14 Binding 1
1242 OpMemberDecorate %15 0 Offset 0
1243 OpMemberDecorate %15 0 RelaxedPrecision
1244 OpDecorate %15 BufferBlock
1245 -OpDecorate %20 DescriptorSet 0
1246 +OpDecorate %20 DescriptorSet 3
1247 -OpDecorate %20 Binding 3
1248 +OpDecorate %20 Binding 2
1249 OpDecorate %22 RelaxedPrecision
1250 -OpDecorate %22 Location 0
1251 +OpDecorate %22 Location 1
1252 OpMemberDecorate %26 0 Offset 0
1253 OpMemberDecorate %26 1 Offset 4
1254 OpMemberDecorate %26 2 Offset 8
1255 OpMemberDecorate %26 3 Offset 12
1256 OpMemberDecorate %27 0 Offset 0
1257 OpMemberDecorate %27 1 Offset 16
1258 OpMemberDecorate %27 2 Offset 20
1259 OpMemberDecorate %27 3 Offset 24
1260 OpMemberDecorate %27 4 Offset 28
1261 OpMemberDecorate %27 5 Offset 32
1262 OpMemberDecorate %27 6 Offset 48
1263 OpMemberDecorate %27 7 Offset 64
1264 OpMemberDecorate %27 2 RelaxedPrecision
1265 OpMemberDecorate %27 4 RelaxedPrecision
1266 OpDecorate %27 Block
1267 OpDecorate %29 DescriptorSet 0
1268 -OpDecorate %29 Binding 4
1269 +OpDecorate %29 Binding 0
1270 OpDecorate %32 RelaxedPrecision
1271 OpDecorate %33 RelaxedPrecision
1272 OpDecorate %36 RelaxedPrecision
1273 OpDecorate %37 RelaxedPrecision
1274 OpDecorate %38 RelaxedPrecision
1275 OpDecorate %39 RelaxedPrecision
1276 OpDecorate %41 RelaxedPrecision
1277 OpDecorate %42 RelaxedPrecision
1278 OpDecorate %43 RelaxedPrecision
1279 OpDecorate %48 RelaxedPrecision
1280 OpDecorate %49 RelaxedPrecision
1281 OpDecorate %50 RelaxedPrecision
1282 OpDecorate %52 RelaxedPrecision
1283 OpDecorate %53 RelaxedPrecision
1284 OpDecorate %54 RelaxedPrecision
1285 OpDecorate %55 RelaxedPrecision
1286 OpDecorate %56 RelaxedPrecision
1287 OpDecorate %57 RelaxedPrecision
1288 OpDecorate %58 RelaxedPrecision
1289 OpDecorate %59 RelaxedPrecision
1290 OpDecorate %60 RelaxedPrecision
1291 OpDecorate %67 RelaxedPrecision
1292 OpDecorate %68 RelaxedPrecision
1293 OpDecorate %72 RelaxedPrecision
1294 OpDecorate %73 RelaxedPrecision
1295 OpDecorate %75 RelaxedPrecision
1296 OpDecorate %76 RelaxedPrecision
1297 OpDecorate %77 RelaxedPrecision
1298 OpDecorate %80 RelaxedPrecision
1299 OpDecorate %81 RelaxedPrecision
1300 %1 = OpTypeFloat 32
1301 %2 = OpTypeVector %1 4
1302 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
1303 %6 = OpTypeSampledImage %5
1304 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
1305 %12 = OpTypeStruct %2
1306 %15 = OpTypeStruct %2
1307 %16 = OpTypeInt 32 0
1308 %17 = OpConstant %16 2
1309 %18 = OpTypeArray %15 %17
1310 %23 = OpTypeInt 32 1
1311 %24 = OpTypeVector %23 4
1312 %25 = OpTypeVector %16 4
1313 %26 = OpTypeStruct %1 %1 %1 %1
1314 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
1315 %35 = OpTypeVector %1 2
1316 %40 = OpTypeVector %23 2
1317 %61 = OpTypeVoid
1318 %69 = OpConstant %16 0
1319 %78 = OpConstant %16 1
1320 +%82 = OpTypePointer Private %2
1321 %3 = OpTypePointer Input %2
1322 %7 = OpTypePointer UniformConstant %6
1323 %10 = OpTypePointer UniformConstant %9
1324 %13 = OpTypePointer Uniform %12
1325 %19 = OpTypePointer Uniform %18
1326 +%83 = OpTypePointer Private %2
1327 %21 = OpTypePointer Output %2
1328 %28 = OpTypePointer Uniform %27
1329 %30 = OpTypePointer Function %2
1330 %70 = OpTypePointer Uniform %2
1331 %31 = OpTypeFunction %2 %30
1332 %47 = OpTypeFunction %2 %30 %30
1333 %62 = OpTypeFunction %61
1334 %4 = OpVariable %3 Input
1335 %8 = OpVariable %7 UniformConstant
1336 %11 = OpVariable %10 UniformConstant
1337 %14 = OpVariable %13 Uniform
1338 %20 = OpVariable %19 Uniform
1339 %22 = OpVariable %21 Output
1340 %29 = OpVariable %28 Uniform
1341 +%84 = OpConstant %23 0
1342 +%85 = OpConstant %1 0.5
1343 %32 = OpFunction %2 None %31
1344 %33 = OpFunctionParameter %30
1345 %34 = OpLabel
1346 %36 = OpLoad %6 %8
1347 %37 = OpLoad %2 %33
1348 %38 = OpVectorShuffle %35 %37 %37 0 1
1349 %39 = OpImageSampleImplicitLod %2 %36 %38
1350 %41 = OpLoad %2 %33
1351 %42 = OpVectorShuffle %35 %41 %41 2 3
1352 %43 = OpConvertFToS %40 %42
1353 %44 = OpLoad %9 %11
1354 %45 = OpImageRead %2 %44 %43
1355 %46 = OpFAdd %2 %39 %45
1356 OpReturnValue %46
1357 OpFunctionEnd
1358 %48 = OpFunction %2 None %47
1359 %49 = OpFunctionParameter %30
1360 %50 = OpFunctionParameter %30
1361 %51 = OpLabel
1362 %52 = OpLoad %2 %49
1363 %53 = OpVectorShuffle %35 %52 %52 0 1
1364 %54 = OpLoad %2 %50
1365 %55 = OpVectorShuffle %35 %54 %54 2 3
1366 %56 = OpCompositeExtract %1 %53 0
1367 %57 = OpCompositeExtract %1 %53 1
1368 %58 = OpCompositeExtract %1 %55 0
1369 %59 = OpCompositeExtract %1 %55 1
1370 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
1371 OpReturnValue %60
1372 OpFunctionEnd
1373 %63 = OpFunction %61 None %62
1374 %64 = OpLabel
1375 %65 = OpVariable %30 Function
1376 %68 = OpVariable %30 Function
1377 %73 = OpVariable %30 Function
1378 %66 = OpLoad %2 %4
1379 OpStore %65 %66
1380 %67 = OpFunctionCall %2 %32 %65
1381 %71 = OpAccessChain %70 %14 %69
1382 %72 = OpLoad %2 %71
1383 OpStore %68 %72
1384 %74 = OpAccessChain %70 %20 %69 %69
1385 %75 = OpLoad %2 %74
1386 OpStore %73 %75
1387 %76 = OpFunctionCall %2 %48 %68 %73
1388 %77 = OpFAdd %2 %67 %76
1389 %79 = OpAccessChain %70 %20 %78 %69
1390 %80 = OpLoad %2 %79
1391 %81 = OpFAdd %2 %77 %80
1392 OpStore %22 %81
1393 OpReturn
1394 OpFunctionEnd
1395 )";
1396 Options options;
1397 options.ignore_location = true;
1398 DoStringDiffTest(kSrc, kDst, kDiff, options);
1399 }
1400
TEST(DiffTest,DifferentDecorationsFragmentIgnoreSetBindingLocation)1401 TEST(DiffTest, DifferentDecorationsFragmentIgnoreSetBindingLocation) {
1402 constexpr char kDiff[] = R"( ; SPIR-V
1403 ; Version: 1.6
1404 ; Generator: Khronos SPIR-V Tools Assembler; 0
1405 -; Bound: 82
1406 +; Bound: 86
1407 ; Schema: 0
1408 OpCapability Shader
1409 OpMemoryModel Logical GLSL450
1410 OpEntryPoint Fragment %63 "main" %4 %22
1411 OpExecutionMode %63 OriginUpperLeft
1412 OpSource GLSL 450
1413 OpName %4 "_ue"
1414 OpName %8 "_uf"
1415 OpName %11 "_ug"
1416 OpName %12 "_uA"
1417 OpMemberName %12 0 "_ux"
1418 OpName %14 "_uc"
1419 OpName %15 "_uB"
1420 OpMemberName %15 0 "_ux"
1421 OpName %20 "_ud"
1422 OpName %22 "_ucol"
1423 OpName %26 "ANGLEDepthRangeParams"
1424 OpMemberName %26 0 "near"
1425 OpMemberName %26 1 "far"
1426 OpMemberName %26 2 "diff"
1427 OpMemberName %26 3 "reserved"
1428 OpName %27 "ANGLEUniformBlock"
1429 OpMemberName %27 0 "viewport"
1430 OpMemberName %27 1 "clipDistancesEnabled"
1431 OpMemberName %27 2 "xfbActiveUnpaused"
1432 OpMemberName %27 3 "xfbVerticesPerInstance"
1433 OpMemberName %27 4 "numSamples"
1434 OpMemberName %27 5 "xfbBufferOffsets"
1435 OpMemberName %27 6 "acbBufferOffsets"
1436 OpMemberName %27 7 "depthRange"
1437 OpName %29 "ANGLEUniforms"
1438 OpName %33 "_uc"
1439 OpName %32 "_uh"
1440 OpName %49 "_ux"
1441 OpName %50 "_uy"
1442 OpName %48 "_ui"
1443 OpName %63 "main"
1444 OpName %65 "param"
1445 OpName %68 "param"
1446 OpName %73 "param"
1447 -OpDecorate %4 Location 0
1448 +OpDecorate %4 Location 1
1449 OpDecorate %8 RelaxedPrecision
1450 -OpDecorate %8 DescriptorSet 0
1451 +OpDecorate %8 DescriptorSet 2
1452 OpDecorate %8 Binding 0
1453 -OpDecorate %11 DescriptorSet 0
1454 +OpDecorate %11 DescriptorSet 3
1455 -OpDecorate %11 Binding 1
1456 +OpDecorate %11 Binding 0
1457 OpMemberDecorate %12 0 Offset 0
1458 OpMemberDecorate %12 0 RelaxedPrecision
1459 OpDecorate %12 Block
1460 -OpDecorate %14 DescriptorSet 0
1461 +OpDecorate %14 DescriptorSet 3
1462 -OpDecorate %14 Binding 2
1463 +OpDecorate %14 Binding 1
1464 OpMemberDecorate %15 0 Offset 0
1465 OpMemberDecorate %15 0 RelaxedPrecision
1466 OpDecorate %15 BufferBlock
1467 -OpDecorate %20 DescriptorSet 0
1468 +OpDecorate %20 DescriptorSet 3
1469 -OpDecorate %20 Binding 3
1470 +OpDecorate %20 Binding 2
1471 OpDecorate %22 RelaxedPrecision
1472 -OpDecorate %22 Location 0
1473 +OpDecorate %22 Location 1
1474 OpMemberDecorate %26 0 Offset 0
1475 OpMemberDecorate %26 1 Offset 4
1476 OpMemberDecorate %26 2 Offset 8
1477 OpMemberDecorate %26 3 Offset 12
1478 OpMemberDecorate %27 0 Offset 0
1479 OpMemberDecorate %27 1 Offset 16
1480 OpMemberDecorate %27 2 Offset 20
1481 OpMemberDecorate %27 3 Offset 24
1482 OpMemberDecorate %27 4 Offset 28
1483 OpMemberDecorate %27 5 Offset 32
1484 OpMemberDecorate %27 6 Offset 48
1485 OpMemberDecorate %27 7 Offset 64
1486 OpMemberDecorate %27 2 RelaxedPrecision
1487 OpMemberDecorate %27 4 RelaxedPrecision
1488 OpDecorate %27 Block
1489 OpDecorate %29 DescriptorSet 0
1490 -OpDecorate %29 Binding 4
1491 +OpDecorate %29 Binding 0
1492 OpDecorate %32 RelaxedPrecision
1493 OpDecorate %33 RelaxedPrecision
1494 OpDecorate %36 RelaxedPrecision
1495 OpDecorate %37 RelaxedPrecision
1496 OpDecorate %38 RelaxedPrecision
1497 OpDecorate %39 RelaxedPrecision
1498 OpDecorate %41 RelaxedPrecision
1499 OpDecorate %42 RelaxedPrecision
1500 OpDecorate %43 RelaxedPrecision
1501 OpDecorate %48 RelaxedPrecision
1502 OpDecorate %49 RelaxedPrecision
1503 OpDecorate %50 RelaxedPrecision
1504 OpDecorate %52 RelaxedPrecision
1505 OpDecorate %53 RelaxedPrecision
1506 OpDecorate %54 RelaxedPrecision
1507 OpDecorate %55 RelaxedPrecision
1508 OpDecorate %56 RelaxedPrecision
1509 OpDecorate %57 RelaxedPrecision
1510 OpDecorate %58 RelaxedPrecision
1511 OpDecorate %59 RelaxedPrecision
1512 OpDecorate %60 RelaxedPrecision
1513 OpDecorate %67 RelaxedPrecision
1514 OpDecorate %68 RelaxedPrecision
1515 OpDecorate %72 RelaxedPrecision
1516 OpDecorate %73 RelaxedPrecision
1517 OpDecorate %75 RelaxedPrecision
1518 OpDecorate %76 RelaxedPrecision
1519 OpDecorate %77 RelaxedPrecision
1520 OpDecorate %80 RelaxedPrecision
1521 OpDecorate %81 RelaxedPrecision
1522 %1 = OpTypeFloat 32
1523 %2 = OpTypeVector %1 4
1524 %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
1525 %6 = OpTypeSampledImage %5
1526 %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
1527 %12 = OpTypeStruct %2
1528 %15 = OpTypeStruct %2
1529 %16 = OpTypeInt 32 0
1530 %17 = OpConstant %16 2
1531 %18 = OpTypeArray %15 %17
1532 %23 = OpTypeInt 32 1
1533 %24 = OpTypeVector %23 4
1534 %25 = OpTypeVector %16 4
1535 %26 = OpTypeStruct %1 %1 %1 %1
1536 %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
1537 %35 = OpTypeVector %1 2
1538 %40 = OpTypeVector %23 2
1539 %61 = OpTypeVoid
1540 %69 = OpConstant %16 0
1541 %78 = OpConstant %16 1
1542 +%82 = OpTypePointer Private %2
1543 %3 = OpTypePointer Input %2
1544 %7 = OpTypePointer UniformConstant %6
1545 %10 = OpTypePointer UniformConstant %9
1546 %13 = OpTypePointer Uniform %12
1547 %19 = OpTypePointer Uniform %18
1548 +%83 = OpTypePointer Private %2
1549 %21 = OpTypePointer Output %2
1550 %28 = OpTypePointer Uniform %27
1551 %30 = OpTypePointer Function %2
1552 %70 = OpTypePointer Uniform %2
1553 %31 = OpTypeFunction %2 %30
1554 %47 = OpTypeFunction %2 %30 %30
1555 %62 = OpTypeFunction %61
1556 %4 = OpVariable %3 Input
1557 %8 = OpVariable %7 UniformConstant
1558 %11 = OpVariable %10 UniformConstant
1559 %14 = OpVariable %13 Uniform
1560 %20 = OpVariable %19 Uniform
1561 %22 = OpVariable %21 Output
1562 %29 = OpVariable %28 Uniform
1563 +%84 = OpConstant %23 0
1564 +%85 = OpConstant %1 0.5
1565 %32 = OpFunction %2 None %31
1566 %33 = OpFunctionParameter %30
1567 %34 = OpLabel
1568 %36 = OpLoad %6 %8
1569 %37 = OpLoad %2 %33
1570 %38 = OpVectorShuffle %35 %37 %37 0 1
1571 %39 = OpImageSampleImplicitLod %2 %36 %38
1572 %41 = OpLoad %2 %33
1573 %42 = OpVectorShuffle %35 %41 %41 2 3
1574 %43 = OpConvertFToS %40 %42
1575 %44 = OpLoad %9 %11
1576 %45 = OpImageRead %2 %44 %43
1577 %46 = OpFAdd %2 %39 %45
1578 OpReturnValue %46
1579 OpFunctionEnd
1580 %48 = OpFunction %2 None %47
1581 %49 = OpFunctionParameter %30
1582 %50 = OpFunctionParameter %30
1583 %51 = OpLabel
1584 %52 = OpLoad %2 %49
1585 %53 = OpVectorShuffle %35 %52 %52 0 1
1586 %54 = OpLoad %2 %50
1587 %55 = OpVectorShuffle %35 %54 %54 2 3
1588 %56 = OpCompositeExtract %1 %53 0
1589 %57 = OpCompositeExtract %1 %53 1
1590 %58 = OpCompositeExtract %1 %55 0
1591 %59 = OpCompositeExtract %1 %55 1
1592 %60 = OpCompositeConstruct %2 %56 %57 %58 %59
1593 OpReturnValue %60
1594 OpFunctionEnd
1595 %63 = OpFunction %61 None %62
1596 %64 = OpLabel
1597 %65 = OpVariable %30 Function
1598 %68 = OpVariable %30 Function
1599 %73 = OpVariable %30 Function
1600 %66 = OpLoad %2 %4
1601 OpStore %65 %66
1602 %67 = OpFunctionCall %2 %32 %65
1603 %71 = OpAccessChain %70 %14 %69
1604 %72 = OpLoad %2 %71
1605 OpStore %68 %72
1606 %74 = OpAccessChain %70 %20 %69 %69
1607 %75 = OpLoad %2 %74
1608 OpStore %73 %75
1609 %76 = OpFunctionCall %2 %48 %68 %73
1610 %77 = OpFAdd %2 %67 %76
1611 %79 = OpAccessChain %70 %20 %78 %69
1612 %80 = OpLoad %2 %79
1613 %81 = OpFAdd %2 %77 %80
1614 OpStore %22 %81
1615 OpReturn
1616 OpFunctionEnd
1617 )";
1618 Options options;
1619 options.ignore_set_binding = true;
1620 options.ignore_location = true;
1621 DoStringDiffTest(kSrc, kDst, kDiff, options);
1622 }
1623
1624 } // namespace
1625 } // namespace diff
1626 } // namespace spvtools
1627