Added semantic and semantic_idx layout qualifiers.

This commit is contained in:
Patrick 2023-11-21 20:12:47 +01:00
parent e87d0d5703
commit bb2d06b0a3
2 changed files with 47 additions and 0 deletions

View File

@ -856,6 +856,10 @@ public:
layoutBindlessSampler = false;
layoutBindlessImage = false;
layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
// BEGIN @MEWIN - 2023-11-21 - Added semantic and semantic_idx layout qualifiers.
layoutSemantic = layoutSemanticEnd;
layoutSemanticIndex = layoutSemanticIndexEnd;
// END @MEWIN
layoutFormat = ElfNone;
clearInterstageLayout();
@ -940,6 +944,14 @@ public:
unsigned int layoutBufferReferenceAlign : 6;
static const unsigned int layoutBufferReferenceAlignEnd = 0x3F;
// BEGIN @MEWIN - 2023-11-21 - Added semantic and semantic_idx layout qualifiers.
unsigned int layoutSemantic : 5;
static const unsigned int layoutSemanticEnd = 0x1F;
unsigned int layoutSemanticIndex : 3;
static const unsigned int layoutSemanticIndexEnd = 7;
// END @MEWIN
TLayoutFormat layoutFormat : 8;
bool layoutPushConstant;
@ -1057,6 +1069,16 @@ public:
bool isShaderRecord() const { return layoutShaderRecord; }
bool hasHitObjectShaderRecordNV() const { return layoutHitObjectShaderRecordNV; }
bool hasBufferReference() const { return layoutBufferReference; }
// BEGIN @MEWIN - 2023-11-21 - Added semantic and semantic_idx layout qualifiers.
bool hasSemantic() const
{
return layoutSemantic != layoutSemanticEnd;
}
bool hasSemanticIndex() const
{
return layoutSemanticIndex != layoutSemanticIndexEnd;
}
// END @MEWIN
bool hasBufferReferenceAlign() const
{
return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd;

View File

@ -5928,6 +5928,24 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
if (nonLiteral)
error(loc, "needs a literal integer", "location", "");
return;
// BEGIN @MEWIN - 2023-11-21 - Added semantic and semantic_idx layout qualifiers.
} else if (id == "semantic") {
if ((unsigned int) value >= TQualifier::layoutSemanticEnd)
error(loc, "semantic is too large", id.c_str(), "");
else
publicType.qualifier.layoutSemantic = value;
if (nonLiteral)
error(loc, "needs a literal integer", "location", "");
return;
} else if (id == "semantic_idx") {
if ((unsigned int) value >= TQualifier::layoutSemanticIndexEnd)
error(loc, "semantic index is too large", id.c_str(), "");
else
publicType.qualifier.layoutSemanticIndex = value;
if (nonLiteral)
error(loc, "needs a literal integer", "location", "");
return;
// END @MEWIN
} else if (id == "set") {
if ((unsigned int)value >= TQualifier::layoutSetEnd)
error(loc, "set is too large", id.c_str(), "");
@ -6257,6 +6275,13 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
if (src.hasSpecConstantId())
dst.layoutSpecConstantId = src.layoutSpecConstantId;
// BEGIN @MEWIN - 2023-11-21 - Added semantic and semantic_idx layout qualifiers.
if (src.hasSemantic())
dst.layoutSemantic = src.layoutSemantic;
if (src.hasSemanticIndex())
dst.layoutSemanticIndex = src.layoutSemanticIndex;
// END @MEWIN
if (src.hasComponent())
dst.layoutComponent = src.layoutComponent;
if (src.hasIndex())