Merge pull request #2950 from qingyuanzNV/insert_opline_before_opfunction2
Generate OpLine Before OpFunction
This commit is contained in:
commit
316f12ac1d
@ -2792,6 +2792,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||||||
} else {
|
} else {
|
||||||
handleFunctionEntry(node);
|
handleFunctionEntry(node);
|
||||||
}
|
}
|
||||||
|
if (options.generateDebugInfo) {
|
||||||
|
const auto& loc = node->getLoc();
|
||||||
|
currentFunction->setDebugLineInfo(builder.getSourceFile(), loc.line, loc.column);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (inEntryPoint)
|
if (inEntryPoint)
|
||||||
entryPointTerminated = true;
|
entryPointTerminated = true;
|
||||||
|
@ -99,6 +99,10 @@ public:
|
|||||||
stringIds[file_c_str] = strId;
|
stringIds[file_c_str] = strId;
|
||||||
return strId;
|
return strId;
|
||||||
}
|
}
|
||||||
|
spv::Id getSourceFile() const
|
||||||
|
{
|
||||||
|
return sourceFileStringId;
|
||||||
|
}
|
||||||
void setSourceFile(const std::string& file)
|
void setSourceFile(const std::string& file)
|
||||||
{
|
{
|
||||||
sourceFileStringId = getStringId(file);
|
sourceFileStringId = getStringId(file);
|
||||||
|
@ -357,6 +357,14 @@ public:
|
|||||||
Decoration getReturnPrecision() const
|
Decoration getReturnPrecision() const
|
||||||
{ return reducedPrecisionReturn ? DecorationRelaxedPrecision : NoPrecision; }
|
{ return reducedPrecisionReturn ? DecorationRelaxedPrecision : NoPrecision; }
|
||||||
|
|
||||||
|
void setDebugLineInfo(Id fileName, int line, int column) {
|
||||||
|
lineInstruction = std::unique_ptr<Instruction>{new Instruction(OpLine)};
|
||||||
|
lineInstruction->addIdOperand(fileName);
|
||||||
|
lineInstruction->addImmediateOperand(line);
|
||||||
|
lineInstruction->addImmediateOperand(column);
|
||||||
|
}
|
||||||
|
bool hasDebugLineInfo() const { return lineInstruction != nullptr; }
|
||||||
|
|
||||||
void setImplicitThis() { implicitThis = true; }
|
void setImplicitThis() { implicitThis = true; }
|
||||||
bool hasImplicitThis() const { return implicitThis; }
|
bool hasImplicitThis() const { return implicitThis; }
|
||||||
|
|
||||||
@ -373,6 +381,11 @@ public:
|
|||||||
|
|
||||||
void dump(std::vector<unsigned int>& out) const
|
void dump(std::vector<unsigned int>& out) const
|
||||||
{
|
{
|
||||||
|
// OpLine
|
||||||
|
if (lineInstruction != nullptr) {
|
||||||
|
lineInstruction->dump(out);
|
||||||
|
}
|
||||||
|
|
||||||
// OpFunction
|
// OpFunction
|
||||||
functionInstruction.dump(out);
|
functionInstruction.dump(out);
|
||||||
|
|
||||||
@ -391,6 +404,7 @@ protected:
|
|||||||
Function& operator=(Function&);
|
Function& operator=(Function&);
|
||||||
|
|
||||||
Module& parent;
|
Module& parent;
|
||||||
|
std::unique_ptr<Instruction> lineInstruction;
|
||||||
Instruction functionInstruction;
|
Instruction functionInstruction;
|
||||||
std::vector<Instruction*> parameterInstructions;
|
std::vector<Instruction*> parameterInstructions;
|
||||||
std::vector<Block*> blocks;
|
std::vector<Block*> blocks;
|
||||||
@ -457,7 +471,8 @@ protected:
|
|||||||
// - the OpFunction instruction
|
// - the OpFunction instruction
|
||||||
// - all the OpFunctionParameter instructions
|
// - all the OpFunctionParameter instructions
|
||||||
__inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent)
|
__inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent)
|
||||||
: parent(parent), functionInstruction(id, resultType, OpFunction), implicitThis(false),
|
: parent(parent), lineInstruction(nullptr),
|
||||||
|
functionInstruction(id, resultType, OpFunction), implicitThis(false),
|
||||||
reducedPrecisionReturn(false)
|
reducedPrecisionReturn(false)
|
||||||
{
|
{
|
||||||
// OpFunction
|
// OpFunction
|
||||||
|
@ -129,6 +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
|
||||||
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
|
||||||
@ -144,6 +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
|
||||||
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
|
||||||
|
@ -120,6 +120,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
|||||||
69(i.vTextureCoords): 68(ptr) Variable Input
|
69(i.vTextureCoords): 68(ptr) Variable Input
|
||||||
72: TypePointer Output 12(fvec4)
|
72: TypePointer Output 12(fvec4)
|
||||||
73(@entryPointOutput.vColor): 72(ptr) Variable Output
|
73(@entryPointOutput.vColor): 72(ptr) Variable Output
|
||||||
|
Line 1 23 1
|
||||||
6(MainPs): 4 Function None 5
|
6(MainPs): 4 Function None 5
|
||||||
7: Label
|
7: Label
|
||||||
67(i): 11(ptr) Variable Function
|
67(i): 11(ptr) Variable Function
|
||||||
@ -135,6 +136,7 @@ PS_OUTPUT MainPs ( PS_INPUT i )
|
|||||||
Store 73(@entryPointOutput.vColor) 77
|
Store 73(@entryPointOutput.vColor) 77
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 23 1
|
||||||
16(@MainPs(struct-PS_INPUT-vf21;):13(PS_OUTPUT) Function None 14
|
16(@MainPs(struct-PS_INPUT-vf21;):13(PS_OUTPUT) Function None 14
|
||||||
15(i): 11(ptr) FunctionParameter
|
15(i): 11(ptr) FunctionParameter
|
||||||
17: Label
|
17: Label
|
||||||
|
@ -112,7 +112,9 @@ 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
|
||||||
5(MainPs): 3 Function None 4
|
5(MainPs): 3 Function None 4
|
||||||
|
NoLine
|
||||||
6: Label
|
6: Label
|
||||||
Line 17 25 0
|
Line 17 25 0
|
||||||
71: 8(fvec2) Load 70(i.vTextureCoords)
|
71: 8(fvec2) Load 70(i.vTextureCoords)
|
||||||
|
@ -60,6 +60,7 @@ gl_FragCoord origin is upper left
|
|||||||
6: Label
|
6: Label
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 2 1
|
||||||
12(PixelShaderFunction(vf4;): 8(fvec4) Function None 10
|
12(PixelShaderFunction(vf4;): 8(fvec4) Function None 10
|
||||||
11(input): 9(ptr) FunctionParameter
|
11(input): 9(ptr) FunctionParameter
|
||||||
13: Label
|
13: Label
|
||||||
|
@ -477,6 +477,7 @@ using depth_any
|
|||||||
128(@entryPointOutput.Color): 127(ptr) Variable Output
|
128(@entryPointOutput.Color): 127(ptr) Variable Output
|
||||||
131: TypePointer Output 7(float)
|
131: TypePointer Output 7(float)
|
||||||
132(@entryPointOutput.Depth): 131(ptr) Variable Output
|
132(@entryPointOutput.Depth): 131(ptr) Variable Output
|
||||||
|
Line 1 15 1
|
||||||
5(main): 3 Function None 4
|
5(main): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
125(flattenTemp): 109(ptr) Variable Function
|
125(flattenTemp): 109(ptr) Variable Function
|
||||||
@ -491,6 +492,7 @@ using depth_any
|
|||||||
Store 132(@entryPointOutput.Depth) 134
|
Store 132(@entryPointOutput.Depth) 134
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 15 1
|
||||||
11(@main():9(PS_OUTPUT) Function None 10
|
11(@main():9(PS_OUTPUT) Function None 10
|
||||||
12: Label
|
12: Label
|
||||||
14(ColorOut): 13(ptr) Variable Function
|
14(ColorOut): 13(ptr) Variable Function
|
||||||
|
@ -215,6 +215,7 @@ Shader version: 500
|
|||||||
53: 7(float) Constant 1073741824
|
53: 7(float) Constant 1073741824
|
||||||
60: TypePointer Output 8(fvec4)
|
60: TypePointer Output 8(fvec4)
|
||||||
61(@entryPointOutput.Pos): 60(ptr) Variable Output
|
61(@entryPointOutput.Pos): 60(ptr) Variable Output
|
||||||
|
Line 1 11 1
|
||||||
5(main): 3 Function None 4
|
5(main): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
Line 1 11 0
|
Line 1 11 0
|
||||||
@ -223,6 +224,7 @@ Shader version: 500
|
|||||||
Store 61(@entryPointOutput.Pos) 63
|
Store 61(@entryPointOutput.Pos) 63
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 11 1
|
||||||
11(@main():9(VS_OUTPUT) Function None 10
|
11(@main():9(VS_OUTPUT) Function None 10
|
||||||
12: Label
|
12: Label
|
||||||
14(PosOut): 13(ptr) Variable Function
|
14(PosOut): 13(ptr) Variable Function
|
||||||
|
@ -136,6 +136,7 @@ void main()
|
|||||||
109: 7(int) Constant 1
|
109: 7(int) Constant 1
|
||||||
111: TypePointer Output 10(float)
|
111: TypePointer Output 10(float)
|
||||||
114: 10(float) Constant 1092616192
|
114: 10(float) Constant 1092616192
|
||||||
|
Line 1 28 11
|
||||||
5(main): 3 Function None 4
|
5(main): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
57(param): 9(ptr) Variable Function
|
57(param): 9(ptr) Variable Function
|
||||||
@ -237,6 +238,7 @@ void main()
|
|||||||
118: Label
|
118: Label
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 16 13
|
||||||
14(foo(struct-S-i11;): 11(fvec4) Function None 12
|
14(foo(struct-S-i11;): 11(fvec4) Function None 12
|
||||||
13(s): 9(ptr) FunctionParameter
|
13(s): 9(ptr) FunctionParameter
|
||||||
15: Label
|
15: Label
|
||||||
|
@ -137,6 +137,7 @@ void main()
|
|||||||
109: 7(int) Constant 1
|
109: 7(int) Constant 1
|
||||||
111: TypePointer Output 10(float)
|
111: TypePointer Output 10(float)
|
||||||
114: 10(float) Constant 1092616192
|
114: 10(float) Constant 1092616192
|
||||||
|
Line 1 28 11
|
||||||
5(main): 3 Function None 4
|
5(main): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
57(param): 9(ptr) Variable Function
|
57(param): 9(ptr) Variable Function
|
||||||
@ -238,6 +239,7 @@ void main()
|
|||||||
118: Label
|
118: Label
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 16 13
|
||||||
14(foo(struct-S-i11;): 11(fvec4) Function None 12
|
14(foo(struct-S-i11;): 11(fvec4) Function None 12
|
||||||
13(s): 9(ptr) FunctionParameter
|
13(s): 9(ptr) FunctionParameter
|
||||||
15: Label
|
15: Label
|
||||||
|
@ -44,6 +44,7 @@ float4 origMain() : SV_Position
|
|||||||
13: 8(fvec4) ConstantComposite 12 12 12 12
|
13: 8(fvec4) ConstantComposite 12 12 12 12
|
||||||
16: TypePointer Output 8(fvec4)
|
16: TypePointer Output 8(fvec4)
|
||||||
17(@entryPointOutput): 16(ptr) Variable Output
|
17(@entryPointOutput): 16(ptr) Variable Output
|
||||||
|
Line 1 2 1
|
||||||
5(newMain): 3 Function None 4
|
5(newMain): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
Line 1 2 0
|
Line 1 2 0
|
||||||
@ -51,6 +52,7 @@ float4 origMain() : SV_Position
|
|||||||
Store 17(@entryPointOutput) 18
|
Store 17(@entryPointOutput) 18
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Line 1 2 1
|
||||||
10(@newMain(): 8(fvec4) Function None 9
|
10(@newMain(): 8(fvec4) Function None 9
|
||||||
11: Label
|
11: Label
|
||||||
Line 1 3 0
|
Line 1 3 0
|
||||||
|
@ -92,6 +92,7 @@ void main()
|
|||||||
56(u): 55(ptr) Variable Input
|
56(u): 55(ptr) Variable Input
|
||||||
58: TypePointer Input 7(float)
|
58: TypePointer Input 7(float)
|
||||||
59(blend): 58(ptr) Variable Input
|
59(blend): 58(ptr) Variable Input
|
||||||
|
Line 1 11 11
|
||||||
5(main): 3 Function None 4
|
5(main): 3 Function None 4
|
||||||
6: Label
|
6: Label
|
||||||
9(blendscale): 8(ptr) Variable Function
|
9(blendscale): 8(ptr) Variable Function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user