Add ES 320 support and additional error checks for SPV_NV_mesh_shader
- Add ES 320 support - Error out use of perprimitiveNV for non mesh/fragment shaders - Error out use of mesh/task shaders w/o use of NV_mesh_shader - Error out use of NV_mesh_shader for non task/mesh shaders - Error out use of perviewNV for non mesh shaders - Error out use of taskNV for non mesh/task shaders - Add test case for mesh shader with ES 320 profile
This commit is contained in:
parent
a8453d4bc0
commit
95e2d4ec02
11 changed files with 1345 additions and 1279 deletions
|
|
@ -4878,7 +4878,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"void barrier();"
|
||||
);
|
||||
#ifdef NV_EXTENSIONS
|
||||
if ((profile != EEsProfile && version >= 450) || esBarrier) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void barrier();"
|
||||
);
|
||||
|
|
@ -4903,7 +4903,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
);
|
||||
}
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void memoryBarrierShared();"
|
||||
"void groupMemoryBarrier();"
|
||||
|
|
@ -5094,7 +5094,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
}
|
||||
|
||||
// Builtins for GL_NV_mesh_shader
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"void writePackedPrimitiveIndices4x8NV(uint, uint);"
|
||||
"\n");
|
||||
|
|
@ -5287,7 +5287,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
// per-vertex attributes
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"out gl_MeshPerVertexNV {"
|
||||
|
|
@ -5328,17 +5328,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"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;"
|
||||
|
||||
|
|
@ -5350,15 +5341,28 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
"in highp uvec3 gl_GlobalInvocationID;"
|
||||
"in highp uint gl_LocalInvocationIndex;"
|
||||
|
||||
"\n");
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
stageBuiltins[EShLangMeshNV].append(
|
||||
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
|
||||
"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters
|
||||
"\n");
|
||||
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"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;"
|
||||
"\n");
|
||||
|
||||
stageBuiltins[EShLangTaskNV].append(
|
||||
"in int gl_DrawID;"
|
||||
);
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -7658,7 +7662,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
|||
|
||||
#ifdef NV_EXTENSIONS
|
||||
// SPV_NV_mesh_shader
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV);
|
||||
s.append(builtInConstant);
|
||||
|
||||
|
|
@ -8633,7 +8637,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
}
|
||||
break;
|
||||
case EShLangMeshNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
// Per-vertex builtins
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_Position", EbvPosition, symbolTable);
|
||||
BuiltInVariable("gl_MeshVerticesNV", "gl_PointSize", EbvPointSize, symbolTable);
|
||||
|
|
@ -8681,7 +8685,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
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);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
// GL_EXT_device_group
|
||||
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
|
||||
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
|
||||
|
|
@ -8743,7 +8749,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
break;
|
||||
|
||||
case EShLangTaskNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
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);
|
||||
|
|
@ -8763,7 +8769,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
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);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
// GL_EXT_device_group
|
||||
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
|
||||
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
|
||||
|
|
@ -9379,12 +9387,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
}
|
||||
break;
|
||||
case EShLangMeshNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
symbolTable.relateToOperator("writePackedPrimitiveIndices4x8NV", EOpWritePackedPrimitiveIndices4x8NV);
|
||||
}
|
||||
// fall through
|
||||
case EShLangTaskNV:
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
|
||||
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
|
||||
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue