Link/SPV: Correct symbol IDs on merging ASTs to a single coherent space

This is one step in providing full linker functionality for creating
correct SPIR-V from multiple compilation units for the same stage.
(This was the only remaining "hard" part. The rest should be simple.)
This commit is contained in:
John Kessenich
2018-07-13 10:40:40 -06:00
parent e7f9caeac4
commit 41436ad204
9 changed files with 481 additions and 56 deletions

View File

@@ -198,7 +198,7 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 71
// Id's are bound by 70
Capability Shader
1: ExtInstImport "GLSL.std.450"
@@ -214,24 +214,24 @@ gl_FragCoord origin is upper left
Name 32 "b"
Name 33 "i"
Name 39 "c"
Name 54 "s2D"
Name 63 "bnameRuntime"
MemberName 63(bnameRuntime) 0 "r"
Name 65 ""
Name 68 "bnameImplicit"
MemberName 68(bnameImplicit) 0 "m"
Name 70 ""
Name 53 "s2D"
Name 62 "bnameRuntime"
MemberName 62(bnameRuntime) 0 "r"
Name 64 ""
Name 67 "bnameImplicit"
MemberName 67(bnameImplicit) 0 "m"
Name 69 ""
Decorate 12(color) Location 0
Decorate 54(s2D) DescriptorSet 0
Decorate 54(s2D) Binding 1
Decorate 62 ArrayStride 4
MemberDecorate 63(bnameRuntime) 0 Offset 0
Decorate 63(bnameRuntime) BufferBlock
Decorate 65 DescriptorSet 0
Decorate 67 ArrayStride 4
MemberDecorate 68(bnameImplicit) 0 Offset 0
Decorate 68(bnameImplicit) BufferBlock
Decorate 70 DescriptorSet 0
Decorate 53(s2D) DescriptorSet 0
Decorate 53(s2D) Binding 1
Decorate 61 ArrayStride 4
MemberDecorate 62(bnameRuntime) 0 Offset 0
Decorate 62(bnameRuntime) BufferBlock
Decorate 64 DescriptorSet 0
Decorate 66 ArrayStride 4
MemberDecorate 67(bnameImplicit) 0 Offset 0
Decorate 67(bnameImplicit) BufferBlock
Decorate 69 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -263,24 +263,23 @@ gl_FragCoord origin is upper left
39(c): 38(ptr) Variable Private
40: 14(int) Constant 3
42: 14(int) Constant 2
43: TypePointer Output 6(float)
45: 14(int) Constant 9
51: TypeImage 6(float) 2D sampled format:Unknown
52: TypeSampledImage 51
53: TypePointer UniformConstant 52
54(s2D): 53(ptr) Variable UniformConstant
56: TypeVector 6(float) 2
57: 6(float) Constant 1056964608
58: 56(fvec2) ConstantComposite 57 57
62: TypeRuntimeArray 6(float)
63(bnameRuntime): TypeStruct 62
64: TypePointer Uniform 63(bnameRuntime)
65: 64(ptr) Variable Uniform
66: 15(int) Constant 4
67: TypeArray 6(float) 66
68(bnameImplicit): TypeStruct 67
69: TypePointer Uniform 68(bnameImplicit)
70: 69(ptr) Variable Uniform
44: 14(int) Constant 9
50: TypeImage 6(float) 2D sampled format:Unknown
51: TypeSampledImage 50
52: TypePointer UniformConstant 51
53(s2D): 52(ptr) Variable UniformConstant
55: TypeVector 6(float) 2
56: 6(float) Constant 1056964608
57: 55(fvec2) ConstantComposite 56 56
61: TypeRuntimeArray 6(float)
62(bnameRuntime): TypeStruct 61
63: TypePointer Uniform 62(bnameRuntime)
64: 63(ptr) Variable Uniform
65: 15(int) Constant 4
66: TypeArray 6(float) 65
67(bnameImplicit): TypeStruct 66
68: TypePointer Uniform 67(bnameImplicit)
69: 68(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
13: 7(fvec4) FunctionCall 9(getColor()
@@ -298,18 +297,18 @@ gl_FragCoord origin is upper left
FunctionEnd
9(getColor(): 7(fvec4) Function None 8
10: Label
44: 43(ptr) AccessChain 12(color) 42
Store 44 21
46: 22(ptr) AccessChain 19(a1) 45
43: 22(ptr) AccessChain 19(a1) 42
Store 43 21
45: 22(ptr) AccessChain 27(a2) 44
Store 45 21
46: 22(ptr) AccessChain 32(b) 42
Store 46 21
47: 22(ptr) AccessChain 27(a2) 42
47: 22(ptr) AccessChain 39(c) 40
Store 47 21
48: 22(ptr) AccessChain 32(b) 40
Store 48 21
49: 37 Load 39(c)
50: 22(ptr) AccessChain 32(b) 49
Store 50 21
55: 52 Load 54(s2D)
59: 7(fvec4) ImageSampleImplicitLod 55 58
ReturnValue 59
48: 14(int) Load 33(i)
49: 22(ptr) AccessChain 39(c) 48
Store 49 21
54: 51 Load 53(s2D)
58: 7(fvec4) ImageSampleImplicitLod 54 57
ReturnValue 58
FunctionEnd