[Mesa-dev] [PATCH] linker: Remove unnecessary overload of program_resource_visitor::visit_field

Ian Romanick idr at freedesktop.org
Wed Nov 9 21:22:46 UTC 2016


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

It looks like I added this version as a short-hand for users that didn't
need the fuller version.  I don't think there's any real utility in
that.  I'm not sure what my thinking was there.  Maybe if those users
overloaded the recursion function could just call the compact version to
avoid passing some parameters?  None of the users do that.

Either way, having this extra overload is not useful.  Delete it.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/glsl/link_uniform_blocks.cpp | 20 ++++++--------------
 src/compiler/glsl/link_uniforms.cpp       | 21 ++++-----------------
 src/compiler/glsl/link_varyings.cpp       |  7 ++++---
 src/compiler/glsl/linker.h                | 14 +-------------
 src/mesa/program/ir_to_mesa.cpp           | 11 +++++++----
 5 files changed, 22 insertions(+), 51 deletions(-)

diff --git a/src/compiler/glsl/link_uniform_blocks.cpp b/src/compiler/glsl/link_uniform_blocks.cpp
index 1fc0e2d..a73b2d2 100644
--- a/src/compiler/glsl/link_uniform_blocks.cpp
+++ b/src/compiler/glsl/link_uniform_blocks.cpp
@@ -60,15 +60,6 @@ public:
    struct gl_shader_program *prog;
 
 private:
-   virtual void visit_field(const glsl_type *type, const char *name,
-                            bool row_major)
-   {
-      (void) type;
-      (void) name;
-      (void) row_major;
-      assert(!"Should not get here.");
-   }
-
    virtual void enter_record(const glsl_type *type, const char *,
                              bool row_major, const enum glsl_interface_packing packing) {
       assert(type->is_record());
@@ -191,12 +182,13 @@ public:
    unsigned num_active_uniforms;
 
 private:
-   virtual void visit_field(const glsl_type *type, const char *name,
-                            bool row_major)
+   virtual void visit_field(const glsl_type * /* type */,
+                            const char * /* name */,
+                            bool /* row_major */,
+                            const glsl_type * /* record_type */,
+                            const enum glsl_interface_packing,
+                            bool /* last_field */)
    {
-      (void) type;
-      (void) name;
-      (void) row_major;
       this->num_active_uniforms++;
    }
 };
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index 54adbdf..40347ac 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -225,16 +225,6 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
 }
 
 void
-program_resource_visitor::visit_field(const glsl_type *type, const char *name,
-                                      bool row_major,
-                                      const glsl_type *,
-                                      const enum glsl_interface_packing,
-                                      bool /* last_field */)
-{
-   visit_field(type, name, row_major);
-}
-
-void
 program_resource_visitor::visit_field(const glsl_struct_field *)
 {
 }
@@ -345,7 +335,10 @@ public:
 
 private:
    virtual void visit_field(const glsl_type *type, const char *name,
-                            bool /* row_major */)
+                            bool /* row_major */,
+                            const glsl_type * /* record_type */,
+                            const enum glsl_interface_packing,
+                            bool /* last_field */)
    {
       assert(!type->without_array()->is_record());
       assert(!type->without_array()->is_interface());
@@ -648,12 +641,6 @@ private:
       this->record_array_count = record_array_count;
    }
 
-   virtual void visit_field(const glsl_type *, const char *,
-                            bool /* row_major */)
-   {
-      assert(!"Should not get here.");
-   }
-
    virtual void enter_record(const glsl_type *type, const char *,
                              bool row_major,
                              const enum glsl_interface_packing packing)
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index e622b3e..e39ccc5 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1786,13 +1786,14 @@ public:
 
 private:
    virtual void visit_field(const glsl_type *type, const char *name,
-                            bool row_major)
+                            bool /* row_major */,
+                            const glsl_type * /* record_type */,
+                            const enum glsl_interface_packing,
+                            bool /* last_field */)
    {
       assert(!type->without_array()->is_record());
       assert(!type->without_array()->is_interface());
 
-      (void) row_major;
-
       tfeedback_candidate *candidate
          = rzalloc(this->mem_ctx, tfeedback_candidate);
       candidate->toplevel_var = this->toplevel_var;
diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h
index 420abf9..d30aeda 100644
--- a/src/compiler/glsl/linker.h
+++ b/src/compiler/glsl/linker.h
@@ -145,23 +145,11 @@ protected:
     * \param last_field   Set if \c name is the last field of the structure
     *                     containing it.  This will always be false for items
     *                     not contained in a structure or interface block.
-    *
-    * The default implementation just calls the other \c visit_field method.
     */
    virtual void visit_field(const glsl_type *type, const char *name,
                             bool row_major, const glsl_type *record_type,
                             const enum glsl_interface_packing packing,
-                            bool last_field);
-
-   /**
-    * Method invoked for each leaf of the variable
-    *
-    * \param type  Type of the field.
-    * \param name  Fully qualified name of the field.
-    * \param row_major  For a matrix type, is it stored row-major.
-    */
-   virtual void visit_field(const glsl_type *type, const char *name,
-                            bool row_major) = 0;
+                            bool last_field) = 0;
 
    /**
     * Visit a record before visiting its fields
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index f4c2ad6..6a1a977 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2381,7 +2381,9 @@ public:
 
 private:
    virtual void visit_field(const glsl_type *type, const char *name,
-                            bool row_major);
+                            bool row_major, const glsl_type *record_type,
+                            const enum glsl_interface_packing packing,
+                            bool last_field);
 
    struct gl_shader_program *shader_program;
    struct gl_program_parameter_list *params;
@@ -2393,12 +2395,13 @@ private:
 
 void
 add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
-                                   bool row_major)
+                                   bool /* row_major */,
+                                   const glsl_type * /* record_type */,
+                                   const enum glsl_interface_packing,
+                                   bool /* last_field */)
 {
    unsigned int size;
 
-   (void) row_major;
-
    /* atomics don't get real storage */
    if (type->contains_atomic())
       return;
-- 
2.5.5



More information about the mesa-dev mailing list