KhronosGroup / SPIRV-Tools

Apache License 2.0
1.09k stars 554 forks source link

spirv-diff reports differences between a file and itself #5260

Closed jimblandy closed 1 year ago

jimblandy commented 1 year ago

When passed the attached file as both the "source" and "destination" for the diff, spirv-diff prints:

 ; SPIR-V
 ; Version: 1.6
 ; Generator: Khronos SPIR-V Tools Assembler; 0
-; Bound: 546
+; Bound: 547
 ; Schema: 0
                OpCapability SampledCubeArray
                OpCapability ImageQuery
                OpCapability Image1D
                OpCapability Shader
...

and then reports no other changes in the file. It should report no changes.

identical.zip

jimblandy commented 1 year ago

The problem seems to be that the file doesn't use an ID: it skips %154. IdMap::MapUnmatchedIds finds this in the source, and maps it to a fresh destination id, extending the size of the map. The map size is then used to produce the header.