
This PR adds the ability to offset sampler, texture, and UBO bindings from provided base bindings, and to auto-number bindings that are not provided with explicit register numbers. The mechanism works as follows: - Offsets may be given on the command line for all stages, or individually for one or more single stages, in which case the offset will be auto-selected according to the stage being compiled. There is also an API to set them. The new command line options are --shift-sampler-binding, --shift-texture-binding, and --shift-UBO-binding. - Uniforms which are not given explicit bindings in the source code are auto-numbered if and only if they are in live code as determined by the algorithm used to build the reflection database, and the --auto-map-bindings option is given. This auto-numbering avoids using any binding slots which were explicitly provided in the code, whether or not that explicit use was live. E.g, "uniform Texture1D foo : register(t3);" with --shift-texture-binding 10 will reserve binding 13, whether or not foo is used in live code. - Shorter synonyms for the command line options are available. See the --help output. The testing infrastructure is slightly extended to allow use of the binding offset API, and two new tests spv.register.(no)autoassign.frag are added for comparing the resulting SPIR-V.
225 lines
11 KiB
Plaintext
225 lines
11 KiB
Plaintext
spv.register.noautoassign.frag
|
|
|
|
Linked fragment stage:
|
|
|
|
|
|
// Module Version 10000
|
|
// Generated by (magic number): 80001
|
|
// Id's are bound by 154
|
|
|
|
Capability Shader
|
|
Capability Sampled1D
|
|
1: ExtInstImport "GLSL.std.450"
|
|
MemoryModel Logical GLSL450
|
|
EntryPoint Fragment 4 "main_ep" 143
|
|
ExecutionMode 4 OriginUpperLeft
|
|
Name 4 "main_ep"
|
|
Name 9 "Func1("
|
|
Name 11 "Func2("
|
|
Name 13 "Func2_unused("
|
|
Name 17 "g_tTex1"
|
|
Name 21 "g_sSamp1"
|
|
Name 27 "g_tTex2"
|
|
Name 29 "g_sSamp2"
|
|
Name 39 "g_tTex3"
|
|
Name 46 "g_sSamp3"
|
|
Name 64 "g_tTex4"
|
|
Name 69 "g_sSamp4"
|
|
Name 84 "g_tTex5"
|
|
Name 86 "g_sSamp5"
|
|
Name 93 "MyStruct_t"
|
|
MemberName 93(MyStruct_t) 0 "a"
|
|
MemberName 93(MyStruct_t) 1 "b"
|
|
MemberName 93(MyStruct_t) 2 "c"
|
|
Name 95 "mystruct"
|
|
Name 117 "g_tTex_unused1"
|
|
Name 119 "g_sSamp_unused1"
|
|
Name 124 "g_tTex_unused2"
|
|
Name 126 "g_sSamp_unused2"
|
|
Name 134 "PS_OUTPUT"
|
|
MemberName 134(PS_OUTPUT) 0 "Color"
|
|
Name 136 "psout"
|
|
Name 143 "Color"
|
|
Name 147 "g_tTex_unused3"
|
|
Name 149 "myfloat4_a"
|
|
Name 150 "myfloat4_b"
|
|
Name 153 "myint4_a"
|
|
Decorate 17(g_tTex1) DescriptorSet 0
|
|
Decorate 17(g_tTex1) Binding 11
|
|
Decorate 21(g_sSamp1) DescriptorSet 0
|
|
Decorate 21(g_sSamp1) Binding 5
|
|
Decorate 27(g_tTex2) DescriptorSet 0
|
|
Decorate 29(g_sSamp2) DescriptorSet 0
|
|
Decorate 39(g_tTex3) DescriptorSet 0
|
|
Decorate 39(g_tTex3) Binding 13
|
|
Decorate 46(g_sSamp3) DescriptorSet 0
|
|
Decorate 46(g_sSamp3) Binding 7
|
|
Decorate 64(g_tTex4) DescriptorSet 0
|
|
Decorate 69(g_sSamp4) DescriptorSet 0
|
|
Decorate 84(g_tTex5) DescriptorSet 0
|
|
Decorate 86(g_sSamp5) DescriptorSet 0
|
|
Decorate 95(mystruct) Binding 19
|
|
Decorate 117(g_tTex_unused1) DescriptorSet 0
|
|
Decorate 117(g_tTex_unused1) Binding 10
|
|
Decorate 119(g_sSamp_unused1) DescriptorSet 0
|
|
Decorate 124(g_tTex_unused2) DescriptorSet 0
|
|
Decorate 124(g_tTex_unused2) Binding 12
|
|
Decorate 126(g_sSamp_unused2) DescriptorSet 0
|
|
Decorate 143(Color) Location 0
|
|
Decorate 147(g_tTex_unused3) DescriptorSet 0
|
|
2: TypeVoid
|
|
3: TypeFunction 2
|
|
6: TypeFloat 32
|
|
7: TypeVector 6(float) 4
|
|
8: TypeFunction 7(fvec4)
|
|
15: TypeImage 6(float) 1D sampled format:Unknown
|
|
16: TypePointer UniformConstant 15
|
|
17(g_tTex1): 16(ptr) Variable UniformConstant
|
|
19: TypeSampler
|
|
20: TypePointer UniformConstant 19
|
|
21(g_sSamp1): 20(ptr) Variable UniformConstant
|
|
23: TypeSampledImage 15
|
|
25: 6(float) Constant 1036831949
|
|
27(g_tTex2): 16(ptr) Variable UniformConstant
|
|
29(g_sSamp2): 20(ptr) Variable UniformConstant
|
|
32: 6(float) Constant 1045220557
|
|
35: TypeInt 32 0
|
|
36: 35(int) Constant 2
|
|
37: TypeArray 15 36
|
|
38: TypePointer UniformConstant 37
|
|
39(g_tTex3): 38(ptr) Variable UniformConstant
|
|
40: TypeInt 32 1
|
|
41: 40(int) Constant 0
|
|
44: TypeArray 19 36
|
|
45: TypePointer UniformConstant 44
|
|
46(g_sSamp3): 45(ptr) Variable UniformConstant
|
|
50: 6(float) Constant 1050253722
|
|
53: 40(int) Constant 1
|
|
61: 35(int) Constant 3
|
|
62: TypeArray 15 61
|
|
63: TypePointer UniformConstant 62
|
|
64(g_tTex4): 63(ptr) Variable UniformConstant
|
|
67: TypeArray 19 61
|
|
68: TypePointer UniformConstant 67
|
|
69(g_sSamp4): 68(ptr) Variable UniformConstant
|
|
73: 6(float) Constant 1053609165
|
|
76: 40(int) Constant 2
|
|
84(g_tTex5): 16(ptr) Variable UniformConstant
|
|
86(g_sSamp5): 20(ptr) Variable UniformConstant
|
|
89: 6(float) Constant 1056964608
|
|
92: TypeVector 6(float) 3
|
|
93(MyStruct_t): TypeStruct 40(int) 6(float) 92(fvec3)
|
|
94: TypePointer UniformConstant 93(MyStruct_t)
|
|
95(mystruct): 94(ptr) Variable UniformConstant
|
|
96: 35(int) Constant 1
|
|
97: TypePointer UniformConstant 6(float)
|
|
117(g_tTex_unused1): 16(ptr) Variable UniformConstant
|
|
119(g_sSamp_unused1): 20(ptr) Variable UniformConstant
|
|
122: 6(float) Constant 1066192077
|
|
124(g_tTex_unused2): 16(ptr) Variable UniformConstant
|
|
126(g_sSamp_unused2): 20(ptr) Variable UniformConstant
|
|
129: 6(float) Constant 1067030938
|
|
134(PS_OUTPUT): TypeStruct 7(fvec4)
|
|
135: TypePointer Function 134(PS_OUTPUT)
|
|
140: TypePointer Function 7(fvec4)
|
|
142: TypePointer Output 7(fvec4)
|
|
143(Color): 142(ptr) Variable Output
|
|
147(g_tTex_unused3): 16(ptr) Variable UniformConstant
|
|
148: TypePointer UniformConstant 7(fvec4)
|
|
149(myfloat4_a): 148(ptr) Variable UniformConstant
|
|
150(myfloat4_b): 148(ptr) Variable UniformConstant
|
|
151: TypeVector 40(int) 4
|
|
152: TypePointer UniformConstant 151(ivec4)
|
|
153(myint4_a): 152(ptr) Variable UniformConstant
|
|
4(main_ep): 2 Function None 3
|
|
5: Label
|
|
136(psout): 135(ptr) Variable Function
|
|
137: 7(fvec4) FunctionCall 9(Func1()
|
|
138: 7(fvec4) FunctionCall 11(Func2()
|
|
139: 7(fvec4) FAdd 137 138
|
|
141: 140(ptr) AccessChain 136(psout) 41
|
|
Store 141 139
|
|
144: 140(ptr) AccessChain 136(psout) 41
|
|
145: 7(fvec4) Load 144
|
|
Store 143(Color) 145
|
|
Return
|
|
FunctionEnd
|
|
9(Func1(): 7(fvec4) Function None 8
|
|
10: Label
|
|
18: 15 Load 17(g_tTex1)
|
|
22: 19 Load 21(g_sSamp1)
|
|
24: 23 SampledImage 18 22
|
|
26: 7(fvec4) ImageSampleImplicitLod 24 25
|
|
28: 15 Load 27(g_tTex2)
|
|
30: 19 Load 29(g_sSamp2)
|
|
31: 23 SampledImage 28 30
|
|
33: 7(fvec4) ImageSampleImplicitLod 31 32
|
|
34: 7(fvec4) FAdd 26 33
|
|
42: 16(ptr) AccessChain 39(g_tTex3) 41
|
|
43: 15 Load 42
|
|
47: 20(ptr) AccessChain 46(g_sSamp3) 41
|
|
48: 19 Load 47
|
|
49: 23 SampledImage 43 48
|
|
51: 7(fvec4) ImageSampleImplicitLod 49 50
|
|
52: 7(fvec4) FAdd 34 51
|
|
54: 16(ptr) AccessChain 39(g_tTex3) 53
|
|
55: 15 Load 54
|
|
56: 20(ptr) AccessChain 46(g_sSamp3) 53
|
|
57: 19 Load 56
|
|
58: 23 SampledImage 55 57
|
|
59: 7(fvec4) ImageSampleImplicitLod 58 50
|
|
60: 7(fvec4) FAdd 52 59
|
|
65: 16(ptr) AccessChain 64(g_tTex4) 53
|
|
66: 15 Load 65
|
|
70: 20(ptr) AccessChain 69(g_sSamp4) 53
|
|
71: 19 Load 70
|
|
72: 23 SampledImage 66 71
|
|
74: 7(fvec4) ImageSampleImplicitLod 72 73
|
|
75: 7(fvec4) FAdd 60 74
|
|
77: 16(ptr) AccessChain 64(g_tTex4) 76
|
|
78: 15 Load 77
|
|
79: 20(ptr) AccessChain 69(g_sSamp4) 76
|
|
80: 19 Load 79
|
|
81: 23 SampledImage 78 80
|
|
82: 7(fvec4) ImageSampleImplicitLod 81 73
|
|
83: 7(fvec4) FAdd 75 82
|
|
85: 15 Load 84(g_tTex5)
|
|
87: 19 Load 86(g_sSamp5)
|
|
88: 23 SampledImage 85 87
|
|
90: 7(fvec4) ImageSampleImplicitLod 88 89
|
|
91: 7(fvec4) FAdd 83 90
|
|
98: 97(ptr) AccessChain 95(mystruct) 76 96
|
|
99: 6(float) Load 98
|
|
100: 7(fvec4) CompositeConstruct 99 99 99 99
|
|
101: 7(fvec4) FAdd 91 100
|
|
ReturnValue 101
|
|
FunctionEnd
|
|
11(Func2(): 7(fvec4) Function None 8
|
|
12: Label
|
|
104: 15 Load 17(g_tTex1)
|
|
105: 19 Load 21(g_sSamp1)
|
|
106: 23 SampledImage 104 105
|
|
107: 7(fvec4) ImageSampleImplicitLod 106 25
|
|
108: 16(ptr) AccessChain 39(g_tTex3) 53
|
|
109: 15 Load 108
|
|
110: 20(ptr) AccessChain 46(g_sSamp3) 53
|
|
111: 19 Load 110
|
|
112: 23 SampledImage 109 111
|
|
113: 7(fvec4) ImageSampleImplicitLod 112 50
|
|
114: 7(fvec4) FAdd 107 113
|
|
ReturnValue 114
|
|
FunctionEnd
|
|
13(Func2_unused(): 7(fvec4) Function None 8
|
|
14: Label
|
|
118: 15 Load 117(g_tTex_unused1)
|
|
120: 19 Load 119(g_sSamp_unused1)
|
|
121: 23 SampledImage 118 120
|
|
123: 7(fvec4) ImageSampleImplicitLod 121 122
|
|
125: 15 Load 124(g_tTex_unused2)
|
|
127: 19 Load 126(g_sSamp_unused2)
|
|
128: 23 SampledImage 125 127
|
|
130: 7(fvec4) ImageSampleImplicitLod 128 129
|
|
131: 7(fvec4) FAdd 123 130
|
|
ReturnValue 131
|
|
FunctionEnd
|