Fix incorrect parse message of mesh shader

When GL_EXT_mesh_shader is enabled, the check of layout qualifiers
'max_vertices' and 'max_primitives' should use
gl_MaxMeshOutputVerticesEXT and gl_MaxMeshOutputPrimitivesEXT.
This commit is contained in:
Rex Xu 2022-10-11 15:01:35 +08:00
parent 89db4e1caa
commit 17b0a21877

View file

@ -5973,8 +5973,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
if (id == "max_vertices") { if (id == "max_vertices") {
requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "max_vertices"); requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "max_vertices");
publicType.shaderQualifiers.vertices = value; publicType.shaderQualifiers.vertices = value;
if (value > resources.maxMeshOutputVerticesNV) int max = extensionTurnedOn(E_GL_EXT_mesh_shader) ? resources.maxMeshOutputVerticesEXT
error(loc, "too large, must be less than gl_MaxMeshOutputVerticesNV", "max_vertices", ""); : resources.maxMeshOutputVerticesNV;
if (value > max) {
TString maxsErrtring = "too large, must be less than ";
maxsErrtring.append(extensionTurnedOn(E_GL_EXT_mesh_shader) ? "gl_MaxMeshOutputVerticesEXT"
: "gl_MaxMeshOutputVerticesNV");
error(loc, maxsErrtring.c_str(), "max_vertices", "");
}
if (nonLiteral) if (nonLiteral)
error(loc, "needs a literal integer", "max_vertices", ""); error(loc, "needs a literal integer", "max_vertices", "");
return; return;
@ -5982,8 +5988,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
if (id == "max_primitives") { if (id == "max_primitives") {
requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "max_primitives"); requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "max_primitives");
publicType.shaderQualifiers.primitives = value; publicType.shaderQualifiers.primitives = value;
if (value > resources.maxMeshOutputPrimitivesNV) int max = extensionTurnedOn(E_GL_EXT_mesh_shader) ? resources.maxMeshOutputPrimitivesEXT
error(loc, "too large, must be less than gl_MaxMeshOutputPrimitivesNV", "max_primitives", ""); : resources.maxMeshOutputPrimitivesNV;
if (value > max) {
TString maxsErrtring = "too large, must be less than ";
maxsErrtring.append(extensionTurnedOn(E_GL_EXT_mesh_shader) ? "gl_MaxMeshOutputPrimitivesEXT"
: "gl_MaxMeshOutputPrimitivesNV");
error(loc, maxsErrtring.c_str(), "max_primitives", "");
}
if (nonLiteral) if (nonLiteral)
error(loc, "needs a literal integer", "max_primitives", ""); error(loc, "needs a literal integer", "max_primitives", "");
return; return;