[Mesa-dev] [PATCH 06/20] glsl: Add glsl_parser_state::has_atomic_counters helper

Ian Romanick idr at freedesktop.org
Wed Apr 29 16:25:57 PDT 2015


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/builtin_functions.cpp | 2 +-
 src/glsl/builtin_types.cpp     | 2 +-
 src/glsl/builtin_variables.cpp | 2 +-
 src/glsl/glsl_parser.yy        | 4 ++--
 src/glsl/glsl_parser_extras.h  | 5 +++++
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 524b8d6..5ce8112 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 fef86df..d92e2eb 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 21e7331..9d0b272 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 aceb3b9..b34d7ef 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1404,13 +1404,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 dae7864..382c200 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(400, 0);
+   }
+
    bool has_explicit_attrib_stream() const
    {
       return ARB_gpu_shader5_enable || is_version(400, 0);
-- 
2.1.0



More information about the mesa-dev mailing list