Remapper: remove debug info for IDs stripped in other passes

If some DCE is performed such as removing dead functions, then even
if we are NOT stripping debug info, we still must remove the debug
opcodes that refer to the now-dead IDs.

Also, this adds a small change to perform no ID remapping if none
is requested, making spirv-remap properly be a no-op if no options
are given.
This commit is contained in:
steve-lunarg 2016-12-09 11:13:23 -07:00
parent 906cc21816
commit 297754cfe8
11 changed files with 246 additions and 219 deletions

View File

@ -327,12 +327,10 @@ namespace spv {
bound(maxBound); // reset header ID bound to as big as it now needs to be bound(maxBound); // reset header ID bound to as big as it now needs to be
} }
// Mark debug instructions for stripping
void spirvbin_t::stripDebug() void spirvbin_t::stripDebug()
{ {
if ((options & STRIP) == 0) // Strip instructions in the stripOp set: debug info.
return;
// build local Id and name maps
process( process(
[&](spv::Op opCode, unsigned start) { [&](spv::Op opCode, unsigned start) {
// remember opcodes we want to strip later // remember opcodes we want to strip later
@ -343,6 +341,32 @@ namespace spv {
op_fn_nop); op_fn_nop);
} }
// Mark instructions that refer to now-removed IDs for stripping
void spirvbin_t::stripDeadRefs()
{
process(
[&](spv::Op opCode, unsigned start) {
// strip opcodes pointing to removed data
switch (opCode) {
case spv::OpName:
case spv::OpMemberName:
case spv::OpDecorate:
case spv::OpMemberDecorate:
if (idPosR.find(asId(start+1)) == idPosR.end())
stripInst(start);
break;
default:
break; // leave it alone
}
return true;
},
op_fn_nop);
strip();
}
// Update local maps of ID, type, etc positions
void spirvbin_t::buildLocalMaps() void spirvbin_t::buildLocalMaps()
{ {
msg(2, 2, std::string("build local maps: ")); msg(2, 2, std::string("build local maps: "));
@ -351,7 +375,6 @@ namespace spv {
idMapL.clear(); idMapL.clear();
// preserve nameMap, so we don't clear that. // preserve nameMap, so we don't clear that.
fnPos.clear(); fnPos.clear();
fnPosDCE.clear();
fnCalls.clear(); fnCalls.clear();
typeConstPos.clear(); typeConstPos.clear();
idPosR.clear(); idPosR.clear();
@ -366,10 +389,6 @@ namespace spv {
// build local Id and name maps // build local Id and name maps
process( process(
[&](spv::Op opCode, unsigned start) { [&](spv::Op opCode, unsigned start) {
// remember opcodes we want to strip later
if ((options & STRIP) && isStripOp(opCode))
stripInst(start);
unsigned word = start+1; unsigned word = start+1;
spv::Id typeId = spv::NoResult; spv::Id typeId = spv::NoResult;
@ -957,7 +976,6 @@ namespace spv {
if (call_it == fnCalls.end() || call_it->second == 0) { if (call_it == fnCalls.end() || call_it->second == 0) {
changed = true; changed = true;
stripRange.push_back(fn->second); stripRange.push_back(fn->second);
fnPosDCE.insert(*fn);
// decrease counts of called functions // decrease counts of called functions
process( process(
@ -1011,11 +1029,15 @@ namespace spv {
// Remove single-use function variables + associated decorations and names // Remove single-use function variables + associated decorations and names
process( process(
[&](spv::Op opCode, unsigned start) { [&](spv::Op opCode, unsigned start) {
if ((opCode == spv::OpVariable && varUseCount[asId(start+2)] == 1) || spv::Id id = spv::NoResult;
(opCode == spv::OpDecorate && varUseCount[asId(start+1)] == 1) || if (opCode == spv::OpVariable)
(opCode == spv::OpName && varUseCount[asId(start+1)] == 1)) { id = asId(start+2);
stripInst(start); if (opCode == spv::OpDecorate || opCode == spv::OpName)
} id = asId(start+1);
if (id != spv::NoResult && varUseCount[id] == 1)
stripInst(start);
return true; return true;
}, },
op_fn_nop); op_fn_nop);
@ -1276,25 +1298,31 @@ namespace spv {
// Set up opcode tables from SpvDoc // Set up opcode tables from SpvDoc
spv::Parameterize(); spv::Parameterize();
validate(); // validate header validate(); // validate header
buildLocalMaps(); buildLocalMaps(); // build ID maps
msg(3, 4, std::string("ID bound: ") + std::to_string(bound())); msg(3, 4, std::string("ID bound: ") + std::to_string(bound()));
if (options & STRIP) stripDebug();
strip(); // strip out data we decided to eliminate strip(); // strip out data we decided to eliminate
if (options & OPT_LOADSTORE) optLoadStore(); if (options & OPT_LOADSTORE) optLoadStore();
if (options & OPT_FWD_LS) forwardLoadStores(); if (options & OPT_FWD_LS) forwardLoadStores();
if (options & DCE_FUNCS) dceFuncs(); if (options & DCE_FUNCS) dceFuncs();
if (options & DCE_VARS) dceVars(); if (options & DCE_VARS) dceVars();
if (options & DCE_TYPES) dceTypes(); if (options & DCE_TYPES) dceTypes();
strip(); // strip out data we decided to eliminate
strip(); // strip out data we decided to eliminate
stripDeadRefs(); // remove references to things we DCEed
// after the last strip, we must clean any debug info referring to now-deleted data
if (options & MAP_TYPES) mapTypeConst(); if (options & MAP_TYPES) mapTypeConst();
if (options & MAP_NAMES) mapNames(); if (options & MAP_NAMES) mapNames();
if (options & MAP_FUNCS) mapFnBodies(); if (options & MAP_FUNCS) mapFnBodies();
mapRemainder(); // map any unmapped IDs if (options & MAP_ALL) {
applyMap(); // Now remap each shader to the new IDs we've come up with mapRemainder(); // map any unmapped IDs
applyMap(); // Now remap each shader to the new IDs we've come up with
}
} }
// remap from a memory image // remap from a memory image

View File

@ -239,7 +239,8 @@ private:
void applyMap(); // remap per local name map void applyMap(); // remap per local name map
void mapRemainder(); // map any IDs we haven't touched yet void mapRemainder(); // map any IDs we haven't touched yet
void stripDebug(); // strip debug info void stripDebug(); // strip all debug info
void stripDeadRefs(); // strips debug info for now-dead references after DCE
void strip(); // remove debug symbols void strip(); // remove debug symbols
std::vector<spirword_t> spv; // SPIR words std::vector<spirword_t> spv; // SPIR words
@ -264,7 +265,6 @@ private:
// Function start and end. use unordered_map because we'll have // Function start and end. use unordered_map because we'll have
// many fewer functions than IDs. // many fewer functions than IDs.
std::unordered_map<spv::Id, range_t> fnPos; std::unordered_map<spv::Id, range_t> fnPos;
std::unordered_map<spv::Id, range_t> fnPosDCE; // deleted functions
// Which functions are called, anywhere in the module, with a call count // Which functions are called, anywhere in the module, with a call count
std::unordered_map<spv::Id, int> fnCalls; std::unordered_map<spv::Id, int> fnCalls;

View File

@ -3,34 +3,33 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 19 // Id's are bound by 22
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 14 16 EntryPoint Fragment 4 "main" 17 19
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
Name 9 "dead_fn(" Name 17 "outf4"
Name 14 "outf4" Name 19 "inf"
Name 16 "inf"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 3 7: TypeVector 6(float) 3
8: TypeFunction 7(fvec3) 8: TypeFunction 7(fvec3)
10: 6(float) Constant 0 11: 6(float) Constant 0
11: 7(fvec3) ConstantComposite 10 10 10 12: 7(fvec3) ConstantComposite 11 11 11
12: TypeVector 6(float) 4 15: TypeVector 6(float) 4
13: TypePointer Output 12(fvec4) 16: TypePointer Output 15(fvec4)
14(outf4): 13(ptr) Variable Output 17(outf4): 16(ptr) Variable Output
15: TypePointer Input 6(float) 18: TypePointer Input 6(float)
16(inf): 15(ptr) Variable Input 19(inf): 18(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
17: 6(float) Load 16(inf) 20: 6(float) Load 19(inf)
18: 12(fvec4) CompositeConstruct 17 17 17 17 21: 15(fvec4) CompositeConstruct 20 20 20 20
Store 14(outf4) 18 Store 17(outf4) 21
Return Return
FunctionEnd FunctionEnd

View File

@ -3,18 +3,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 20 // Id's are bound by 22
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 15 17 EntryPoint Fragment 4 "main" 17 19
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
Name 9 "dead_fn(" Name 9 "dead_fn("
Name 15 "outf4" Name 17 "outf4"
Name 17 "inf" Name 19 "inf"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -22,16 +22,16 @@ Warning, version 450 is not yet complete; most version-specific features are pre
8: TypeFunction 7(fvec3) 8: TypeFunction 7(fvec3)
11: 6(float) Constant 0 11: 6(float) Constant 0
12: 7(fvec3) ConstantComposite 11 11 11 12: 7(fvec3) ConstantComposite 11 11 11
13: TypeVector 6(float) 4 15: TypeVector 6(float) 4
14: TypePointer Output 13(fvec4) 16: TypePointer Output 15(fvec4)
15(outf4): 14(ptr) Variable Output 17(outf4): 16(ptr) Variable Output
16: TypePointer Input 6(float) 18: TypePointer Input 6(float)
17(inf): 16(ptr) Variable Input 19(inf): 18(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
18: 6(float) Load 17(inf) 20: 6(float) Load 19(inf)
19: 13(fvec4) CompositeConstruct 18 18 18 18 21: 15(fvec4) CompositeConstruct 20 20 20 20
Store 15(outf4) 19 Store 17(outf4) 21
Return Return
FunctionEnd FunctionEnd
9(dead_fn(): 7(fvec3) Function None 8 9(dead_fn(): 7(fvec3) Function None 8

View File

@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 20 // Id's are bound by 22
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 15 17 EntryPoint Fragment 4 "main" 17 19
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
@ -17,16 +17,16 @@ Warning, version 450 is not yet complete; most version-specific features are pre
8: TypeFunction 7(fvec3) 8: TypeFunction 7(fvec3)
11: 6(float) Constant 0 11: 6(float) Constant 0
12: 7(fvec3) ConstantComposite 11 11 11 12: 7(fvec3) ConstantComposite 11 11 11
13: TypeVector 6(float) 4 15: TypeVector 6(float) 4
14: TypePointer Output 13(fvec4) 16: TypePointer Output 15(fvec4)
15: 14(ptr) Variable Output 17: 16(ptr) Variable Output
16: TypePointer Input 6(float) 18: TypePointer Input 6(float)
17: 16(ptr) Variable Input 19: 18(ptr) Variable Input
4: 2 Function None 3 4: 2 Function None 3
5: Label 5: Label
18: 6(float) Load 17 20: 6(float) Load 19
19: 13(fvec4) CompositeConstruct 18 18 18 18 21: 15(fvec4) CompositeConstruct 20 20 20 20
Store 15 19 Store 17 21
Return Return
FunctionEnd FunctionEnd
9: 7(fvec3) Function None 8 9: 7(fvec3) Function None 8

View File

@ -3,7 +3,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 190 // Id's are bound by 191
Capability Shader Capability Shader
Capability Sampled1D Capability Sampled1D
@ -57,9 +57,9 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
Name 173 "psout" Name 173 "psout"
Name 180 "Color" Name 180 "Color"
Name 184 "Depth" Name 184 "Depth"
Name 187 "g_sSamp2d" Name 188 "g_sSamp2d"
Name 188 "g_sSamp2D_b" Name 189 "g_sSamp2D_b"
Name 189 "g_tTex1df4a" Name 190 "g_tTex1df4a"
Decorate 41(g_tTex1df4) DescriptorSet 0 Decorate 41(g_tTex1df4) DescriptorSet 0
Decorate 41(g_tTex1df4) Binding 0 Decorate 41(g_tTex1df4) Binding 0
Decorate 45(g_sSamp) DescriptorSet 0 Decorate 45(g_sSamp) DescriptorSet 0
@ -77,10 +77,10 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
Decorate 165(g_tTexcdu4) DescriptorSet 0 Decorate 165(g_tTexcdu4) DescriptorSet 0
Decorate 180(Color) Location 0 Decorate 180(Color) Location 0
Decorate 184(Depth) BuiltIn FragDepth Decorate 184(Depth) BuiltIn FragDepth
Decorate 187(g_sSamp2d) DescriptorSet 0 Decorate 188(g_sSamp2d) DescriptorSet 0
Decorate 188(g_sSamp2D_b) DescriptorSet 0 Decorate 189(g_sSamp2D_b) DescriptorSet 0
Decorate 189(g_tTex1df4a) DescriptorSet 0 Decorate 190(g_tTex1df4a) DescriptorSet 0
Decorate 189(g_tTex1df4a) Binding 1 Decorate 190(g_tTex1df4a) Binding 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
@ -184,9 +184,9 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
180(Color): 179(ptr) Variable Output 180(Color): 179(ptr) Variable Output
183: TypePointer Output 35(float) 183: TypePointer Output 35(float)
184(Depth): 183(ptr) Variable Output 184(Depth): 183(ptr) Variable Output
187(g_sSamp2d): 44(ptr) Variable UniformConstant 188(g_sSamp2d): 44(ptr) Variable UniformConstant
188(g_sSamp2D_b): 44(ptr) Variable UniformConstant 189(g_sSamp2D_b): 44(ptr) Variable UniformConstant
189(g_tTex1df4a): 40(ptr) Variable UniformConstant 190(g_tTex1df4a): 40(ptr) Variable UniformConstant
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
9(mtest): 8(ptr) Variable Function 9(mtest): 8(ptr) Variable Function

View File

@ -3,7 +3,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 190 // Id's are bound by 191
Capability Shader Capability Shader
Capability Sampled1D Capability Sampled1D
@ -28,10 +28,10 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
Decorate 165 DescriptorSet 0 Decorate 165 DescriptorSet 0
Decorate 180 Location 0 Decorate 180 Location 0
Decorate 184 BuiltIn FragDepth Decorate 184 BuiltIn FragDepth
Decorate 187 DescriptorSet 0
Decorate 188 DescriptorSet 0 Decorate 188 DescriptorSet 0
Decorate 189 DescriptorSet 0 Decorate 189 DescriptorSet 0
Decorate 189 Binding 1 Decorate 190 DescriptorSet 0
Decorate 190 Binding 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
@ -135,9 +135,9 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
180: 179(ptr) Variable Output 180: 179(ptr) Variable Output
183: TypePointer Output 35(float) 183: TypePointer Output 35(float)
184: 183(ptr) Variable Output 184: 183(ptr) Variable Output
187: 44(ptr) Variable UniformConstant
188: 44(ptr) Variable UniformConstant 188: 44(ptr) Variable UniformConstant
189: 40(ptr) Variable UniformConstant 189: 44(ptr) Variable UniformConstant
190: 40(ptr) Variable UniformConstant
4: 2 Function None 3 4: 2 Function None 3
5: Label 5: Label
9: 8(ptr) Variable Function 9: 8(ptr) Variable Function

View File

@ -1,13 +1,13 @@
remap.hlsl.templatetypes.none.frag remap.hlsl.templatetypes.none.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 149 // Id's are bound by 150
Capability Shader Capability Shader
Capability Float64 Capability Float64
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 146 148 EntryPoint Fragment 4 "main" 146 149
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Name 4 "main" Name 4 "main"
Name 9 "r00" Name 9 "r00"
@ -39,9 +39,9 @@ remap.hlsl.templatetypes.none.frag
Name 136 "r65" Name 136 "r65"
Name 141 "r66" Name 141 "r66"
Name 146 "@entryPointOutput" Name 146 "@entryPointOutput"
Name 148 "input" Name 149 "input"
Decorate 146(@entryPointOutput) Location 0 Decorate 146(@entryPointOutput) Location 0
Decorate 148(input) Location 0 Decorate 149(input) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -157,8 +157,8 @@ remap.hlsl.templatetypes.none.frag
144: 139 ConstantComposite 72 126 142 143 144: 139 ConstantComposite 72 126 142 143
145: TypePointer Output 6(float) 145: TypePointer Output 6(float)
146(@entryPointOutput): 145(ptr) Variable Output 146(@entryPointOutput): 145(ptr) Variable Output
147: TypePointer Input 7(fvec4) 148: TypePointer Input 7(fvec4)
148(input): 147(ptr) Variable Input 149(input): 148(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
9(r00): 8(ptr) Variable Function 9(r00): 8(ptr) Variable Function

View File

@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 82 // Id's are bound by 86
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 50 69 71 EntryPoint Fragment 4 "main" 53 73 75
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
@ -18,13 +18,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Name 13 "bound" Name 13 "bound"
Name 17 "r" Name 17 "r"
Name 19 "x" Name 19 "x"
Name 42 "param" Name 44 "param"
Name 50 "ini4" Name 53 "ini4"
Name 69 "outf4" Name 73 "outf4"
Name 71 "inf" Name 75 "inf"
Name 74 "param"
Name 78 "param" Name 78 "param"
Decorate 50(ini4) Flat Name 82 "param"
Decorate 53(ini4) Flat
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
@ -37,35 +37,35 @@ Warning, version 450 is not yet complete; most version-specific features are pre
28: TypeBool 28: TypeBool
30: 8(float) Constant 1056964608 30: 8(float) Constant 1056964608
34: 6(int) Constant 1 34: 6(int) Constant 1
38: 6(int) Constant 2 40: 6(int) Constant 2
48: TypeVector 6(int) 4 51: TypeVector 6(int) 4
49: TypePointer Input 48(ivec4) 52: TypePointer Input 51(ivec4)
50(ini4): 49(ptr) Variable Input 53(ini4): 52(ptr) Variable Input
51: TypeInt 32 0 54: TypeInt 32 0
52: 51(int) Constant 1 55: 54(int) Constant 1
53: TypePointer Input 6(int) 56: TypePointer Input 6(int)
56: 51(int) Constant 2 59: 54(int) Constant 2
61: 51(int) Constant 0 64: 54(int) Constant 0
67: TypeVector 8(float) 4 71: TypeVector 8(float) 4
68: TypePointer Output 67(fvec4) 72: TypePointer Output 71(fvec4)
69(outf4): 68(ptr) Variable Output 73(outf4): 72(ptr) Variable Output
70: TypePointer Input 8(float) 74: TypePointer Input 8(float)
71(inf): 70(ptr) Variable Input 75(inf): 74(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
74(param): 7(ptr) Variable Function
78(param): 7(ptr) Variable Function 78(param): 7(ptr) Variable Function
72: 8(float) Load 71(inf) 82(param): 7(ptr) Variable Function
73: 6(int) ConvertFToS 72 76: 8(float) Load 75(inf)
Store 74(param) 73
75: 8(float) FunctionCall 11(Test1(i1;) 74(param)
76: 8(float) Load 71(inf)
77: 6(int) ConvertFToS 76 77: 6(int) ConvertFToS 76
Store 78(param) 77 Store 78(param) 77
79: 8(float) FunctionCall 14(Test2(i1;) 78(param) 79: 8(float) FunctionCall 11(Test1(i1;) 78(param)
80: 8(float) FAdd 75 79 80: 8(float) Load 75(inf)
81: 67(fvec4) CompositeConstruct 80 80 80 80 81: 6(int) ConvertFToS 80
Store 69(outf4) 81 Store 82(param) 81
83: 8(float) FunctionCall 14(Test2(i1;) 82(param)
84: 8(float) FAdd 79 83
85: 71(fvec4) CompositeConstruct 84 84 84 84
Store 73(outf4) 85
Return Return
FunctionEnd FunctionEnd
11(Test1(i1;): 8(float) Function None 9 11(Test1(i1;): 8(float) Function None 9
@ -101,31 +101,31 @@ Warning, version 450 is not yet complete; most version-specific features are pre
14(Test2(i1;): 8(float) Function None 9 14(Test2(i1;): 8(float) Function None 9
13(bound): 7(ptr) FunctionParameter 13(bound): 7(ptr) FunctionParameter
15: Label 15: Label
42(param): 7(ptr) Variable Function 44(param): 7(ptr) Variable Function
37: 6(int) Load 13(bound) 39: 6(int) Load 13(bound)
39: 28(bool) SGreaterThan 37 38 41: 28(bool) SGreaterThan 39 40
SelectionMerge 41 None SelectionMerge 43 None
BranchConditional 39 40 45 BranchConditional 41 42 48
40: Label 42: Label
43: 6(int) Load 13(bound) 45: 6(int) Load 13(bound)
Store 42(param) 43 Store 44(param) 45
44: 8(float) FunctionCall 11(Test1(i1;) 42(param) 46: 8(float) FunctionCall 11(Test1(i1;) 44(param)
ReturnValue 44 ReturnValue 46
45: Label 48: Label
46: 6(int) Load 13(bound) 49: 6(int) Load 13(bound)
47: 6(int) IMul 46 38 50: 6(int) IMul 49 40
54: 53(ptr) AccessChain 50(ini4) 52 57: 56(ptr) AccessChain 53(ini4) 55
55: 6(int) Load 54
57: 53(ptr) AccessChain 50(ini4) 56
58: 6(int) Load 57 58: 6(int) Load 57
59: 6(int) IMul 55 58 60: 56(ptr) AccessChain 53(ini4) 59
60: 6(int) IAdd 47 59 61: 6(int) Load 60
62: 53(ptr) AccessChain 50(ini4) 61 62: 6(int) IMul 58 61
63: 6(int) Load 62 63: 6(int) IAdd 50 62
64: 6(int) IAdd 60 63 65: 56(ptr) AccessChain 53(ini4) 64
65: 8(float) ConvertSToF 64 66: 6(int) Load 65
ReturnValue 65 67: 6(int) IAdd 63 66
41: Label 68: 8(float) ConvertSToF 67
66: 8(float) Undef ReturnValue 68
ReturnValue 66 43: Label
70: 8(float) Undef
ReturnValue 70
FunctionEnd FunctionEnd

View File

@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 87 // Id's are bound by 91
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 55 74 76 EntryPoint Fragment 4 "main" 58 78 80
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
@ -18,13 +18,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Name 13 "bound" Name 13 "bound"
Name 17 "r" Name 17 "r"
Name 19 "x" Name 19 "x"
Name 47 "param" Name 49 "param"
Name 55 "ini4" Name 58 "ini4"
Name 74 "outf4" Name 78 "outf4"
Name 76 "inf" Name 80 "inf"
Name 79 "param"
Name 83 "param" Name 83 "param"
Decorate 55(ini4) Flat Name 87 "param"
Decorate 58(ini4) Flat
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
@ -38,36 +38,36 @@ Warning, version 450 is not yet complete; most version-specific features are pre
30: 8(float) Constant 1056964608 30: 8(float) Constant 1056964608
34: 6(int) Constant 1 34: 6(int) Constant 1
36: 8(float) Constant 1045220557 36: 8(float) Constant 1045220557
41: 6(int) Constant 2 43: 6(int) Constant 2
51: 6(int) Constant 4 54: 6(int) Constant 4
53: TypeVector 6(int) 4 56: TypeVector 6(int) 4
54: TypePointer Input 53(ivec4) 57: TypePointer Input 56(ivec4)
55(ini4): 54(ptr) Variable Input 58(ini4): 57(ptr) Variable Input
56: TypeInt 32 0 59: TypeInt 32 0
57: 56(int) Constant 1 60: 59(int) Constant 1
58: TypePointer Input 6(int) 61: TypePointer Input 6(int)
61: 56(int) Constant 2 64: 59(int) Constant 2
66: 56(int) Constant 0 69: 59(int) Constant 0
72: TypeVector 8(float) 4 76: TypeVector 8(float) 4
73: TypePointer Output 72(fvec4) 77: TypePointer Output 76(fvec4)
74(outf4): 73(ptr) Variable Output 78(outf4): 77(ptr) Variable Output
75: TypePointer Input 8(float) 79: TypePointer Input 8(float)
76(inf): 75(ptr) Variable Input 80(inf): 79(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
79(param): 7(ptr) Variable Function
83(param): 7(ptr) Variable Function 83(param): 7(ptr) Variable Function
77: 8(float) Load 76(inf) 87(param): 7(ptr) Variable Function
78: 6(int) ConvertFToS 77 81: 8(float) Load 80(inf)
Store 79(param) 78
80: 8(float) FunctionCall 11(Test1(i1;) 79(param)
81: 8(float) Load 76(inf)
82: 6(int) ConvertFToS 81 82: 6(int) ConvertFToS 81
Store 83(param) 82 Store 83(param) 82
84: 8(float) FunctionCall 14(Test2(i1;) 83(param) 84: 8(float) FunctionCall 11(Test1(i1;) 83(param)
85: 8(float) FAdd 80 84 85: 8(float) Load 80(inf)
86: 72(fvec4) CompositeConstruct 85 85 85 85 86: 6(int) ConvertFToS 85
Store 74(outf4) 86 Store 87(param) 86
88: 8(float) FunctionCall 14(Test2(i1;) 87(param)
89: 8(float) FAdd 84 88
90: 76(fvec4) CompositeConstruct 89 89 89 89
Store 78(outf4) 90
Return Return
FunctionEnd FunctionEnd
11(Test1(i1;): 8(float) Function None 9 11(Test1(i1;): 8(float) Function None 9
@ -106,32 +106,32 @@ Warning, version 450 is not yet complete; most version-specific features are pre
14(Test2(i1;): 8(float) Function None 9 14(Test2(i1;): 8(float) Function None 9
13(bound): 7(ptr) FunctionParameter 13(bound): 7(ptr) FunctionParameter
15: Label 15: Label
47(param): 7(ptr) Variable Function 49(param): 7(ptr) Variable Function
40: 6(int) Load 13(bound) 42: 6(int) Load 13(bound)
42: 28(bool) SGreaterThan 40 41 44: 28(bool) SGreaterThan 42 43
SelectionMerge 44 None SelectionMerge 46 None
BranchConditional 42 43 49 BranchConditional 44 45 52
43: Label 45: Label
45: 6(int) Load 13(bound) 47: 6(int) Load 13(bound)
46: 6(int) IMul 45 41 48: 6(int) IMul 47 43
Store 47(param) 46 Store 49(param) 48
48: 8(float) FunctionCall 11(Test1(i1;) 47(param) 50: 8(float) FunctionCall 11(Test1(i1;) 49(param)
ReturnValue 48 ReturnValue 50
49: Label 52: Label
50: 6(int) Load 13(bound) 53: 6(int) Load 13(bound)
52: 6(int) IMul 50 51 55: 6(int) IMul 53 54
59: 58(ptr) AccessChain 55(ini4) 57 62: 61(ptr) AccessChain 58(ini4) 60
60: 6(int) Load 59
62: 58(ptr) AccessChain 55(ini4) 61
63: 6(int) Load 62 63: 6(int) Load 62
64: 6(int) IMul 60 63 65: 61(ptr) AccessChain 58(ini4) 64
65: 6(int) IAdd 52 64 66: 6(int) Load 65
67: 58(ptr) AccessChain 55(ini4) 66 67: 6(int) IMul 63 66
68: 6(int) Load 67 68: 6(int) IAdd 55 67
69: 6(int) IAdd 65 68 70: 61(ptr) AccessChain 58(ini4) 69
70: 8(float) ConvertSToF 69 71: 6(int) Load 70
ReturnValue 70 72: 6(int) IAdd 68 71
44: Label 73: 8(float) ConvertSToF 72
71: 8(float) Undef ReturnValue 73
ReturnValue 71 46: Label
75: 8(float) Undef
ReturnValue 75
FunctionEnd FunctionEnd

View File

@ -5,7 +5,7 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 44 // Id's are bound by 48
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
@ -20,8 +20,8 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
Decorate 23(FragColor) RelaxedPrecision Decorate 23(FragColor) RelaxedPrecision
Decorate 23(FragColor) Location 0 Decorate 23(FragColor) Location 0
Decorate 29 RelaxedPrecision Decorate 29 RelaxedPrecision
Decorate 35 RelaxedPrecision Decorate 36 RelaxedPrecision
Decorate 41 RelaxedPrecision Decorate 43 RelaxedPrecision
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -36,12 +36,12 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
23(FragColor): 22(ptr) Variable Output 23(FragColor): 22(ptr) Variable Output
24: 10(int) Constant 0 24: 10(int) Constant 0
27: 6(float) Constant 0 27: 6(float) Constant 0
30: 10(int) Constant 1 31: 10(int) Constant 1
33: 6(float) Constant 1065353216 34: 6(float) Constant 1065353216
36: 10(int) Constant 2 38: 10(int) Constant 2
39: 6(float) Constant 1073741824 41: 6(float) Constant 1073741824
42: 6(float) Constant 3212836864 45: 6(float) Constant 3212836864
43: 7(fvec4) ConstantComposite 42 42 42 42 46: 7(fvec4) ConstantComposite 45 45 45 45
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
13: 12(ptr) AccessChain 9(in0) 11 13: 12(ptr) AccessChain 9(in0) 11
@ -53,7 +53,7 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
case 1: 18 case 1: 18
case 2: 19 case 2: 19
20: Label 20: Label
Store 23(FragColor) 43 Store 23(FragColor) 46
Branch 21 Branch 21
17: Label 17: Label
25: 12(ptr) AccessChain 9(in0) 24 25: 12(ptr) AccessChain 9(in0) 24
@ -63,18 +63,18 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
Store 23(FragColor) 29 Store 23(FragColor) 29
Branch 21 Branch 21
18: Label 18: Label
31: 12(ptr) AccessChain 9(in0) 30 32: 12(ptr) AccessChain 9(in0) 31
32: 6(float) Load 31 33: 6(float) Load 32
34: 6(float) FAdd 32 33 35: 6(float) FAdd 33 34
35: 7(fvec4) CompositeConstruct 34 34 34 34 36: 7(fvec4) CompositeConstruct 35 35 35 35
Store 23(FragColor) 35 Store 23(FragColor) 36
Branch 21 Branch 21
19: Label 19: Label
37: 12(ptr) AccessChain 9(in0) 36 39: 12(ptr) AccessChain 9(in0) 38
38: 6(float) Load 37 40: 6(float) Load 39
40: 6(float) FAdd 38 39 42: 6(float) FAdd 40 41
41: 7(fvec4) CompositeConstruct 40 40 40 40 43: 7(fvec4) CompositeConstruct 42 42 42 42
Store 23(FragColor) 41 Store 23(FragColor) 43
Branch 21 Branch 21
21: Label 21: Label
Return Return