summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2016-05-20 15:17:37 -0700
committerKenneth Graunke <kenneth@whitecape.org>2016-08-07 23:47:55 -0700
commitd0642c52fce91936443ea64ebbc2719813b95aae (patch)
tree7e0a882df6183c8fa4c11b52cd696d71b798f3ab /src/compiler
parent3fb4a9b3b3ef034a3317529197041c25831df286 (diff)
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>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/builtin_variables.cpp6
-rw-r--r--src/compiler/glsl/glsl_parser.yy19
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h5
3 files changed, 12 insertions, 18 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index f63dc3a0b16..20d1d75f596 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -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);
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 3885688d9b8..61c4723eac8 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -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");
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index cca7fa8e0ee..f9c1ffca842 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -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);