• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: 89
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 %36 RelaxedPrecision
1035  OpDecorate %37 RelaxedPrecision
1036  OpDecorate %38 RelaxedPrecision
1037  OpDecorate %39 RelaxedPrecision
1038  OpDecorate %41 RelaxedPrecision
1039  OpDecorate %42 RelaxedPrecision
1040  OpDecorate %43 RelaxedPrecision
1041  OpDecorate %48 RelaxedPrecision
1042  OpDecorate %49 RelaxedPrecision
1043  OpDecorate %50 RelaxedPrecision
1044  OpDecorate %52 RelaxedPrecision
1045  OpDecorate %53 RelaxedPrecision
1046  OpDecorate %54 RelaxedPrecision
1047  OpDecorate %55 RelaxedPrecision
1048  OpDecorate %56 RelaxedPrecision
1049  OpDecorate %57 RelaxedPrecision
1050  OpDecorate %58 RelaxedPrecision
1051  OpDecorate %59 RelaxedPrecision
1052  OpDecorate %60 RelaxedPrecision
1053  OpDecorate %67 RelaxedPrecision
1054  OpDecorate %68 RelaxedPrecision
1055  OpDecorate %72 RelaxedPrecision
1056  OpDecorate %73 RelaxedPrecision
1057  OpDecorate %75 RelaxedPrecision
1058  OpDecorate %76 RelaxedPrecision
1059  OpDecorate %77 RelaxedPrecision
1060  OpDecorate %80 RelaxedPrecision
1061  OpDecorate %81 RelaxedPrecision
1062  %1 = OpTypeFloat 32
1063  %2 = OpTypeVector %1 4
1064  %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
1065  %6 = OpTypeSampledImage %5
1066  %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
1067  %12 = OpTypeStruct %2
1068  %15 = OpTypeStruct %2
1069  %16 = OpTypeInt 32 0
1070  %17 = OpConstant %16 2
1071  %18 = OpTypeArray %15 %17
1072  %23 = OpTypeInt 32 1
1073  %24 = OpTypeVector %23 4
1074  %25 = OpTypeVector %16 4
1075  %26 = OpTypeStruct %1 %1 %1 %1
1076  %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
1077  %35 = OpTypeVector %1 2
1078  %40 = OpTypeVector %23 2
1079  %61 = OpTypeVoid
1080  %69 = OpConstant %16 0
1081  %78 = OpConstant %16 1
1082 +%85 = OpTypePointer Private %2
1083  %3 = OpTypePointer Input %2
1084  %7 = OpTypePointer UniformConstant %6
1085  %10 = OpTypePointer UniformConstant %9
1086  %13 = OpTypePointer Uniform %12
1087  %19 = OpTypePointer Uniform %18
1088 +%86 = OpTypePointer Private %2
1089  %21 = OpTypePointer Output %2
1090  %28 = OpTypePointer Uniform %27
1091  %30 = OpTypePointer Function %2
1092  %70 = OpTypePointer Uniform %2
1093  %31 = OpTypeFunction %2 %30
1094  %47 = OpTypeFunction %2 %30 %30
1095  %62 = OpTypeFunction %61
1096  %4 = OpVariable %3 Input
1097  %8 = OpVariable %7 UniformConstant
1098  %11 = OpVariable %10 UniformConstant
1099 +%82 = OpVariable %13 Uniform
1100 -%14 = OpVariable %13 Uniform
1101 +%14 = OpVariable %19 Uniform
1102 -%20 = OpVariable %19 Uniform
1103  %22 = OpVariable %21 Output
1104 -%29 = OpVariable %28 Uniform
1105 +%83 = OpVariable %28 Uniform
1106 +%87 = OpConstant %23 0
1107 +%88 = OpConstant %1 0.5
1108  %32 = OpFunction %2 None %31
1109  %33 = OpFunctionParameter %30
1110  %34 = OpLabel
1111  %36 = OpLoad %6 %8
1112  %37 = OpLoad %2 %33
1113  %38 = OpVectorShuffle %35 %37 %37 0 1
1114  %39 = OpImageSampleImplicitLod %2 %36 %38
1115  %41 = OpLoad %2 %33
1116  %42 = OpVectorShuffle %35 %41 %41 2 3
1117  %43 = OpConvertFToS %40 %42
1118  %44 = OpLoad %9 %11
1119  %45 = OpImageRead %2 %44 %43
1120  %46 = OpFAdd %2 %39 %45
1121  OpReturnValue %46
1122  OpFunctionEnd
1123  %48 = OpFunction %2 None %47
1124  %49 = OpFunctionParameter %30
1125  %50 = OpFunctionParameter %30
1126  %51 = OpLabel
1127  %52 = OpLoad %2 %49
1128  %53 = OpVectorShuffle %35 %52 %52 0 1
1129  %54 = OpLoad %2 %50
1130  %55 = OpVectorShuffle %35 %54 %54 2 3
1131  %56 = OpCompositeExtract %1 %53 0
1132  %57 = OpCompositeExtract %1 %53 1
1133  %58 = OpCompositeExtract %1 %55 0
1134  %59 = OpCompositeExtract %1 %55 1
1135  %60 = OpCompositeConstruct %2 %56 %57 %58 %59
1136  OpReturnValue %60
1137  OpFunctionEnd
1138  %63 = OpFunction %61 None %62
1139  %64 = OpLabel
1140  %65 = OpVariable %30 Function
1141  %68 = OpVariable %30 Function
1142  %73 = OpVariable %30 Function
1143  %66 = OpLoad %2 %4
1144  OpStore %65 %66
1145  %67 = OpFunctionCall %2 %32 %65
1146 -%71 = OpAccessChain %70 %14 %69
1147 +%84 = OpAccessChain %70 %82 %69
1148 -%72 = OpLoad %2 %71
1149 +%72 = OpLoad %2 %84
1150  OpStore %68 %72
1151 -%74 = OpAccessChain %70 %20 %69 %69
1152 +%74 = OpAccessChain %70 %14 %69 %69
1153  %75 = OpLoad %2 %74
1154  OpStore %73 %75
1155  %76 = OpFunctionCall %2 %48 %68 %73
1156  %77 = OpFAdd %2 %67 %76
1157 -%79 = OpAccessChain %70 %20 %78 %69
1158 +%79 = OpAccessChain %70 %14 %78 %69
1159  %80 = OpLoad %2 %79
1160  %81 = OpFAdd %2 %77 %80
1161  OpStore %22 %81
1162  OpReturn
1163  OpFunctionEnd
1164 )";
1165   Options options;
1166   DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options);
1167 }
1168 
TEST(DiffTest,DifferentDecorationsFragmentIgnoreLocation)1169 TEST(DiffTest, DifferentDecorationsFragmentIgnoreLocation) {
1170   constexpr char kDiff[] = R"( ; SPIR-V
1171  ; Version: 1.6
1172  ; Generator: Khronos SPIR-V Tools Assembler; 0
1173 -; Bound: 82
1174 +; Bound: 86
1175  ; Schema: 0
1176  OpCapability Shader
1177  OpMemoryModel Logical GLSL450
1178  OpEntryPoint Fragment %63 "main" %4 %22
1179  OpExecutionMode %63 OriginUpperLeft
1180  OpSource GLSL 450
1181  OpName %4 "_ue"
1182  OpName %8 "_uf"
1183  OpName %11 "_ug"
1184  OpName %12 "_uA"
1185  OpMemberName %12 0 "_ux"
1186  OpName %14 "_uc"
1187  OpName %15 "_uB"
1188  OpMemberName %15 0 "_ux"
1189  OpName %20 "_ud"
1190  OpName %22 "_ucol"
1191  OpName %26 "ANGLEDepthRangeParams"
1192  OpMemberName %26 0 "near"
1193  OpMemberName %26 1 "far"
1194  OpMemberName %26 2 "diff"
1195  OpMemberName %26 3 "reserved"
1196  OpName %27 "ANGLEUniformBlock"
1197  OpMemberName %27 0 "viewport"
1198  OpMemberName %27 1 "clipDistancesEnabled"
1199  OpMemberName %27 2 "xfbActiveUnpaused"
1200  OpMemberName %27 3 "xfbVerticesPerInstance"
1201  OpMemberName %27 4 "numSamples"
1202  OpMemberName %27 5 "xfbBufferOffsets"
1203  OpMemberName %27 6 "acbBufferOffsets"
1204  OpMemberName %27 7 "depthRange"
1205  OpName %29 "ANGLEUniforms"
1206  OpName %33 "_uc"
1207  OpName %32 "_uh"
1208  OpName %49 "_ux"
1209  OpName %50 "_uy"
1210  OpName %48 "_ui"
1211  OpName %63 "main"
1212  OpName %65 "param"
1213  OpName %68 "param"
1214  OpName %73 "param"
1215 -OpDecorate %4 Location 0
1216 +OpDecorate %4 Location 1
1217  OpDecorate %8 RelaxedPrecision
1218 -OpDecorate %8 DescriptorSet 0
1219 +OpDecorate %8 DescriptorSet 2
1220  OpDecorate %8 Binding 0
1221 -OpDecorate %11 DescriptorSet 0
1222 +OpDecorate %11 DescriptorSet 3
1223 -OpDecorate %11 Binding 1
1224 +OpDecorate %11 Binding 0
1225  OpMemberDecorate %12 0 Offset 0
1226  OpMemberDecorate %12 0 RelaxedPrecision
1227  OpDecorate %12 Block
1228 -OpDecorate %14 DescriptorSet 0
1229 +OpDecorate %14 DescriptorSet 3
1230 -OpDecorate %14 Binding 2
1231 +OpDecorate %14 Binding 1
1232  OpMemberDecorate %15 0 Offset 0
1233  OpMemberDecorate %15 0 RelaxedPrecision
1234  OpDecorate %15 BufferBlock
1235 -OpDecorate %20 DescriptorSet 0
1236 +OpDecorate %20 DescriptorSet 3
1237 -OpDecorate %20 Binding 3
1238 +OpDecorate %20 Binding 2
1239  OpDecorate %22 RelaxedPrecision
1240 -OpDecorate %22 Location 0
1241 +OpDecorate %22 Location 1
1242  OpMemberDecorate %26 0 Offset 0
1243  OpMemberDecorate %26 1 Offset 4
1244  OpMemberDecorate %26 2 Offset 8
1245  OpMemberDecorate %26 3 Offset 12
1246  OpMemberDecorate %27 0 Offset 0
1247  OpMemberDecorate %27 1 Offset 16
1248  OpMemberDecorate %27 2 Offset 20
1249  OpMemberDecorate %27 3 Offset 24
1250  OpMemberDecorate %27 4 Offset 28
1251  OpMemberDecorate %27 5 Offset 32
1252  OpMemberDecorate %27 6 Offset 48
1253  OpMemberDecorate %27 7 Offset 64
1254  OpMemberDecorate %27 2 RelaxedPrecision
1255  OpMemberDecorate %27 4 RelaxedPrecision
1256  OpDecorate %27 Block
1257  OpDecorate %29 DescriptorSet 0
1258 -OpDecorate %29 Binding 4
1259 +OpDecorate %29 Binding 0
1260  OpDecorate %32 RelaxedPrecision
1261  OpDecorate %33 RelaxedPrecision
1262  OpDecorate %36 RelaxedPrecision
1263  OpDecorate %37 RelaxedPrecision
1264  OpDecorate %38 RelaxedPrecision
1265  OpDecorate %39 RelaxedPrecision
1266  OpDecorate %41 RelaxedPrecision
1267  OpDecorate %42 RelaxedPrecision
1268  OpDecorate %43 RelaxedPrecision
1269  OpDecorate %48 RelaxedPrecision
1270  OpDecorate %49 RelaxedPrecision
1271  OpDecorate %50 RelaxedPrecision
1272  OpDecorate %52 RelaxedPrecision
1273  OpDecorate %53 RelaxedPrecision
1274  OpDecorate %54 RelaxedPrecision
1275  OpDecorate %55 RelaxedPrecision
1276  OpDecorate %56 RelaxedPrecision
1277  OpDecorate %57 RelaxedPrecision
1278  OpDecorate %58 RelaxedPrecision
1279  OpDecorate %59 RelaxedPrecision
1280  OpDecorate %60 RelaxedPrecision
1281  OpDecorate %67 RelaxedPrecision
1282  OpDecorate %68 RelaxedPrecision
1283  OpDecorate %72 RelaxedPrecision
1284  OpDecorate %73 RelaxedPrecision
1285  OpDecorate %75 RelaxedPrecision
1286  OpDecorate %76 RelaxedPrecision
1287  OpDecorate %77 RelaxedPrecision
1288  OpDecorate %80 RelaxedPrecision
1289  OpDecorate %81 RelaxedPrecision
1290  %1 = OpTypeFloat 32
1291  %2 = OpTypeVector %1 4
1292  %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
1293  %6 = OpTypeSampledImage %5
1294  %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
1295  %12 = OpTypeStruct %2
1296  %15 = OpTypeStruct %2
1297  %16 = OpTypeInt 32 0
1298  %17 = OpConstant %16 2
1299  %18 = OpTypeArray %15 %17
1300  %23 = OpTypeInt 32 1
1301  %24 = OpTypeVector %23 4
1302  %25 = OpTypeVector %16 4
1303  %26 = OpTypeStruct %1 %1 %1 %1
1304  %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
1305  %35 = OpTypeVector %1 2
1306  %40 = OpTypeVector %23 2
1307  %61 = OpTypeVoid
1308  %69 = OpConstant %16 0
1309  %78 = OpConstant %16 1
1310 +%82 = OpTypePointer Private %2
1311  %3 = OpTypePointer Input %2
1312  %7 = OpTypePointer UniformConstant %6
1313  %10 = OpTypePointer UniformConstant %9
1314  %13 = OpTypePointer Uniform %12
1315  %19 = OpTypePointer Uniform %18
1316 +%83 = OpTypePointer Private %2
1317  %21 = OpTypePointer Output %2
1318  %28 = OpTypePointer Uniform %27
1319  %30 = OpTypePointer Function %2
1320  %70 = OpTypePointer Uniform %2
1321  %31 = OpTypeFunction %2 %30
1322  %47 = OpTypeFunction %2 %30 %30
1323  %62 = OpTypeFunction %61
1324  %4 = OpVariable %3 Input
1325  %8 = OpVariable %7 UniformConstant
1326  %11 = OpVariable %10 UniformConstant
1327  %14 = OpVariable %13 Uniform
1328  %20 = OpVariable %19 Uniform
1329  %22 = OpVariable %21 Output
1330  %29 = OpVariable %28 Uniform
1331 +%84 = OpConstant %23 0
1332 +%85 = OpConstant %1 0.5
1333  %32 = OpFunction %2 None %31
1334  %33 = OpFunctionParameter %30
1335  %34 = OpLabel
1336  %36 = OpLoad %6 %8
1337  %37 = OpLoad %2 %33
1338  %38 = OpVectorShuffle %35 %37 %37 0 1
1339  %39 = OpImageSampleImplicitLod %2 %36 %38
1340  %41 = OpLoad %2 %33
1341  %42 = OpVectorShuffle %35 %41 %41 2 3
1342  %43 = OpConvertFToS %40 %42
1343  %44 = OpLoad %9 %11
1344  %45 = OpImageRead %2 %44 %43
1345  %46 = OpFAdd %2 %39 %45
1346  OpReturnValue %46
1347  OpFunctionEnd
1348  %48 = OpFunction %2 None %47
1349  %49 = OpFunctionParameter %30
1350  %50 = OpFunctionParameter %30
1351  %51 = OpLabel
1352  %52 = OpLoad %2 %49
1353  %53 = OpVectorShuffle %35 %52 %52 0 1
1354  %54 = OpLoad %2 %50
1355  %55 = OpVectorShuffle %35 %54 %54 2 3
1356  %56 = OpCompositeExtract %1 %53 0
1357  %57 = OpCompositeExtract %1 %53 1
1358  %58 = OpCompositeExtract %1 %55 0
1359  %59 = OpCompositeExtract %1 %55 1
1360  %60 = OpCompositeConstruct %2 %56 %57 %58 %59
1361  OpReturnValue %60
1362  OpFunctionEnd
1363  %63 = OpFunction %61 None %62
1364  %64 = OpLabel
1365  %65 = OpVariable %30 Function
1366  %68 = OpVariable %30 Function
1367  %73 = OpVariable %30 Function
1368  %66 = OpLoad %2 %4
1369  OpStore %65 %66
1370  %67 = OpFunctionCall %2 %32 %65
1371  %71 = OpAccessChain %70 %14 %69
1372  %72 = OpLoad %2 %71
1373  OpStore %68 %72
1374  %74 = OpAccessChain %70 %20 %69 %69
1375  %75 = OpLoad %2 %74
1376  OpStore %73 %75
1377  %76 = OpFunctionCall %2 %48 %68 %73
1378  %77 = OpFAdd %2 %67 %76
1379  %79 = OpAccessChain %70 %20 %78 %69
1380  %80 = OpLoad %2 %79
1381  %81 = OpFAdd %2 %77 %80
1382  OpStore %22 %81
1383  OpReturn
1384  OpFunctionEnd
1385 )";
1386   Options options;
1387   options.ignore_location = true;
1388   DoStringDiffTest(kSrc, kDst, kDiff, options);
1389 }
1390 
TEST(DiffTest,DifferentDecorationsFragmentIgnoreSetBindingLocation)1391 TEST(DiffTest, DifferentDecorationsFragmentIgnoreSetBindingLocation) {
1392   constexpr char kDiff[] = R"( ; SPIR-V
1393  ; Version: 1.6
1394  ; Generator: Khronos SPIR-V Tools Assembler; 0
1395 -; Bound: 82
1396 +; Bound: 86
1397  ; Schema: 0
1398  OpCapability Shader
1399  OpMemoryModel Logical GLSL450
1400  OpEntryPoint Fragment %63 "main" %4 %22
1401  OpExecutionMode %63 OriginUpperLeft
1402  OpSource GLSL 450
1403  OpName %4 "_ue"
1404  OpName %8 "_uf"
1405  OpName %11 "_ug"
1406  OpName %12 "_uA"
1407  OpMemberName %12 0 "_ux"
1408  OpName %14 "_uc"
1409  OpName %15 "_uB"
1410  OpMemberName %15 0 "_ux"
1411  OpName %20 "_ud"
1412  OpName %22 "_ucol"
1413  OpName %26 "ANGLEDepthRangeParams"
1414  OpMemberName %26 0 "near"
1415  OpMemberName %26 1 "far"
1416  OpMemberName %26 2 "diff"
1417  OpMemberName %26 3 "reserved"
1418  OpName %27 "ANGLEUniformBlock"
1419  OpMemberName %27 0 "viewport"
1420  OpMemberName %27 1 "clipDistancesEnabled"
1421  OpMemberName %27 2 "xfbActiveUnpaused"
1422  OpMemberName %27 3 "xfbVerticesPerInstance"
1423  OpMemberName %27 4 "numSamples"
1424  OpMemberName %27 5 "xfbBufferOffsets"
1425  OpMemberName %27 6 "acbBufferOffsets"
1426  OpMemberName %27 7 "depthRange"
1427  OpName %29 "ANGLEUniforms"
1428  OpName %33 "_uc"
1429  OpName %32 "_uh"
1430  OpName %49 "_ux"
1431  OpName %50 "_uy"
1432  OpName %48 "_ui"
1433  OpName %63 "main"
1434  OpName %65 "param"
1435  OpName %68 "param"
1436  OpName %73 "param"
1437 -OpDecorate %4 Location 0
1438 +OpDecorate %4 Location 1
1439  OpDecorate %8 RelaxedPrecision
1440 -OpDecorate %8 DescriptorSet 0
1441 +OpDecorate %8 DescriptorSet 2
1442  OpDecorate %8 Binding 0
1443 -OpDecorate %11 DescriptorSet 0
1444 +OpDecorate %11 DescriptorSet 3
1445 -OpDecorate %11 Binding 1
1446 +OpDecorate %11 Binding 0
1447  OpMemberDecorate %12 0 Offset 0
1448  OpMemberDecorate %12 0 RelaxedPrecision
1449  OpDecorate %12 Block
1450 -OpDecorate %14 DescriptorSet 0
1451 +OpDecorate %14 DescriptorSet 3
1452 -OpDecorate %14 Binding 2
1453 +OpDecorate %14 Binding 1
1454  OpMemberDecorate %15 0 Offset 0
1455  OpMemberDecorate %15 0 RelaxedPrecision
1456  OpDecorate %15 BufferBlock
1457 -OpDecorate %20 DescriptorSet 0
1458 +OpDecorate %20 DescriptorSet 3
1459 -OpDecorate %20 Binding 3
1460 +OpDecorate %20 Binding 2
1461  OpDecorate %22 RelaxedPrecision
1462 -OpDecorate %22 Location 0
1463 +OpDecorate %22 Location 1
1464  OpMemberDecorate %26 0 Offset 0
1465  OpMemberDecorate %26 1 Offset 4
1466  OpMemberDecorate %26 2 Offset 8
1467  OpMemberDecorate %26 3 Offset 12
1468  OpMemberDecorate %27 0 Offset 0
1469  OpMemberDecorate %27 1 Offset 16
1470  OpMemberDecorate %27 2 Offset 20
1471  OpMemberDecorate %27 3 Offset 24
1472  OpMemberDecorate %27 4 Offset 28
1473  OpMemberDecorate %27 5 Offset 32
1474  OpMemberDecorate %27 6 Offset 48
1475  OpMemberDecorate %27 7 Offset 64
1476  OpMemberDecorate %27 2 RelaxedPrecision
1477  OpMemberDecorate %27 4 RelaxedPrecision
1478  OpDecorate %27 Block
1479  OpDecorate %29 DescriptorSet 0
1480 -OpDecorate %29 Binding 4
1481 +OpDecorate %29 Binding 0
1482  OpDecorate %32 RelaxedPrecision
1483  OpDecorate %33 RelaxedPrecision
1484  OpDecorate %36 RelaxedPrecision
1485  OpDecorate %37 RelaxedPrecision
1486  OpDecorate %38 RelaxedPrecision
1487  OpDecorate %39 RelaxedPrecision
1488  OpDecorate %41 RelaxedPrecision
1489  OpDecorate %42 RelaxedPrecision
1490  OpDecorate %43 RelaxedPrecision
1491  OpDecorate %48 RelaxedPrecision
1492  OpDecorate %49 RelaxedPrecision
1493  OpDecorate %50 RelaxedPrecision
1494  OpDecorate %52 RelaxedPrecision
1495  OpDecorate %53 RelaxedPrecision
1496  OpDecorate %54 RelaxedPrecision
1497  OpDecorate %55 RelaxedPrecision
1498  OpDecorate %56 RelaxedPrecision
1499  OpDecorate %57 RelaxedPrecision
1500  OpDecorate %58 RelaxedPrecision
1501  OpDecorate %59 RelaxedPrecision
1502  OpDecorate %60 RelaxedPrecision
1503  OpDecorate %67 RelaxedPrecision
1504  OpDecorate %68 RelaxedPrecision
1505  OpDecorate %72 RelaxedPrecision
1506  OpDecorate %73 RelaxedPrecision
1507  OpDecorate %75 RelaxedPrecision
1508  OpDecorate %76 RelaxedPrecision
1509  OpDecorate %77 RelaxedPrecision
1510  OpDecorate %80 RelaxedPrecision
1511  OpDecorate %81 RelaxedPrecision
1512  %1 = OpTypeFloat 32
1513  %2 = OpTypeVector %1 4
1514  %5 = OpTypeImage %1 2D 0 0 0 1 Unknown
1515  %6 = OpTypeSampledImage %5
1516  %9 = OpTypeImage %1 2D 0 0 0 2 Rgba8
1517  %12 = OpTypeStruct %2
1518  %15 = OpTypeStruct %2
1519  %16 = OpTypeInt 32 0
1520  %17 = OpConstant %16 2
1521  %18 = OpTypeArray %15 %17
1522  %23 = OpTypeInt 32 1
1523  %24 = OpTypeVector %23 4
1524  %25 = OpTypeVector %16 4
1525  %26 = OpTypeStruct %1 %1 %1 %1
1526  %27 = OpTypeStruct %2 %16 %16 %23 %23 %24 %25 %26
1527  %35 = OpTypeVector %1 2
1528  %40 = OpTypeVector %23 2
1529  %61 = OpTypeVoid
1530  %69 = OpConstant %16 0
1531  %78 = OpConstant %16 1
1532 +%82 = OpTypePointer Private %2
1533  %3 = OpTypePointer Input %2
1534  %7 = OpTypePointer UniformConstant %6
1535  %10 = OpTypePointer UniformConstant %9
1536  %13 = OpTypePointer Uniform %12
1537  %19 = OpTypePointer Uniform %18
1538 +%83 = OpTypePointer Private %2
1539  %21 = OpTypePointer Output %2
1540  %28 = OpTypePointer Uniform %27
1541  %30 = OpTypePointer Function %2
1542  %70 = OpTypePointer Uniform %2
1543  %31 = OpTypeFunction %2 %30
1544  %47 = OpTypeFunction %2 %30 %30
1545  %62 = OpTypeFunction %61
1546  %4 = OpVariable %3 Input
1547  %8 = OpVariable %7 UniformConstant
1548  %11 = OpVariable %10 UniformConstant
1549  %14 = OpVariable %13 Uniform
1550  %20 = OpVariable %19 Uniform
1551  %22 = OpVariable %21 Output
1552  %29 = OpVariable %28 Uniform
1553 +%84 = OpConstant %23 0
1554 +%85 = OpConstant %1 0.5
1555  %32 = OpFunction %2 None %31
1556  %33 = OpFunctionParameter %30
1557  %34 = OpLabel
1558  %36 = OpLoad %6 %8
1559  %37 = OpLoad %2 %33
1560  %38 = OpVectorShuffle %35 %37 %37 0 1
1561  %39 = OpImageSampleImplicitLod %2 %36 %38
1562  %41 = OpLoad %2 %33
1563  %42 = OpVectorShuffle %35 %41 %41 2 3
1564  %43 = OpConvertFToS %40 %42
1565  %44 = OpLoad %9 %11
1566  %45 = OpImageRead %2 %44 %43
1567  %46 = OpFAdd %2 %39 %45
1568  OpReturnValue %46
1569  OpFunctionEnd
1570  %48 = OpFunction %2 None %47
1571  %49 = OpFunctionParameter %30
1572  %50 = OpFunctionParameter %30
1573  %51 = OpLabel
1574  %52 = OpLoad %2 %49
1575  %53 = OpVectorShuffle %35 %52 %52 0 1
1576  %54 = OpLoad %2 %50
1577  %55 = OpVectorShuffle %35 %54 %54 2 3
1578  %56 = OpCompositeExtract %1 %53 0
1579  %57 = OpCompositeExtract %1 %53 1
1580  %58 = OpCompositeExtract %1 %55 0
1581  %59 = OpCompositeExtract %1 %55 1
1582  %60 = OpCompositeConstruct %2 %56 %57 %58 %59
1583  OpReturnValue %60
1584  OpFunctionEnd
1585  %63 = OpFunction %61 None %62
1586  %64 = OpLabel
1587  %65 = OpVariable %30 Function
1588  %68 = OpVariable %30 Function
1589  %73 = OpVariable %30 Function
1590  %66 = OpLoad %2 %4
1591  OpStore %65 %66
1592  %67 = OpFunctionCall %2 %32 %65
1593  %71 = OpAccessChain %70 %14 %69
1594  %72 = OpLoad %2 %71
1595  OpStore %68 %72
1596  %74 = OpAccessChain %70 %20 %69 %69
1597  %75 = OpLoad %2 %74
1598  OpStore %73 %75
1599  %76 = OpFunctionCall %2 %48 %68 %73
1600  %77 = OpFAdd %2 %67 %76
1601  %79 = OpAccessChain %70 %20 %78 %69
1602  %80 = OpLoad %2 %79
1603  %81 = OpFAdd %2 %77 %80
1604  OpStore %22 %81
1605  OpReturn
1606  OpFunctionEnd
1607 )";
1608   Options options;
1609   options.ignore_set_binding = true;
1610   options.ignore_location = true;
1611   DoStringDiffTest(kSrc, kDst, kDiff, options);
1612 }
1613 
1614 }  // namespace
1615 }  // namespace diff
1616 }  // namespace spvtools
1617