[Mesa-dev] [PATCH 06/21] glsl: Use accessors for ir_variable::warn_extension

Ian Romanick idr at freedesktop.org
Tue May 27 19:49:01 PDT 2014


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

The payoff for this will come in the next patch.

No change in the peak ir_variable memory usage in a trimmed apitrace of
dota2 on 64-bit.

No change in the peak ir_variable memory usage in a trimmed apitrace of
dota2 on 32-bit.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/builtin_variables.cpp |  4 ++--
 src/glsl/ir.cpp                | 11 +++++++++++
 src/glsl/ir.h                  | 22 +++++++++++++++++-----
 3 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 9b35850..1461953 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -913,14 +913,14 @@ builtin_variable_generator::generate_fs_special_vars()
       ir_variable *const var =
          add_output(FRAG_RESULT_STENCIL, int_t, "gl_FragStencilRefARB");
       if (state->ARB_shader_stencil_export_warn)
-         var->warn_extension = "GL_ARB_shader_stencil_export";
+         var->enable_extension_warning("GL_ARB_shader_stencil_export");
    }
 
    if (state->AMD_shader_stencil_export_enable) {
       ir_variable *const var =
          add_output(FRAG_RESULT_STENCIL, int_t, "gl_FragStencilRefAMD");
       if (state->AMD_shader_stencil_export_warn)
-         var->warn_extension = "GL_AMD_shader_stencil_export";
+         var->enable_extension_warning("GL_AMD_shader_stencil_export");
    }
 
    if (state->ARB_sample_shading_enable) {
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index c727d89..3d6af56 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1610,6 +1610,17 @@ ir_variable::determine_interpolation_mode(bool flat_shade)
       return INTERP_QUALIFIER_SMOOTH;
 }
 
+void
+ir_variable::enable_extension_warning(const char *extension)
+{
+   this->warn_extension = extension;
+}
+
+const char *
+ir_variable::get_extension_warning() const
+{
+   return this->warn_extension;
+}
 
 ir_function_signature::ir_function_signature(const glsl_type *return_type,
                                              builtin_available_predicate b)
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index fac24df..3298a50 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -501,6 +501,18 @@ public:
    }
 
    /**
+    * Enable emitting extension warnings for this variable
+    */
+   void enable_extension_warning(const char *extension);
+
+   /**
+    * Get the extension warning string for this variable
+    *
+    * If warnings are not enabled, \c NULL is returned.
+    */
+   const char *get_extension_warning() const;
+
+   /**
     * Declared type of the variable
     */
    const struct glsl_type *type;
@@ -740,11 +752,6 @@ public:
    /*@}*/
 
    /**
-    * Emit a warning if this variable is accessed.
-    */
-   const char *warn_extension;
-
-   /**
     * Value assigned in the initializer of a variable declared "const"
     */
    ir_constant *constant_value;
@@ -767,6 +774,11 @@ private:
     * \sa ir_variable::location
     */
    const glsl_type *interface_type;
+
+   /**
+    * Emit a warning if this variable is accessed.
+    */
+   const char *warn_extension;
 };
 
 /**
-- 
1.8.1.4



More information about the mesa-dev mailing list