mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
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) {
|
||||
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 {
|
||||
if (inEntryPoint)
|
||||
|
@ -129,7 +129,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
||||
71(i.vTextureCoords): 70(ptr) Variable Input
|
||||
74: TypePointer Output 11(fvec4)
|
||||
75(@entryPointOutput.vColor): 74(ptr) Variable Output
|
||||
Line 1 23 1
|
||||
Line 17 23 1
|
||||
5(MainPs): 3 Function None 4
|
||||
6: Label
|
||||
69(i): 10(ptr) Variable Function
|
||||
@ -145,7 +145,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
||||
Store 75(@entryPointOutput.vColor) 79
|
||||
Return
|
||||
FunctionEnd
|
||||
Line 1 23 1
|
||||
Line 17 23 1
|
||||
15(@MainPs(struct-PS_INPUT-vf21;):12(PS_OUTPUT) Function None 13
|
||||
14(i): 10(ptr) FunctionParameter
|
||||
16: Label
|
||||
|
@ -112,7 +112,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
||||
70(i.vTextureCoords): 69(ptr) Variable Input
|
||||
73: TypePointer Output 11(fvec4)
|
||||
74(@entryPointOutput.vColor): 73(ptr) Variable Output
|
||||
Line 1 25 1
|
||||
Line 17 25 1
|
||||
5(MainPs): 3 Function None 4
|
||||
NoLine
|
||||
6: Label
|
||||
|
@ -1,18 +1,19 @@
|
||||
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:8: varying deprecated in version 130; may be removed in future release
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000a
|
||||
// Id's are bound by 65
|
||||
// Id's are bound by 84
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
2: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 5 "main" 41 53 56 59
|
||||
EntryPoint Fragment 5 "main" 60 72 75 78
|
||||
ExecutionMode 5 OriginUpperLeft
|
||||
1: String "spv.pp.line.frag"
|
||||
13: String "header.h"
|
||||
Source GLSL 140 1 "// OpModuleProcessed auto-map-locations
|
||||
// OpModuleProcessed auto-map-bindings
|
||||
// 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
|
||||
#line 1
|
||||
#version 140
|
||||
#extension GL_GOOGLE_cpp_style_line_directive : require
|
||||
|
||||
uniform sampler1D texSampler1D;
|
||||
uniform sampler2D texSampler2D;
|
||||
@ -30,9 +32,20 @@ varying vec4 u;
|
||||
|
||||
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()
|
||||
{
|
||||
float blendscale = 1.789;
|
||||
float blendscale = myAbs(1.789);
|
||||
float bias = 2.0;
|
||||
float coords1D = 1.789;
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
@ -46,105 +59,135 @@ void main()
|
||||
gl_FragColor = mix(color, u, blend * blendscale);
|
||||
}
|
||||
"
|
||||
SourceExtension "GL_GOOGLE_cpp_style_line_directive"
|
||||
Name 5 "main"
|
||||
Name 9 "blendscale"
|
||||
Name 11 "bias"
|
||||
Name 13 "coords1D"
|
||||
Name 16 "color"
|
||||
Name 22 "texSampler1D"
|
||||
Name 37 "texSampler2D"
|
||||
Name 41 "coords2D"
|
||||
Name 53 "gl_FragColor"
|
||||
Name 56 "u"
|
||||
Name 59 "blend"
|
||||
Decorate 22(texSampler1D) DescriptorSet 0
|
||||
Decorate 22(texSampler1D) Binding 0
|
||||
Decorate 37(texSampler2D) DescriptorSet 0
|
||||
Decorate 37(texSampler2D) Binding 1
|
||||
Decorate 41(coords2D) Location 2
|
||||
Decorate 53(gl_FragColor) Location 0
|
||||
Decorate 56(u) Location 1
|
||||
Decorate 59(blend) Location 0
|
||||
Name 11 "myAbs(f1;"
|
||||
Name 10 "x"
|
||||
Name 27 "blendscale"
|
||||
Name 29 "param"
|
||||
Name 31 "bias"
|
||||
Name 33 "coords1D"
|
||||
Name 36 "color"
|
||||
Name 41 "texSampler1D"
|
||||
Name 56 "texSampler2D"
|
||||
Name 60 "coords2D"
|
||||
Name 72 "gl_FragColor"
|
||||
Name 75 "u"
|
||||
Name 78 "blend"
|
||||
Decorate 41(texSampler1D) DescriptorSet 0
|
||||
Decorate 41(texSampler1D) Binding 0
|
||||
Decorate 56(texSampler2D) DescriptorSet 0
|
||||
Decorate 56(texSampler2D) Binding 1
|
||||
Decorate 60(coords2D) Location 2
|
||||
Decorate 72(gl_FragColor) Location 0
|
||||
Decorate 75(u) Location 1
|
||||
Decorate 78(blend) Location 0
|
||||
3: TypeVoid
|
||||
4: TypeFunction 3
|
||||
7: TypeFloat 32
|
||||
8: TypePointer Function 7(float)
|
||||
10: 7(float) Constant 1071971828
|
||||
12: 7(float) Constant 1073741824
|
||||
14: TypeVector 7(float) 4
|
||||
15: TypePointer Function 14(fvec4)
|
||||
17: 7(float) Constant 0
|
||||
18: 14(fvec4) ConstantComposite 17 17 17 17
|
||||
19: TypeImage 7(float) 1D sampled format:Unknown
|
||||
20: TypeSampledImage 19
|
||||
21: TypePointer UniformConstant 20
|
||||
22(texSampler1D): 21(ptr) Variable UniformConstant
|
||||
34: TypeImage 7(float) 2D sampled format:Unknown
|
||||
35: TypeSampledImage 34
|
||||
36: TypePointer UniformConstant 35
|
||||
37(texSampler2D): 36(ptr) Variable UniformConstant
|
||||
39: TypeVector 7(float) 2
|
||||
40: TypePointer Input 39(fvec2)
|
||||
41(coords2D): 40(ptr) Variable Input
|
||||
52: TypePointer Output 14(fvec4)
|
||||
53(gl_FragColor): 52(ptr) Variable Output
|
||||
55: TypePointer Input 14(fvec4)
|
||||
56(u): 55(ptr) Variable Input
|
||||
58: TypePointer Input 7(float)
|
||||
59(blend): 58(ptr) Variable Input
|
||||
Line 1 11 11
|
||||
9: TypeFunction 7(float) 8(ptr)
|
||||
15: 7(float) Constant 0
|
||||
16: TypeBool
|
||||
28: 7(float) Constant 1071971828
|
||||
32: 7(float) Constant 1073741824
|
||||
34: TypeVector 7(float) 4
|
||||
35: TypePointer Function 34(fvec4)
|
||||
37: 34(fvec4) ConstantComposite 15 15 15 15
|
||||
38: TypeImage 7(float) 1D sampled format:Unknown
|
||||
39: TypeSampledImage 38
|
||||
40: TypePointer UniformConstant 39
|
||||
41(texSampler1D): 40(ptr) Variable UniformConstant
|
||||
53: TypeImage 7(float) 2D sampled format:Unknown
|
||||
54: TypeSampledImage 53
|
||||
55: TypePointer UniformConstant 54
|
||||
56(texSampler2D): 55(ptr) Variable UniformConstant
|
||||
58: TypeVector 7(float) 2
|
||||
59: TypePointer Input 58(fvec2)
|
||||
60(coords2D): 59(ptr) Variable Input
|
||||
71: TypePointer Output 34(fvec4)
|
||||
72(gl_FragColor): 71(ptr) Variable Output
|
||||
74: TypePointer Input 34(fvec4)
|
||||
75(u): 74(ptr) Variable Input
|
||||
77: TypePointer Input 7(float)
|
||||
78(blend): 77(ptr) Variable Input
|
||||
Line 1 23 11
|
||||
5(main): 3 Function None 4
|
||||
6: Label
|
||||
9(blendscale): 8(ptr) Variable Function
|
||||
11(bias): 8(ptr) Variable Function
|
||||
13(coords1D): 8(ptr) Variable Function
|
||||
16(color): 15(ptr) Variable Function
|
||||
Line 1 13 0
|
||||
Store 9(blendscale) 10
|
||||
Line 1 14 0
|
||||
Store 11(bias) 12
|
||||
Line 1 15 0
|
||||
Store 13(coords1D) 10
|
||||
Line 1 16 0
|
||||
Store 16(color) 18
|
||||
27(blendscale): 8(ptr) Variable Function
|
||||
29(param): 8(ptr) Variable Function
|
||||
31(bias): 8(ptr) Variable Function
|
||||
33(coords1D): 8(ptr) Variable Function
|
||||
36(color): 35(ptr) Variable Function
|
||||
Line 1 25 0
|
||||
Store 29(param) 28
|
||||
30: 7(float) FunctionCall 11(myAbs(f1;) 29(param)
|
||||
Store 27(blendscale) 30
|
||||
Line 1 26 0
|
||||
Store 31(bias) 32
|
||||
Line 1 27 0
|
||||
Store 33(coords1D) 28
|
||||
Line 1 28 0
|
||||
Store 36(color) 37
|
||||
Line 1 54 0
|
||||
23: 20 Load 22(texSampler1D)
|
||||
24: 7(float) Load 13(coords1D)
|
||||
25: 14(fvec4) ImageSampleImplicitLod 23 24
|
||||
26: 14(fvec4) Load 16(color)
|
||||
27: 14(fvec4) FAdd 26 25
|
||||
Store 16(color) 27
|
||||
42: 39 Load 41(texSampler1D)
|
||||
43: 7(float) Load 33(coords1D)
|
||||
44: 34(fvec4) ImageSampleImplicitLod 42 43
|
||||
45: 34(fvec4) Load 36(color)
|
||||
46: 34(fvec4) FAdd 45 44
|
||||
Store 36(color) 46
|
||||
Line 1 55 0
|
||||
28: 20 Load 22(texSampler1D)
|
||||
29: 7(float) Load 13(coords1D)
|
||||
30: 7(float) Load 11(bias)
|
||||
31: 14(fvec4) ImageSampleImplicitLod 28 29 Bias 30
|
||||
32: 14(fvec4) Load 16(color)
|
||||
33: 14(fvec4) FAdd 32 31
|
||||
Store 16(color) 33
|
||||
47: 39 Load 41(texSampler1D)
|
||||
48: 7(float) Load 33(coords1D)
|
||||
49: 7(float) Load 31(bias)
|
||||
50: 34(fvec4) ImageSampleImplicitLod 47 48 Bias 49
|
||||
51: 34(fvec4) Load 36(color)
|
||||
52: 34(fvec4) FAdd 51 50
|
||||
Store 36(color) 52
|
||||
Line 1 103 0
|
||||
38: 35 Load 37(texSampler2D)
|
||||
42: 39(fvec2) Load 41(coords2D)
|
||||
43: 14(fvec4) ImageSampleImplicitLod 38 42
|
||||
44: 14(fvec4) Load 16(color)
|
||||
45: 14(fvec4) FAdd 44 43
|
||||
Store 16(color) 45
|
||||
57: 54 Load 56(texSampler2D)
|
||||
61: 58(fvec2) Load 60(coords2D)
|
||||
62: 34(fvec4) ImageSampleImplicitLod 57 61
|
||||
63: 34(fvec4) Load 36(color)
|
||||
64: 34(fvec4) FAdd 63 62
|
||||
Store 36(color) 64
|
||||
Line 1 104 0
|
||||
46: 35 Load 37(texSampler2D)
|
||||
47: 39(fvec2) Load 41(coords2D)
|
||||
48: 7(float) Load 11(bias)
|
||||
49: 14(fvec4) ImageSampleImplicitLod 46 47 Bias 48
|
||||
50: 14(fvec4) Load 16(color)
|
||||
51: 14(fvec4) FAdd 50 49
|
||||
Store 16(color) 51
|
||||
65: 54 Load 56(texSampler2D)
|
||||
66: 58(fvec2) Load 60(coords2D)
|
||||
67: 7(float) Load 31(bias)
|
||||
68: 34(fvec4) ImageSampleImplicitLod 65 66 Bias 67
|
||||
69: 34(fvec4) Load 36(color)
|
||||
70: 34(fvec4) FAdd 69 68
|
||||
Store 36(color) 70
|
||||
Line 1 106 0
|
||||
54: 14(fvec4) Load 16(color)
|
||||
57: 14(fvec4) Load 56(u)
|
||||
60: 7(float) Load 59(blend)
|
||||
61: 7(float) Load 9(blendscale)
|
||||
62: 7(float) FMul 60 61
|
||||
63: 14(fvec4) CompositeConstruct 62 62 62 62
|
||||
64: 14(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 54 57 63
|
||||
Store 53(gl_FragColor) 64
|
||||
73: 34(fvec4) Load 36(color)
|
||||
76: 34(fvec4) Load 75(u)
|
||||
79: 7(float) Load 78(blend)
|
||||
80: 7(float) Load 27(blendscale)
|
||||
81: 7(float) FMul 79 80
|
||||
82: 34(fvec4) CompositeConstruct 81 81 81 81
|
||||
83: 34(fvec4) ExtInst 2(GLSL.std.450) 46(FMix) 73 76 82
|
||||
Store 72(gl_FragColor) 83
|
||||
Return
|
||||
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
|
||||
#extension GL_GOOGLE_cpp_style_line_directive : require
|
||||
|
||||
uniform sampler1D texSampler1D;
|
||||
uniform sampler2D texSampler2D;
|
||||
@ -8,9 +9,20 @@ varying vec4 u;
|
||||
|
||||
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()
|
||||
{
|
||||
float blendscale = 1.789;
|
||||
float blendscale = myAbs(1.789);
|
||||
float bias = 2.0;
|
||||
float coords1D = 1.789;
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
|
Loading…
Reference in New Issue
Block a user