Fix OpLine prepending OpFunction reports wrong file when #line is present
This commit is contained in:
parent
7757cbebe4
commit
c52b3d5075
@ -2846,7 +2846,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||||||
}
|
}
|
||||||
if (options.generateDebugInfo) {
|
if (options.generateDebugInfo) {
|
||||||
const auto& loc = node->getLoc();
|
const auto& loc = node->getLoc();
|
||||||
currentFunction->setDebugLineInfo(builder.getSourceFile(), loc.line, loc.column);
|
const char* sourceFileName = loc.getFilename();
|
||||||
|
spv::Id sourceFileId = sourceFileName ? builder.getStringId(sourceFileName) : builder.getSourceFile();
|
||||||
|
currentFunction->setDebugLineInfo(sourceFileId, loc.line, loc.column);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (inEntryPoint)
|
if (inEntryPoint)
|
||||||
|
@ -129,7 +129,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
|||||||
71(i.vTextureCoords): 70(ptr) Variable Input
|
71(i.vTextureCoords): 70(ptr) Variable Input
|
||||||
74: TypePointer Output 11(fvec4)
|
74: TypePointer Output 11(fvec4)
|
||||||
75(@entryPointOutput.vColor): 74(ptr) Variable Output
|
75(@entryPointOutput.vColor): 74(ptr) Variable Output
|
||||||
Line 1 23 1
|
Line 17 23 1
|
||||||
5(MainPs): 3 Function None 4
|
5(MainPs): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
69(i): 10(ptr) Variable Function
|
69(i): 10(ptr) Variable Function
|
||||||
@ -145,7 +145,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
|||||||
Store 75(@entryPointOutput.vColor) 79
|
Store 75(@entryPointOutput.vColor) 79
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
Line 1 23 1
|
Line 17 23 1
|
||||||
15(@MainPs(struct-PS_INPUT-vf21;):12(PS_OUTPUT) Function None 13
|
15(@MainPs(struct-PS_INPUT-vf21;):12(PS_OUTPUT) Function None 13
|
||||||
14(i): 10(ptr) FunctionParameter
|
14(i): 10(ptr) FunctionParameter
|
||||||
16: Label
|
16: Label
|
||||||
|
@ -112,7 +112,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
|||||||
70(i.vTextureCoords): 69(ptr) Variable Input
|
70(i.vTextureCoords): 69(ptr) Variable Input
|
||||||
73: TypePointer Output 11(fvec4)
|
73: TypePointer Output 11(fvec4)
|
||||||
74(@entryPointOutput.vColor): 73(ptr) Variable Output
|
74(@entryPointOutput.vColor): 73(ptr) Variable Output
|
||||||
Line 1 25 1
|
Line 17 25 1
|
||||||
5(MainPs): 3 Function None 4
|
5(MainPs): 3 Function None 4
|
||||||
NoLine
|
NoLine
|
||||||
6: Label
|
6: Label
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
spv.pp.line.frag
|
spv.pp.line.frag
|
||||||
WARNING: spv.pp.line.frag:6: varying deprecated in version 130; may be removed in future release
|
|
||||||
WARNING: spv.pp.line.frag:7: varying deprecated in version 130; may be removed in future release
|
WARNING: spv.pp.line.frag:7: varying deprecated in version 130; may be removed in future release
|
||||||
|
WARNING: spv.pp.line.frag:8: varying deprecated in version 130; may be removed in future release
|
||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 8000a
|
// Generated by (magic number): 8000a
|
||||||
// Id's are bound by 65
|
// Id's are bound by 84
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
Capability Sampled1D
|
Capability Sampled1D
|
||||||
2: ExtInstImport "GLSL.std.450"
|
2: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 5 "main" 41 53 56 59
|
EntryPoint Fragment 5 "main" 60 72 75 78
|
||||||
ExecutionMode 5 OriginUpperLeft
|
ExecutionMode 5 OriginUpperLeft
|
||||||
1: String "spv.pp.line.frag"
|
1: String "spv.pp.line.frag"
|
||||||
|
13: String "header.h"
|
||||||
Source GLSL 140 1 "// OpModuleProcessed auto-map-locations
|
Source GLSL 140 1 "// OpModuleProcessed auto-map-locations
|
||||||
// OpModuleProcessed auto-map-bindings
|
// OpModuleProcessed auto-map-bindings
|
||||||
// OpModuleProcessed client vulkan100
|
// OpModuleProcessed client vulkan100
|
||||||
@ -21,6 +22,7 @@ WARNING: spv.pp.line.frag:7: varying deprecated in version 130; may be removed i
|
|||||||
// OpModuleProcessed entry-point main
|
// OpModuleProcessed entry-point main
|
||||||
#line 1
|
#line 1
|
||||||
#version 140
|
#version 140
|
||||||
|
#extension GL_GOOGLE_cpp_style_line_directive : require
|
||||||
|
|
||||||
uniform sampler1D texSampler1D;
|
uniform sampler1D texSampler1D;
|
||||||
uniform sampler2D texSampler2D;
|
uniform sampler2D texSampler2D;
|
||||||
@ -30,9 +32,20 @@ varying vec4 u;
|
|||||||
|
|
||||||
in vec2 coords2D;
|
in vec2 coords2D;
|
||||||
|
|
||||||
|
#line 0 "header.h"
|
||||||
|
float myAbs(float x) {
|
||||||
|
if (x > 0) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return -x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#line 22 "spv.pp.line.frag"
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float blendscale = 1.789;
|
float blendscale = myAbs(1.789);
|
||||||
float bias = 2.0;
|
float bias = 2.0;
|
||||||
float coords1D = 1.789;
|
float coords1D = 1.789;
|
||||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
@ -46,105 +59,135 @@ void main()
|
|||||||
gl_FragColor = mix(color, u, blend * blendscale);
|
gl_FragColor = mix(color, u, blend * blendscale);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
SourceExtension "GL_GOOGLE_cpp_style_line_directive"
|
||||||
Name 5 "main"
|
Name 5 "main"
|
||||||
Name 9 "blendscale"
|
Name 11 "myAbs(f1;"
|
||||||
Name 11 "bias"
|
Name 10 "x"
|
||||||
Name 13 "coords1D"
|
Name 27 "blendscale"
|
||||||
Name 16 "color"
|
Name 29 "param"
|
||||||
Name 22 "texSampler1D"
|
Name 31 "bias"
|
||||||
Name 37 "texSampler2D"
|
Name 33 "coords1D"
|
||||||
Name 41 "coords2D"
|
Name 36 "color"
|
||||||
Name 53 "gl_FragColor"
|
Name 41 "texSampler1D"
|
||||||
Name 56 "u"
|
Name 56 "texSampler2D"
|
||||||
Name 59 "blend"
|
Name 60 "coords2D"
|
||||||
Decorate 22(texSampler1D) DescriptorSet 0
|
Name 72 "gl_FragColor"
|
||||||
Decorate 22(texSampler1D) Binding 0
|
Name 75 "u"
|
||||||
Decorate 37(texSampler2D) DescriptorSet 0
|
Name 78 "blend"
|
||||||
Decorate 37(texSampler2D) Binding 1
|
Decorate 41(texSampler1D) DescriptorSet 0
|
||||||
Decorate 41(coords2D) Location 2
|
Decorate 41(texSampler1D) Binding 0
|
||||||
Decorate 53(gl_FragColor) Location 0
|
Decorate 56(texSampler2D) DescriptorSet 0
|
||||||
Decorate 56(u) Location 1
|
Decorate 56(texSampler2D) Binding 1
|
||||||
Decorate 59(blend) Location 0
|
Decorate 60(coords2D) Location 2
|
||||||
|
Decorate 72(gl_FragColor) Location 0
|
||||||
|
Decorate 75(u) Location 1
|
||||||
|
Decorate 78(blend) Location 0
|
||||||
3: TypeVoid
|
3: TypeVoid
|
||||||
4: TypeFunction 3
|
4: TypeFunction 3
|
||||||
7: TypeFloat 32
|
7: TypeFloat 32
|
||||||
8: TypePointer Function 7(float)
|
8: TypePointer Function 7(float)
|
||||||
10: 7(float) Constant 1071971828
|
9: TypeFunction 7(float) 8(ptr)
|
||||||
12: 7(float) Constant 1073741824
|
15: 7(float) Constant 0
|
||||||
14: TypeVector 7(float) 4
|
16: TypeBool
|
||||||
15: TypePointer Function 14(fvec4)
|
28: 7(float) Constant 1071971828
|
||||||
17: 7(float) Constant 0
|
32: 7(float) Constant 1073741824
|
||||||
18: 14(fvec4) ConstantComposite 17 17 17 17
|
34: TypeVector 7(float) 4
|
||||||
19: TypeImage 7(float) 1D sampled format:Unknown
|
35: TypePointer Function 34(fvec4)
|
||||||
20: TypeSampledImage 19
|
37: 34(fvec4) ConstantComposite 15 15 15 15
|
||||||
21: TypePointer UniformConstant 20
|
38: TypeImage 7(float) 1D sampled format:Unknown
|
||||||
22(texSampler1D): 21(ptr) Variable UniformConstant
|
39: TypeSampledImage 38
|
||||||
34: TypeImage 7(float) 2D sampled format:Unknown
|
40: TypePointer UniformConstant 39
|
||||||
35: TypeSampledImage 34
|
41(texSampler1D): 40(ptr) Variable UniformConstant
|
||||||
36: TypePointer UniformConstant 35
|
53: TypeImage 7(float) 2D sampled format:Unknown
|
||||||
37(texSampler2D): 36(ptr) Variable UniformConstant
|
54: TypeSampledImage 53
|
||||||
39: TypeVector 7(float) 2
|
55: TypePointer UniformConstant 54
|
||||||
40: TypePointer Input 39(fvec2)
|
56(texSampler2D): 55(ptr) Variable UniformConstant
|
||||||
41(coords2D): 40(ptr) Variable Input
|
58: TypeVector 7(float) 2
|
||||||
52: TypePointer Output 14(fvec4)
|
59: TypePointer Input 58(fvec2)
|
||||||
53(gl_FragColor): 52(ptr) Variable Output
|
60(coords2D): 59(ptr) Variable Input
|
||||||
55: TypePointer Input 14(fvec4)
|
71: TypePointer Output 34(fvec4)
|
||||||
56(u): 55(ptr) Variable Input
|
72(gl_FragColor): 71(ptr) Variable Output
|
||||||
58: TypePointer Input 7(float)
|
74: TypePointer Input 34(fvec4)
|
||||||
59(blend): 58(ptr) Variable Input
|
75(u): 74(ptr) Variable Input
|
||||||
Line 1 11 11
|
77: TypePointer Input 7(float)
|
||||||
|
78(blend): 77(ptr) Variable Input
|
||||||
|
Line 1 23 11
|
||||||
5(main): 3 Function None 4
|
5(main): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
9(blendscale): 8(ptr) Variable Function
|
27(blendscale): 8(ptr) Variable Function
|
||||||
11(bias): 8(ptr) Variable Function
|
29(param): 8(ptr) Variable Function
|
||||||
13(coords1D): 8(ptr) Variable Function
|
31(bias): 8(ptr) Variable Function
|
||||||
16(color): 15(ptr) Variable Function
|
33(coords1D): 8(ptr) Variable Function
|
||||||
Line 1 13 0
|
36(color): 35(ptr) Variable Function
|
||||||
Store 9(blendscale) 10
|
Line 1 25 0
|
||||||
Line 1 14 0
|
Store 29(param) 28
|
||||||
Store 11(bias) 12
|
30: 7(float) FunctionCall 11(myAbs(f1;) 29(param)
|
||||||
Line 1 15 0
|
Store 27(blendscale) 30
|
||||||
Store 13(coords1D) 10
|
Line 1 26 0
|
||||||
Line 1 16 0
|
Store 31(bias) 32
|
||||||
Store 16(color) 18
|
Line 1 27 0
|
||||||
|
Store 33(coords1D) 28
|
||||||
|
Line 1 28 0
|
||||||
|
Store 36(color) 37
|
||||||
Line 1 54 0
|
Line 1 54 0
|
||||||
23: 20 Load 22(texSampler1D)
|
42: 39 Load 41(texSampler1D)
|
||||||
24: 7(float) Load 13(coords1D)
|
43: 7(float) Load 33(coords1D)
|
||||||
25: 14(fvec4) ImageSampleImplicitLod 23 24
|
44: 34(fvec4) ImageSampleImplicitLod 42 43
|
||||||
26: 14(fvec4) Load 16(color)
|
45: 34(fvec4) Load 36(color)
|
||||||
27: 14(fvec4) FAdd 26 25
|
46: 34(fvec4) FAdd 45 44
|
||||||
Store 16(color) 27
|
Store 36(color) 46
|
||||||
Line 1 55 0
|
Line 1 55 0
|
||||||
28: 20 Load 22(texSampler1D)
|
47: 39 Load 41(texSampler1D)
|
||||||
29: 7(float) Load 13(coords1D)
|
48: 7(float) Load 33(coords1D)
|
||||||
30: 7(float) Load 11(bias)
|
49: 7(float) Load 31(bias)
|
||||||
31: 14(fvec4) ImageSampleImplicitLod 28 29 Bias 30
|
50: 34(fvec4) ImageSampleImplicitLod 47 48 Bias 49
|
||||||
32: 14(fvec4) Load 16(color)
|
51: 34(fvec4) Load 36(color)
|
||||||
33: 14(fvec4) FAdd 32 31
|
52: 34(fvec4) FAdd 51 50
|
||||||
Store 16(color) 33
|
Store 36(color) 52
|
||||||
Line 1 103 0
|
Line 1 103 0
|
||||||
38: 35 Load 37(texSampler2D)
|
57: 54 Load 56(texSampler2D)
|
||||||
42: 39(fvec2) Load 41(coords2D)
|
61: 58(fvec2) Load 60(coords2D)
|
||||||
43: 14(fvec4) ImageSampleImplicitLod 38 42
|
62: 34(fvec4) ImageSampleImplicitLod 57 61
|
||||||
44: 14(fvec4) Load 16(color)
|
63: 34(fvec4) Load 36(color)
|
||||||
45: 14(fvec4) FAdd 44 43
|
64: 34(fvec4) FAdd 63 62
|
||||||
Store 16(color) 45
|
Store 36(color) 64
|
||||||
Line 1 104 0
|
Line 1 104 0
|
||||||
46: 35 Load 37(texSampler2D)
|
65: 54 Load 56(texSampler2D)
|
||||||
47: 39(fvec2) Load 41(coords2D)
|
66: 58(fvec2) Load 60(coords2D)
|
||||||
48: 7(float) Load 11(bias)
|
67: 7(float) Load 31(bias)
|
||||||
49: 14(fvec4) ImageSampleImplicitLod 46 47 Bias 48
|
68: 34(fvec4) ImageSampleImplicitLod 65 66 Bias 67
|
||||||
50: 14(fvec4) Load 16(color)
|
69: 34(fvec4) Load 36(color)
|
||||||
51: 14(fvec4) FAdd 50 49
|
70: 34(fvec4) FAdd 69 68
|
||||||
Store 16(color) 51
|
Store 36(color) 70
|
||||||
Line 1 106 0
|
Line 1 106 0
|
||||||
54: 14(fvec4) Load 16(color)
|
73: 34(fvec4) Load 36(color)
|
||||||
57: 14(fvec4) Load 56(u)
|
76: 34(fvec4) Load 75(u)
|
||||||
60: 7(float) Load 59(blend)
|
79: 7(float) Load 78(blend)
|
||||||
61: 7(float) Load 9(blendscale)
|
80: 7(float) Load 27(blendscale)
|
||||||
62: 7(float) FMul 60 61
|
81: 7(float) FMul 79 80
|
||||||
63: 14(fvec4) CompositeConstruct 62 62 62 62
|
82: 34(fvec4) CompositeConstruct 81 81 81 81
|
||||||
64: 14(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 54 57 63
|
83: 34(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 73 76 82
|
||||||
Store 53(gl_FragColor) 64
|
Store 72(gl_FragColor) 83
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 13 1 20
|
||||||
|
11(myAbs(f1;): 7(float) Function None 9
|
||||||
|
10(x): 8(ptr) FunctionParameter
|
||||||
|
12: Label
|
||||||
|
Line 13 2 0
|
||||||
|
14: 7(float) Load 10(x)
|
||||||
|
17: 16(bool) FOrdGreaterThan 14 15
|
||||||
|
SelectionMerge 19 None
|
||||||
|
BranchConditional 17 18 22
|
||||||
|
18: Label
|
||||||
|
Line 13 3 0
|
||||||
|
20: 7(float) Load 10(x)
|
||||||
|
ReturnValue 20
|
||||||
|
22: Label
|
||||||
|
Line 13 6 0
|
||||||
|
23: 7(float) Load 10(x)
|
||||||
|
24: 7(float) FNegate 23
|
||||||
|
ReturnValue 24
|
||||||
|
19: Label
|
||||||
|
Unreachable
|
||||||
|
FunctionEnd
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#version 140
|
#version 140
|
||||||
|
#extension GL_GOOGLE_cpp_style_line_directive : require
|
||||||
|
|
||||||
uniform sampler1D texSampler1D;
|
uniform sampler1D texSampler1D;
|
||||||
uniform sampler2D texSampler2D;
|
uniform sampler2D texSampler2D;
|
||||||
@ -8,9 +9,20 @@ varying vec4 u;
|
|||||||
|
|
||||||
in vec2 coords2D;
|
in vec2 coords2D;
|
||||||
|
|
||||||
|
#line 0 "header.h"
|
||||||
|
float myAbs(float x) {
|
||||||
|
if (x > 0) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return -x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#line 22 "spv.pp.line.frag"
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float blendscale = 1.789;
|
float blendscale = myAbs(1.789);
|
||||||
float bias = 2.0;
|
float bias = 2.0;
|
||||||
float coords1D = 1.789;
|
float coords1D = 1.789;
|
||||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user