Add-support-for-SPV_NV_mesh_shader
This commit is contained in:
parent
3a1379667d
commit
3c3669904c
41 changed files with 6976 additions and 4237 deletions
|
|
@ -2941,6 +2941,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
|
||||
"\n"
|
||||
);
|
||||
#ifdef NV_EXTENSIONS
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void subgroupMemoryBarrierShared();"
|
||||
"\n"
|
||||
);
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"void subgroupMemoryBarrierShared();"
|
||||
"\n"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
|
|
@ -4867,6 +4877,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangCompute].append(
|
||||
"void barrier();"
|
||||
);
|
||||
#ifdef NV_EXTENSIONS
|
||||
if ((profile != EEsProfile && version >= 450) || esBarrier) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void barrier();"
|
||||
);
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"void barrier();"
|
||||
);
|
||||
}
|
||||
#endif
|
||||
if ((profile != EEsProfile && version >= 130) || esBarrier)
|
||||
commonBuiltins.append(
|
||||
"void memoryBarrier();"
|
||||
|
|
@ -4882,6 +4902,18 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"void groupMemoryBarrier();"
|
||||
);
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void memoryBarrierShared();"
|
||||
"void groupMemoryBarrier();"
|
||||
);
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"void memoryBarrierShared();"
|
||||
"void groupMemoryBarrier();"
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
commonBuiltins.append("void controlBarrier(int, int, int, int);\n"
|
||||
"void memoryBarrier(int, int, int);\n");
|
||||
|
|
@ -5039,6 +5071,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangCompute].append(derivativesAndControl64bits);
|
||||
stageBuiltins[EShLangCompute].append("\n");
|
||||
}
|
||||
|
||||
// Builtins for GL_NV_mesh_shader
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void writePackedPrimitiveIndices4x8NV(uint, uint);"
|
||||
"\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
|
|
@ -5220,6 +5259,89 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"\n");
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
//============================================================================
|
||||
//
|
||||
// Define the interface to the mesh/task shader.
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
// per-vertex attributes
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"out gl_MeshPerVertexNV {"
|
||||
"vec4 gl_Position;"
|
||||
"float gl_PointSize;"
|
||||
"float gl_ClipDistance[];"
|
||||
"float gl_CullDistance[];"
|
||||
"perviewNV vec4 gl_PositionPerViewNV[];"
|
||||
"perviewNV float gl_ClipDistancePerViewNV[][8];"
|
||||
"perviewNV float gl_CullDistancePerViewNV[][8];"
|
||||
"} gl_MeshVerticesNV[];"
|
||||
);
|
||||
|
||||
// per-primitive attributes
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"perprimitiveNV out gl_MeshPerPrimitiveNV {"
|
||||
"int gl_PrimitiveID;"
|
||||
"int gl_Layer;"
|
||||
"int gl_ViewportIndex;"
|
||||
"int gl_ViewportMask[];"
|
||||
"perviewNV int gl_LayerPerViewNV[];"
|
||||
"perviewNV int gl_ViewportMaskPerViewNV[][1];"
|
||||
"} gl_MeshPrimitivesNV[];"
|
||||
);
|
||||
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"out uint gl_PrimitiveCountNV;"
|
||||
"out uint gl_PrimitiveIndicesNV[];"
|
||||
|
||||
"in uint gl_MeshViewCountNV;"
|
||||
"in uint gl_MeshViewIndicesNV[4];"
|
||||
|
||||
"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
|
||||
|
||||
"in highp uvec3 gl_WorkGroupID;"
|
||||
"in highp uvec3 gl_LocalInvocationID;"
|
||||
|
||||
"in highp uvec3 gl_GlobalInvocationID;"
|
||||
"in highp uint gl_LocalInvocationIndex;"
|
||||
|
||||
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
|
||||
"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters
|
||||
|
||||
"\n");
|
||||
|
||||
if (version >= 460) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"in int gl_DrawID;"
|
||||
);
|
||||
}
|
||||
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"out uint gl_TaskCountNV;"
|
||||
|
||||
"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
|
||||
|
||||
"in highp uvec3 gl_WorkGroupID;"
|
||||
"in highp uvec3 gl_LocalInvocationID;"
|
||||
|
||||
"in highp uvec3 gl_GlobalInvocationID;"
|
||||
"in highp uint gl_LocalInvocationIndex;"
|
||||
|
||||
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
|
||||
"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters
|
||||
|
||||
"\n");
|
||||
|
||||
if (version >= 460) {
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"in int gl_DrawID;"
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Define the interface to the vertex shader.
|
||||
|
|
@ -5889,6 +6011,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangGeometry] .append(ballotDecls);
|
||||
stageBuiltins[EShLangCompute] .append(ballotDecls);
|
||||
stageBuiltins[EShLangFragment] .append(fragmentBallotDecls);
|
||||
#ifdef NV_EXTENSIONS
|
||||
stageBuiltins[EShLangMeshNV] .append(ballotDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(ballotDecls);
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((profile != EEsProfile && version >= 140) ||
|
||||
|
|
@ -5925,11 +6051,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangGeometry] .append(ballotDecls);
|
||||
stageBuiltins[EShLangCompute] .append(ballotDecls);
|
||||
stageBuiltins[EShLangFragment] .append(fragmentBallotDecls);
|
||||
#ifdef NV_EXTENSIONS
|
||||
stageBuiltins[EShLangMeshNV] .append(ballotDecls);
|
||||
stageBuiltins[EShLangTaskNV] .append(ballotDecls);
|
||||
#endif
|
||||
|
||||
stageBuiltins[EShLangCompute].append(
|
||||
"highp in uint gl_NumSubgroups;"
|
||||
"highp in uint gl_SubgroupID;"
|
||||
"\n");
|
||||
#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");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (version >= 300 /* both ES and non-ES */) {
|
||||
|
|
@ -7398,6 +7538,31 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// SPV_NV_mesh_shader
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV);
|
||||
s.append(builtInConstant);
|
||||
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputPrimitivesNV = %d;", resources.maxMeshOutputPrimitivesNV);
|
||||
s.append(builtInConstant);
|
||||
|
||||
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxMeshWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxMeshWorkGroupSizeX_NV,
|
||||
resources.maxMeshWorkGroupSizeY_NV,
|
||||
resources.maxMeshWorkGroupSizeZ_NV);
|
||||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxTaskWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxTaskWorkGroupSizeX_NV,
|
||||
resources.maxTaskWorkGroupSizeY_NV,
|
||||
resources.maxTaskWorkGroupSizeZ_NV);
|
||||
s.append(builtInConstant);
|
||||
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshViewCountNV = %d;", resources.maxMeshViewCountNV);
|
||||
s.append(builtInConstant);
|
||||
|
||||
s.append("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
s.append("\n");
|
||||
}
|
||||
|
||||
|
|
@ -8265,7 +8430,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
|
||||
}
|
||||
|
||||
// GL_ARB_shader_ballot
|
||||
// GL_KHR_shader_subgroup
|
||||
if (spvVersion.vulkan > 0) {
|
||||
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
|
|
@ -8304,6 +8469,200 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
// Per-vertex builtins
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_Position", EbvPosition, symbolTable);
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_PointSize", EbvPointSize, symbolTable);
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistance", EbvClipDistance, symbolTable);
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistance", EbvCullDistance, symbolTable);
|
||||
// Per-view builtins
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistancePerViewNV", EbvClipDistancePerViewNV, symbolTable);
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistancePerViewNV", EbvCullDistancePerViewNV, symbolTable);
|
||||
|
||||
// Per-primitive builtins
|
||||
BuiltInVariable("gl_MeshPrimitivesNV", "gl_PrimitiveID", EbvPrimitiveId, symbolTable);
|
||||
BuiltInVariable("gl_MeshPrimitivesNV", "gl_Layer", EbvLayer, symbolTable);
|
||||
BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportIndex", EbvViewportIndex, symbolTable);
|
||||
BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMask", EbvViewportMaskNV, symbolTable);
|
||||
// Per-view builtins
|
||||
BuiltInVariable("gl_MeshPrimitivesNV", "gl_LayerPerViewNV", EbvLayerPerViewNV, symbolTable);
|
||||
BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);
|
||||
|
||||
symbolTable.setVariableExtensions("gl_PrimitiveCountNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_PrimitiveIndicesNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
BuiltInVariable("gl_PrimitiveCountNV", EbvPrimitiveCountNV, symbolTable);
|
||||
BuiltInVariable("gl_PrimitiveIndicesNV", EbvPrimitiveIndicesNV, symbolTable);
|
||||
BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);
|
||||
BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);
|
||||
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
|
||||
BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);
|
||||
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
|
||||
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
|
||||
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
|
||||
|
||||
symbolTable.setVariableExtensions("gl_MaxMeshOutputVerticesNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MaxMeshOutputPrimitivesNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MaxMeshWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
// GL_EXT_device_group
|
||||
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
|
||||
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
|
||||
|
||||
// GL_ARB_shader_draw_parameters
|
||||
symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);
|
||||
BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);
|
||||
if (version >= 460) {
|
||||
BuiltInVariable("gl_DrawID", EbvDrawId, 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
|
||||
if (spvVersion.vulkan > 0) {
|
||||
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);
|
||||
|
||||
symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
}
|
||||
break;
|
||||
|
||||
case EShLangTaskNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
symbolTable.setVariableExtensions("gl_TaskCountNV", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable);
|
||||
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
|
||||
BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);
|
||||
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
|
||||
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
|
||||
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
|
||||
|
||||
symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);
|
||||
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader);
|
||||
|
||||
// GL_EXT_device_group
|
||||
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
|
||||
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
|
||||
|
||||
// GL_ARB_shader_draw_parameters
|
||||
symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);
|
||||
BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);
|
||||
if (version >= 460) {
|
||||
BuiltInVariable("gl_DrawID", EbvDrawId, 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
|
||||
if (spvVersion.vulkan > 0) {
|
||||
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);
|
||||
|
||||
symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
assert(false && "Language not supported");
|
||||
break;
|
||||
|
|
@ -8840,6 +9199,20 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
#endif
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
symbolTable.relateToOperator("writePackedPrimitiveIndices4x8NV", EOpWritePackedPrimitiveIndices4x8NV);
|
||||
}
|
||||
// fall through
|
||||
case EShLangTaskNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
|
||||
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
assert(false && "Language not supported");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -491,7 +491,8 @@ void TParseContext::makeEditable(TSymbol*& symbol)
|
|||
ioArraySymbolResizeList.push_back(symbol);
|
||||
}
|
||||
|
||||
// Return true if this is a geometry shader input array or tessellation control output array.
|
||||
// Return true if this is a geometry shader input array or tessellation control output array
|
||||
// or mesh shader output array.
|
||||
bool TParseContext::isIoResizeArray(const TType& type) const
|
||||
{
|
||||
return type.isArray() &&
|
||||
|
|
@ -499,7 +500,9 @@ bool TParseContext::isIoResizeArray(const TType& type) const
|
|||
(language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && ! type.getQualifier().patch)
|
||||
#ifdef NV_EXTENSIONS
|
||||
||
|
||||
(language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn && type.getQualifier().pervertexNV)
|
||||
(language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn && type.getQualifier().pervertexNV) ||
|
||||
(language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut && !type.getQualifier().perTaskNV)
|
||||
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
|
@ -551,7 +554,7 @@ void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TInterm
|
|||
|
||||
// fix array size, if it can be fixed and needs to be fixed (will allow variable indexing)
|
||||
if (symbolNode->getType().isUnsizedArray()) {
|
||||
int newSize = getIoArrayImplicitSize();
|
||||
int newSize = getIoArrayImplicitSize(symbolNode->getType().getQualifier().isPerPrimitive());
|
||||
if (newSize > 0)
|
||||
symbolNode->getWritableType().changeOuterArraySize(newSize);
|
||||
}
|
||||
|
|
@ -565,9 +568,9 @@ void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TInterm
|
|||
// Types without an array size will be given one.
|
||||
// Types already having a size that is wrong will get an error.
|
||||
//
|
||||
void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly)
|
||||
void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly, bool isPerPrimitive)
|
||||
{
|
||||
int requiredSize = getIoArrayImplicitSize();
|
||||
int requiredSize = getIoArrayImplicitSize(isPerPrimitive);
|
||||
if (requiredSize == 0)
|
||||
return;
|
||||
|
||||
|
|
@ -581,6 +584,11 @@ void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnl
|
|||
)
|
||||
|
||||
feature = "vertices";
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (language == EShLangMeshNV) {
|
||||
feature = isPerPrimitive ? "max_primitives" : "max_vertices";
|
||||
}
|
||||
#endif
|
||||
else
|
||||
feature = "unknown";
|
||||
|
||||
|
|
@ -593,7 +601,7 @@ void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnl
|
|||
checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList[i]->getWritableType(), ioArraySymbolResizeList[i]->getName());
|
||||
}
|
||||
|
||||
int TParseContext::getIoArrayImplicitSize() const
|
||||
int TParseContext::getIoArrayImplicitSize(bool isPerPrimitive) const
|
||||
{
|
||||
if (language == EShLangGeometry)
|
||||
return TQualifier::mapGeometryToSize(intermediate.getInputPrimitive());
|
||||
|
|
@ -602,6 +610,13 @@ int TParseContext::getIoArrayImplicitSize() const
|
|||
#ifdef NV_EXTENSIONS
|
||||
else if (language == EShLangFragment)
|
||||
return 3; //Number of vertices for Fragment shader is always three.
|
||||
else if (language == EShLangMeshNV) {
|
||||
if (isPerPrimitive) {
|
||||
return intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0;
|
||||
} else {
|
||||
return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
else
|
||||
|
|
@ -622,6 +637,8 @@ void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredS
|
|||
if (type.getOuterArraySize() > requiredSize)
|
||||
error(loc, " cannot be greater than 3 for pervertexNV", feature, name.c_str());
|
||||
}
|
||||
else if (language == EShLangMeshNV)
|
||||
error(loc, "inconsistent output array size of", feature, name.c_str());
|
||||
#endif
|
||||
else
|
||||
assert(0);
|
||||
|
|
@ -1322,8 +1339,15 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction
|
|||
// without actually redeclaring the array. (It is an error to use a member before the
|
||||
// redeclaration, but not an error to use the array name itself.)
|
||||
const TString& name = intermNode->getAsSymbolNode()->getName();
|
||||
if (name == "gl_in" || name == "gl_out")
|
||||
length = getIoArrayImplicitSize();
|
||||
if (name == "gl_in" || name == "gl_out"
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| name == "gl_MeshVerticesNV"
|
||||
|| name == "gl_MeshPrimitivesNV"
|
||||
#endif
|
||||
)
|
||||
{
|
||||
length = getIoArrayImplicitSize(type.getQualifier().isPerPrimitive());
|
||||
}
|
||||
}
|
||||
if (length == 0) {
|
||||
if (intermNode->getAsSymbolNode() && isIoResizeArray(type))
|
||||
|
|
@ -3070,6 +3094,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
|||
if (qualifier.patch && qualifier.isInterpolation())
|
||||
error(loc, "cannot use interpolation qualifiers with patch", "patch", "");
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (qualifier.perTaskNV && publicType.basicType != EbtBlock)
|
||||
error(loc, "taskNV variables can be declared only as blocks", "taskNV", "");
|
||||
#endif
|
||||
|
||||
if (qualifier.storage == EvqVaryingIn) {
|
||||
switch (language) {
|
||||
case EShLangVertex:
|
||||
|
|
@ -3257,6 +3286,11 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
|
|||
MERGE_SINGLETON(nopersp);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
MERGE_SINGLETON(explicitInterp);
|
||||
#endif
|
||||
#ifdef NV_EXTENSIONS
|
||||
MERGE_SINGLETON(perPrimitiveNV);
|
||||
MERGE_SINGLETON(perViewNV);
|
||||
MERGE_SINGLETON(perTaskNV);
|
||||
#endif
|
||||
MERGE_SINGLETON(patch);
|
||||
MERGE_SINGLETON(sample);
|
||||
|
|
@ -3599,7 +3633,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
|
|||
if (! symbolTable.atBuiltInLevel()) {
|
||||
if (isIoResizeArray(type)) {
|
||||
ioArraySymbolResizeList.push_back(symbol);
|
||||
checkIoArraysConsistency(loc, true);
|
||||
checkIoArraysConsistency(loc, true, type.getQualifier().isPerPrimitive());
|
||||
} else
|
||||
fixIoArraySize(loc, symbol->getWritableType());
|
||||
}
|
||||
|
|
@ -3652,7 +3686,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
|
|||
existingType.updateArraySizes(type);
|
||||
|
||||
if (isIoResizeArray(type))
|
||||
checkIoArraysConsistency(loc);
|
||||
checkIoArraysConsistency(loc, false, type.getQualifier().isPerPrimitive());
|
||||
}
|
||||
|
||||
// Policy and error check for needing a runtime sized array.
|
||||
|
|
@ -3688,6 +3722,28 @@ bool TParseContext::isRuntimeLength(const TIntermTyped& base) const
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// Fix mesh view output array dimension
|
||||
void TParseContext::resizeMeshViewDimension(const TSourceLoc& loc, TType& type)
|
||||
{
|
||||
// see if member is a per-view attribute
|
||||
if (type.getQualifier().isPerView()) {
|
||||
// since we don't have the maxMeshViewCountNV set during parsing builtins, we hardcode the value
|
||||
int maxViewCount = parsingBuiltins ? 4 : resources.maxMeshViewCountNV;
|
||||
|
||||
if (! type.isArray()) {
|
||||
error(loc, "requires an view array dimension", "perviewNV", "");
|
||||
}
|
||||
else if (!type.isUnsizedArray() && type.getOuterArraySize() != maxViewCount) {
|
||||
error(loc, "mesh view output array size must be gl_MaxMeshViewCountNV or implicitly sized", "[]", "");
|
||||
}
|
||||
else if (type.isUnsizedArray()) {
|
||||
type.changeOuterArraySize(maxViewCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Returns true if the first argument to the #line directive is the line number for the next line.
|
||||
//
|
||||
// Desktop, pre-version 3.30: "After processing this directive
|
||||
|
|
@ -3878,7 +3934,12 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
|
||||
profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature);
|
||||
|
||||
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") {
|
||||
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment"
|
||||
#ifdef NV_EXTENSIONS
|
||||
&& blockName != "gl_MeshPerVertexNV" && blockName != "gl_MeshPerPrimitiveNV"
|
||||
#endif
|
||||
)
|
||||
{
|
||||
error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str());
|
||||
return;
|
||||
}
|
||||
|
|
@ -4054,7 +4115,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
// Tracking for implicit sizing of array
|
||||
if (isIoResizeArray(block->getType())) {
|
||||
ioArraySymbolResizeList.push_back(block);
|
||||
checkIoArraysConsistency(loc, true);
|
||||
checkIoArraysConsistency(loc, true, block->getType().getQualifier().isPerPrimitive());
|
||||
} else if (block->getType().isArray())
|
||||
fixIoArraySize(loc, block->getWritableType());
|
||||
|
||||
|
|
@ -4471,44 +4532,57 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
publicType.qualifier.layoutPushConstant = true;
|
||||
return;
|
||||
}
|
||||
if (language == EShLangGeometry || language == EShLangTessEvaluation) {
|
||||
if (language == EShLangGeometry || language == EShLangTessEvaluation
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| language == EShLangMeshNV
|
||||
#endif
|
||||
) {
|
||||
if (id == TQualifier::getGeometryString(ElgTriangles)) {
|
||||
publicType.shaderQualifiers.geometry = ElgTriangles;
|
||||
return;
|
||||
}
|
||||
if (language == EShLangGeometry) {
|
||||
if (language == EShLangGeometry
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| language == EShLangMeshNV
|
||||
#endif
|
||||
) {
|
||||
if (id == TQualifier::getGeometryString(ElgPoints)) {
|
||||
publicType.shaderQualifiers.geometry = ElgPoints;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgLineStrip)) {
|
||||
publicType.shaderQualifiers.geometry = ElgLineStrip;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgLines)) {
|
||||
publicType.shaderQualifiers.geometry = ElgLines;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgLinesAdjacency)) {
|
||||
publicType.shaderQualifiers.geometry = ElgLinesAdjacency;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgTrianglesAdjacency)) {
|
||||
publicType.shaderQualifiers.geometry = ElgTrianglesAdjacency;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgTriangleStrip)) {
|
||||
publicType.shaderQualifiers.geometry = ElgTriangleStrip;
|
||||
return;
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (id == "passthrough") {
|
||||
requireExtensions(loc, 1, &E_SPV_NV_geometry_shader_passthrough, "geometry shader passthrough");
|
||||
publicType.qualifier.layoutPassthrough = true;
|
||||
intermediate.setGeoPassthroughEXT();
|
||||
return;
|
||||
}
|
||||
if (language == EShLangGeometry)
|
||||
#endif
|
||||
{
|
||||
if (id == TQualifier::getGeometryString(ElgLineStrip)) {
|
||||
publicType.shaderQualifiers.geometry = ElgLineStrip;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgLinesAdjacency)) {
|
||||
publicType.shaderQualifiers.geometry = ElgLinesAdjacency;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgTrianglesAdjacency)) {
|
||||
publicType.shaderQualifiers.geometry = ElgTrianglesAdjacency;
|
||||
return;
|
||||
}
|
||||
if (id == TQualifier::getGeometryString(ElgTriangleStrip)) {
|
||||
publicType.shaderQualifiers.geometry = ElgTriangleStrip;
|
||||
return;
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (id == "passthrough") {
|
||||
requireExtensions(loc, 1, &E_SPV_NV_geometry_shader_passthrough, "geometry shader passthrough");
|
||||
publicType.qualifier.layoutPassthrough = true;
|
||||
intermediate.setGeoPassthroughEXT();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
assert(language == EShLangTessEvaluation);
|
||||
|
||||
|
|
@ -4863,10 +4937,37 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
if (id == "max_vertices") {
|
||||
publicType.shaderQualifiers.vertices = value;
|
||||
if (value > resources.maxMeshOutputVerticesNV)
|
||||
error(loc, "too large, must be less than gl_MaxMeshOutputVerticesNV", "max_vertices", "");
|
||||
return;
|
||||
}
|
||||
if (id == "max_primitives") {
|
||||
publicType.shaderQualifiers.primitives = value;
|
||||
if (value > resources.maxMeshOutputPrimitivesNV)
|
||||
error(loc, "too large, must be less than gl_MaxMeshOutputPrimitivesNV", "max_primitives", "");
|
||||
return;
|
||||
}
|
||||
// Fall through
|
||||
|
||||
case EShLangTaskNV:
|
||||
// Fall through
|
||||
#endif
|
||||
case EShLangCompute:
|
||||
if (id.compare(0, 11, "local_size_") == 0) {
|
||||
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
|
||||
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (language == EShLangMeshNV || language == EShLangTaskNV) {
|
||||
profileRequires(loc, ~EEsProfile, 450, E_GL_NV_mesh_shader, "gl_WorkGroupSize");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
|
||||
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
|
||||
}
|
||||
if (id.size() == 12 && value == 0) {
|
||||
error(loc, "must be at least 1", id.c_str(), "");
|
||||
return;
|
||||
|
|
@ -5013,9 +5114,10 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
|
|||
switch (qualifier.storage) {
|
||||
case EvqVaryingIn:
|
||||
case EvqVaryingOut:
|
||||
if (type.getBasicType() != EbtBlock ||
|
||||
(!(*type.getStruct())[0].type->getQualifier().hasLocation() &&
|
||||
(*type.getStruct())[0].type->getQualifier().builtIn == EbvNone))
|
||||
if (!type.getQualifier().isTaskMemory() &&
|
||||
(type.getBasicType() != EbtBlock ||
|
||||
(!(*type.getStruct())[0].type->getQualifier().hasLocation() &&
|
||||
(*type.getStruct())[0].type->getQualifier().builtIn == EbvNone)))
|
||||
error(loc, "SPIR-V requires location for user input/output", "location", "");
|
||||
break;
|
||||
default:
|
||||
|
|
@ -5104,6 +5206,10 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
|||
case EvqVaryingOut:
|
||||
if (type.getBasicType() == EbtBlock)
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "location qualifier on in/out block");
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (type.getQualifier().isTaskMemory())
|
||||
error(loc, "cannot apply to taskNV in/out blocks", "location", "");
|
||||
#endif
|
||||
break;
|
||||
case EvqUniform:
|
||||
case EvqBuffer:
|
||||
|
|
@ -5355,7 +5461,7 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
|
|||
}
|
||||
|
||||
if (qualifier.hasBinding()) {
|
||||
if (! qualifier.isUniformOrBuffer())
|
||||
if (! qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory())
|
||||
error(loc, "requires uniform or buffer storage qualifier", "binding", "");
|
||||
}
|
||||
if (qualifier.hasStream()) {
|
||||
|
|
@ -5367,7 +5473,7 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
|
|||
error(loc, "can only be used on an output", "xfb layout qualifier", "");
|
||||
}
|
||||
if (qualifier.hasUniformLayout()) {
|
||||
if (! qualifier.isUniformOrBuffer()) {
|
||||
if (! qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory()) {
|
||||
if (qualifier.hasMatrix() || qualifier.hasPacking())
|
||||
error(loc, "matrix or packing qualifiers can only be used on a uniform or buffer", "layout", "");
|
||||
if (qualifier.hasOffset() || qualifier.hasAlign())
|
||||
|
|
@ -5408,13 +5514,25 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
|
|||
error(loc, message, "local_size id", "");
|
||||
}
|
||||
if (shaderQualifiers.vertices != TQualifier::layoutNotSet) {
|
||||
if (language == EShLangGeometry)
|
||||
if (language == EShLangGeometry
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| language == EShLangMeshNV
|
||||
#endif
|
||||
)
|
||||
error(loc, message, "max_vertices", "");
|
||||
else if (language == EShLangTessControl)
|
||||
error(loc, message, "vertices", "");
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (shaderQualifiers.primitives != TQualifier::layoutNotSet) {
|
||||
if (language == EShLangMeshNV)
|
||||
error(loc, message, "max_primitives", "");
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
#endif
|
||||
if (shaderQualifiers.blendEquation)
|
||||
error(loc, message, "blend equation", "");
|
||||
if (shaderQualifiers.numViews != TQualifier::layoutNotSet)
|
||||
|
|
@ -6445,6 +6563,14 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
if (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal && memberQualifier.storage != currentBlockQualifier.storage)
|
||||
error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), "");
|
||||
memberQualifier.storage = currentBlockQualifier.storage;
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (currentBlockQualifier.perPrimitiveNV)
|
||||
memberQualifier.perPrimitiveNV = currentBlockQualifier.perPrimitiveNV;
|
||||
if (currentBlockQualifier.perViewNV)
|
||||
memberQualifier.perViewNV = currentBlockQualifier.perViewNV;
|
||||
if (currentBlockQualifier.perTaskNV)
|
||||
memberQualifier.perTaskNV = currentBlockQualifier.perTaskNV;
|
||||
#endif
|
||||
if ((currentBlockQualifier.storage == EvqUniform || currentBlockQualifier.storage == EvqBuffer) && (memberQualifier.isInterpolation() || memberQualifier.isAuxiliary()))
|
||||
error(memberLoc, "member of uniform or buffer block cannot have an auxiliary or interpolation qualifier", memberType.getFieldName().c_str(), "");
|
||||
if (memberType.isArray())
|
||||
|
|
@ -6490,6 +6616,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
if (currentBlockQualifier.layoutPushConstant && !currentBlockQualifier.hasPacking())
|
||||
currentBlockQualifier.layoutPacking = ElpStd430;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// Special case for "taskNV in/out", which has a default of std430,
|
||||
if (currentBlockQualifier.perTaskNV && !currentBlockQualifier.hasPacking())
|
||||
currentBlockQualifier.layoutPacking = ElpStd430;
|
||||
#endif
|
||||
|
||||
// fix and check for member layout qualifiers
|
||||
|
||||
mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true);
|
||||
|
|
@ -6504,6 +6636,9 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
|
||||
bool memberWithLocation = false;
|
||||
bool memberWithoutLocation = false;
|
||||
#ifdef NV_EXTENSIONS
|
||||
bool memberWithPerViewQualifier = false;
|
||||
#endif
|
||||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||
TQualifier& memberQualifier = typeList[member].type->getQualifier();
|
||||
const TSourceLoc& memberLoc = typeList[member].loc;
|
||||
|
|
@ -6547,6 +6682,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
error(memberLoc, "can only be used with std140 or std430 layout packing", "offset/align", "");
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (memberQualifier.isPerView()) {
|
||||
memberWithPerViewQualifier = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
TQualifier newMemberQualification = defaultQualification;
|
||||
mergeQualifiers(memberLoc, newMemberQualification, memberQualifier, false);
|
||||
memberQualifier = newMemberQualification;
|
||||
|
|
@ -6561,6 +6702,14 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
for (unsigned int member = 0; member < typeList.size(); ++member)
|
||||
layoutTypeCheck(typeList[member].loc, *typeList[member].type);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (memberWithPerViewQualifier) {
|
||||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||
resizeMeshViewDimension(typeList[member].loc, *typeList[member].type);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// reverse merge, so that currentBlockQualifier now has all layout information
|
||||
// (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers)
|
||||
mergeObjectLayoutQualifiers(currentBlockQualifier, defaultQualification, true);
|
||||
|
|
@ -6624,7 +6773,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
// fix up
|
||||
if (isIoResizeArray(blockType)) {
|
||||
ioArraySymbolResizeList.push_back(&variable);
|
||||
checkIoArraysConsistency(loc, true);
|
||||
checkIoArraysConsistency(loc, true, blockType.getQualifier().isPerPrimitive());
|
||||
} else
|
||||
fixIoArraySize(loc, variable.getWritableType());
|
||||
|
||||
|
|
@ -6652,16 +6801,39 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
|
|||
profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "input block");
|
||||
// It is a compile-time error to have an input block in a vertex shader or an output block in a fragment shader
|
||||
// "Compute shaders do not permit user-defined input variables..."
|
||||
requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block");
|
||||
if (language == EShLangFragment)
|
||||
requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask
|
||||
#ifdef NV_EXTENSIONS
|
||||
|EShLangMeshNVMask
|
||||
#endif
|
||||
), "input block");
|
||||
if (language == EShLangFragment) {
|
||||
profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block");
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (language == EShLangMeshNV && ! qualifier.isTaskMemory()) {
|
||||
error(loc, "input blocks cannot be used in a mesh shader", "out", "");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case EvqVaryingOut:
|
||||
profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "output block");
|
||||
requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block");
|
||||
requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask
|
||||
#ifdef NV_EXTENSIONS
|
||||
|EShLangMeshNVMask|EShLangTaskNVMask
|
||||
#endif
|
||||
), "output block");
|
||||
// ES 310 can have a block before shader_io is turned on, so skip this test for built-ins
|
||||
if (language == EShLangVertex && ! parsingBuiltins)
|
||||
if (language == EShLangVertex && ! parsingBuiltins) {
|
||||
profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block");
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (language == EShLangMeshNV && qualifier.isTaskMemory()) {
|
||||
error(loc, "can only use on input blocks in mesh shader", "taskNV", "");
|
||||
}
|
||||
else if (language == EShLangTaskNV && ! qualifier.isTaskMemory()) {
|
||||
error(loc, "output blocks cannot be used in a task shader", "out", "");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), "");
|
||||
|
|
@ -6699,6 +6871,10 @@ void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier&
|
|||
error(loc, "cannot use invariant qualifier on an interface block", "invariant", "");
|
||||
if (qualifier.layoutPushConstant)
|
||||
intermediate.addPushConstantCount();
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (qualifier.perTaskNV)
|
||||
intermediate.addTaskNVCount();
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -6784,7 +6960,7 @@ void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeLis
|
|||
//
|
||||
void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typeList)
|
||||
{
|
||||
if (! qualifier.isUniformOrBuffer())
|
||||
if (!qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory())
|
||||
return;
|
||||
if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430)
|
||||
return;
|
||||
|
|
@ -6916,7 +7092,11 @@ void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qual
|
|||
void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType)
|
||||
{
|
||||
if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) {
|
||||
#ifdef NV_EXTENSIONS
|
||||
assert(language == EShLangTessControl || language == EShLangGeometry || language == EShLangMeshNV);
|
||||
#else
|
||||
assert(language == EShLangTessControl || language == EShLangGeometry);
|
||||
#endif
|
||||
const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices";
|
||||
|
||||
if (publicType.qualifier.storage != EvqVaryingOut)
|
||||
|
|
@ -6927,6 +7107,17 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
if (language == EShLangTessControl)
|
||||
checkIoArraysConsistency(loc);
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (publicType.shaderQualifiers.primitives != TQualifier::layoutNotSet) {
|
||||
assert(language == EShLangMeshNV);
|
||||
const char* id = "max_primitives";
|
||||
|
||||
if (publicType.qualifier.storage != EvqVaryingOut)
|
||||
error(loc, "can only apply to 'out'", id, "");
|
||||
if (! intermediate.setPrimitives(publicType.shaderQualifiers.primitives))
|
||||
error(loc, "cannot change previously set layout value", id, "");
|
||||
}
|
||||
#endif
|
||||
if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) {
|
||||
if (publicType.qualifier.storage != EvqVaryingIn)
|
||||
error(loc, "can only apply to 'in'", "invocations", "");
|
||||
|
|
@ -6943,6 +7134,12 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
case ElgTrianglesAdjacency:
|
||||
case ElgQuads:
|
||||
case ElgIsolines:
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (language == EShLangMeshNV) {
|
||||
error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (intermediate.setInputPrimitive(publicType.shaderQualifiers.geometry)) {
|
||||
if (language == EShLangGeometry)
|
||||
checkIoArraysConsistency(loc);
|
||||
|
|
@ -6954,6 +7151,15 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
}
|
||||
} else if (publicType.qualifier.storage == EvqVaryingOut) {
|
||||
switch (publicType.shaderQualifiers.geometry) {
|
||||
#ifdef NV_EXTENSIONS
|
||||
case ElgLines:
|
||||
case ElgTriangles:
|
||||
if (language != EShLangMeshNV) {
|
||||
error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// Fall through
|
||||
case ElgPoints:
|
||||
case ElgLineStrip:
|
||||
case ElgTriangleStrip:
|
||||
|
|
@ -6993,14 +7199,41 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
error(loc, "cannot change previously set size", "local_size", "");
|
||||
else {
|
||||
int max = 0;
|
||||
switch (i) {
|
||||
case 0: max = resources.maxComputeWorkGroupSizeX; break;
|
||||
case 1: max = resources.maxComputeWorkGroupSizeY; break;
|
||||
case 2: max = resources.maxComputeWorkGroupSizeZ; break;
|
||||
default: break;
|
||||
if (language == EShLangCompute) {
|
||||
switch (i) {
|
||||
case 0: max = resources.maxComputeWorkGroupSizeX; break;
|
||||
case 1: max = resources.maxComputeWorkGroupSizeY; break;
|
||||
case 2: max = resources.maxComputeWorkGroupSizeZ; break;
|
||||
default: break;
|
||||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
else if (language == EShLangMeshNV) {
|
||||
switch (i) {
|
||||
case 0: max = resources.maxMeshWorkGroupSizeX_NV; break;
|
||||
case 1: max = resources.maxMeshWorkGroupSizeY_NV; break;
|
||||
case 2: max = resources.maxMeshWorkGroupSizeZ_NV; break;
|
||||
default: break;
|
||||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxMeshWorkGroupSizeNV", "local_size", "");
|
||||
}
|
||||
else if (language == EShLangTaskNV) {
|
||||
switch (i) {
|
||||
case 0: max = resources.maxTaskWorkGroupSizeX_NV; break;
|
||||
case 1: max = resources.maxTaskWorkGroupSizeY_NV; break;
|
||||
case 2: max = resources.maxTaskWorkGroupSizeZ_NV; break;
|
||||
default: break;
|
||||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", "");
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
assert(0);
|
||||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
|
||||
|
||||
// Fix the existing constant gl_WorkGroupSize with this new information.
|
||||
TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize");
|
||||
|
|
|
|||
|
|
@ -298,8 +298,8 @@ public:
|
|||
void fixIoArraySize(const TSourceLoc&, TType&);
|
||||
void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
|
||||
void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base);
|
||||
void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false);
|
||||
int getIoArrayImplicitSize() const;
|
||||
void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false, bool isPerPrimitive = false);
|
||||
int getIoArrayImplicitSize(bool isPerPrimitive = false) const;
|
||||
void checkIoArrayConsistency(const TSourceLoc&, int requiredSize, const char* feature, TType&, const TString&);
|
||||
|
||||
TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right);
|
||||
|
|
@ -423,6 +423,9 @@ public:
|
|||
// Determine loop control from attributes
|
||||
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
void resizeMeshViewDimension(const TSourceLoc&, TType&);
|
||||
#endif
|
||||
protected:
|
||||
void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type);
|
||||
void inheritGlobalDefaults(TQualifier& dst) const;
|
||||
|
|
|
|||
|
|
@ -700,6 +700,12 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["resource"] = RESOURCE;
|
||||
(*KeywordMap)["superp"] = SUPERP;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
(*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV;
|
||||
(*KeywordMap)["perviewNV"] = PERVIEWNV;
|
||||
(*KeywordMap)["taskNV"] = PERTASKNV;
|
||||
#endif
|
||||
|
||||
ReservedSet = new std::unordered_set<const char*, str_hash, str_eq>;
|
||||
|
||||
ReservedSet->insert("common");
|
||||
|
|
@ -1565,6 +1571,16 @@ int TScanContext::tokenizeIdentifier()
|
|||
return identifierOrReserved(reserved);
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case PERPRIMITIVENV:
|
||||
case PERVIEWNV:
|
||||
case PERTASKNV:
|
||||
if (parseContext.profile != EEsProfile &&
|
||||
(parseContext.version >= 450 || parseContext.extensionTurnedOn(E_GL_NV_mesh_shader)))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
#endif
|
||||
|
||||
default:
|
||||
parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -347,6 +347,18 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
|
|||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// check for mesh
|
||||
if (profile != EEsProfile && version >= 450)
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMeshNV, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for task
|
||||
if (profile != EEsProfile && version >= 450)
|
||||
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTaskNV, source,
|
||||
infoSink, commonTable, symbolTables);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -570,6 +582,16 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
version = profile == EEsProfile ? 310 : 420;
|
||||
}
|
||||
break;
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
case EShLangTaskNV:
|
||||
if ((profile == EEsProfile) ||
|
||||
(profile != EEsProfile && version < 450)) {
|
||||
correct = false;
|
||||
infoSink.info.message(EPrefixError, "#version: mesh/task shaders require non-es profile with version 450 or above");
|
||||
version = 450;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable;
|
||||
extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable;
|
||||
#endif
|
||||
|
||||
// AEP
|
||||
|
|
@ -411,6 +412,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_NV_fragment_shader_barycentric 1\n"
|
||||
"#define GL_NV_compute_shader_derivatives 1\n"
|
||||
"#define GL_NV_shader_texture_footprint 1\n"
|
||||
"#define GL_NV_mesh_shader 1\n"
|
||||
#endif
|
||||
"#define GL_KHX_shader_explicit_arithmetic_types 1\n"
|
||||
"#define GL_KHX_shader_explicit_arithmetic_types_int8 1\n"
|
||||
|
|
@ -498,6 +500,10 @@ const char* StageName(EShLanguage stage)
|
|||
case EShLangGeometry: return "geometry";
|
||||
case EShLangFragment: return "fragment";
|
||||
case EShLangCompute: return "compute";
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV: return "mesh";
|
||||
case EShLangTaskNV: return "task";
|
||||
#endif
|
||||
default: return "unknown stage";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ const char* const E_GL_NV_shader_subgroup_partitioned = "GL_NV_shader_
|
|||
const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric";
|
||||
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";
|
||||
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
|
||||
const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 };
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
|
||||
%token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
|
||||
%token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4
|
||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT EXPLICITINTERPAMD PERVERTEXNV
|
||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
|
||||
|
||||
%token <lex> MAT2X2 MAT2X3 MAT2X4
|
||||
%token <lex> MAT3X2 MAT3X3 MAT3X4
|
||||
|
|
@ -1152,6 +1152,30 @@ interpolation_qualifier
|
|||
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.pervertexNV = true;
|
||||
#endif
|
||||
}
|
||||
| PERPRIMITIVENV {
|
||||
#ifdef NV_EXTENSIONS
|
||||
parseContext.globalCheck($1.loc, "perprimitiveNV");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NV_mesh_shader, "perprimitiveNV");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perPrimitiveNV = true;
|
||||
#endif
|
||||
}
|
||||
| PERVIEWNV {
|
||||
#ifdef NV_EXTENSIONS
|
||||
parseContext.globalCheck($1.loc, "perviewNV");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NV_mesh_shader, "perviewNV");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perViewNV = true;
|
||||
#endif
|
||||
}
|
||||
| PERTASKNV {
|
||||
#ifdef NV_EXTENSIONS
|
||||
parseContext.globalCheck($1.loc, "taskNV");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NV_mesh_shader, "taskNV");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.perTaskNV = true;
|
||||
#endif
|
||||
}
|
||||
;
|
||||
|
|
@ -1319,7 +1343,11 @@ storage_qualifier
|
|||
parseContext.globalCheck($1.loc, "shared");
|
||||
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
|
||||
parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
|
||||
#ifdef NV_EXTENSIONS
|
||||
parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
|
||||
#else
|
||||
parseContext.requireStage($1.loc, EShLangCompute, "shared");
|
||||
#endif
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqShared;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -165,280 +165,283 @@ extern int yydebug;
|
|||
LAYOUT = 375,
|
||||
EXPLICITINTERPAMD = 376,
|
||||
PERVERTEXNV = 377,
|
||||
MAT2X2 = 378,
|
||||
MAT2X3 = 379,
|
||||
MAT2X4 = 380,
|
||||
MAT3X2 = 381,
|
||||
MAT3X3 = 382,
|
||||
MAT3X4 = 383,
|
||||
MAT4X2 = 384,
|
||||
MAT4X3 = 385,
|
||||
MAT4X4 = 386,
|
||||
DMAT2X2 = 387,
|
||||
DMAT2X3 = 388,
|
||||
DMAT2X4 = 389,
|
||||
DMAT3X2 = 390,
|
||||
DMAT3X3 = 391,
|
||||
DMAT3X4 = 392,
|
||||
DMAT4X2 = 393,
|
||||
DMAT4X3 = 394,
|
||||
DMAT4X4 = 395,
|
||||
F16MAT2X2 = 396,
|
||||
F16MAT2X3 = 397,
|
||||
F16MAT2X4 = 398,
|
||||
F16MAT3X2 = 399,
|
||||
F16MAT3X3 = 400,
|
||||
F16MAT3X4 = 401,
|
||||
F16MAT4X2 = 402,
|
||||
F16MAT4X3 = 403,
|
||||
F16MAT4X4 = 404,
|
||||
F32MAT2X2 = 405,
|
||||
F32MAT2X3 = 406,
|
||||
F32MAT2X4 = 407,
|
||||
F32MAT3X2 = 408,
|
||||
F32MAT3X3 = 409,
|
||||
F32MAT3X4 = 410,
|
||||
F32MAT4X2 = 411,
|
||||
F32MAT4X3 = 412,
|
||||
F32MAT4X4 = 413,
|
||||
F64MAT2X2 = 414,
|
||||
F64MAT2X3 = 415,
|
||||
F64MAT2X4 = 416,
|
||||
F64MAT3X2 = 417,
|
||||
F64MAT3X3 = 418,
|
||||
F64MAT3X4 = 419,
|
||||
F64MAT4X2 = 420,
|
||||
F64MAT4X3 = 421,
|
||||
F64MAT4X4 = 422,
|
||||
ATOMIC_UINT = 423,
|
||||
SAMPLER1D = 424,
|
||||
SAMPLER2D = 425,
|
||||
SAMPLER3D = 426,
|
||||
SAMPLERCUBE = 427,
|
||||
SAMPLER1DSHADOW = 428,
|
||||
SAMPLER2DSHADOW = 429,
|
||||
SAMPLERCUBESHADOW = 430,
|
||||
SAMPLER1DARRAY = 431,
|
||||
SAMPLER2DARRAY = 432,
|
||||
SAMPLER1DARRAYSHADOW = 433,
|
||||
SAMPLER2DARRAYSHADOW = 434,
|
||||
ISAMPLER1D = 435,
|
||||
ISAMPLER2D = 436,
|
||||
ISAMPLER3D = 437,
|
||||
ISAMPLERCUBE = 438,
|
||||
ISAMPLER1DARRAY = 439,
|
||||
ISAMPLER2DARRAY = 440,
|
||||
USAMPLER1D = 441,
|
||||
USAMPLER2D = 442,
|
||||
USAMPLER3D = 443,
|
||||
USAMPLERCUBE = 444,
|
||||
USAMPLER1DARRAY = 445,
|
||||
USAMPLER2DARRAY = 446,
|
||||
SAMPLER2DRECT = 447,
|
||||
SAMPLER2DRECTSHADOW = 448,
|
||||
ISAMPLER2DRECT = 449,
|
||||
USAMPLER2DRECT = 450,
|
||||
SAMPLERBUFFER = 451,
|
||||
ISAMPLERBUFFER = 452,
|
||||
USAMPLERBUFFER = 453,
|
||||
SAMPLERCUBEARRAY = 454,
|
||||
SAMPLERCUBEARRAYSHADOW = 455,
|
||||
ISAMPLERCUBEARRAY = 456,
|
||||
USAMPLERCUBEARRAY = 457,
|
||||
SAMPLER2DMS = 458,
|
||||
ISAMPLER2DMS = 459,
|
||||
USAMPLER2DMS = 460,
|
||||
SAMPLER2DMSARRAY = 461,
|
||||
ISAMPLER2DMSARRAY = 462,
|
||||
USAMPLER2DMSARRAY = 463,
|
||||
SAMPLEREXTERNALOES = 464,
|
||||
F16SAMPLER1D = 465,
|
||||
F16SAMPLER2D = 466,
|
||||
F16SAMPLER3D = 467,
|
||||
F16SAMPLER2DRECT = 468,
|
||||
F16SAMPLERCUBE = 469,
|
||||
F16SAMPLER1DARRAY = 470,
|
||||
F16SAMPLER2DARRAY = 471,
|
||||
F16SAMPLERCUBEARRAY = 472,
|
||||
F16SAMPLERBUFFER = 473,
|
||||
F16SAMPLER2DMS = 474,
|
||||
F16SAMPLER2DMSARRAY = 475,
|
||||
F16SAMPLER1DSHADOW = 476,
|
||||
F16SAMPLER2DSHADOW = 477,
|
||||
F16SAMPLER1DARRAYSHADOW = 478,
|
||||
F16SAMPLER2DARRAYSHADOW = 479,
|
||||
F16SAMPLER2DRECTSHADOW = 480,
|
||||
F16SAMPLERCUBESHADOW = 481,
|
||||
F16SAMPLERCUBEARRAYSHADOW = 482,
|
||||
SAMPLER = 483,
|
||||
SAMPLERSHADOW = 484,
|
||||
TEXTURE1D = 485,
|
||||
TEXTURE2D = 486,
|
||||
TEXTURE3D = 487,
|
||||
TEXTURECUBE = 488,
|
||||
TEXTURE1DARRAY = 489,
|
||||
TEXTURE2DARRAY = 490,
|
||||
ITEXTURE1D = 491,
|
||||
ITEXTURE2D = 492,
|
||||
ITEXTURE3D = 493,
|
||||
ITEXTURECUBE = 494,
|
||||
ITEXTURE1DARRAY = 495,
|
||||
ITEXTURE2DARRAY = 496,
|
||||
UTEXTURE1D = 497,
|
||||
UTEXTURE2D = 498,
|
||||
UTEXTURE3D = 499,
|
||||
UTEXTURECUBE = 500,
|
||||
UTEXTURE1DARRAY = 501,
|
||||
UTEXTURE2DARRAY = 502,
|
||||
TEXTURE2DRECT = 503,
|
||||
ITEXTURE2DRECT = 504,
|
||||
UTEXTURE2DRECT = 505,
|
||||
TEXTUREBUFFER = 506,
|
||||
ITEXTUREBUFFER = 507,
|
||||
UTEXTUREBUFFER = 508,
|
||||
TEXTURECUBEARRAY = 509,
|
||||
ITEXTURECUBEARRAY = 510,
|
||||
UTEXTURECUBEARRAY = 511,
|
||||
TEXTURE2DMS = 512,
|
||||
ITEXTURE2DMS = 513,
|
||||
UTEXTURE2DMS = 514,
|
||||
TEXTURE2DMSARRAY = 515,
|
||||
ITEXTURE2DMSARRAY = 516,
|
||||
UTEXTURE2DMSARRAY = 517,
|
||||
F16TEXTURE1D = 518,
|
||||
F16TEXTURE2D = 519,
|
||||
F16TEXTURE3D = 520,
|
||||
F16TEXTURE2DRECT = 521,
|
||||
F16TEXTURECUBE = 522,
|
||||
F16TEXTURE1DARRAY = 523,
|
||||
F16TEXTURE2DARRAY = 524,
|
||||
F16TEXTURECUBEARRAY = 525,
|
||||
F16TEXTUREBUFFER = 526,
|
||||
F16TEXTURE2DMS = 527,
|
||||
F16TEXTURE2DMSARRAY = 528,
|
||||
SUBPASSINPUT = 529,
|
||||
SUBPASSINPUTMS = 530,
|
||||
ISUBPASSINPUT = 531,
|
||||
ISUBPASSINPUTMS = 532,
|
||||
USUBPASSINPUT = 533,
|
||||
USUBPASSINPUTMS = 534,
|
||||
F16SUBPASSINPUT = 535,
|
||||
F16SUBPASSINPUTMS = 536,
|
||||
IMAGE1D = 537,
|
||||
IIMAGE1D = 538,
|
||||
UIMAGE1D = 539,
|
||||
IMAGE2D = 540,
|
||||
IIMAGE2D = 541,
|
||||
UIMAGE2D = 542,
|
||||
IMAGE3D = 543,
|
||||
IIMAGE3D = 544,
|
||||
UIMAGE3D = 545,
|
||||
IMAGE2DRECT = 546,
|
||||
IIMAGE2DRECT = 547,
|
||||
UIMAGE2DRECT = 548,
|
||||
IMAGECUBE = 549,
|
||||
IIMAGECUBE = 550,
|
||||
UIMAGECUBE = 551,
|
||||
IMAGEBUFFER = 552,
|
||||
IIMAGEBUFFER = 553,
|
||||
UIMAGEBUFFER = 554,
|
||||
IMAGE1DARRAY = 555,
|
||||
IIMAGE1DARRAY = 556,
|
||||
UIMAGE1DARRAY = 557,
|
||||
IMAGE2DARRAY = 558,
|
||||
IIMAGE2DARRAY = 559,
|
||||
UIMAGE2DARRAY = 560,
|
||||
IMAGECUBEARRAY = 561,
|
||||
IIMAGECUBEARRAY = 562,
|
||||
UIMAGECUBEARRAY = 563,
|
||||
IMAGE2DMS = 564,
|
||||
IIMAGE2DMS = 565,
|
||||
UIMAGE2DMS = 566,
|
||||
IMAGE2DMSARRAY = 567,
|
||||
IIMAGE2DMSARRAY = 568,
|
||||
UIMAGE2DMSARRAY = 569,
|
||||
F16IMAGE1D = 570,
|
||||
F16IMAGE2D = 571,
|
||||
F16IMAGE3D = 572,
|
||||
F16IMAGE2DRECT = 573,
|
||||
F16IMAGECUBE = 574,
|
||||
F16IMAGE1DARRAY = 575,
|
||||
F16IMAGE2DARRAY = 576,
|
||||
F16IMAGECUBEARRAY = 577,
|
||||
F16IMAGEBUFFER = 578,
|
||||
F16IMAGE2DMS = 579,
|
||||
F16IMAGE2DMSARRAY = 580,
|
||||
STRUCT = 581,
|
||||
VOID = 582,
|
||||
WHILE = 583,
|
||||
IDENTIFIER = 584,
|
||||
TYPE_NAME = 585,
|
||||
FLOATCONSTANT = 586,
|
||||
DOUBLECONSTANT = 587,
|
||||
INT16CONSTANT = 588,
|
||||
UINT16CONSTANT = 589,
|
||||
INT32CONSTANT = 590,
|
||||
UINT32CONSTANT = 591,
|
||||
INTCONSTANT = 592,
|
||||
UINTCONSTANT = 593,
|
||||
INT64CONSTANT = 594,
|
||||
UINT64CONSTANT = 595,
|
||||
BOOLCONSTANT = 596,
|
||||
FLOAT16CONSTANT = 597,
|
||||
LEFT_OP = 598,
|
||||
RIGHT_OP = 599,
|
||||
INC_OP = 600,
|
||||
DEC_OP = 601,
|
||||
LE_OP = 602,
|
||||
GE_OP = 603,
|
||||
EQ_OP = 604,
|
||||
NE_OP = 605,
|
||||
AND_OP = 606,
|
||||
OR_OP = 607,
|
||||
XOR_OP = 608,
|
||||
MUL_ASSIGN = 609,
|
||||
DIV_ASSIGN = 610,
|
||||
ADD_ASSIGN = 611,
|
||||
MOD_ASSIGN = 612,
|
||||
LEFT_ASSIGN = 613,
|
||||
RIGHT_ASSIGN = 614,
|
||||
AND_ASSIGN = 615,
|
||||
XOR_ASSIGN = 616,
|
||||
OR_ASSIGN = 617,
|
||||
SUB_ASSIGN = 618,
|
||||
LEFT_PAREN = 619,
|
||||
RIGHT_PAREN = 620,
|
||||
LEFT_BRACKET = 621,
|
||||
RIGHT_BRACKET = 622,
|
||||
LEFT_BRACE = 623,
|
||||
RIGHT_BRACE = 624,
|
||||
DOT = 625,
|
||||
COMMA = 626,
|
||||
COLON = 627,
|
||||
EQUAL = 628,
|
||||
SEMICOLON = 629,
|
||||
BANG = 630,
|
||||
DASH = 631,
|
||||
TILDE = 632,
|
||||
PLUS = 633,
|
||||
STAR = 634,
|
||||
SLASH = 635,
|
||||
PERCENT = 636,
|
||||
LEFT_ANGLE = 637,
|
||||
RIGHT_ANGLE = 638,
|
||||
VERTICAL_BAR = 639,
|
||||
CARET = 640,
|
||||
AMPERSAND = 641,
|
||||
QUESTION = 642,
|
||||
INVARIANT = 643,
|
||||
PRECISE = 644,
|
||||
HIGH_PRECISION = 645,
|
||||
MEDIUM_PRECISION = 646,
|
||||
LOW_PRECISION = 647,
|
||||
PRECISION = 648,
|
||||
PACKED = 649,
|
||||
RESOURCE = 650,
|
||||
SUPERP = 651
|
||||
PERPRIMITIVENV = 378,
|
||||
PERVIEWNV = 379,
|
||||
PERTASKNV = 380,
|
||||
MAT2X2 = 381,
|
||||
MAT2X3 = 382,
|
||||
MAT2X4 = 383,
|
||||
MAT3X2 = 384,
|
||||
MAT3X3 = 385,
|
||||
MAT3X4 = 386,
|
||||
MAT4X2 = 387,
|
||||
MAT4X3 = 388,
|
||||
MAT4X4 = 389,
|
||||
DMAT2X2 = 390,
|
||||
DMAT2X3 = 391,
|
||||
DMAT2X4 = 392,
|
||||
DMAT3X2 = 393,
|
||||
DMAT3X3 = 394,
|
||||
DMAT3X4 = 395,
|
||||
DMAT4X2 = 396,
|
||||
DMAT4X3 = 397,
|
||||
DMAT4X4 = 398,
|
||||
F16MAT2X2 = 399,
|
||||
F16MAT2X3 = 400,
|
||||
F16MAT2X4 = 401,
|
||||
F16MAT3X2 = 402,
|
||||
F16MAT3X3 = 403,
|
||||
F16MAT3X4 = 404,
|
||||
F16MAT4X2 = 405,
|
||||
F16MAT4X3 = 406,
|
||||
F16MAT4X4 = 407,
|
||||
F32MAT2X2 = 408,
|
||||
F32MAT2X3 = 409,
|
||||
F32MAT2X4 = 410,
|
||||
F32MAT3X2 = 411,
|
||||
F32MAT3X3 = 412,
|
||||
F32MAT3X4 = 413,
|
||||
F32MAT4X2 = 414,
|
||||
F32MAT4X3 = 415,
|
||||
F32MAT4X4 = 416,
|
||||
F64MAT2X2 = 417,
|
||||
F64MAT2X3 = 418,
|
||||
F64MAT2X4 = 419,
|
||||
F64MAT3X2 = 420,
|
||||
F64MAT3X3 = 421,
|
||||
F64MAT3X4 = 422,
|
||||
F64MAT4X2 = 423,
|
||||
F64MAT4X3 = 424,
|
||||
F64MAT4X4 = 425,
|
||||
ATOMIC_UINT = 426,
|
||||
SAMPLER1D = 427,
|
||||
SAMPLER2D = 428,
|
||||
SAMPLER3D = 429,
|
||||
SAMPLERCUBE = 430,
|
||||
SAMPLER1DSHADOW = 431,
|
||||
SAMPLER2DSHADOW = 432,
|
||||
SAMPLERCUBESHADOW = 433,
|
||||
SAMPLER1DARRAY = 434,
|
||||
SAMPLER2DARRAY = 435,
|
||||
SAMPLER1DARRAYSHADOW = 436,
|
||||
SAMPLER2DARRAYSHADOW = 437,
|
||||
ISAMPLER1D = 438,
|
||||
ISAMPLER2D = 439,
|
||||
ISAMPLER3D = 440,
|
||||
ISAMPLERCUBE = 441,
|
||||
ISAMPLER1DARRAY = 442,
|
||||
ISAMPLER2DARRAY = 443,
|
||||
USAMPLER1D = 444,
|
||||
USAMPLER2D = 445,
|
||||
USAMPLER3D = 446,
|
||||
USAMPLERCUBE = 447,
|
||||
USAMPLER1DARRAY = 448,
|
||||
USAMPLER2DARRAY = 449,
|
||||
SAMPLER2DRECT = 450,
|
||||
SAMPLER2DRECTSHADOW = 451,
|
||||
ISAMPLER2DRECT = 452,
|
||||
USAMPLER2DRECT = 453,
|
||||
SAMPLERBUFFER = 454,
|
||||
ISAMPLERBUFFER = 455,
|
||||
USAMPLERBUFFER = 456,
|
||||
SAMPLERCUBEARRAY = 457,
|
||||
SAMPLERCUBEARRAYSHADOW = 458,
|
||||
ISAMPLERCUBEARRAY = 459,
|
||||
USAMPLERCUBEARRAY = 460,
|
||||
SAMPLER2DMS = 461,
|
||||
ISAMPLER2DMS = 462,
|
||||
USAMPLER2DMS = 463,
|
||||
SAMPLER2DMSARRAY = 464,
|
||||
ISAMPLER2DMSARRAY = 465,
|
||||
USAMPLER2DMSARRAY = 466,
|
||||
SAMPLEREXTERNALOES = 467,
|
||||
F16SAMPLER1D = 468,
|
||||
F16SAMPLER2D = 469,
|
||||
F16SAMPLER3D = 470,
|
||||
F16SAMPLER2DRECT = 471,
|
||||
F16SAMPLERCUBE = 472,
|
||||
F16SAMPLER1DARRAY = 473,
|
||||
F16SAMPLER2DARRAY = 474,
|
||||
F16SAMPLERCUBEARRAY = 475,
|
||||
F16SAMPLERBUFFER = 476,
|
||||
F16SAMPLER2DMS = 477,
|
||||
F16SAMPLER2DMSARRAY = 478,
|
||||
F16SAMPLER1DSHADOW = 479,
|
||||
F16SAMPLER2DSHADOW = 480,
|
||||
F16SAMPLER1DARRAYSHADOW = 481,
|
||||
F16SAMPLER2DARRAYSHADOW = 482,
|
||||
F16SAMPLER2DRECTSHADOW = 483,
|
||||
F16SAMPLERCUBESHADOW = 484,
|
||||
F16SAMPLERCUBEARRAYSHADOW = 485,
|
||||
SAMPLER = 486,
|
||||
SAMPLERSHADOW = 487,
|
||||
TEXTURE1D = 488,
|
||||
TEXTURE2D = 489,
|
||||
TEXTURE3D = 490,
|
||||
TEXTURECUBE = 491,
|
||||
TEXTURE1DARRAY = 492,
|
||||
TEXTURE2DARRAY = 493,
|
||||
ITEXTURE1D = 494,
|
||||
ITEXTURE2D = 495,
|
||||
ITEXTURE3D = 496,
|
||||
ITEXTURECUBE = 497,
|
||||
ITEXTURE1DARRAY = 498,
|
||||
ITEXTURE2DARRAY = 499,
|
||||
UTEXTURE1D = 500,
|
||||
UTEXTURE2D = 501,
|
||||
UTEXTURE3D = 502,
|
||||
UTEXTURECUBE = 503,
|
||||
UTEXTURE1DARRAY = 504,
|
||||
UTEXTURE2DARRAY = 505,
|
||||
TEXTURE2DRECT = 506,
|
||||
ITEXTURE2DRECT = 507,
|
||||
UTEXTURE2DRECT = 508,
|
||||
TEXTUREBUFFER = 509,
|
||||
ITEXTUREBUFFER = 510,
|
||||
UTEXTUREBUFFER = 511,
|
||||
TEXTURECUBEARRAY = 512,
|
||||
ITEXTURECUBEARRAY = 513,
|
||||
UTEXTURECUBEARRAY = 514,
|
||||
TEXTURE2DMS = 515,
|
||||
ITEXTURE2DMS = 516,
|
||||
UTEXTURE2DMS = 517,
|
||||
TEXTURE2DMSARRAY = 518,
|
||||
ITEXTURE2DMSARRAY = 519,
|
||||
UTEXTURE2DMSARRAY = 520,
|
||||
F16TEXTURE1D = 521,
|
||||
F16TEXTURE2D = 522,
|
||||
F16TEXTURE3D = 523,
|
||||
F16TEXTURE2DRECT = 524,
|
||||
F16TEXTURECUBE = 525,
|
||||
F16TEXTURE1DARRAY = 526,
|
||||
F16TEXTURE2DARRAY = 527,
|
||||
F16TEXTURECUBEARRAY = 528,
|
||||
F16TEXTUREBUFFER = 529,
|
||||
F16TEXTURE2DMS = 530,
|
||||
F16TEXTURE2DMSARRAY = 531,
|
||||
SUBPASSINPUT = 532,
|
||||
SUBPASSINPUTMS = 533,
|
||||
ISUBPASSINPUT = 534,
|
||||
ISUBPASSINPUTMS = 535,
|
||||
USUBPASSINPUT = 536,
|
||||
USUBPASSINPUTMS = 537,
|
||||
F16SUBPASSINPUT = 538,
|
||||
F16SUBPASSINPUTMS = 539,
|
||||
IMAGE1D = 540,
|
||||
IIMAGE1D = 541,
|
||||
UIMAGE1D = 542,
|
||||
IMAGE2D = 543,
|
||||
IIMAGE2D = 544,
|
||||
UIMAGE2D = 545,
|
||||
IMAGE3D = 546,
|
||||
IIMAGE3D = 547,
|
||||
UIMAGE3D = 548,
|
||||
IMAGE2DRECT = 549,
|
||||
IIMAGE2DRECT = 550,
|
||||
UIMAGE2DRECT = 551,
|
||||
IMAGECUBE = 552,
|
||||
IIMAGECUBE = 553,
|
||||
UIMAGECUBE = 554,
|
||||
IMAGEBUFFER = 555,
|
||||
IIMAGEBUFFER = 556,
|
||||
UIMAGEBUFFER = 557,
|
||||
IMAGE1DARRAY = 558,
|
||||
IIMAGE1DARRAY = 559,
|
||||
UIMAGE1DARRAY = 560,
|
||||
IMAGE2DARRAY = 561,
|
||||
IIMAGE2DARRAY = 562,
|
||||
UIMAGE2DARRAY = 563,
|
||||
IMAGECUBEARRAY = 564,
|
||||
IIMAGECUBEARRAY = 565,
|
||||
UIMAGECUBEARRAY = 566,
|
||||
IMAGE2DMS = 567,
|
||||
IIMAGE2DMS = 568,
|
||||
UIMAGE2DMS = 569,
|
||||
IMAGE2DMSARRAY = 570,
|
||||
IIMAGE2DMSARRAY = 571,
|
||||
UIMAGE2DMSARRAY = 572,
|
||||
F16IMAGE1D = 573,
|
||||
F16IMAGE2D = 574,
|
||||
F16IMAGE3D = 575,
|
||||
F16IMAGE2DRECT = 576,
|
||||
F16IMAGECUBE = 577,
|
||||
F16IMAGE1DARRAY = 578,
|
||||
F16IMAGE2DARRAY = 579,
|
||||
F16IMAGECUBEARRAY = 580,
|
||||
F16IMAGEBUFFER = 581,
|
||||
F16IMAGE2DMS = 582,
|
||||
F16IMAGE2DMSARRAY = 583,
|
||||
STRUCT = 584,
|
||||
VOID = 585,
|
||||
WHILE = 586,
|
||||
IDENTIFIER = 587,
|
||||
TYPE_NAME = 588,
|
||||
FLOATCONSTANT = 589,
|
||||
DOUBLECONSTANT = 590,
|
||||
INT16CONSTANT = 591,
|
||||
UINT16CONSTANT = 592,
|
||||
INT32CONSTANT = 593,
|
||||
UINT32CONSTANT = 594,
|
||||
INTCONSTANT = 595,
|
||||
UINTCONSTANT = 596,
|
||||
INT64CONSTANT = 597,
|
||||
UINT64CONSTANT = 598,
|
||||
BOOLCONSTANT = 599,
|
||||
FLOAT16CONSTANT = 600,
|
||||
LEFT_OP = 601,
|
||||
RIGHT_OP = 602,
|
||||
INC_OP = 603,
|
||||
DEC_OP = 604,
|
||||
LE_OP = 605,
|
||||
GE_OP = 606,
|
||||
EQ_OP = 607,
|
||||
NE_OP = 608,
|
||||
AND_OP = 609,
|
||||
OR_OP = 610,
|
||||
XOR_OP = 611,
|
||||
MUL_ASSIGN = 612,
|
||||
DIV_ASSIGN = 613,
|
||||
ADD_ASSIGN = 614,
|
||||
MOD_ASSIGN = 615,
|
||||
LEFT_ASSIGN = 616,
|
||||
RIGHT_ASSIGN = 617,
|
||||
AND_ASSIGN = 618,
|
||||
XOR_ASSIGN = 619,
|
||||
OR_ASSIGN = 620,
|
||||
SUB_ASSIGN = 621,
|
||||
LEFT_PAREN = 622,
|
||||
RIGHT_PAREN = 623,
|
||||
LEFT_BRACKET = 624,
|
||||
RIGHT_BRACKET = 625,
|
||||
LEFT_BRACE = 626,
|
||||
RIGHT_BRACE = 627,
|
||||
DOT = 628,
|
||||
COMMA = 629,
|
||||
COLON = 630,
|
||||
EQUAL = 631,
|
||||
SEMICOLON = 632,
|
||||
BANG = 633,
|
||||
DASH = 634,
|
||||
TILDE = 635,
|
||||
PLUS = 636,
|
||||
STAR = 637,
|
||||
SLASH = 638,
|
||||
PERCENT = 639,
|
||||
LEFT_ANGLE = 640,
|
||||
RIGHT_ANGLE = 641,
|
||||
VERTICAL_BAR = 642,
|
||||
CARET = 643,
|
||||
AMPERSAND = 644,
|
||||
QUESTION = 645,
|
||||
INVARIANT = 646,
|
||||
PRECISE = 647,
|
||||
HIGH_PRECISION = 648,
|
||||
MEDIUM_PRECISION = 649,
|
||||
LOW_PRECISION = 650,
|
||||
PRECISION = 651,
|
||||
PACKED = 652,
|
||||
RESOURCE = 653,
|
||||
SUPERP = 654
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -482,7 +485,7 @@ union YYSTYPE
|
|||
};
|
||||
} interm;
|
||||
|
||||
#line 486 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
#line 489 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
|
|
|||
|
|
@ -1048,6 +1048,10 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
|
||||
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
|
||||
#endif
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad aggregation op");
|
||||
}
|
||||
|
||||
|
|
@ -1451,6 +1455,16 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
infoSink.debug << "max_vertices = " << vertices << "\n";
|
||||
infoSink.debug << "max_primitives = " << primitives << "\n";
|
||||
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
||||
// Fall through
|
||||
|
||||
case EShLangTaskNV:
|
||||
// Fall through
|
||||
#endif
|
||||
case EShLangCompute:
|
||||
infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n";
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,13 +141,27 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
if (vertices == TQualifier::layoutNotSet)
|
||||
vertices = unit.vertices;
|
||||
else if (vertices != unit.vertices) {
|
||||
if (language == EShLangGeometry)
|
||||
if (language == EShLangGeometry
|
||||
#ifdef NV_EXTENSIONS
|
||||
|| language == EShLangMeshNV
|
||||
#endif
|
||||
)
|
||||
error(infoSink, "Contradictory layout max_vertices values");
|
||||
else if (language == EShLangTessControl)
|
||||
error(infoSink, "Contradictory layout vertices values");
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (primitives == TQualifier::layoutNotSet)
|
||||
primitives = unit.primitives;
|
||||
else if (primitives != unit.primitives) {
|
||||
if (language == EShLangMeshNV)
|
||||
error(infoSink, "Contradictory layout max_primitives values");
|
||||
else
|
||||
assert(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (inputPrimitive == ElgNone)
|
||||
inputPrimitive = unit.inputPrimitive;
|
||||
|
|
@ -266,6 +280,10 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
|
|||
|
||||
// Getting this far means we have two existing trees to merge...
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
numTaskNVBlocks += unit.numTaskNVBlocks;
|
||||
#endif
|
||||
|
||||
// Get the top-level globals of each unit
|
||||
TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence();
|
||||
TIntermSequence& unitGlobals = unit.treeRoot->getAsAggregate()->getSequence();
|
||||
|
|
@ -690,6 +708,22 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
|||
break;
|
||||
case EShLangCompute:
|
||||
break;
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
case EShLangMeshNV:
|
||||
if (outputPrimitive == ElgNone)
|
||||
error(infoSink, "At least one shader must specify an output layout primitive");
|
||||
if (vertices == TQualifier::layoutNotSet)
|
||||
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)");
|
||||
// fall through
|
||||
case EShLangTaskNV:
|
||||
if (numTaskNVBlocks > 1)
|
||||
error(infoSink, "Only one taskNV interface block is allowed per shader");
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
error(infoSink, "Unknown Stage.");
|
||||
break;
|
||||
|
|
@ -960,7 +994,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
return -1;
|
||||
|
||||
int size;
|
||||
if (qualifier.isUniformOrBuffer()) {
|
||||
if (qualifier.isUniformOrBuffer() || qualifier.isTaskMemory()) {
|
||||
if (type.isSizedArray())
|
||||
size = type.getCumulativeArraySize();
|
||||
else
|
||||
|
|
@ -1111,10 +1145,19 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
|
|||
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
|
||||
// TODO: are there valid cases of having an unsized array with a location? If so, running this code too early.
|
||||
TType elementType(type, 0);
|
||||
if (type.isSizedArray())
|
||||
if (type.isSizedArray()
|
||||
#ifdef NV_EXTENSIONS
|
||||
&& !type.getQualifier().isPerView()
|
||||
#endif
|
||||
)
|
||||
return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage);
|
||||
else
|
||||
else {
|
||||
#ifdef NV_EXTENSIONS
|
||||
// unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];"
|
||||
elementType.getQualifier().perViewNV = false;
|
||||
#endif
|
||||
return computeTypeLocationSize(elementType, stage);
|
||||
}
|
||||
}
|
||||
|
||||
// "The locations consumed by block and structure members are determined by applying the rules above
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ public:
|
|||
layoutOverrideCoverage(false),
|
||||
geoPassthroughEXT(false),
|
||||
computeDerivativeMode(LayoutDerivativeNone),
|
||||
primitives(TQualifier::layoutNotSet),
|
||||
numTaskNVBlocks(0),
|
||||
#endif
|
||||
autoMapBindings(false),
|
||||
autoMapLocations(false),
|
||||
|
|
@ -427,6 +429,10 @@ public:
|
|||
int getNumEntryPoints() const { return numEntryPoints; }
|
||||
int getNumErrors() const { return numErrors; }
|
||||
void addPushConstantCount() { ++numPushConstants; }
|
||||
#ifdef NV_EXTENSIONS
|
||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
||||
#endif
|
||||
|
||||
bool isRecursive() const { return recursive; }
|
||||
|
||||
TIntermSymbol* addSymbol(const TVariable&);
|
||||
|
|
@ -636,6 +642,14 @@ public:
|
|||
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
|
||||
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
|
||||
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
|
||||
bool setPrimitives(int m)
|
||||
{
|
||||
if (primitives != TQualifier::layoutNotSet)
|
||||
return primitives == m;
|
||||
primitives = m;
|
||||
return true;
|
||||
}
|
||||
int getPrimitives() const { return primitives; }
|
||||
#endif
|
||||
|
||||
const char* addSemanticName(const TString& name)
|
||||
|
|
@ -740,6 +754,8 @@ protected:
|
|||
bool layoutOverrideCoverage;
|
||||
bool geoPassthroughEXT;
|
||||
ComputeDerivativeMode computeDerivativeMode;
|
||||
int primitives;
|
||||
int numTaskNVBlocks;
|
||||
#endif
|
||||
|
||||
// Base shift values
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue