glslang -> SPIR-V: some built-in decoration code was turned off; turn it on.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@30466 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
0016eaf1b9
commit
9a3399450a
1 changed files with 9 additions and 27 deletions
|
|
@ -287,35 +287,14 @@ spv::Decoration TranslateInvariantDecoration(const glslang::TType& type)
|
||||||
return (spv::Decoration)spv::BadValue;
|
return (spv::Decoration)spv::BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identify what SPIR-V built-in variable a symbol is.
|
// Translate glslang built-in variable to SPIR-V built in decoration.
|
||||||
// Return -1 if a symbol is not a built-in to decorate.
|
spv::BuiltIn TranslateBuiltInDecoration(const glslang::TIntermSymbol& node)
|
||||||
int TranslateBuiltInDecoration(const glslang::TIntermSymbol& symbol)
|
|
||||||
{
|
{
|
||||||
switch (symbol.getQualifier().storage) {
|
const glslang::TString& name = node.getName();
|
||||||
case glslang::EvqVertexId: return spv::BuiltInVertexId;
|
|
||||||
case glslang::EvqInstanceId: return spv::BuiltInInstanceId;
|
|
||||||
case glslang::EvqPosition: return spv::BuiltInPosition;
|
|
||||||
case glslang::EvqPointSize: return spv::BuiltInPointSize;
|
|
||||||
case glslang::EvqClipVertex: return spv::BuiltInClipVertex;
|
|
||||||
case glslang::EvqFace: return spv::BuiltInFrontFacing;
|
|
||||||
case glslang::EvqFragCoord: return spv::BuiltInFragCoord;
|
|
||||||
case glslang::EvqPointCoord: return spv::BuiltInPointCoord;
|
|
||||||
case glslang::EvqFragColor: return spv::BuiltInFragColor;
|
|
||||||
case glslang::EvqFragDepth: return spv::BuiltInFragDepth;
|
|
||||||
default:
|
|
||||||
// TODO: built-ins not identified by storage qualifier
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Translate glslang built-in variable to SPIR-V built in.
|
|
||||||
spv::BuiltIn TranslateBuiltIn(const glslang::TIntermSymbol* node)
|
|
||||||
{
|
|
||||||
const glslang::TString& name = node->getName();
|
|
||||||
if (name.compare(0, 3, "gl_") != 0)
|
if (name.compare(0, 3, "gl_") != 0)
|
||||||
return (spv::BuiltIn)spv::BadValue;
|
return (spv::BuiltIn)spv::BadValue;
|
||||||
|
|
||||||
switch (node->getQualifier().storage) {
|
switch (node.getQualifier().storage) {
|
||||||
case glslang::EvqPosition: return spv::BuiltInPosition;
|
case glslang::EvqPosition: return spv::BuiltInPosition;
|
||||||
case glslang::EvqPointSize: return spv::BuiltInPointSize;
|
case glslang::EvqPointSize: return spv::BuiltInPointSize;
|
||||||
case glslang::EvqClipVertex: return spv::BuiltInClipVertex;
|
case glslang::EvqClipVertex: return spv::BuiltInClipVertex;
|
||||||
|
|
@ -326,7 +305,7 @@ spv::BuiltIn TranslateBuiltIn(const glslang::TIntermSymbol* node)
|
||||||
case glslang::EvqFace: return spv::BuiltInFrontFacing;
|
case glslang::EvqFace: return spv::BuiltInFrontFacing;
|
||||||
case glslang::EvqFragColor: return spv::BuiltInFragColor;
|
case glslang::EvqFragColor: return spv::BuiltInFragColor;
|
||||||
case glslang::EvqFragDepth: return spv::BuiltInFragDepth;
|
case glslang::EvqFragDepth: return spv::BuiltInFragDepth;
|
||||||
default: return (spv::BuiltIn)spv::BadValue;
|
default:
|
||||||
if (name == "gl_ClipDistance")
|
if (name == "gl_ClipDistance")
|
||||||
return spv::BuiltInClipDistance;
|
return spv::BuiltInClipDistance;
|
||||||
else if (name == "gl_PrimitiveID" || name == "gl_PrimitiveIDIn")
|
else if (name == "gl_PrimitiveID" || name == "gl_PrimitiveIDIn")
|
||||||
|
|
@ -365,7 +344,10 @@ spv::BuiltIn TranslateBuiltIn(const glslang::TIntermSymbol* node)
|
||||||
return spv::BuiltInGlobalInvocationId;
|
return spv::BuiltInGlobalInvocationId;
|
||||||
else if (name == "gl_LocalInvocationIndexID")
|
else if (name == "gl_LocalInvocationIndexID")
|
||||||
return spv::BuiltInLocalInvocationIndex;
|
return spv::BuiltInLocalInvocationIndex;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (spv::BuiltIn)spv::BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -2439,7 +2421,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
|
||||||
|
|
||||||
// built-in variable decorations
|
// built-in variable decorations
|
||||||
int num = TranslateBuiltInDecoration(*symbol);
|
int num = TranslateBuiltInDecoration(*symbol);
|
||||||
if (num >= 0)
|
if (num != spv::BadValue)
|
||||||
builder.addDecoration(id, spv::DecorationBuiltIn, num);
|
builder.addDecoration(id, spv::DecorationBuiltIn, num);
|
||||||
|
|
||||||
if (linkageOnly)
|
if (linkageOnly)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue