Updates for final Vulkan ray tracing extensions (#2466)
* Fix traceRay/executeCallable to have id instead of constant. Update to final (non-provisional) SPIR-V capabilities (includes review feedback) - Change visibilty of findLinkerObjects. See merge request GLSL/glslang!78 * Add support for OpConvertUToAccelerationStructureKHR. GLSL : https://gitlab.khronos.org/GLSL/GLSL/-/merge_requests/60 SPV : https://gitlab.khronos.org/spirv/spirv-extensions/-/merge_requests/182 See merge request GLSL/glslang!77 * Add volatile qualifier to certain builtins for ray tracing. See merge request GLSL/glslang!81 * make gl_RayTmaxEXT volatile in intersection shader Vulkan Issue #2268 * Add testing for layouts on SBT vulkan/vulkan#2230 - no layout specified should be same as std430 - explicitly test std140, std430, scalar layouts See merge request GLSL/glslang!86 * Support for new opcodes OpIgnoreIntersectionKHR and OpTerminateRayKHR vulkan/vulkan#2374 Add support for ignoreIntersectionEXT and terminateRayEXT as block terminator statements. See merge request GLSL/glslang!87 * Fix code-generation issues with global ray query variables See merge request GLSL/glslang!88 * update dependencies for spirv-headers and tools And update mesh shader results * Fix indeterminate argument ordering Authored-by: David Neto <dneto@google.com> Co-authored-by: Ashwin Lele (NVIDIA Corporation) <alele@nvidia.com> Co-authored-by: Neslisah <Neslisah.Torosdagli@amd.com>
This commit is contained in:
parent
7f6559d280
commit
ffccefddfd
76 changed files with 4951 additions and 3663 deletions
|
|
@ -757,6 +757,12 @@ public:
|
|||
bool isPerPrimitive() const { return perPrimitiveNV; }
|
||||
bool isPerView() const { return perViewNV; }
|
||||
bool isTaskMemory() const { return perTaskNV; }
|
||||
bool isAnyPayload() const {
|
||||
return storage == EvqPayload || storage == EvqPayloadIn;
|
||||
}
|
||||
bool isAnyCallable() const {
|
||||
return storage == EvqCallableData || storage == EvqCallableDataIn;
|
||||
}
|
||||
|
||||
// True if this type of IO is supposed to be arrayed with extra level for per-vertex data
|
||||
bool isArrayedIo(EShLanguage language) const
|
||||
|
|
|
|||
|
|
@ -280,6 +280,12 @@ enum TOperator {
|
|||
EOpConvUvec2ToPtr,
|
||||
EOpConvPtrToUvec2,
|
||||
|
||||
// uint64_t -> accelerationStructureEXT
|
||||
EOpConvUint64ToAccStruct,
|
||||
|
||||
// uvec2 -> accelerationStructureEXT
|
||||
EOpConvUvec2ToAccStruct,
|
||||
|
||||
//
|
||||
// binary operations
|
||||
//
|
||||
|
|
@ -631,6 +637,8 @@ enum TOperator {
|
|||
EOpKill, // Fragment only
|
||||
EOpTerminateInvocation, // Fragment only
|
||||
EOpDemote, // Fragment only
|
||||
EOpTerminateRayKHR, // Any-hit only
|
||||
EOpIgnoreIntersectionKHR, // Any-hit only
|
||||
EOpReturn,
|
||||
EOpBreak,
|
||||
EOpContinue,
|
||||
|
|
@ -752,6 +760,7 @@ enum TOperator {
|
|||
EOpConstructNonuniform, // expected to be transformed away, not present in final AST
|
||||
EOpConstructReference,
|
||||
EOpConstructCooperativeMatrix,
|
||||
EOpConstructAccStruct,
|
||||
EOpConstructGuardEnd,
|
||||
|
||||
//
|
||||
|
|
@ -912,11 +921,13 @@ enum TOperator {
|
|||
EOpAverageRounded,
|
||||
EOpMul32x16,
|
||||
|
||||
EOpTrace,
|
||||
EOpTraceNV,
|
||||
EOpTraceKHR,
|
||||
EOpReportIntersection,
|
||||
EOpIgnoreIntersection,
|
||||
EOpTerminateRay,
|
||||
EOpExecuteCallable,
|
||||
EOpIgnoreIntersectionNV,
|
||||
EOpTerminateRayNV,
|
||||
EOpExecuteCallableNV,
|
||||
EOpExecuteCallableKHR,
|
||||
EOpWritePackedPrimitiveIndices4x8NV,
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -4421,9 +4421,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"\n");
|
||||
stageBuiltins[EShLangAnyHit].append(
|
||||
"void ignoreIntersectionNV();"
|
||||
"void ignoreIntersectionEXT();"
|
||||
"void terminateRayNV();"
|
||||
"void terminateRayEXT();"
|
||||
"\n");
|
||||
stageBuiltins[EShLangClosestHit].append(
|
||||
"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
|
||||
|
|
@ -5454,6 +5452,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"in uint64_t gl_SubGroupLeMaskARB;"
|
||||
"in uint64_t gl_SubGroupLtMaskARB;"
|
||||
"\n";
|
||||
const char* rtBallotDecls =
|
||||
"uniform volatile uint gl_SubGroupSizeARB;"
|
||||
"in volatile uint gl_SubGroupInvocationARB;"
|
||||
"in volatile uint64_t gl_SubGroupEqMaskARB;"
|
||||
"in volatile uint64_t gl_SubGroupGeMaskARB;"
|
||||
"in volatile uint64_t gl_SubGroupGtMaskARB;"
|
||||
"in volatile uint64_t gl_SubGroupLeMaskARB;"
|
||||
"in volatile uint64_t gl_SubGroupLtMaskARB;"
|
||||
"\n";
|
||||
const char* fragmentBallotDecls =
|
||||
"uniform uint gl_SubGroupSizeARB;"
|
||||
"flat in uint gl_SubGroupInvocationARB;"
|
||||
|
|
@ -5471,6 +5478,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangFragment] .append(fragmentBallotDecls);
|
||||
stageBuiltins[EShLangMeshNV] .append(ballotDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(ballotDecls);
|
||||
stageBuiltins[EShLangRayGen] .append(rtBallotDecls);
|
||||
stageBuiltins[EShLangIntersect] .append(rtBallotDecls);
|
||||
// No volatile qualifier on these builtins in any-hit
|
||||
stageBuiltins[EShLangAnyHit] .append(ballotDecls);
|
||||
stageBuiltins[EShLangClosestHit] .append(rtBallotDecls);
|
||||
stageBuiltins[EShLangMiss] .append(rtBallotDecls);
|
||||
stageBuiltins[EShLangCallable] .append(rtBallotDecls);
|
||||
}
|
||||
|
||||
// GL_KHR_shader_subgroup
|
||||
|
|
@ -5508,6 +5522,21 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"in highp uint gl_NumSubgroups;"
|
||||
"in highp uint gl_SubgroupID;"
|
||||
"\n";
|
||||
// These builtins are volatile for RT stages
|
||||
const char* rtSubgroupDecls =
|
||||
"in mediump volatile uint gl_SubgroupSize;"
|
||||
"in mediump volatile uint gl_SubgroupInvocationID;"
|
||||
"in highp volatile uvec4 gl_SubgroupEqMask;"
|
||||
"in highp volatile uvec4 gl_SubgroupGeMask;"
|
||||
"in highp volatile uvec4 gl_SubgroupGtMask;"
|
||||
"in highp volatile uvec4 gl_SubgroupLeMask;"
|
||||
"in highp volatile uvec4 gl_SubgroupLtMask;"
|
||||
// GL_NV_shader_sm_builtins
|
||||
"in highp uint gl_WarpsPerSMNV;"
|
||||
"in highp uint gl_SMCountNV;"
|
||||
"in highp volatile uint gl_WarpIDNV;"
|
||||
"in highp volatile uint gl_SMIDNV;"
|
||||
"\n";
|
||||
|
||||
stageBuiltins[EShLangVertex] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangTessControl] .append(subgroupDecls);
|
||||
|
|
@ -5520,12 +5549,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangMeshNV] .append(computeSubgroupDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(computeSubgroupDecls);
|
||||
stageBuiltins[EShLangRayGen] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangIntersect] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangRayGen] .append(rtSubgroupDecls);
|
||||
stageBuiltins[EShLangIntersect] .append(rtSubgroupDecls);
|
||||
// No volatile qualifier on these builtins in any-hit
|
||||
stageBuiltins[EShLangAnyHit] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangClosestHit] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangMiss] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangCallable] .append(subgroupDecls);
|
||||
stageBuiltins[EShLangClosestHit] .append(rtSubgroupDecls);
|
||||
stageBuiltins[EShLangMiss] .append(rtSubgroupDecls);
|
||||
stageBuiltins[EShLangCallable] .append(rtSubgroupDecls);
|
||||
}
|
||||
|
||||
// GL_NV_ray_tracing/GL_EXT_ray_tracing
|
||||
|
|
@ -5593,7 +5623,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"in float gl_RayTminNV;"
|
||||
"in float gl_RayTminEXT;"
|
||||
"in float gl_RayTmaxNV;"
|
||||
"in float gl_RayTmaxEXT;"
|
||||
"in volatile float gl_RayTmaxEXT;"
|
||||
"in mat4x3 gl_ObjectToWorldNV;"
|
||||
"in mat4x3 gl_ObjectToWorldEXT;"
|
||||
"in mat3x4 gl_ObjectToWorld3x4EXT;"
|
||||
|
|
@ -8454,9 +8484,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
symbolTable.setFunctionExtensions("reportIntersectionNV", 1, &E_GL_NV_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("reportIntersectionEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("ignoreIntersectionNV", 1, &E_GL_NV_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("ignoreIntersectionEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("terminateRayNV", 1, &E_GL_NV_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("terminateRayEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("executeCallableNV", 1, &E_GL_NV_ray_tracing);
|
||||
symbolTable.setFunctionExtensions("executeCallableEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
|
||||
|
|
@ -9286,10 +9314,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
case EShLangClosestHit:
|
||||
case EShLangMiss:
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
symbolTable.relateToOperator("traceNV", EOpTrace);
|
||||
symbolTable.relateToOperator("traceRayEXT", EOpTrace);
|
||||
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallable);
|
||||
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallable);
|
||||
symbolTable.relateToOperator("traceNV", EOpTraceNV);
|
||||
symbolTable.relateToOperator("traceRayEXT", EOpTraceKHR);
|
||||
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);
|
||||
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);
|
||||
}
|
||||
break;
|
||||
case EShLangIntersect:
|
||||
|
|
@ -9300,16 +9328,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
break;
|
||||
case EShLangAnyHit:
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
symbolTable.relateToOperator("ignoreIntersectionNV", EOpIgnoreIntersection);
|
||||
symbolTable.relateToOperator("ignoreIntersectionEXT", EOpIgnoreIntersection);
|
||||
symbolTable.relateToOperator("terminateRayNV", EOpTerminateRay);
|
||||
symbolTable.relateToOperator("terminateRayEXT", EOpTerminateRay);
|
||||
symbolTable.relateToOperator("ignoreIntersectionNV", EOpIgnoreIntersectionNV);
|
||||
symbolTable.relateToOperator("terminateRayNV", EOpTerminateRayNV);
|
||||
}
|
||||
break;
|
||||
case EShLangCallable:
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallable);
|
||||
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallable);
|
||||
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);
|
||||
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);
|
||||
}
|
||||
break;
|
||||
case EShLangMeshNV:
|
||||
|
|
|
|||
|
|
@ -2298,6 +2298,10 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||
case EbtReference:
|
||||
op = EOpConstructReference;
|
||||
break;
|
||||
|
||||
case EbtAccStruct:
|
||||
op = EOpConstructAccStruct;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2076,14 +2076,32 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
|||
}
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EOpTrace:
|
||||
case EOpTraceNV:
|
||||
if (!(*argp)[10]->getAsConstantUnion())
|
||||
error(loc, "argument must be compile-time constant", "payload number", "");
|
||||
error(loc, "argument must be compile-time constant", "payload number", "a");
|
||||
break;
|
||||
case EOpExecuteCallable:
|
||||
case EOpTraceKHR:
|
||||
if (!(*argp)[10]->getAsConstantUnion())
|
||||
error(loc, "argument must be compile-time constant", "payload number", "a");
|
||||
else {
|
||||
unsigned int location = (*argp)[10]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
|
||||
if (intermediate.checkLocationRT(0, location) < 0)
|
||||
error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location);
|
||||
}
|
||||
break;
|
||||
case EOpExecuteCallableNV:
|
||||
if (!(*argp)[1]->getAsConstantUnion())
|
||||
error(loc, "argument must be compile-time constant", "callable data number", "");
|
||||
break;
|
||||
case EOpExecuteCallableKHR:
|
||||
if (!(*argp)[1]->getAsConstantUnion())
|
||||
error(loc, "argument must be compile-time constant", "callable data number", "");
|
||||
else {
|
||||
unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
|
||||
if (intermediate.checkLocationRT(1, location) < 0)
|
||||
error(loc, "with layout(location =", "no callableDataEXT/callableDataInEXT declared", "%d)", location);
|
||||
}
|
||||
break;
|
||||
|
||||
case EOpRayQueryGetIntersectionType:
|
||||
case EOpRayQueryGetIntersectionT:
|
||||
|
|
@ -3440,7 +3458,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
|||
if (! symbolTable.atGlobalLevel())
|
||||
return;
|
||||
|
||||
if (!(publicType.userDef && publicType.userDef->isReference())) {
|
||||
if (!(publicType.userDef && publicType.userDef->isReference()) && !parsingBuiltins) {
|
||||
if (qualifier.isMemoryQualifierImageAndSSBOOnly() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer) {
|
||||
error(loc, "memory qualifiers cannot be used on this type", "", "");
|
||||
} else if (qualifier.isMemory() && (publicType.basicType != EbtSampler) && !publicType.qualifier.isUniformOrBuffer()) {
|
||||
|
|
@ -7460,6 +7478,19 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||
|
||||
return node;
|
||||
|
||||
case EOpConstructAccStruct:
|
||||
if ((node->getType().isScalar() && node->getType().getBasicType() == EbtUint64)) {
|
||||
// construct acceleration structure from uint64
|
||||
requireExtensions(loc, 1, &E_GL_EXT_ray_tracing, "uint64_t conversion to acclerationStructureEXT");
|
||||
return intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToAccStruct, true, node,
|
||||
type);
|
||||
} else if (node->getType().isVector() && node->getType().getBasicType() == EbtUint && node->getVectorSize() == 2) {
|
||||
// construct acceleration structure from uint64
|
||||
requireExtensions(loc, 1, &E_GL_EXT_ray_tracing, "uvec2 conversion to accelerationStructureEXT");
|
||||
return intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUvec2ToAccStruct, true, node,
|
||||
type);
|
||||
} else
|
||||
return nullptr;
|
||||
#endif // GLSLANG_WEB
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -366,6 +366,8 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["else"] = ELSE;
|
||||
(*KeywordMap)["discard"] = DISCARD;
|
||||
(*KeywordMap)["terminateInvocation"] = TERMINATE_INVOCATION;
|
||||
(*KeywordMap)["terminateRayEXT"] = TERMINATE_RAY;
|
||||
(*KeywordMap)["ignoreIntersectionEXT"] = IGNORE_INTERSECTION;
|
||||
(*KeywordMap)["return"] = RETURN;
|
||||
(*KeywordMap)["void"] = VOID;
|
||||
(*KeywordMap)["bool"] = BOOL;
|
||||
|
|
@ -942,6 +944,12 @@ int TScanContext::tokenizeIdentifier()
|
|||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case TERMINATE_RAY:
|
||||
case IGNORE_INTERSECTION:
|
||||
if (!parseContext.extensionTurnedOn(E_GL_EXT_ray_tracing))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ GLSLANG_WEB_EXCLUDE_OFF
|
|||
%token <lex> STRUCT VOID WHILE
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
|
||||
%token <lex> TERMINATE_INVOCATION
|
||||
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION
|
||||
%token <lex> UNIFORM SHARED BUFFER
|
||||
%token <lex> FLAT SMOOTH LAYOUT
|
||||
|
||||
|
|
@ -3932,6 +3933,16 @@ jump_statement
|
|||
parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
|
||||
$$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
|
||||
}
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
| TERMINATE_RAY SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
|
||||
$$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
|
||||
}
|
||||
| IGNORE_INTERSECTION SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
|
||||
$$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
|
||||
}
|
||||
GLSLANG_WEB_EXCLUDE_OFF
|
||||
;
|
||||
|
||||
// Grammar Note: No 'goto'. Gotos are not supported.
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> STRUCT VOID WHILE
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
|
||||
%token <lex> TERMINATE_INVOCATION
|
||||
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION
|
||||
%token <lex> UNIFORM SHARED BUFFER
|
||||
%token <lex> FLAT SMOOTH LAYOUT
|
||||
|
||||
|
|
@ -3932,6 +3933,16 @@ jump_statement
|
|||
parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
|
||||
$$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
|
||||
}
|
||||
|
||||
| TERMINATE_RAY SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
|
||||
$$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
|
||||
}
|
||||
| IGNORE_INTERSECTION SEMICOLON {
|
||||
parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
|
||||
$$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
// Grammar Note: No 'goto'. Gotos are not supported.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
/* A Bison parser, made by GNU Bison 3.7.2. */
|
||||
/* A Bison parser, made by GNU Bison 3.7.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
#ifndef YY_YY_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
|
|
@ -447,53 +447,55 @@ extern int yydebug;
|
|||
CASE = 648, /* CASE */
|
||||
DEFAULT = 649, /* DEFAULT */
|
||||
TERMINATE_INVOCATION = 650, /* TERMINATE_INVOCATION */
|
||||
UNIFORM = 651, /* UNIFORM */
|
||||
SHARED = 652, /* SHARED */
|
||||
BUFFER = 653, /* BUFFER */
|
||||
FLAT = 654, /* FLAT */
|
||||
SMOOTH = 655, /* SMOOTH */
|
||||
LAYOUT = 656, /* LAYOUT */
|
||||
DOUBLECONSTANT = 657, /* DOUBLECONSTANT */
|
||||
INT16CONSTANT = 658, /* INT16CONSTANT */
|
||||
UINT16CONSTANT = 659, /* UINT16CONSTANT */
|
||||
FLOAT16CONSTANT = 660, /* FLOAT16CONSTANT */
|
||||
INT32CONSTANT = 661, /* INT32CONSTANT */
|
||||
UINT32CONSTANT = 662, /* UINT32CONSTANT */
|
||||
INT64CONSTANT = 663, /* INT64CONSTANT */
|
||||
UINT64CONSTANT = 664, /* UINT64CONSTANT */
|
||||
SUBROUTINE = 665, /* SUBROUTINE */
|
||||
DEMOTE = 666, /* DEMOTE */
|
||||
PAYLOADNV = 667, /* PAYLOADNV */
|
||||
PAYLOADINNV = 668, /* PAYLOADINNV */
|
||||
HITATTRNV = 669, /* HITATTRNV */
|
||||
CALLDATANV = 670, /* CALLDATANV */
|
||||
CALLDATAINNV = 671, /* CALLDATAINNV */
|
||||
PAYLOADEXT = 672, /* PAYLOADEXT */
|
||||
PAYLOADINEXT = 673, /* PAYLOADINEXT */
|
||||
HITATTREXT = 674, /* HITATTREXT */
|
||||
CALLDATAEXT = 675, /* CALLDATAEXT */
|
||||
CALLDATAINEXT = 676, /* CALLDATAINEXT */
|
||||
PATCH = 677, /* PATCH */
|
||||
SAMPLE = 678, /* SAMPLE */
|
||||
NONUNIFORM = 679, /* NONUNIFORM */
|
||||
COHERENT = 680, /* COHERENT */
|
||||
VOLATILE = 681, /* VOLATILE */
|
||||
RESTRICT = 682, /* RESTRICT */
|
||||
READONLY = 683, /* READONLY */
|
||||
WRITEONLY = 684, /* WRITEONLY */
|
||||
DEVICECOHERENT = 685, /* DEVICECOHERENT */
|
||||
QUEUEFAMILYCOHERENT = 686, /* QUEUEFAMILYCOHERENT */
|
||||
WORKGROUPCOHERENT = 687, /* WORKGROUPCOHERENT */
|
||||
SUBGROUPCOHERENT = 688, /* SUBGROUPCOHERENT */
|
||||
NONPRIVATE = 689, /* NONPRIVATE */
|
||||
SHADERCALLCOHERENT = 690, /* SHADERCALLCOHERENT */
|
||||
NOPERSPECTIVE = 691, /* NOPERSPECTIVE */
|
||||
EXPLICITINTERPAMD = 692, /* EXPLICITINTERPAMD */
|
||||
PERVERTEXNV = 693, /* PERVERTEXNV */
|
||||
PERPRIMITIVENV = 694, /* PERPRIMITIVENV */
|
||||
PERVIEWNV = 695, /* PERVIEWNV */
|
||||
PERTASKNV = 696, /* PERTASKNV */
|
||||
PRECISE = 697 /* PRECISE */
|
||||
TERMINATE_RAY = 651, /* TERMINATE_RAY */
|
||||
IGNORE_INTERSECTION = 652, /* IGNORE_INTERSECTION */
|
||||
UNIFORM = 653, /* UNIFORM */
|
||||
SHARED = 654, /* SHARED */
|
||||
BUFFER = 655, /* BUFFER */
|
||||
FLAT = 656, /* FLAT */
|
||||
SMOOTH = 657, /* SMOOTH */
|
||||
LAYOUT = 658, /* LAYOUT */
|
||||
DOUBLECONSTANT = 659, /* DOUBLECONSTANT */
|
||||
INT16CONSTANT = 660, /* INT16CONSTANT */
|
||||
UINT16CONSTANT = 661, /* UINT16CONSTANT */
|
||||
FLOAT16CONSTANT = 662, /* FLOAT16CONSTANT */
|
||||
INT32CONSTANT = 663, /* INT32CONSTANT */
|
||||
UINT32CONSTANT = 664, /* UINT32CONSTANT */
|
||||
INT64CONSTANT = 665, /* INT64CONSTANT */
|
||||
UINT64CONSTANT = 666, /* UINT64CONSTANT */
|
||||
SUBROUTINE = 667, /* SUBROUTINE */
|
||||
DEMOTE = 668, /* DEMOTE */
|
||||
PAYLOADNV = 669, /* PAYLOADNV */
|
||||
PAYLOADINNV = 670, /* PAYLOADINNV */
|
||||
HITATTRNV = 671, /* HITATTRNV */
|
||||
CALLDATANV = 672, /* CALLDATANV */
|
||||
CALLDATAINNV = 673, /* CALLDATAINNV */
|
||||
PAYLOADEXT = 674, /* PAYLOADEXT */
|
||||
PAYLOADINEXT = 675, /* PAYLOADINEXT */
|
||||
HITATTREXT = 676, /* HITATTREXT */
|
||||
CALLDATAEXT = 677, /* CALLDATAEXT */
|
||||
CALLDATAINEXT = 678, /* CALLDATAINEXT */
|
||||
PATCH = 679, /* PATCH */
|
||||
SAMPLE = 680, /* SAMPLE */
|
||||
NONUNIFORM = 681, /* NONUNIFORM */
|
||||
COHERENT = 682, /* COHERENT */
|
||||
VOLATILE = 683, /* VOLATILE */
|
||||
RESTRICT = 684, /* RESTRICT */
|
||||
READONLY = 685, /* READONLY */
|
||||
WRITEONLY = 686, /* WRITEONLY */
|
||||
DEVICECOHERENT = 687, /* DEVICECOHERENT */
|
||||
QUEUEFAMILYCOHERENT = 688, /* QUEUEFAMILYCOHERENT */
|
||||
WORKGROUPCOHERENT = 689, /* WORKGROUPCOHERENT */
|
||||
SUBGROUPCOHERENT = 690, /* SUBGROUPCOHERENT */
|
||||
NONPRIVATE = 691, /* NONPRIVATE */
|
||||
SHADERCALLCOHERENT = 692, /* SHADERCALLCOHERENT */
|
||||
NOPERSPECTIVE = 693, /* NOPERSPECTIVE */
|
||||
EXPLICITINTERPAMD = 694, /* EXPLICITINTERPAMD */
|
||||
PERVERTEXNV = 695, /* PERVERTEXNV */
|
||||
PERPRIMITIVENV = 696, /* PERPRIMITIVENV */
|
||||
PERVIEWNV = 697, /* PERVIEWNV */
|
||||
PERTASKNV = 698, /* PERTASKNV */
|
||||
PRECISE = 699 /* PRECISE */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
#endif
|
||||
|
|
@ -502,7 +504,7 @@ extern int yydebug;
|
|||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 97 "glslang/MachineIndependent/glslang.y"
|
||||
#line 97 "MachineIndependent/glslang.y"
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
|
|
@ -538,7 +540,7 @@ union YYSTYPE
|
|||
glslang::TArraySizes* typeParameters;
|
||||
} interm;
|
||||
|
||||
#line 542 "glslang/MachineIndependent/glslang_tab.cpp.h"
|
||||
#line 544 "MachineIndependent/glslang_tab.cpp.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
@ -550,4 +552,4 @@ typedef union YYSTYPE YYSTYPE;
|
|||
|
||||
int yyparse (glslang::TParseContext* pParseContext);
|
||||
|
||||
#endif /* !YY_YY_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
|
|
|
|||
|
|
@ -438,6 +438,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpConvUint64ToPtr: out.debug << "Convert uint64_t to pointer"; break;
|
||||
case EOpConvPtrToUint64: out.debug << "Convert pointer to uint64_t"; break;
|
||||
|
||||
case EOpConvUint64ToAccStruct: out.debug << "Convert uint64_t to acceleration structure"; break;
|
||||
case EOpConvUvec2ToAccStruct: out.debug << "Convert uvec2 to acceleration strucuture "; break;
|
||||
|
||||
case EOpRadians: out.debug << "radians"; break;
|
||||
case EOpDegrees: out.debug << "degrees"; break;
|
||||
case EOpSin: out.debug << "sine"; break;
|
||||
|
|
@ -829,6 +832,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break;
|
||||
case EOpConstructReference: out.debug << "Construct reference"; break;
|
||||
case EOpConstructCooperativeMatrix: out.debug << "Construct cooperative matrix"; break;
|
||||
case EOpConstructAccStruct: out.debug << "Construct acceleration structure"; break;
|
||||
|
||||
case EOpLessThan: out.debug << "Compare Less Than"; break;
|
||||
case EOpGreaterThan: out.debug << "Compare Greater Than"; break;
|
||||
|
|
@ -1079,11 +1083,15 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||
|
||||
case EOpTrace: out.debug << "traceNV"; break;
|
||||
case EOpTraceNV: out.debug << "traceNV"; break;
|
||||
case EOpTraceKHR: out.debug << "traceRayKHR"; break;
|
||||
case EOpReportIntersection: out.debug << "reportIntersectionNV"; break;
|
||||
case EOpIgnoreIntersection: out.debug << "ignoreIntersectionNV"; break;
|
||||
case EOpTerminateRay: out.debug << "terminateRayNV"; break;
|
||||
case EOpExecuteCallable: out.debug << "executeCallableNV"; break;
|
||||
case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break;
|
||||
case EOpIgnoreIntersectionKHR: out.debug << "ignoreIntersectionKHR"; break;
|
||||
case EOpTerminateRayNV: out.debug << "terminateRayNV"; break;
|
||||
case EOpTerminateRayKHR: out.debug << "terminateRayKHR"; break;
|
||||
case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break;
|
||||
case EOpExecuteCallableKHR: out.debug << "executeCallableKHR"; break;
|
||||
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
|
||||
|
||||
case EOpRayQueryInitialize: out.debug << "rayQueryInitializeEXT"; break;
|
||||
|
|
@ -1409,15 +1417,17 @@ bool TOutputTraverser::visitBranch(TVisit /* visit*/, TIntermBranch* node)
|
|||
OutputTreeText(out, node, depth);
|
||||
|
||||
switch (node->getFlowOp()) {
|
||||
case EOpKill: out.debug << "Branch: Kill"; break;
|
||||
case EOpTerminateInvocation: out.debug << "Branch: TerminateInvocation"; break;
|
||||
case EOpBreak: out.debug << "Branch: Break"; break;
|
||||
case EOpContinue: out.debug << "Branch: Continue"; break;
|
||||
case EOpReturn: out.debug << "Branch: Return"; break;
|
||||
case EOpCase: out.debug << "case: "; break;
|
||||
case EOpDemote: out.debug << "Demote"; break;
|
||||
case EOpDefault: out.debug << "default: "; break;
|
||||
default: out.debug << "Branch: Unknown Branch"; break;
|
||||
case EOpKill: out.debug << "Branch: Kill"; break;
|
||||
case EOpTerminateInvocation: out.debug << "Branch: TerminateInvocation"; break;
|
||||
case EOpIgnoreIntersectionKHR: out.debug << "Branch: IgnoreIntersectionKHR"; break;
|
||||
case EOpTerminateRayKHR: out.debug << "Branch: TerminateRayKHR"; break;
|
||||
case EOpBreak: out.debug << "Branch: Break"; break;
|
||||
case EOpContinue: out.debug << "Branch: Continue"; break;
|
||||
case EOpReturn: out.debug << "Branch: Return"; break;
|
||||
case EOpCase: out.debug << "case: "; break;
|
||||
case EOpDemote: out.debug << "Demote"; break;
|
||||
case EOpDefault: out.debug << "default: "; break;
|
||||
default: out.debug << "Branch: Unknown Branch"; break;
|
||||
}
|
||||
|
||||
if (node->getExpression()) {
|
||||
|
|
|
|||
|
|
@ -1057,8 +1057,8 @@ bool TIntermediate::userOutputUsed() const
|
|||
return found;
|
||||
}
|
||||
|
||||
// Accumulate locations used for inputs, outputs, and uniforms, and check for collisions
|
||||
// as the accumulation is done.
|
||||
// Accumulate locations used for inputs, outputs, and uniforms, payload and callable data
|
||||
// and check for collisions as the accumulation is done.
|
||||
//
|
||||
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
|
||||
//
|
||||
|
|
@ -1070,6 +1070,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
typeCollision = false;
|
||||
|
||||
int set;
|
||||
int setRT;
|
||||
if (qualifier.isPipeInput())
|
||||
set = 0;
|
||||
else if (qualifier.isPipeOutput())
|
||||
|
|
@ -1078,11 +1079,17 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
set = 2;
|
||||
else if (qualifier.storage == EvqBuffer)
|
||||
set = 3;
|
||||
else if (qualifier.isAnyPayload())
|
||||
setRT = 0;
|
||||
else if (qualifier.isAnyCallable())
|
||||
setRT = 1;
|
||||
else
|
||||
return -1;
|
||||
|
||||
int size;
|
||||
if (qualifier.isUniformOrBuffer() || qualifier.isTaskMemory()) {
|
||||
if (qualifier.isAnyPayload() || qualifier.isAnyCallable()) {
|
||||
size = 1;
|
||||
} else if (qualifier.isUniformOrBuffer() || qualifier.isTaskMemory()) {
|
||||
if (type.isSizedArray())
|
||||
size = type.getCumulativeArraySize();
|
||||
else
|
||||
|
|
@ -1110,10 +1117,17 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
// (A vertex shader input will show using only one location, even for a dvec3/4.)
|
||||
//
|
||||
// So, for the case of dvec3, we need two independent ioRanges.
|
||||
|
||||
//
|
||||
// For raytracing IO (payloads and callabledata) each declaration occupies a single
|
||||
// slot irrespective of type.
|
||||
int collision = -1; // no collision
|
||||
#ifndef GLSLANG_WEB
|
||||
if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
||||
if (qualifier.isAnyPayload() || qualifier.isAnyCallable()) {
|
||||
TRange range(qualifier.layoutLocation, qualifier.layoutLocation);
|
||||
collision = checkLocationRT(setRT, qualifier.layoutLocation);
|
||||
if (collision < 0)
|
||||
usedIoRT[setRT].push_back(range);
|
||||
} else if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
|
||||
(qualifier.isPipeInput() || qualifier.isPipeOutput())) {
|
||||
// Dealing with dvec3 in/out split across two locations.
|
||||
// Need two io-ranges.
|
||||
|
|
@ -1189,6 +1203,16 @@ int TIntermediate::checkLocationRange(int set, const TIoRange& range, const TTyp
|
|||
return -1; // no collision
|
||||
}
|
||||
|
||||
int TIntermediate::checkLocationRT(int set, int location) {
|
||||
TRange range(location, location);
|
||||
for (size_t r = 0; r < usedIoRT[set].size(); ++r) {
|
||||
if (range.overlap(usedIoRT[set][r])) {
|
||||
return range.start;
|
||||
}
|
||||
}
|
||||
return -1; // no collision
|
||||
}
|
||||
|
||||
// Accumulate bindings and offsets, and check for collisions
|
||||
// as the accumulation is done.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -416,6 +416,9 @@ public:
|
|||
EShLanguage getStage() const { return language; }
|
||||
void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); }
|
||||
const std::set<std::string>& getRequestedExtensions() const { return requestedExtensions; }
|
||||
bool isRayTracingStage() const {
|
||||
return language >= EShLangRayGen && language <= EShLangCallableNV;
|
||||
}
|
||||
|
||||
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
|
||||
TIntermNode* getTreeRoot() const { return treeRoot; }
|
||||
|
|
@ -531,6 +534,7 @@ public:
|
|||
// Linkage related
|
||||
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
|
||||
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
|
||||
TIntermAggregate* findLinkerObjects() const;
|
||||
|
||||
void setUseStorageBuffer() { useStorageBuffer = true; }
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
|
|
@ -866,6 +870,7 @@ public:
|
|||
|
||||
int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
|
||||
int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
|
||||
int checkLocationRT(int set, int location);
|
||||
int addUsedOffsets(int binding, int offset, int numOffsets);
|
||||
bool addUsedConstantId(int id);
|
||||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
|
|
@ -941,7 +946,6 @@ protected:
|
|||
void checkCallGraphCycles(TInfoSink&);
|
||||
void checkCallGraphBodies(TInfoSink&, bool keepUncalled);
|
||||
void inOutLocationCheck(TInfoSink&);
|
||||
TIntermAggregate* findLinkerObjects() const;
|
||||
bool userOutputUsed() const;
|
||||
bool isSpecializationOperation(const TIntermOperator&) const;
|
||||
bool isNonuniformPropagating(TOperator) const;
|
||||
|
|
@ -1050,6 +1054,8 @@ protected:
|
|||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
|
||||
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
|
||||
std::vector<TRange> usedIoRT[2]; // sets of used location, one for rayPayload/rayPayloadIN and other
|
||||
// for callableData/callableDataIn
|
||||
// set of names of statically read/written I/O that might need extra checking
|
||||
std::set<TString> ioAccessed;
|
||||
// source code of shader, useful as part of debug information
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue