Fix subgroup support for ray tracing
Closes #1735 GlslangToSpv.cpp - minor formatting cleanup BaseTypes.h - minor formatting cleanup - add subgroup builtins to GetBuiltInVariableString (was resulting in "unknown built-in variable" messages in test output) Initialize.cpp - better naming and re-use of strings for subgroup builtin variable declarations - define subgroup builtin variables in ray-tracing shaders intermOut.cpp - add handling of the EOpSubgroupParition* variables (was resulting in "ERROR: Bad aggregation op" messages in test output) Update test results.
This commit is contained in:
parent
c3e60ad9b6
commit
593a4e0aa5
45 changed files with 2237 additions and 3886 deletions
|
|
@ -6129,7 +6129,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
// GL_KHR_shader_subgroup
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
const char* ballotDecls =
|
||||
const char* subgroupDecls =
|
||||
"in mediump uint gl_SubgroupSize;"
|
||||
"in mediump uint gl_SubgroupInvocationID;"
|
||||
"in highp uvec4 gl_SubgroupEqMask;"
|
||||
|
|
@ -6138,7 +6138,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"in highp uvec4 gl_SubgroupLeMask;"
|
||||
"in highp uvec4 gl_SubgroupLtMask;"
|
||||
"\n";
|
||||
const char* fragmentBallotDecls =
|
||||
const char* fragmentSubgroupDecls =
|
||||
"flat in mediump uint gl_SubgroupSize;"
|
||||
"flat in mediump uint gl_SubgroupInvocationID;"
|
||||
"flat in highp uvec4 gl_SubgroupEqMask;"
|
||||
|
|
@ -6147,30 +6147,29 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"flat in highp uvec4 gl_SubgroupLeMask;"
|
||||
"flat in highp uvec4 gl_SubgroupLtMask;"
|
||||
"\n";
|
||||
stageBuiltins[EShLangVertex] .append(ballotDecls);
|
||||
stageBuiltins[EShLangTessControl] .append(ballotDecls);
|
||||
stageBuiltins[EShLangTessEvaluation].append(ballotDecls);
|
||||
stageBuiltins[EShLangGeometry] .append(ballotDecls);
|
||||
stageBuiltins[EShLangCompute] .append(ballotDecls);
|
||||
stageBuiltins[EShLangFragment] .append(fragmentBallotDecls);
|
||||
#ifdef NV_EXTENSIONS
|
||||
stageBuiltins[EShLangMeshNV] .append(ballotDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(ballotDecls);
|
||||
#endif
|
||||
const char* computeSubgroupDecls =
|
||||
"in highp uint gl_NumSubgroups;"
|
||||
"in highp uint gl_SubgroupID;"
|
||||
"\n";
|
||||
|
||||
stageBuiltins[EShLangCompute].append(
|
||||
"highp in uint gl_NumSubgroups;"
|
||||
"highp in uint gl_SubgroupID;"
|
||||
"\n");
|
||||
stageBuiltins[EShLangVertex] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangTessControl] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangTessEvaluation].append(subgroupDecls);
|
||||
stageBuiltins[EShLangGeometry] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangCompute] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangCompute] .append(computeSubgroupDecls);
|
||||
stageBuiltins[EShLangFragment] .append(fragmentSubgroupDecls);
|
||||
#ifdef NV_EXTENSIONS
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"highp in uint gl_NumSubgroups;"
|
||||
"highp in uint gl_SubgroupID;"
|
||||
"\n");
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"highp in uint gl_NumSubgroups;"
|
||||
"highp in uint gl_SubgroupID;"
|
||||
"\n");
|
||||
stageBuiltins[EShLangMeshNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangMeshNV] .append(computeSubgroupDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(computeSubgroupDecls);
|
||||
stageBuiltins[EShLangRayGenNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangIntersectNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangAnyHitNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangClosestHitNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangMissNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangCallableNV] .append(subgroupDecls);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -8754,8 +8753,52 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
BuiltInVariable("gl_WorldToObjectNV", EbvWorldToObjectNV, symbolTable);
|
||||
BuiltInVariable("gl_IncomingRayFlagsNV", EbvIncomingRayFlagsNV, symbolTable);
|
||||
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
|
||||
}
|
||||
|
||||
// GL_ARB_shader_ballot
|
||||
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
|
||||
|
||||
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
|
||||
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
|
||||
|
||||
if (spvVersion.vulkan > 0)
|
||||
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
|
||||
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
|
||||
else
|
||||
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
|
||||
|
||||
// GL_KHR_shader_subgroup
|
||||
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
|
||||
|
||||
BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
|
||||
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
|
||||
}
|
||||
break;
|
||||
|
||||
case EShLangMeshNV:
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
// per-vertex builtins
|
||||
|
|
|
|||
|
|
@ -1057,6 +1057,31 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||
case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; break;
|
||||
case EOpSubgroupPartitionedMin: out.debug << "subgroupPartitionedMinNV"; break;
|
||||
case EOpSubgroupPartitionedMax: out.debug << "subgroupPartitionedMaxNV"; break;
|
||||
case EOpSubgroupPartitionedAnd: out.debug << "subgroupPartitionedAndNV"; break;
|
||||
case EOpSubgroupPartitionedOr: out.debug << "subgroupPartitionedOrNV"; break;
|
||||
case EOpSubgroupPartitionedXor: out.debug << "subgroupPartitionedXorNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveAdd: out.debug << "subgroupPartitionedInclusiveAddNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveMul: out.debug << "subgroupPartitionedInclusiveMulNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveMin: out.debug << "subgroupPartitionedInclusiveMinNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveMax: out.debug << "subgroupPartitionedInclusiveMaxNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveAnd: out.debug << "subgroupPartitionedInclusiveAndNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveOr: out.debug << "subgroupPartitionedInclusiveOrNV"; break;
|
||||
case EOpSubgroupPartitionedInclusiveXor: out.debug << "subgroupPartitionedInclusiveXorNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveAdd: out.debug << "subgroupPartitionedExclusiveAddNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveMul: out.debug << "subgroupPartitionedExclusiveMulNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveMin: out.debug << "subgroupPartitionedExclusiveMinNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveMax: out.debug << "subgroupPartitionedExclusiveMaxNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break;
|
||||
case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break;
|
||||
#endif
|
||||
|
||||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue