• 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 vertex shaders.
28 constexpr char kSrc[] = R"(OpCapability Shader
29 OpMemoryModel Logical GLSL450
30 OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %20 %25
31 OpSource GLSL 450
32 OpName %4 "_ub"
33 OpName %5 "_uc"
34 OpName %6 "_ud"
35 OpName %8 "_ue"
36 OpName %9 "defaultUniformsVS"
37 OpMemberName %9 0 "_ua"
38 OpName %11 ""
39 OpName %16 "ANGLEDepthRangeParams"
40 OpMemberName %16 0 "near"
41 OpMemberName %16 1 "far"
42 OpMemberName %16 2 "diff"
43 OpMemberName %16 3 "reserved"
44 OpName %17 "ANGLEUniformBlock"
45 OpMemberName %17 0 "viewport"
46 OpMemberName %17 1 "clipDistancesEnabled"
47 OpMemberName %17 2 "xfbActiveUnpaused"
48 OpMemberName %17 3 "xfbVerticesPerInstance"
49 OpMemberName %17 4 "numSamples"
50 OpMemberName %17 5 "xfbBufferOffsets"
51 OpMemberName %17 6 "acbBufferOffsets"
52 OpMemberName %17 7 "depthRange"
53 OpName %19 "ANGLEUniforms"
54 OpName %20 "ANGLEXfbPosition"
55 OpName %23 "gl_PerVertex"
56 OpMemberName %23 0 "gl_Position"
57 OpMemberName %23 1 "gl_PointSize"
58 OpMemberName %23 2 "gl_ClipDistance"
59 OpMemberName %23 3 "gl_CullDistance"
60 OpName %25 ""
61 OpName %29 "_ua"
62 OpName %28 "_uf"
63 OpName %33 "_uf"
64 OpName %32 "_ug"
65 OpName %40 "main"
66 OpName %42 "param"
67 OpName %50 "param"
68 OpName %53 "param"
69 OpDecorate %4 Location 0
70 OpDecorate %5 Location 1
71 OpDecorate %6 Location 2
72 OpDecorate %8 Location 0
73 OpMemberDecorate %9 0 Offset 0
74 OpDecorate %9 Block
75 OpDecorate %11 DescriptorSet 0
76 OpDecorate %11 Binding 0
77 OpMemberDecorate %16 0 Offset 0
78 OpMemberDecorate %16 1 Offset 4
79 OpMemberDecorate %16 2 Offset 8
80 OpMemberDecorate %16 3 Offset 12
81 OpMemberDecorate %17 0 Offset 0
82 OpMemberDecorate %17 1 Offset 16
83 OpMemberDecorate %17 2 Offset 20
84 OpMemberDecorate %17 3 Offset 24
85 OpMemberDecorate %17 4 Offset 28
86 OpMemberDecorate %17 5 Offset 32
87 OpMemberDecorate %17 6 Offset 48
88 OpMemberDecorate %17 7 Offset 64
89 OpMemberDecorate %17 2 RelaxedPrecision
90 OpMemberDecorate %17 4 RelaxedPrecision
91 OpDecorate %17 Block
92 OpDecorate %19 DescriptorSet 0
93 OpDecorate %19 Binding 1
94 OpDecorate %20 Location 1
95 OpMemberDecorate %23 0 BuiltIn Position
96 OpMemberDecorate %23 1 BuiltIn PointSize
97 OpMemberDecorate %23 2 BuiltIn ClipDistance
98 OpMemberDecorate %23 3 BuiltIn CullDistance
99 OpDecorate %23 Block
100 OpDecorate %28 RelaxedPrecision
101 OpDecorate %29 RelaxedPrecision
102 OpDecorate %31 RelaxedPrecision
103 OpDecorate %32 RelaxedPrecision
104 OpDecorate %33 RelaxedPrecision
105 OpDecorate %35 RelaxedPrecision
106 OpDecorate %36 RelaxedPrecision
107 OpDecorate %37 RelaxedPrecision
108 OpDecorate %44 RelaxedPrecision
109 OpDecorate %52 RelaxedPrecision
110 OpDecorate %55 RelaxedPrecision
111 OpDecorate %56 RelaxedPrecision
112 %1 = OpTypeFloat 32
113 %2 = OpTypeVector %1 4
114 %9 = OpTypeStruct %2
115 %12 = OpTypeInt 32 0
116 %13 = OpTypeInt 32 1
117 %14 = OpTypeVector %13 4
118 %15 = OpTypeVector %12 4
119 %16 = OpTypeStruct %1 %1 %1 %1
120 %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
121 %21 = OpConstant %12 8
122 %22 = OpTypeArray %1 %21
123 %23 = OpTypeStruct %2 %1 %22 %22
124 %38 = OpTypeVoid
125 %45 = OpConstant %12 0
126 %3 = OpTypePointer Input %2
127 %7 = OpTypePointer Output %2
128 %10 = OpTypePointer Uniform %9
129 %18 = OpTypePointer Uniform %17
130 %24 = OpTypePointer Output %23
131 %26 = OpTypePointer Function %2
132 %46 = OpTypePointer Uniform %2
133 %27 = OpTypeFunction %2 %26
134 %39 = OpTypeFunction %38
135 %4 = OpVariable %3 Input
136 %5 = OpVariable %3 Input
137 %6 = OpVariable %3 Input
138 %8 = OpVariable %7 Output
139 %11 = OpVariable %10 Uniform
140 %19 = OpVariable %18 Uniform
141 %20 = OpVariable %7 Output
142 %25 = OpVariable %24 Output
143 %28 = OpFunction %2 None %27
144 %29 = OpFunctionParameter %26
145 %30 = OpLabel
146 %31 = OpLoad %2 %29
147 OpReturnValue %31
148 OpFunctionEnd
149 %32 = OpFunction %2 None %27
150 %33 = OpFunctionParameter %26
151 %34 = OpLabel
152 %35 = OpLoad %2 %33
153 %36 = OpLoad %2 %33
154 %37 = OpFAdd %2 %35 %36
155 OpReturnValue %37
156 OpFunctionEnd
157 %40 = OpFunction %38 None %39
158 %41 = OpLabel
159 %42 = OpVariable %26 Function
160 %50 = OpVariable %26 Function
161 %53 = OpVariable %26 Function
162 %43 = OpLoad %2 %4
163 OpStore %42 %43
164 %44 = OpFunctionCall %2 %28 %42
165 %47 = OpAccessChain %46 %11 %45
166 %48 = OpLoad %2 %47
167 %49 = OpFAdd %2 %44 %48
168 OpStore %8 %49
169 %51 = OpLoad %2 %5
170 OpStore %50 %51
171 %52 = OpFunctionCall %2 %32 %50
172 %54 = OpLoad %2 %6
173 OpStore %53 %54
174 %55 = OpFunctionCall %2 %28 %53
175 %56 = OpFAdd %2 %52 %55
176 %57 = OpAccessChain %7 %25 %45
177 OpStore %57 %56
178 OpReturn
179 OpFunctionEnd
180 )";
181 constexpr char kDst[] = R"(OpCapability Shader
182 OpMemoryModel Logical GLSL450
183 OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %25
184 OpSource GLSL 450
185 OpName %4 "_ub"
186 OpName %5 "_uc"
187 OpName %6 "_ud"
188 OpName %8 "_ue"
189 OpName %9 "defaultUniformsVS"
190 OpMemberName %9 0 "_ua"
191 OpName %11 ""
192 OpName %16 "ANGLEDepthRangeParams"
193 OpMemberName %16 0 "near"
194 OpMemberName %16 1 "far"
195 OpMemberName %16 2 "diff"
196 OpMemberName %16 3 "reserved"
197 OpName %17 "ANGLEUniformBlock"
198 OpMemberName %17 0 "viewport"
199 OpMemberName %17 1 "clipDistancesEnabled"
200 OpMemberName %17 2 "xfbActiveUnpaused"
201 OpMemberName %17 3 "xfbVerticesPerInstance"
202 OpMemberName %17 4 "numSamples"
203 OpMemberName %17 5 "xfbBufferOffsets"
204 OpMemberName %17 6 "acbBufferOffsets"
205 OpMemberName %17 7 "depthRange"
206 OpName %19 "ANGLEUniforms"
207 OpName %23 "gl_PerVertex"
208 OpMemberName %23 0 "gl_Position"
209 OpName %25 ""
210 OpName %29 "_ua"
211 OpName %28 "_uf"
212 OpName %33 "_uf"
213 OpName %32 "_ug"
214 OpName %40 "main"
215 OpName %42 "param"
216 OpName %50 "param"
217 OpName %53 "param"
218 OpDecorate %4 Location 1
219 OpDecorate %5 Location 2
220 OpDecorate %6 Location 0
221 OpDecorate %8 Location 1
222 OpMemberDecorate %9 0 Offset 0
223 OpDecorate %9 Block
224 OpDecorate %11 DescriptorSet 0
225 OpDecorate %11 Binding 1
226 OpMemberDecorate %16 0 Offset 0
227 OpMemberDecorate %16 1 Offset 4
228 OpMemberDecorate %16 2 Offset 8
229 OpMemberDecorate %16 3 Offset 12
230 OpMemberDecorate %17 0 Offset 0
231 OpMemberDecorate %17 1 Offset 16
232 OpMemberDecorate %17 2 Offset 20
233 OpMemberDecorate %17 3 Offset 24
234 OpMemberDecorate %17 4 Offset 28
235 OpMemberDecorate %17 5 Offset 32
236 OpMemberDecorate %17 6 Offset 48
237 OpMemberDecorate %17 7 Offset 64
238 OpMemberDecorate %17 2 RelaxedPrecision
239 OpMemberDecorate %17 4 RelaxedPrecision
240 OpDecorate %17 Block
241 OpDecorate %19 DescriptorSet 2
242 OpDecorate %19 Binding 0
243 OpMemberDecorate %23 0 BuiltIn Position
244 OpDecorate %23 Block
245 OpDecorate %28 RelaxedPrecision
246 OpDecorate %29 RelaxedPrecision
247 OpDecorate %31 RelaxedPrecision
248 OpDecorate %32 RelaxedPrecision
249 OpDecorate %33 RelaxedPrecision
250 OpDecorate %35 RelaxedPrecision
251 OpDecorate %36 RelaxedPrecision
252 OpDecorate %37 RelaxedPrecision
253 OpDecorate %44 RelaxedPrecision
254 OpDecorate %52 RelaxedPrecision
255 OpDecorate %55 RelaxedPrecision
256 OpDecorate %56 RelaxedPrecision
257 %1 = OpTypeFloat 32
258 %2 = OpTypeVector %1 4
259 %9 = OpTypeStruct %2
260 %12 = OpTypeInt 32 0
261 %13 = OpTypeInt 32 1
262 %14 = OpTypeVector %13 4
263 %15 = OpTypeVector %12 4
264 %16 = OpTypeStruct %1 %1 %1 %1
265 %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
266 %21 = OpConstant %12 8
267 %22 = OpTypeArray %1 %21
268 %23 = OpTypeStruct %2
269 %38 = OpTypeVoid
270 %45 = OpConstant %12 0
271 %58 = OpTypePointer Private %2
272 %3 = OpTypePointer Input %2
273 %59 = OpTypePointer Private %2
274 %7 = OpTypePointer Output %2
275 %10 = OpTypePointer Uniform %9
276 %18 = OpTypePointer Uniform %17
277 %24 = OpTypePointer Output %23
278 %26 = OpTypePointer Function %2
279 %46 = OpTypePointer Uniform %2
280 %27 = OpTypeFunction %2 %26
281 %39 = OpTypeFunction %38
282 %4 = OpVariable %3 Input
283 %5 = OpVariable %3 Input
284 %6 = OpVariable %3 Input
285 %8 = OpVariable %7 Output
286 %11 = OpVariable %10 Uniform
287 %19 = OpVariable %18 Uniform
288 %20 = OpVariable %59 Private
289 %25 = OpVariable %24 Output
290 %60 = OpConstant %13 0
291 %61 = OpConstant %1 0.5
292 %28 = OpFunction %2 None %27
293 %29 = OpFunctionParameter %26
294 %30 = OpLabel
295 %31 = OpLoad %2 %29
296 OpReturnValue %31
297 OpFunctionEnd
298 %32 = OpFunction %2 None %27
299 %33 = OpFunctionParameter %26
300 %34 = OpLabel
301 %35 = OpLoad %2 %33
302 %36 = OpLoad %2 %33
303 %37 = OpFAdd %2 %35 %36
304 OpReturnValue %37
305 OpFunctionEnd
306 %40 = OpFunction %38 None %39
307 %41 = OpLabel
308 %42 = OpVariable %26 Function
309 %50 = OpVariable %26 Function
310 %53 = OpVariable %26 Function
311 %43 = OpLoad %2 %4
312 OpStore %42 %43
313 %44 = OpFunctionCall %2 %28 %42
314 %47 = OpAccessChain %46 %11 %45
315 %48 = OpLoad %2 %47
316 %49 = OpFAdd %2 %44 %48
317 OpStore %8 %49
318 %51 = OpLoad %2 %5
319 OpStore %50 %51
320 %52 = OpFunctionCall %2 %32 %50
321 %54 = OpLoad %2 %6
322 OpStore %53 %54
323 %55 = OpFunctionCall %2 %28 %53
324 %56 = OpFAdd %2 %52 %55
325 %57 = OpAccessChain %7 %25 %45
326 OpStore %57 %56
327 %62 = OpAccessChain %7 %25 %60
328 %63 = OpLoad %2 %62
329 %64 = OpCompositeExtract %1 %63 0
330 %65 = OpCompositeExtract %1 %63 1
331 %66 = OpCompositeExtract %1 %63 2
332 %67 = OpCompositeExtract %1 %63 3
333 %69 = OpFNegate %1 %64
334 %70 = OpFAdd %1 %66 %67
335 %71 = OpFMul %1 %70 %61
336 %68 = OpCompositeConstruct %2 %65 %69 %71 %67
337 OpStore %62 %68
338 OpReturn
339 OpFunctionEnd
340 )";
341 
TEST(DiffTest,DifferentDecorationsVertex)342 TEST(DiffTest, DifferentDecorationsVertex) {
343   constexpr char kDiff[] = R"( ; SPIR-V
344  ; Version: 1.6
345  ; Generator: Khronos SPIR-V Tools Assembler; 0
346 -; Bound: 58
347 +; Bound: 73
348  ; Schema: 0
349  OpCapability Shader
350  OpMemoryModel Logical GLSL450
351 -OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %20 %25
352 +OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %25
353  OpSource GLSL 450
354  OpName %4 "_ub"
355  OpName %5 "_uc"
356  OpName %6 "_ud"
357  OpName %8 "_ue"
358  OpName %9 "defaultUniformsVS"
359  OpMemberName %9 0 "_ua"
360  OpName %11 ""
361  OpName %16 "ANGLEDepthRangeParams"
362  OpMemberName %16 0 "near"
363  OpMemberName %16 1 "far"
364  OpMemberName %16 2 "diff"
365  OpMemberName %16 3 "reserved"
366  OpName %17 "ANGLEUniformBlock"
367  OpMemberName %17 0 "viewport"
368  OpMemberName %17 1 "clipDistancesEnabled"
369  OpMemberName %17 2 "xfbActiveUnpaused"
370  OpMemberName %17 3 "xfbVerticesPerInstance"
371  OpMemberName %17 4 "numSamples"
372  OpMemberName %17 5 "xfbBufferOffsets"
373  OpMemberName %17 6 "acbBufferOffsets"
374  OpMemberName %17 7 "depthRange"
375  OpName %19 "ANGLEUniforms"
376 -OpName %20 "ANGLEXfbPosition"
377  OpName %23 "gl_PerVertex"
378  OpMemberName %23 0 "gl_Position"
379 -OpMemberName %23 1 "gl_PointSize"
380 -OpMemberName %23 2 "gl_ClipDistance"
381 -OpMemberName %23 3 "gl_CullDistance"
382  OpName %25 ""
383  OpName %29 "_ua"
384  OpName %28 "_uf"
385  OpName %33 "_uf"
386  OpName %32 "_ug"
387  OpName %40 "main"
388  OpName %42 "param"
389  OpName %50 "param"
390  OpName %53 "param"
391 -OpDecorate %4 Location 0
392 +OpDecorate %4 Location 1
393 -OpDecorate %5 Location 1
394 +OpDecorate %5 Location 2
395 -OpDecorate %6 Location 2
396 +OpDecorate %6 Location 0
397 -OpDecorate %8 Location 0
398 +OpDecorate %8 Location 1
399  OpMemberDecorate %9 0 Offset 0
400  OpDecorate %9 Block
401  OpDecorate %11 DescriptorSet 0
402 -OpDecorate %11 Binding 0
403 +OpDecorate %11 Binding 1
404  OpMemberDecorate %16 0 Offset 0
405  OpMemberDecorate %16 1 Offset 4
406  OpMemberDecorate %16 2 Offset 8
407  OpMemberDecorate %16 3 Offset 12
408  OpMemberDecorate %17 0 Offset 0
409  OpMemberDecorate %17 1 Offset 16
410  OpMemberDecorate %17 2 Offset 20
411  OpMemberDecorate %17 3 Offset 24
412  OpMemberDecorate %17 4 Offset 28
413  OpMemberDecorate %17 5 Offset 32
414  OpMemberDecorate %17 6 Offset 48
415  OpMemberDecorate %17 7 Offset 64
416  OpMemberDecorate %17 2 RelaxedPrecision
417  OpMemberDecorate %17 4 RelaxedPrecision
418  OpDecorate %17 Block
419 -OpDecorate %19 DescriptorSet 0
420 +OpDecorate %19 DescriptorSet 2
421 -OpDecorate %19 Binding 1
422 +OpDecorate %19 Binding 0
423 -OpDecorate %20 Location 1
424  OpMemberDecorate %23 0 BuiltIn Position
425 -OpMemberDecorate %23 1 BuiltIn PointSize
426 -OpMemberDecorate %23 2 BuiltIn ClipDistance
427 -OpMemberDecorate %23 3 BuiltIn CullDistance
428  OpDecorate %23 Block
429  OpDecorate %28 RelaxedPrecision
430  OpDecorate %29 RelaxedPrecision
431  OpDecorate %31 RelaxedPrecision
432  OpDecorate %32 RelaxedPrecision
433  OpDecorate %33 RelaxedPrecision
434  OpDecorate %35 RelaxedPrecision
435  OpDecorate %36 RelaxedPrecision
436  OpDecorate %37 RelaxedPrecision
437  OpDecorate %44 RelaxedPrecision
438  OpDecorate %52 RelaxedPrecision
439  OpDecorate %55 RelaxedPrecision
440  OpDecorate %56 RelaxedPrecision
441  %1 = OpTypeFloat 32
442  %2 = OpTypeVector %1 4
443  %9 = OpTypeStruct %2
444  %12 = OpTypeInt 32 0
445  %13 = OpTypeInt 32 1
446  %14 = OpTypeVector %13 4
447  %15 = OpTypeVector %12 4
448  %16 = OpTypeStruct %1 %1 %1 %1
449  %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
450  %21 = OpConstant %12 8
451  %22 = OpTypeArray %1 %21
452 -%23 = OpTypeStruct %2 %1 %22 %22
453 +%23 = OpTypeStruct %2
454  %38 = OpTypeVoid
455  %45 = OpConstant %12 0
456 +%59 = OpTypePointer Private %2
457  %3 = OpTypePointer Input %2
458 +%60 = OpTypePointer Private %2
459  %7 = OpTypePointer Output %2
460  %10 = OpTypePointer Uniform %9
461  %18 = OpTypePointer Uniform %17
462  %24 = OpTypePointer Output %23
463  %26 = OpTypePointer Function %2
464  %46 = OpTypePointer Uniform %2
465  %27 = OpTypeFunction %2 %26
466  %39 = OpTypeFunction %38
467  %4 = OpVariable %3 Input
468  %5 = OpVariable %3 Input
469  %6 = OpVariable %3 Input
470  %8 = OpVariable %7 Output
471  %11 = OpVariable %10 Uniform
472  %19 = OpVariable %18 Uniform
473 -%20 = OpVariable %7 Output
474 +%58 = OpVariable %60 Private
475  %25 = OpVariable %24 Output
476 +%61 = OpConstant %13 0
477 +%62 = OpConstant %1 0.5
478  %28 = OpFunction %2 None %27
479  %29 = OpFunctionParameter %26
480  %30 = OpLabel
481  %31 = OpLoad %2 %29
482  OpReturnValue %31
483  OpFunctionEnd
484  %32 = OpFunction %2 None %27
485  %33 = OpFunctionParameter %26
486  %34 = OpLabel
487  %35 = OpLoad %2 %33
488  %36 = OpLoad %2 %33
489  %37 = OpFAdd %2 %35 %36
490  OpReturnValue %37
491  OpFunctionEnd
492  %40 = OpFunction %38 None %39
493  %41 = OpLabel
494  %42 = OpVariable %26 Function
495  %50 = OpVariable %26 Function
496  %53 = OpVariable %26 Function
497  %43 = OpLoad %2 %4
498  OpStore %42 %43
499  %44 = OpFunctionCall %2 %28 %42
500  %47 = OpAccessChain %46 %11 %45
501  %48 = OpLoad %2 %47
502  %49 = OpFAdd %2 %44 %48
503  OpStore %8 %49
504  %51 = OpLoad %2 %5
505  OpStore %50 %51
506  %52 = OpFunctionCall %2 %32 %50
507  %54 = OpLoad %2 %6
508  OpStore %53 %54
509  %55 = OpFunctionCall %2 %28 %53
510  %56 = OpFAdd %2 %52 %55
511  %57 = OpAccessChain %7 %25 %45
512  OpStore %57 %56
513 +%63 = OpAccessChain %7 %25 %61
514 +%64 = OpLoad %2 %63
515 +%65 = OpCompositeExtract %1 %64 0
516 +%66 = OpCompositeExtract %1 %64 1
517 +%67 = OpCompositeExtract %1 %64 2
518 +%68 = OpCompositeExtract %1 %64 3
519 +%70 = OpFNegate %1 %65
520 +%71 = OpFAdd %1 %67 %68
521 +%72 = OpFMul %1 %71 %62
522 +%69 = OpCompositeConstruct %2 %66 %70 %72 %68
523 +OpStore %63 %69
524  OpReturn
525  OpFunctionEnd
526 )";
527   Options options;
528   DoStringDiffTest(kSrc, kDst, kDiff, options);
529 }
530 
TEST(DiffTest,DifferentDecorationsVertexNoDebug)531 TEST(DiffTest, DifferentDecorationsVertexNoDebug) {
532   constexpr char kSrcNoDebug[] = R"(OpCapability Shader
533 OpMemoryModel Logical GLSL450
534 OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %20 %25
535 OpSource GLSL 450
536 OpDecorate %4 Location 0
537 OpDecorate %5 Location 1
538 OpDecorate %6 Location 2
539 OpDecorate %8 Location 0
540 OpMemberDecorate %9 0 Offset 0
541 OpDecorate %9 Block
542 OpDecorate %11 DescriptorSet 0
543 OpDecorate %11 Binding 0
544 OpMemberDecorate %16 0 Offset 0
545 OpMemberDecorate %16 1 Offset 4
546 OpMemberDecorate %16 2 Offset 8
547 OpMemberDecorate %16 3 Offset 12
548 OpMemberDecorate %17 0 Offset 0
549 OpMemberDecorate %17 1 Offset 16
550 OpMemberDecorate %17 2 Offset 20
551 OpMemberDecorate %17 3 Offset 24
552 OpMemberDecorate %17 4 Offset 28
553 OpMemberDecorate %17 5 Offset 32
554 OpMemberDecorate %17 6 Offset 48
555 OpMemberDecorate %17 7 Offset 64
556 OpMemberDecorate %17 2 RelaxedPrecision
557 OpMemberDecorate %17 4 RelaxedPrecision
558 OpDecorate %17 Block
559 OpDecorate %19 DescriptorSet 0
560 OpDecorate %19 Binding 1
561 OpDecorate %20 Location 1
562 OpMemberDecorate %23 0 BuiltIn Position
563 OpMemberDecorate %23 1 BuiltIn PointSize
564 OpMemberDecorate %23 2 BuiltIn ClipDistance
565 OpMemberDecorate %23 3 BuiltIn CullDistance
566 OpDecorate %23 Block
567 OpDecorate %28 RelaxedPrecision
568 OpDecorate %29 RelaxedPrecision
569 OpDecorate %31 RelaxedPrecision
570 OpDecorate %32 RelaxedPrecision
571 OpDecorate %33 RelaxedPrecision
572 OpDecorate %35 RelaxedPrecision
573 OpDecorate %36 RelaxedPrecision
574 OpDecorate %37 RelaxedPrecision
575 OpDecorate %44 RelaxedPrecision
576 OpDecorate %52 RelaxedPrecision
577 OpDecorate %55 RelaxedPrecision
578 OpDecorate %56 RelaxedPrecision
579 %1 = OpTypeFloat 32
580 %2 = OpTypeVector %1 4
581 %9 = OpTypeStruct %2
582 %12 = OpTypeInt 32 0
583 %13 = OpTypeInt 32 1
584 %14 = OpTypeVector %13 4
585 %15 = OpTypeVector %12 4
586 %16 = OpTypeStruct %1 %1 %1 %1
587 %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
588 %21 = OpConstant %12 8
589 %22 = OpTypeArray %1 %21
590 %23 = OpTypeStruct %2 %1 %22 %22
591 %38 = OpTypeVoid
592 %45 = OpConstant %12 0
593 %3 = OpTypePointer Input %2
594 %7 = OpTypePointer Output %2
595 %10 = OpTypePointer Uniform %9
596 %18 = OpTypePointer Uniform %17
597 %24 = OpTypePointer Output %23
598 %26 = OpTypePointer Function %2
599 %46 = OpTypePointer Uniform %2
600 %27 = OpTypeFunction %2 %26
601 %39 = OpTypeFunction %38
602 %4 = OpVariable %3 Input
603 %5 = OpVariable %3 Input
604 %6 = OpVariable %3 Input
605 %8 = OpVariable %7 Output
606 %11 = OpVariable %10 Uniform
607 %19 = OpVariable %18 Uniform
608 %20 = OpVariable %7 Output
609 %25 = OpVariable %24 Output
610 %28 = OpFunction %2 None %27
611 %29 = OpFunctionParameter %26
612 %30 = OpLabel
613 %31 = OpLoad %2 %29
614 OpReturnValue %31
615 OpFunctionEnd
616 %32 = OpFunction %2 None %27
617 %33 = OpFunctionParameter %26
618 %34 = OpLabel
619 %35 = OpLoad %2 %33
620 %36 = OpLoad %2 %33
621 %37 = OpFAdd %2 %35 %36
622 OpReturnValue %37
623 OpFunctionEnd
624 %40 = OpFunction %38 None %39
625 %41 = OpLabel
626 %42 = OpVariable %26 Function
627 %50 = OpVariable %26 Function
628 %53 = OpVariable %26 Function
629 %43 = OpLoad %2 %4
630 OpStore %42 %43
631 %44 = OpFunctionCall %2 %28 %42
632 %47 = OpAccessChain %46 %11 %45
633 %48 = OpLoad %2 %47
634 %49 = OpFAdd %2 %44 %48
635 OpStore %8 %49
636 %51 = OpLoad %2 %5
637 OpStore %50 %51
638 %52 = OpFunctionCall %2 %32 %50
639 %54 = OpLoad %2 %6
640 OpStore %53 %54
641 %55 = OpFunctionCall %2 %28 %53
642 %56 = OpFAdd %2 %52 %55
643 %57 = OpAccessChain %7 %25 %45
644 OpStore %57 %56
645 OpReturn
646 OpFunctionEnd
647 
648 )";
649   constexpr char kDstNoDebug[] = R"(OpCapability Shader
650 OpMemoryModel Logical GLSL450
651 OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %25
652 OpSource GLSL 450
653 OpDecorate %4 Location 1
654 OpDecorate %5 Location 2
655 OpDecorate %6 Location 0
656 OpDecorate %8 Location 1
657 OpMemberDecorate %9 0 Offset 0
658 OpDecorate %9 Block
659 OpDecorate %11 DescriptorSet 0
660 OpDecorate %11 Binding 1
661 OpMemberDecorate %16 0 Offset 0
662 OpMemberDecorate %16 1 Offset 4
663 OpMemberDecorate %16 2 Offset 8
664 OpMemberDecorate %16 3 Offset 12
665 OpMemberDecorate %17 0 Offset 0
666 OpMemberDecorate %17 1 Offset 16
667 OpMemberDecorate %17 2 Offset 20
668 OpMemberDecorate %17 3 Offset 24
669 OpMemberDecorate %17 4 Offset 28
670 OpMemberDecorate %17 5 Offset 32
671 OpMemberDecorate %17 6 Offset 48
672 OpMemberDecorate %17 7 Offset 64
673 OpMemberDecorate %17 2 RelaxedPrecision
674 OpMemberDecorate %17 4 RelaxedPrecision
675 OpDecorate %17 Block
676 OpDecorate %19 DescriptorSet 2
677 OpDecorate %19 Binding 0
678 OpMemberDecorate %23 0 BuiltIn Position
679 OpDecorate %23 Block
680 OpDecorate %28 RelaxedPrecision
681 OpDecorate %29 RelaxedPrecision
682 OpDecorate %31 RelaxedPrecision
683 OpDecorate %32 RelaxedPrecision
684 OpDecorate %33 RelaxedPrecision
685 OpDecorate %35 RelaxedPrecision
686 OpDecorate %36 RelaxedPrecision
687 OpDecorate %37 RelaxedPrecision
688 OpDecorate %44 RelaxedPrecision
689 OpDecorate %52 RelaxedPrecision
690 OpDecorate %55 RelaxedPrecision
691 OpDecorate %56 RelaxedPrecision
692 %1 = OpTypeFloat 32
693 %2 = OpTypeVector %1 4
694 %9 = OpTypeStruct %2
695 %12 = OpTypeInt 32 0
696 %13 = OpTypeInt 32 1
697 %14 = OpTypeVector %13 4
698 %15 = OpTypeVector %12 4
699 %16 = OpTypeStruct %1 %1 %1 %1
700 %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
701 %21 = OpConstant %12 8
702 %22 = OpTypeArray %1 %21
703 %23 = OpTypeStruct %2
704 %38 = OpTypeVoid
705 %45 = OpConstant %12 0
706 %58 = OpTypePointer Private %2
707 %3 = OpTypePointer Input %2
708 %59 = OpTypePointer Private %2
709 %7 = OpTypePointer Output %2
710 %10 = OpTypePointer Uniform %9
711 %18 = OpTypePointer Uniform %17
712 %24 = OpTypePointer Output %23
713 %26 = OpTypePointer Function %2
714 %46 = OpTypePointer Uniform %2
715 %27 = OpTypeFunction %2 %26
716 %39 = OpTypeFunction %38
717 %4 = OpVariable %3 Input
718 %5 = OpVariable %3 Input
719 %6 = OpVariable %3 Input
720 %8 = OpVariable %7 Output
721 %11 = OpVariable %10 Uniform
722 %19 = OpVariable %18 Uniform
723 %20 = OpVariable %59 Private
724 %25 = OpVariable %24 Output
725 %60 = OpConstant %13 0
726 %61 = OpConstant %1 0.5
727 %28 = OpFunction %2 None %27
728 %29 = OpFunctionParameter %26
729 %30 = OpLabel
730 %31 = OpLoad %2 %29
731 OpReturnValue %31
732 OpFunctionEnd
733 %32 = OpFunction %2 None %27
734 %33 = OpFunctionParameter %26
735 %34 = OpLabel
736 %35 = OpLoad %2 %33
737 %36 = OpLoad %2 %33
738 %37 = OpFAdd %2 %35 %36
739 OpReturnValue %37
740 OpFunctionEnd
741 %40 = OpFunction %38 None %39
742 %41 = OpLabel
743 %42 = OpVariable %26 Function
744 %50 = OpVariable %26 Function
745 %53 = OpVariable %26 Function
746 %43 = OpLoad %2 %4
747 OpStore %42 %43
748 %44 = OpFunctionCall %2 %28 %42
749 %47 = OpAccessChain %46 %11 %45
750 %48 = OpLoad %2 %47
751 %49 = OpFAdd %2 %44 %48
752 OpStore %8 %49
753 %51 = OpLoad %2 %5
754 OpStore %50 %51
755 %52 = OpFunctionCall %2 %32 %50
756 %54 = OpLoad %2 %6
757 OpStore %53 %54
758 %55 = OpFunctionCall %2 %28 %53
759 %56 = OpFAdd %2 %52 %55
760 %57 = OpAccessChain %7 %25 %45
761 OpStore %57 %56
762 %62 = OpAccessChain %7 %25 %60
763 %63 = OpLoad %2 %62
764 %64 = OpCompositeExtract %1 %63 0
765 %65 = OpCompositeExtract %1 %63 1
766 %66 = OpCompositeExtract %1 %63 2
767 %67 = OpCompositeExtract %1 %63 3
768 %69 = OpFNegate %1 %64
769 %70 = OpFAdd %1 %66 %67
770 %71 = OpFMul %1 %70 %61
771 %68 = OpCompositeConstruct %2 %65 %69 %71 %67
772 OpStore %62 %68
773 OpReturn
774 OpFunctionEnd
775 )";
776   constexpr char kDiff[] = R"( ; SPIR-V
777  ; Version: 1.6
778  ; Generator: Khronos SPIR-V Tools Assembler; 0
779 -; Bound: 58
780 +; Bound: 79
781  ; Schema: 0
782  OpCapability Shader
783  OpMemoryModel Logical GLSL450
784 -OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %20 %25
785 +OpEntryPoint Vertex %40 "main" %5 %6 %4 %20 %25
786  OpSource GLSL 450
787  OpDecorate %4 Location 0
788  OpDecorate %5 Location 1
789  OpDecorate %6 Location 2
790 -OpDecorate %8 Location 0
791  OpMemberDecorate %9 0 Offset 0
792  OpDecorate %9 Block
793 -OpDecorate %11 DescriptorSet 0
794 +OpDecorate %11 DescriptorSet 2
795  OpDecorate %11 Binding 0
796  OpMemberDecorate %16 0 Offset 0
797  OpMemberDecorate %16 1 Offset 4
798  OpMemberDecorate %16 2 Offset 8
799  OpMemberDecorate %16 3 Offset 12
800  OpMemberDecorate %17 0 Offset 0
801  OpMemberDecorate %17 1 Offset 16
802  OpMemberDecorate %17 2 Offset 20
803  OpMemberDecorate %17 3 Offset 24
804  OpMemberDecorate %17 4 Offset 28
805  OpMemberDecorate %17 5 Offset 32
806  OpMemberDecorate %17 6 Offset 48
807  OpMemberDecorate %17 7 Offset 64
808  OpMemberDecorate %17 2 RelaxedPrecision
809  OpMemberDecorate %17 4 RelaxedPrecision
810  OpDecorate %17 Block
811  OpDecorate %19 DescriptorSet 0
812  OpDecorate %19 Binding 1
813  OpDecorate %20 Location 1
814  OpMemberDecorate %23 0 BuiltIn Position
815 -OpMemberDecorate %23 1 BuiltIn PointSize
816 -OpMemberDecorate %23 2 BuiltIn ClipDistance
817 -OpMemberDecorate %23 3 BuiltIn CullDistance
818  OpDecorate %23 Block
819  OpDecorate %28 RelaxedPrecision
820 -OpDecorate %29 RelaxedPrecision
821 +OpDecorate %59 RelaxedPrecision
822  OpDecorate %31 RelaxedPrecision
823  OpDecorate %32 RelaxedPrecision
824 -OpDecorate %33 RelaxedPrecision
825 +OpDecorate %60 RelaxedPrecision
826  OpDecorate %35 RelaxedPrecision
827  OpDecorate %36 RelaxedPrecision
828  OpDecorate %37 RelaxedPrecision
829  OpDecorate %44 RelaxedPrecision
830  OpDecorate %52 RelaxedPrecision
831  OpDecorate %55 RelaxedPrecision
832  OpDecorate %56 RelaxedPrecision
833  %1 = OpTypeFloat 32
834  %2 = OpTypeVector %1 4
835  %9 = OpTypeStruct %2
836  %12 = OpTypeInt 32 0
837  %13 = OpTypeInt 32 1
838  %14 = OpTypeVector %13 4
839  %15 = OpTypeVector %12 4
840  %16 = OpTypeStruct %1 %1 %1 %1
841  %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
842  %21 = OpConstant %12 8
843  %22 = OpTypeArray %1 %21
844 -%23 = OpTypeStruct %2 %1 %22 %22
845 +%23 = OpTypeStruct %2
846  %38 = OpTypeVoid
847  %45 = OpConstant %12 0
848 +%65 = OpTypePointer Private %2
849  %3 = OpTypePointer Input %2
850 +%66 = OpTypePointer Private %2
851  %7 = OpTypePointer Output %2
852  %10 = OpTypePointer Uniform %9
853  %18 = OpTypePointer Uniform %17
854  %24 = OpTypePointer Output %23
855  %26 = OpTypePointer Function %2
856  %46 = OpTypePointer Uniform %2
857  %27 = OpTypeFunction %2 %26
858  %39 = OpTypeFunction %38
859  %4 = OpVariable %3 Input
860  %5 = OpVariable %3 Input
861  %6 = OpVariable %3 Input
862 -%8 = OpVariable %7 Output
863 -%11 = OpVariable %10 Uniform
864 +%11 = OpVariable %18 Uniform
865 -%19 = OpVariable %18 Uniform
866 +%19 = OpVariable %10 Uniform
867  %20 = OpVariable %7 Output
868 +%58 = OpVariable %66 Private
869  %25 = OpVariable %24 Output
870 +%67 = OpConstant %13 0
871 +%68 = OpConstant %1 0.5
872  %28 = OpFunction %2 None %27
873 -%29 = OpFunctionParameter %26
874 +%59 = OpFunctionParameter %26
875  %30 = OpLabel
876 -%31 = OpLoad %2 %29
877 +%31 = OpLoad %2 %59
878  OpReturnValue %31
879  OpFunctionEnd
880  %32 = OpFunction %2 None %27
881 -%33 = OpFunctionParameter %26
882 +%60 = OpFunctionParameter %26
883  %34 = OpLabel
884 -%35 = OpLoad %2 %33
885 +%35 = OpLoad %2 %60
886 -%36 = OpLoad %2 %33
887 +%36 = OpLoad %2 %60
888  %37 = OpFAdd %2 %35 %36
889  OpReturnValue %37
890  OpFunctionEnd
891  %40 = OpFunction %38 None %39
892  %41 = OpLabel
893  %42 = OpVariable %26 Function
894  %50 = OpVariable %26 Function
895  %53 = OpVariable %26 Function
896 -%43 = OpLoad %2 %4
897 +%61 = OpLoad %2 %5
898 -OpStore %42 %43
899 +OpStore %42 %61
900  %44 = OpFunctionCall %2 %28 %42
901 -%47 = OpAccessChain %46 %11 %45
902 +%62 = OpAccessChain %46 %19 %45
903 -%48 = OpLoad %2 %47
904 +%48 = OpLoad %2 %62
905  %49 = OpFAdd %2 %44 %48
906 -OpStore %8 %49
907 +OpStore %20 %49
908 -%51 = OpLoad %2 %5
909 +%63 = OpLoad %2 %6
910 -OpStore %50 %51
911 +OpStore %50 %63
912  %52 = OpFunctionCall %2 %32 %50
913 -%54 = OpLoad %2 %6
914 +%64 = OpLoad %2 %4
915 -OpStore %53 %54
916 +OpStore %53 %64
917  %55 = OpFunctionCall %2 %28 %53
918  %56 = OpFAdd %2 %52 %55
919  %57 = OpAccessChain %7 %25 %45
920  OpStore %57 %56
921 +%69 = OpAccessChain %7 %25 %67
922 +%70 = OpLoad %2 %69
923 +%71 = OpCompositeExtract %1 %70 0
924 +%72 = OpCompositeExtract %1 %70 1
925 +%73 = OpCompositeExtract %1 %70 2
926 +%74 = OpCompositeExtract %1 %70 3
927 +%76 = OpFNegate %1 %71
928 +%77 = OpFAdd %1 %73 %74
929 +%78 = OpFMul %1 %77 %68
930 +%75 = OpCompositeConstruct %2 %72 %76 %78 %74
931 +OpStore %69 %75
932  OpReturn
933  OpFunctionEnd
934 )";
935   Options options;
936   DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options);
937 }
938 
TEST(DiffTest,DifferentDecorationsVertexIgnoreSetBinding)939 TEST(DiffTest, DifferentDecorationsVertexIgnoreSetBinding) {
940   constexpr char kDiff[] = R"( ; SPIR-V
941  ; Version: 1.6
942  ; Generator: Khronos SPIR-V Tools Assembler; 0
943 -; Bound: 58
944 +; Bound: 73
945  ; Schema: 0
946  OpCapability Shader
947  OpMemoryModel Logical GLSL450
948 -OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %20 %25
949 +OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %25
950  OpSource GLSL 450
951  OpName %4 "_ub"
952  OpName %5 "_uc"
953  OpName %6 "_ud"
954  OpName %8 "_ue"
955  OpName %9 "defaultUniformsVS"
956  OpMemberName %9 0 "_ua"
957  OpName %11 ""
958  OpName %16 "ANGLEDepthRangeParams"
959  OpMemberName %16 0 "near"
960  OpMemberName %16 1 "far"
961  OpMemberName %16 2 "diff"
962  OpMemberName %16 3 "reserved"
963  OpName %17 "ANGLEUniformBlock"
964  OpMemberName %17 0 "viewport"
965  OpMemberName %17 1 "clipDistancesEnabled"
966  OpMemberName %17 2 "xfbActiveUnpaused"
967  OpMemberName %17 3 "xfbVerticesPerInstance"
968  OpMemberName %17 4 "numSamples"
969  OpMemberName %17 5 "xfbBufferOffsets"
970  OpMemberName %17 6 "acbBufferOffsets"
971  OpMemberName %17 7 "depthRange"
972  OpName %19 "ANGLEUniforms"
973 -OpName %20 "ANGLEXfbPosition"
974  OpName %23 "gl_PerVertex"
975  OpMemberName %23 0 "gl_Position"
976 -OpMemberName %23 1 "gl_PointSize"
977 -OpMemberName %23 2 "gl_ClipDistance"
978 -OpMemberName %23 3 "gl_CullDistance"
979  OpName %25 ""
980  OpName %29 "_ua"
981  OpName %28 "_uf"
982  OpName %33 "_uf"
983  OpName %32 "_ug"
984  OpName %40 "main"
985  OpName %42 "param"
986  OpName %50 "param"
987  OpName %53 "param"
988 -OpDecorate %4 Location 0
989 +OpDecorate %4 Location 1
990 -OpDecorate %5 Location 1
991 +OpDecorate %5 Location 2
992 -OpDecorate %6 Location 2
993 +OpDecorate %6 Location 0
994 -OpDecorate %8 Location 0
995 +OpDecorate %8 Location 1
996  OpMemberDecorate %9 0 Offset 0
997  OpDecorate %9 Block
998  OpDecorate %11 DescriptorSet 0
999 -OpDecorate %11 Binding 0
1000 +OpDecorate %11 Binding 1
1001  OpMemberDecorate %16 0 Offset 0
1002  OpMemberDecorate %16 1 Offset 4
1003  OpMemberDecorate %16 2 Offset 8
1004  OpMemberDecorate %16 3 Offset 12
1005  OpMemberDecorate %17 0 Offset 0
1006  OpMemberDecorate %17 1 Offset 16
1007  OpMemberDecorate %17 2 Offset 20
1008  OpMemberDecorate %17 3 Offset 24
1009  OpMemberDecorate %17 4 Offset 28
1010  OpMemberDecorate %17 5 Offset 32
1011  OpMemberDecorate %17 6 Offset 48
1012  OpMemberDecorate %17 7 Offset 64
1013  OpMemberDecorate %17 2 RelaxedPrecision
1014  OpMemberDecorate %17 4 RelaxedPrecision
1015  OpDecorate %17 Block
1016 -OpDecorate %19 DescriptorSet 0
1017 +OpDecorate %19 DescriptorSet 2
1018 -OpDecorate %19 Binding 1
1019 +OpDecorate %19 Binding 0
1020 -OpDecorate %20 Location 1
1021  OpMemberDecorate %23 0 BuiltIn Position
1022 -OpMemberDecorate %23 1 BuiltIn PointSize
1023 -OpMemberDecorate %23 2 BuiltIn ClipDistance
1024 -OpMemberDecorate %23 3 BuiltIn CullDistance
1025  OpDecorate %23 Block
1026  OpDecorate %28 RelaxedPrecision
1027  OpDecorate %29 RelaxedPrecision
1028  OpDecorate %31 RelaxedPrecision
1029  OpDecorate %32 RelaxedPrecision
1030  OpDecorate %33 RelaxedPrecision
1031  OpDecorate %35 RelaxedPrecision
1032  OpDecorate %36 RelaxedPrecision
1033  OpDecorate %37 RelaxedPrecision
1034  OpDecorate %44 RelaxedPrecision
1035  OpDecorate %52 RelaxedPrecision
1036  OpDecorate %55 RelaxedPrecision
1037  OpDecorate %56 RelaxedPrecision
1038  %1 = OpTypeFloat 32
1039  %2 = OpTypeVector %1 4
1040  %9 = OpTypeStruct %2
1041  %12 = OpTypeInt 32 0
1042  %13 = OpTypeInt 32 1
1043  %14 = OpTypeVector %13 4
1044  %15 = OpTypeVector %12 4
1045  %16 = OpTypeStruct %1 %1 %1 %1
1046  %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
1047  %21 = OpConstant %12 8
1048  %22 = OpTypeArray %1 %21
1049 -%23 = OpTypeStruct %2 %1 %22 %22
1050 +%23 = OpTypeStruct %2
1051  %38 = OpTypeVoid
1052  %45 = OpConstant %12 0
1053 +%59 = OpTypePointer Private %2
1054  %3 = OpTypePointer Input %2
1055 +%60 = OpTypePointer Private %2
1056  %7 = OpTypePointer Output %2
1057  %10 = OpTypePointer Uniform %9
1058  %18 = OpTypePointer Uniform %17
1059  %24 = OpTypePointer Output %23
1060  %26 = OpTypePointer Function %2
1061  %46 = OpTypePointer Uniform %2
1062  %27 = OpTypeFunction %2 %26
1063  %39 = OpTypeFunction %38
1064  %4 = OpVariable %3 Input
1065  %5 = OpVariable %3 Input
1066  %6 = OpVariable %3 Input
1067  %8 = OpVariable %7 Output
1068  %11 = OpVariable %10 Uniform
1069  %19 = OpVariable %18 Uniform
1070 -%20 = OpVariable %7 Output
1071 +%58 = OpVariable %60 Private
1072  %25 = OpVariable %24 Output
1073 +%61 = OpConstant %13 0
1074 +%62 = OpConstant %1 0.5
1075  %28 = OpFunction %2 None %27
1076  %29 = OpFunctionParameter %26
1077  %30 = OpLabel
1078  %31 = OpLoad %2 %29
1079  OpReturnValue %31
1080  OpFunctionEnd
1081  %32 = OpFunction %2 None %27
1082  %33 = OpFunctionParameter %26
1083  %34 = OpLabel
1084  %35 = OpLoad %2 %33
1085  %36 = OpLoad %2 %33
1086  %37 = OpFAdd %2 %35 %36
1087  OpReturnValue %37
1088  OpFunctionEnd
1089  %40 = OpFunction %38 None %39
1090  %41 = OpLabel
1091  %42 = OpVariable %26 Function
1092  %50 = OpVariable %26 Function
1093  %53 = OpVariable %26 Function
1094  %43 = OpLoad %2 %4
1095  OpStore %42 %43
1096  %44 = OpFunctionCall %2 %28 %42
1097  %47 = OpAccessChain %46 %11 %45
1098  %48 = OpLoad %2 %47
1099  %49 = OpFAdd %2 %44 %48
1100  OpStore %8 %49
1101  %51 = OpLoad %2 %5
1102  OpStore %50 %51
1103  %52 = OpFunctionCall %2 %32 %50
1104  %54 = OpLoad %2 %6
1105  OpStore %53 %54
1106  %55 = OpFunctionCall %2 %28 %53
1107  %56 = OpFAdd %2 %52 %55
1108  %57 = OpAccessChain %7 %25 %45
1109  OpStore %57 %56
1110 +%63 = OpAccessChain %7 %25 %61
1111 +%64 = OpLoad %2 %63
1112 +%65 = OpCompositeExtract %1 %64 0
1113 +%66 = OpCompositeExtract %1 %64 1
1114 +%67 = OpCompositeExtract %1 %64 2
1115 +%68 = OpCompositeExtract %1 %64 3
1116 +%70 = OpFNegate %1 %65
1117 +%71 = OpFAdd %1 %67 %68
1118 +%72 = OpFMul %1 %71 %62
1119 +%69 = OpCompositeConstruct %2 %66 %70 %72 %68
1120 +OpStore %63 %69
1121  OpReturn
1122  OpFunctionEnd
1123 )";
1124   Options options;
1125   options.ignore_set_binding = true;
1126   DoStringDiffTest(kSrc, kDst, kDiff, options);
1127 }
1128 
TEST(DiffTest,DifferentDecorationsVertexIgnoreSetBindingLocation)1129 TEST(DiffTest, DifferentDecorationsVertexIgnoreSetBindingLocation) {
1130   constexpr char kDiff[] = R"( ; SPIR-V
1131  ; Version: 1.6
1132  ; Generator: Khronos SPIR-V Tools Assembler; 0
1133 -; Bound: 58
1134 +; Bound: 73
1135  ; Schema: 0
1136  OpCapability Shader
1137  OpMemoryModel Logical GLSL450
1138 -OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %20 %25
1139 +OpEntryPoint Vertex %40 "main" %4 %5 %6 %8 %25
1140  OpSource GLSL 450
1141  OpName %4 "_ub"
1142  OpName %5 "_uc"
1143  OpName %6 "_ud"
1144  OpName %8 "_ue"
1145  OpName %9 "defaultUniformsVS"
1146  OpMemberName %9 0 "_ua"
1147  OpName %11 ""
1148  OpName %16 "ANGLEDepthRangeParams"
1149  OpMemberName %16 0 "near"
1150  OpMemberName %16 1 "far"
1151  OpMemberName %16 2 "diff"
1152  OpMemberName %16 3 "reserved"
1153  OpName %17 "ANGLEUniformBlock"
1154  OpMemberName %17 0 "viewport"
1155  OpMemberName %17 1 "clipDistancesEnabled"
1156  OpMemberName %17 2 "xfbActiveUnpaused"
1157  OpMemberName %17 3 "xfbVerticesPerInstance"
1158  OpMemberName %17 4 "numSamples"
1159  OpMemberName %17 5 "xfbBufferOffsets"
1160  OpMemberName %17 6 "acbBufferOffsets"
1161  OpMemberName %17 7 "depthRange"
1162  OpName %19 "ANGLEUniforms"
1163 -OpName %20 "ANGLEXfbPosition"
1164  OpName %23 "gl_PerVertex"
1165  OpMemberName %23 0 "gl_Position"
1166 -OpMemberName %23 1 "gl_PointSize"
1167 -OpMemberName %23 2 "gl_ClipDistance"
1168 -OpMemberName %23 3 "gl_CullDistance"
1169  OpName %25 ""
1170  OpName %29 "_ua"
1171  OpName %28 "_uf"
1172  OpName %33 "_uf"
1173  OpName %32 "_ug"
1174  OpName %40 "main"
1175  OpName %42 "param"
1176  OpName %50 "param"
1177  OpName %53 "param"
1178 -OpDecorate %4 Location 0
1179 +OpDecorate %4 Location 1
1180 -OpDecorate %5 Location 1
1181 +OpDecorate %5 Location 2
1182 -OpDecorate %6 Location 2
1183 +OpDecorate %6 Location 0
1184 -OpDecorate %8 Location 0
1185 +OpDecorate %8 Location 1
1186  OpMemberDecorate %9 0 Offset 0
1187  OpDecorate %9 Block
1188  OpDecorate %11 DescriptorSet 0
1189 -OpDecorate %11 Binding 0
1190 +OpDecorate %11 Binding 1
1191  OpMemberDecorate %16 0 Offset 0
1192  OpMemberDecorate %16 1 Offset 4
1193  OpMemberDecorate %16 2 Offset 8
1194  OpMemberDecorate %16 3 Offset 12
1195  OpMemberDecorate %17 0 Offset 0
1196  OpMemberDecorate %17 1 Offset 16
1197  OpMemberDecorate %17 2 Offset 20
1198  OpMemberDecorate %17 3 Offset 24
1199  OpMemberDecorate %17 4 Offset 28
1200  OpMemberDecorate %17 5 Offset 32
1201  OpMemberDecorate %17 6 Offset 48
1202  OpMemberDecorate %17 7 Offset 64
1203  OpMemberDecorate %17 2 RelaxedPrecision
1204  OpMemberDecorate %17 4 RelaxedPrecision
1205  OpDecorate %17 Block
1206 -OpDecorate %19 DescriptorSet 0
1207 +OpDecorate %19 DescriptorSet 2
1208 -OpDecorate %19 Binding 1
1209 +OpDecorate %19 Binding 0
1210 -OpDecorate %20 Location 1
1211  OpMemberDecorate %23 0 BuiltIn Position
1212 -OpMemberDecorate %23 1 BuiltIn PointSize
1213 -OpMemberDecorate %23 2 BuiltIn ClipDistance
1214 -OpMemberDecorate %23 3 BuiltIn CullDistance
1215  OpDecorate %23 Block
1216  OpDecorate %28 RelaxedPrecision
1217  OpDecorate %29 RelaxedPrecision
1218  OpDecorate %31 RelaxedPrecision
1219  OpDecorate %32 RelaxedPrecision
1220  OpDecorate %33 RelaxedPrecision
1221  OpDecorate %35 RelaxedPrecision
1222  OpDecorate %36 RelaxedPrecision
1223  OpDecorate %37 RelaxedPrecision
1224  OpDecorate %44 RelaxedPrecision
1225  OpDecorate %52 RelaxedPrecision
1226  OpDecorate %55 RelaxedPrecision
1227  OpDecorate %56 RelaxedPrecision
1228  %1 = OpTypeFloat 32
1229  %2 = OpTypeVector %1 4
1230  %9 = OpTypeStruct %2
1231  %12 = OpTypeInt 32 0
1232  %13 = OpTypeInt 32 1
1233  %14 = OpTypeVector %13 4
1234  %15 = OpTypeVector %12 4
1235  %16 = OpTypeStruct %1 %1 %1 %1
1236  %17 = OpTypeStruct %2 %12 %12 %13 %13 %14 %15 %16
1237  %21 = OpConstant %12 8
1238  %22 = OpTypeArray %1 %21
1239 -%23 = OpTypeStruct %2 %1 %22 %22
1240 +%23 = OpTypeStruct %2
1241  %38 = OpTypeVoid
1242  %45 = OpConstant %12 0
1243 +%59 = OpTypePointer Private %2
1244  %3 = OpTypePointer Input %2
1245 +%60 = OpTypePointer Private %2
1246  %7 = OpTypePointer Output %2
1247  %10 = OpTypePointer Uniform %9
1248  %18 = OpTypePointer Uniform %17
1249  %24 = OpTypePointer Output %23
1250  %26 = OpTypePointer Function %2
1251  %46 = OpTypePointer Uniform %2
1252  %27 = OpTypeFunction %2 %26
1253  %39 = OpTypeFunction %38
1254  %4 = OpVariable %3 Input
1255  %5 = OpVariable %3 Input
1256  %6 = OpVariable %3 Input
1257  %8 = OpVariable %7 Output
1258  %11 = OpVariable %10 Uniform
1259  %19 = OpVariable %18 Uniform
1260 -%20 = OpVariable %7 Output
1261 +%58 = OpVariable %60 Private
1262  %25 = OpVariable %24 Output
1263 +%61 = OpConstant %13 0
1264 +%62 = OpConstant %1 0.5
1265  %28 = OpFunction %2 None %27
1266  %29 = OpFunctionParameter %26
1267  %30 = OpLabel
1268  %31 = OpLoad %2 %29
1269  OpReturnValue %31
1270  OpFunctionEnd
1271  %32 = OpFunction %2 None %27
1272  %33 = OpFunctionParameter %26
1273  %34 = OpLabel
1274  %35 = OpLoad %2 %33
1275  %36 = OpLoad %2 %33
1276  %37 = OpFAdd %2 %35 %36
1277  OpReturnValue %37
1278  OpFunctionEnd
1279  %40 = OpFunction %38 None %39
1280  %41 = OpLabel
1281  %42 = OpVariable %26 Function
1282  %50 = OpVariable %26 Function
1283  %53 = OpVariable %26 Function
1284  %43 = OpLoad %2 %4
1285  OpStore %42 %43
1286  %44 = OpFunctionCall %2 %28 %42
1287  %47 = OpAccessChain %46 %11 %45
1288  %48 = OpLoad %2 %47
1289  %49 = OpFAdd %2 %44 %48
1290  OpStore %8 %49
1291  %51 = OpLoad %2 %5
1292  OpStore %50 %51
1293  %52 = OpFunctionCall %2 %32 %50
1294  %54 = OpLoad %2 %6
1295  OpStore %53 %54
1296  %55 = OpFunctionCall %2 %28 %53
1297  %56 = OpFAdd %2 %52 %55
1298  %57 = OpAccessChain %7 %25 %45
1299  OpStore %57 %56
1300 +%63 = OpAccessChain %7 %25 %61
1301 +%64 = OpLoad %2 %63
1302 +%65 = OpCompositeExtract %1 %64 0
1303 +%66 = OpCompositeExtract %1 %64 1
1304 +%67 = OpCompositeExtract %1 %64 2
1305 +%68 = OpCompositeExtract %1 %64 3
1306 +%70 = OpFNegate %1 %65
1307 +%71 = OpFAdd %1 %67 %68
1308 +%72 = OpFMul %1 %71 %62
1309 +%69 = OpCompositeConstruct %2 %66 %70 %72 %68
1310 +OpStore %63 %69
1311  OpReturn
1312  OpFunctionEnd
1313 )";
1314   Options options;
1315   options.ignore_set_binding = true;
1316   options.ignore_location = true;
1317   DoStringDiffTest(kSrc, kDst, kDiff, options);
1318 }
1319 
1320 }  // namespace
1321 }  // namespace diff
1322 }  // namespace spvtools
1323