summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-04-28 13:15:46 -0700
committerIan Romanick <[email protected]>2015-05-04 13:49:58 -0700
commit6c9c317cafdaefdec01389778fd96300022c37ab (patch)
tree140c89290efbb9c6f8773f03dffa277707158f6b /src/glsl
parentfa3475b26931fceeeda7ee7f5ffa61927aacaafb (diff)
glsl: Add glsl_parser_state::has_atomic_counters helper
v2: Change GL version from 400 to 420. Noticed by Tapani and Ilia. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/builtin_functions.cpp2
-rw-r--r--src/glsl/builtin_types.cpp2
-rw-r--r--src/glsl/builtin_variables.cpp2
-rw-r--r--src/glsl/glsl_parser.yy4
-rw-r--r--src/glsl/glsl_parser_extras.h5
5 files changed, 10 insertions, 5 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 524b8d6e8b9..5ce811289d1 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -359,7 +359,7 @@ tex3d_lod(const _mesa_glsl_parse_state *state)
static bool
shader_atomic_counters(const _mesa_glsl_parse_state *state)
{
- return state->ARB_shader_atomic_counters_enable;
+ return state->has_atomic_counters();
}
static bool
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
index fef86df28f7..d92e2eb3007 100644
--- a/src/glsl/builtin_types.cpp
+++ b/src/glsl/builtin_types.cpp
@@ -372,7 +372,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::uimage2DMSArray_type);
}
- if (state->ARB_shader_atomic_counters_enable) {
+ if (state->has_atomic_counters()) {
add_type(symbols, glsl_type::atomic_uint_type);
}
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 21e7331c767..9d0b27209e7 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -653,7 +653,7 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxTextureCoords", state->Const.MaxTextureCoords);
}
- if (state->ARB_shader_atomic_counters_enable) {
+ if (state->has_atomic_counters()) {
add_const("gl_MaxVertexAtomicCounters",
state->Const.MaxVertexAtomicCounters);
add_const("gl_MaxGeometryAtomicCounters",
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index a3ba3f6d0ff..3ce9e103f20 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1425,13 +1425,13 @@ layout_qualifier_id:
}
if ((state->ARB_shading_language_420pack_enable ||
- state->ARB_shader_atomic_counters_enable) &&
+ state->has_atomic_counters()) &&
match_layout_qualifier("binding", $1, state) == 0) {
$$.flags.q.explicit_binding = 1;
$$.binding = $3;
}
- if (state->ARB_shader_atomic_counters_enable &&
+ if (state->has_atomic_counters() &&
match_layout_qualifier("offset", $1, state) == 0) {
$$.flags.q.explicit_offset = 1;
$$.offset = $3;
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 3c47aab7b36..51f2bf5e000 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -186,6 +186,11 @@ struct _mesa_glsl_parse_state {
return true;
}
+ bool has_atomic_counters() const
+ {
+ return ARB_shader_atomic_counters_enable || is_version(420, 0);
+ }
+
bool has_explicit_attrib_stream() const
{
return ARB_gpu_shader5_enable || is_version(400, 0);