glslang -> SPV: add decorations for built-ins that are inside blocks.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31266 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
ea543986f9
commit
6b3fd19d89
@ -303,9 +303,9 @@ spv::Decoration TranslateInvariantDecoration(const glslang::TType& type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Translate glslang built-in variable to SPIR-V built in decoration.
|
// Translate glslang built-in variable to SPIR-V built in decoration.
|
||||||
spv::BuiltIn TranslateBuiltInDecoration(const glslang::TIntermSymbol& node)
|
spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable builtIn)
|
||||||
{
|
{
|
||||||
switch (node.getQualifier().builtIn) {
|
switch (builtIn) {
|
||||||
case glslang::EbvPosition: return spv::BuiltInPosition;
|
case glslang::EbvPosition: return spv::BuiltInPosition;
|
||||||
case glslang::EbvPointSize: return spv::BuiltInPointSize;
|
case glslang::EbvPointSize: return spv::BuiltInPointSize;
|
||||||
case glslang::EbvClipVertex: return spv::BuiltInClipVertex;
|
case glslang::EbvClipVertex: return spv::BuiltInClipVertex;
|
||||||
@ -1344,6 +1344,11 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
|
|||||||
builder.addMemberDecoration(spvType, member, spv::DecorationComponent, glslangType.getQualifier().layoutComponent);
|
builder.addMemberDecoration(spvType, member, spv::DecorationComponent, glslangType.getQualifier().layoutComponent);
|
||||||
if (glslangType.getQualifier().hasXfbOffset())
|
if (glslangType.getQualifier().hasXfbOffset())
|
||||||
builder.addMemberDecoration(spvType, member, spv::DecorationOffset, glslangType.getQualifier().layoutXfbOffset);
|
builder.addMemberDecoration(spvType, member, spv::DecorationOffset, glslangType.getQualifier().layoutXfbOffset);
|
||||||
|
|
||||||
|
// built-in variable decorations
|
||||||
|
int builtIn = TranslateBuiltInDecoration(glslangType.getQualifier().builtIn);
|
||||||
|
if (builtIn != spv::BadValue)
|
||||||
|
builder.addMemberDecoration(spvType, member, spv::DecorationBuiltIn, builtIn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2412,9 +2417,9 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
|
|||||||
}
|
}
|
||||||
|
|
||||||
// built-in variable decorations
|
// built-in variable decorations
|
||||||
int num = TranslateBuiltInDecoration(*symbol);
|
int builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn);
|
||||||
if (num != spv::BadValue)
|
if (builtIn != spv::BadValue)
|
||||||
builder.addDecoration(id, spv::DecorationBuiltIn, num);
|
builder.addDecoration(id, spv::DecorationBuiltIn, builtIn);
|
||||||
|
|
||||||
if (linkageOnly)
|
if (linkageOnly)
|
||||||
builder.addDecoration(id, spv::DecorationNoStaticUse);
|
builder.addDecoration(id, spv::DecorationNoStaticUse);
|
||||||
|
@ -368,7 +368,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
|||||||
disassembleIds(numOperands);
|
disassembleIds(numOperands);
|
||||||
return;
|
return;
|
||||||
case OperandVariableLiterals:
|
case OperandVariableLiterals:
|
||||||
if (opCode == OpDecorate && stream[word - 1] == DecorationBuiltIn) {
|
if (opCode == OpDecorate && stream[word - 1] == DecorationBuiltIn ||
|
||||||
|
opCode == OpMemberDecorate && stream[word - 1] == DecorationBuiltIn) {
|
||||||
out << BuiltInString(stream[word++]);
|
out << BuiltInString(stream[word++]);
|
||||||
--numOperands;
|
--numOperands;
|
||||||
++op;
|
++op;
|
||||||
|
@ -45,9 +45,15 @@ Linked geometry stage:
|
|||||||
Decorate 9(fromVertex) Stream 3
|
Decorate 9(fromVertex) Stream 3
|
||||||
Decorate 11 Stream 3
|
Decorate 11 Stream 3
|
||||||
Decorate 14(fromVertex) Block
|
Decorate 14(fromVertex) Block
|
||||||
|
MemberDecorate 28(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 28(gl_PerVertex) 1 BuiltIn PointSize
|
||||||
|
MemberDecorate 28(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||||
Decorate 28(gl_PerVertex) Block
|
Decorate 28(gl_PerVertex) Block
|
||||||
Decorate 28(gl_PerVertex) Stream 0
|
Decorate 28(gl_PerVertex) Stream 0
|
||||||
Decorate 30 Stream 0
|
Decorate 30 Stream 0
|
||||||
|
MemberDecorate 31(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 31(gl_PerVertex) 1 BuiltIn PointSize
|
||||||
|
MemberDecorate 31(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||||
Decorate 31(gl_PerVertex) Block
|
Decorate 31(gl_PerVertex) Block
|
||||||
Decorate 48(gl_PrimitiveID) Stream 0
|
Decorate 48(gl_PrimitiveID) Stream 0
|
||||||
Decorate 48(gl_PrimitiveID) BuiltIn PrimitiveId
|
Decorate 48(gl_PrimitiveID) BuiltIn PrimitiveId
|
||||||
|
@ -42,6 +42,10 @@ Linked vertex stage:
|
|||||||
Name 51 "gl_VertexID"
|
Name 51 "gl_VertexID"
|
||||||
Name 52 "gl_InstanceID"
|
Name 52 "gl_InstanceID"
|
||||||
MemberDecorate 14(gl_PerVertex) 0 Invariant
|
MemberDecorate 14(gl_PerVertex) 0 Invariant
|
||||||
|
MemberDecorate 14(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 14(gl_PerVertex) 1 BuiltIn PointSize
|
||||||
|
MemberDecorate 14(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||||
|
MemberDecorate 14(gl_PerVertex) 3 BuiltIn ClipVertex
|
||||||
Decorate 14(gl_PerVertex) Block
|
Decorate 14(gl_PerVertex) Block
|
||||||
Decorate 49(ui) NoStaticUse
|
Decorate 49(ui) NoStaticUse
|
||||||
Decorate 51(gl_VertexID) BuiltIn VertexId
|
Decorate 51(gl_VertexID) BuiltIn VertexId
|
||||||
|
@ -28,9 +28,13 @@ Linked geometry stage:
|
|||||||
MemberName 17(gl_PerVertex) 0 "gl_Position"
|
MemberName 17(gl_PerVertex) 0 "gl_Position"
|
||||||
MemberName 17(gl_PerVertex) 1 "gl_ClipDistance"
|
MemberName 17(gl_PerVertex) 1 "gl_ClipDistance"
|
||||||
Name 21 "gl_in"
|
Name 21 "gl_in"
|
||||||
|
MemberDecorate 12(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 12(gl_PerVertex) 1 BuiltIn ClipDistance
|
||||||
Decorate 12(gl_PerVertex) Block
|
Decorate 12(gl_PerVertex) Block
|
||||||
Decorate 12(gl_PerVertex) Stream 0
|
Decorate 12(gl_PerVertex) Stream 0
|
||||||
Decorate 14 Stream 0
|
Decorate 14 Stream 0
|
||||||
|
MemberDecorate 17(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 17(gl_PerVertex) 1 BuiltIn ClipDistance
|
||||||
Decorate 17(gl_PerVertex) Block
|
Decorate 17(gl_PerVertex) Block
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
|
@ -52,6 +52,9 @@ Linked tessellation control stage:
|
|||||||
Decorate 39(gl_PatchVerticesIn) BuiltIn PatchVertices
|
Decorate 39(gl_PatchVerticesIn) BuiltIn PatchVertices
|
||||||
Decorate 42(gl_PrimitiveID) BuiltIn PrimitiveId
|
Decorate 42(gl_PrimitiveID) BuiltIn PrimitiveId
|
||||||
Decorate 45(gl_InvocationID) BuiltIn InvocationId
|
Decorate 45(gl_InvocationID) BuiltIn InvocationId
|
||||||
|
MemberDecorate 47(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 47(gl_PerVertex) 1 BuiltIn PointSize
|
||||||
|
MemberDecorate 47(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||||
Decorate 47(gl_PerVertex) Block
|
Decorate 47(gl_PerVertex) Block
|
||||||
Decorate 62(gl_TessLevelOuter) Patch
|
Decorate 62(gl_TessLevelOuter) Patch
|
||||||
Decorate 62(gl_TessLevelOuter) BuiltIn TessLevelOuter
|
Decorate 62(gl_TessLevelOuter) BuiltIn TessLevelOuter
|
||||||
|
@ -62,6 +62,9 @@ Linked tessellation evaluation stage:
|
|||||||
Decorate 54(gl_TessLevelOuter) BuiltIn TessLevelOuter
|
Decorate 54(gl_TessLevelOuter) BuiltIn TessLevelOuter
|
||||||
Decorate 62(gl_TessLevelInner) Patch
|
Decorate 62(gl_TessLevelInner) Patch
|
||||||
Decorate 62(gl_TessLevelInner) BuiltIn TessLevelInner
|
Decorate 62(gl_TessLevelInner) BuiltIn TessLevelInner
|
||||||
|
MemberDecorate 67(gl_PerVertex) 0 BuiltIn Position
|
||||||
|
MemberDecorate 67(gl_PerVertex) 1 BuiltIn PointSize
|
||||||
|
MemberDecorate 67(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||||
Decorate 67(gl_PerVertex) Block
|
Decorate 67(gl_PerVertex) Block
|
||||||
Decorate 78(patchIn) Patch
|
Decorate 78(patchIn) Patch
|
||||||
Decorate 78(patchIn) NoStaticUse
|
Decorate 78(patchIn) NoStaticUse
|
||||||
|
@ -36,6 +36,7 @@ Linked vertex stage:
|
|||||||
Name 58 "sampb4"
|
Name 58 "sampb4"
|
||||||
Name 60 "gl_VertexID"
|
Name 60 "gl_VertexID"
|
||||||
Name 61 "gl_InstanceID"
|
Name 61 "gl_InstanceID"
|
||||||
|
MemberDecorate 11(gl_PerVertex) 0 BuiltIn ClipDistance
|
||||||
Decorate 11(gl_PerVertex) Block
|
Decorate 11(gl_PerVertex) Block
|
||||||
Decorate 35(badorder3) Flat
|
Decorate 35(badorder3) Flat
|
||||||
Decorate 43(uv4) Location 4
|
Decorate 43(uv4) Location 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user