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:
Sahil Parmar 2018-09-25 13:45:32 -07:00
parent a8453d4bc0
commit 95e2d4ec02
11 changed files with 1345 additions and 1279 deletions

View file

@ -612,7 +612,7 @@ int TParseContext::getIoArrayImplicitSize(bool isPerPrimitive) const
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;
return intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0;
} else {
return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0;
}
@ -3600,6 +3600,13 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))
return;
break;
#ifdef NV_EXTENSIONS
case EShLangMeshNV:
if (qualifier.storage == EvqVaryingOut)
if ((profile == EEsProfile && version >= 320) ||
extensionTurnedOn(E_GL_NV_mesh_shader))
return;
#endif
default:
break;
}
@ -4460,6 +4467,12 @@ void TParseContext::finish()
if (profile != EEsProfile && version < 430)
requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_compute_shader, "compute shaders");
break;
#ifdef NV_EXTENSIONS
case EShLangTaskNV:
case EShLangMeshNV:
requireExtensions(getCurrentLoc(), 1, &E_GL_NV_mesh_shader, "mesh shaders");
break;
#endif
default:
break;
}
@ -4963,12 +4976,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
#ifdef NV_EXTENSIONS
case EShLangMeshNV:
if (id == "max_vertices") {
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "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") {
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "max_primitives");
publicType.shaderQualifiers.primitives = value;
if (value > resources.maxMeshOutputPrimitivesNV)
error(loc, "too large, must be less than gl_MaxMeshOutputPrimitivesNV", "max_primitives", "");
@ -4983,7 +4998,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
if (id.compare(0, 11, "local_size_") == 0) {
#ifdef NV_EXTENSIONS
if (language == EShLangMeshNV || language == EShLangTaskNV) {
profileRequires(loc, ~EEsProfile, 450, E_GL_NV_mesh_shader, "gl_WorkGroupSize");
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize");
}
else
#endif