glsl: Add a has_tessellation_shader() helper.

Similar to has_geometry_shader(), has_compute_shader(), and so on.
This will make it easier to add more conditions here later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
This commit is contained in:
Kenneth Graunke
2016-05-20 15:17:37 -07:00
parent 3fb4a9b3b3
commit d0642c52fc
3 changed files with 12 additions and 18 deletions

View File

@@ -861,8 +861,7 @@ builtin_variable_generator::generate_constants()
state->Const.MaxImageSamples);
}
if (state->is_version(400, 0) ||
state->ARB_tessellation_shader_enable) {
if (state->has_tessellation_shader()) {
add_const("gl_MaxTessControlImageUniforms",
state->Const.MaxTessControlImageUniforms);
add_const("gl_MaxTessEvaluationImageUniforms",
@@ -880,8 +879,7 @@ builtin_variable_generator::generate_constants()
state->ARB_viewport_array_enable)
add_const("gl_MaxViewports", state->Const.MaxViewports);
if (state->is_version(400, 0) ||
state->ARB_tessellation_shader_enable) {
if (state->has_tessellation_shader()) {
add_const("gl_MaxPatchVertices", state->Const.MaxPatchVertices);
add_const("gl_MaxTessGenLevel", state->Const.MaxTessGenLevel);
add_const("gl_MaxTessControlInputComponents", state->Const.MaxTessControlInputComponents);

View File

@@ -1390,9 +1390,7 @@ layout_qualifier_id:
}
}
if ($$.flags.i &&
!state->ARB_tessellation_shader_enable &&
!state->is_version(400, 0)) {
if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"primitive mode qualifier `%s' requires "
"GLSL 4.00 or ARB_tessellation_shader", $1);
@@ -1415,9 +1413,7 @@ layout_qualifier_id:
}
}
if ($$.flags.i &&
!state->ARB_tessellation_shader_enable &&
!state->is_version(400, 0)) {
if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"vertex spacing qualifier `%s' requires "
"GLSL 4.00 or ARB_tessellation_shader", $1);
@@ -1432,9 +1428,7 @@ layout_qualifier_id:
$$.ordering = GL_CCW;
}
if ($$.flags.i &&
!state->ARB_tessellation_shader_enable &&
!state->is_version(400, 0)) {
if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"ordering qualifier `%s' requires "
"GLSL 4.00 or ARB_tessellation_shader", $1);
@@ -1446,9 +1440,7 @@ layout_qualifier_id:
$$.point_mode = true;
}
if ($$.flags.i &&
!state->ARB_tessellation_shader_enable &&
!state->is_version(400, 0)) {
if ($$.flags.i && !state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"qualifier `point_mode' requires "
"GLSL 4.00 or ARB_tessellation_shader");
@@ -1608,8 +1600,7 @@ layout_qualifier_id:
if (match_layout_qualifier("vertices", $1, state) == 0) {
$$.flags.q.vertices = 1;
$$.vertices = new(ctx) ast_layout_expression(@1, $3);
if (!state->ARB_tessellation_shader_enable &&
!state->is_version(400, 0)) {
if (!state->has_tessellation_shader()) {
_mesa_glsl_error(& @1, state,
"vertices qualifier requires GLSL 4.00 or "
"ARB_tessellation_shader");

View File

@@ -277,6 +277,11 @@ struct _mesa_glsl_parse_state {
return OES_geometry_shader_enable || is_version(150, 320);
}
bool has_tessellation_shader() const
{
return ARB_tessellation_shader_enable || is_version(400, 0);
}
bool has_clip_distance() const
{
return EXT_clip_cull_distance_enable || is_version(130, 0);