Implement NonSemantic.Shader.DebugInfo.100

See https://github.com/KhronosGroup/SPIRV-Registry.
This commit is contained in:
Jeremy Hayes 2021-12-09 16:26:48 -07:00
parent 9e78bc8108
commit 7a914ce926
55 changed files with 11275 additions and 96 deletions

View file

@ -2733,10 +2733,10 @@ TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* init
TIntermAggregate* loopSequence = (initializer == nullptr ||
initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc)
: initializer->getAsAggregate();
if (loopSequence != nullptr && loopSequence->getOp() == EOpSequence)
if (loopSequence != nullptr && (loopSequence->getOp() == EOpSequence || loopSequence->getOp() == EOpScope))
loopSequence->setOp(EOpNull);
loopSequence = growAggregate(loopSequence, node);
loopSequence->setOperator(EOpSequence);
loopSequence->setOperator(getDebugInfo() ? EOpScope : EOpSequence);
return loopSequence;
}

View file

@ -1839,6 +1839,7 @@ void TShader::setOverrideVersion(int version)
overrideVersion = version;
}
void TShader::setDebugInfo(bool debugInfo) { intermediate->setDebugInfo(debugInfo); }
void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); }
void TShader::setDxPositionW(bool invert) { intermediate->setDxPositionW(invert); }
void TShader::setEnhancedMsgs() { intermediate->setEnhancedMsgs(); }

View file

@ -3726,7 +3726,7 @@ compound_statement
}
RIGHT_BRACE {
if ($3 && $3->getAsAggregate())
$3->getAsAggregate()->setOperator(EOpSequence);
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
$$ = $3;
}
;

View file

@ -151,7 +151,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%parse-param {glslang::TParseContext* pParseContext}
%lex-param {parseContext}
%pure-parser // enable thread safety
%define api.pure // enable thread safety
%expect 1 // One shift reduce conflict because of if | else
%token <lex> CONST BOOL INT UINT FLOAT
@ -3726,7 +3726,7 @@ compound_statement
}
RIGHT_BRACE {
if ($3 && $3->getAsAggregate())
$3->getAsAggregate()->setOperator(EOpSequence);
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
$$ = $3;
}
;

View file

@ -11085,7 +11085,7 @@ yyreduce:
#line 3727 "MachineIndependent/glslang.y"
{
if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate())
(yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence);
(yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
(yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode);
}
#line 11092 "MachineIndependent/glslang_tab.cpp"

View file

@ -665,6 +665,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpConstructReference: out.debug << "Construct reference type"; break;
case EOpDeclare: out.debug << "Declare"; break;
#ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif
@ -692,6 +694,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
switch (node->getOp()) {
case EOpSequence: out.debug << "Sequence\n"; return true;
case EOpScope: out.debug << "Scope\n"; return true;
case EOpLinkerObjects: out.debug << "Linker Objects\n"; return true;
case EOpComma: out.debug << "Comma"; break;
case EOpFunction: out.debug << "Function Definition: " << node->getName(); break;
@ -1107,7 +1110,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
default: out.debug.message(EPrefixError, "Bad aggregation op");
}
if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
if (node->getOp() != EOpSequence && node->getOp() != EOpScope && node->getOp() != EOpParameters)
out.debug << " (" << node->getCompleteString() << ")";
out.debug << "\n";

View file

@ -319,6 +319,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
MERGE_TRUE(autoMapLocations);
MERGE_TRUE(invertY);
MERGE_TRUE(dxPositionW);
MERGE_TRUE(debugInfo);
MERGE_TRUE(flattenUniformArrays);
MERGE_TRUE(useUnknownFormat);
MERGE_TRUE(hlslOffsets);

View file

@ -292,6 +292,7 @@ public:
invertY(false),
dxPositionW(false),
enhancedMsgs(false),
debugInfo(false),
useStorageBuffer(false),
invariantAll(false),
nanMinMaxClamp(false),
@ -461,6 +462,12 @@ public:
const std::string& getEntryPointName() const { return entryPointName; }
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
void setDebugInfo(bool debuginfo)
{
debugInfo = debuginfo;
}
bool getDebugInfo() const { return debugInfo; }
void setInvertY(bool invert)
{
invertY = invert;
@ -1109,6 +1116,7 @@ protected:
bool invertY;
bool dxPositionW;
bool enhancedMsgs;
bool debugInfo;
bool useStorageBuffer;
bool invariantAll;
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN