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

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