Add macro helper to glslang for new C++ attributes

This commit is contained in:
baldurk
2025-03-04 18:48:14 +00:00
parent c98f50f9b7
commit c6cf956d50
9 changed files with 31 additions and 19 deletions
+4 -4
View File
@@ -3090,7 +3090,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case glslang::EOpConstructF16Mat4x3:
case glslang::EOpConstructF16Mat4x4:
isMatrix = true;
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case glslang::EOpConstructFloat:
case glslang::EOpConstructVec2:
case glslang::EOpConstructVec3:
@@ -3266,7 +3266,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case glslang::EOpAtomicStore:
noReturnValue = true;
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case glslang::EOpAtomicLoad:
atomic = true;
break;
@@ -3374,7 +3374,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
case glslang::EOpReorderThreadNV:
noReturnValue = true;
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case glslang::EOpHitObjectIsEmptyNV:
case glslang::EOpHitObjectIsMissNV:
case glslang::EOpHitObjectIsHitNV:
@@ -8367,7 +8367,7 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s
case glslang::EOpSubgroupQuadAny:
builder.addExtension(spv::E_SPV_KHR_quad_control);
builder.addCapability(spv::CapabilityQuadControlKHR);
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case glslang::EOpSubgroupAll:
case glslang::EOpSubgroupAny:
case glslang::EOpSubgroupAllEqual:
+1 -1
View File
@@ -2335,7 +2335,7 @@ void Builder::setupFunctionDebugInfo(Function* function, const char* name, const
currentDebugScopeId.pop();
}
Id Builder::makeDebugFunction([[maybe_unused]] Function* function, Id nameId, Id funcTypeId)
Id Builder::makeDebugFunction(MAYBE_UNUSED Function* function, Id nameId, Id funcTypeId)
{
assert(function != nullptr);
assert(nameId != 0);
+12
View File
@@ -52,3 +52,15 @@
// and do not appear in publicly installed headers. They are not considered to be
// part of the glslang library ABI.
#define GLSLANG_EXPORT_FOR_TESTS GLSLANG_EXPORT
#ifndef DELIBERATE_FALLTHROUGH
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
#define DELIBERATE_FALLTHROUGH [[fallthrough]]
#define MAYBE_UNUSED [[maybe_unused]]
#else
#define DELIBERATE_FALLTHROUGH
#define MAYBE_UNUSED
#endif
#endif
@@ -8175,7 +8175,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);
symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EShLangTessControl:
if (profile == EEsProfile && version >= 310) {
@@ -8190,7 +8190,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);
}
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EShLangTessEvaluation:
case EShLangGeometry:
@@ -10329,7 +10329,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EShLangClosestHit:
case EShLangMiss:
if (profile != EEsProfile && version >= 460) {
@@ -1074,7 +1074,7 @@ void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, T
// matrix multiply does not change shapes
if (lhsNode->isMatrix() && rhsNode->isMatrix())
return;
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EOpAdd:
case EOpSub:
case EOpDiv:
@@ -3247,7 +3247,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
if (left->getType() == right->getType())
return true;
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EOpMul:
case EOpMulAssign:
@@ -3397,7 +3397,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
case EOpAssign:
if (left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows())
return false;
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EOpAdd:
case EOpSub:
@@ -6535,7 +6535,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "max_primitives", "");
return;
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EShLangTask:
// Fall through
@@ -8810,7 +8810,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type);
return newNode;
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EOpConstructUVec3:
case EOpConstructUVec4:
case EOpConstructUint:
@@ -8832,7 +8832,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type);
return newNode;
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EOpConstructDVec2:
case EOpConstructDVec3:
case EOpConstructDVec4:
@@ -8990,7 +8990,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type);
return newNode;
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EOpConstructU64Vec2:
case EOpConstructU64Vec3:
case EOpConstructU64Vec4:
@@ -9966,7 +9966,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
break;
}
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case ElgPoints:
case ElgLineStrip:
case ElgTriangleStrip:
@@ -779,7 +779,7 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
switch (getExtensionBehavior(extensions[i])) {
case EBhWarn:
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc, (messages & EShMsgAbsolutePath) != 0, (messages & EShMsgDisplayErrorColumn) != 0);
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EBhRequire:
case EBhEnable:
okay = true;
@@ -1435,7 +1435,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
infoSink.debug << "max_vertices = " << vertices << "\n";
infoSink.debug << "max_primitives = " << primitives << "\n";
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EShLangTask:
// Fall through
case EShLangCompute:
@@ -1491,7 +1491,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
error(infoSink, "At least one shader must specify a layout(max_vertices = value)");
if (primitives == TQualifier::layoutNotSet)
error(infoSink, "At least one shader must specify a layout(max_primitives = value)");
[[fallthrough]];
DELIBERATE_FALLTHROUGH;
case EShLangTask:
if (numTaskNVBlocks > 1)
error(infoSink, "Only one taskNV interface block is allowed per shader");