[Mesa-dev] [PATCH 05/14] i965: Merge variable hashtables of fs and vec4 visitors

Topi Pohjolainen topi.pohjolainen at intel.com
Wed May 28 05:36:01 PDT 2014


Now empty destructors are dropped allowing compiler to generate the
defaults (calling base class).

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.h             | 2 --
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 8 --------
 src/mesa/drivers/dri/i965/brw_shader.cpp       | 5 ++++-
 src/mesa/drivers/dri/i965/brw_shader.h         | 2 ++
 src/mesa/drivers/dri/i965/brw_vec4.h           | 3 ---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 9 ---------
 6 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 9581f41..184725c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -250,7 +250,6 @@ public:
               struct gl_shader_program *shader_prog,
               struct gl_fragment_program *fp,
               unsigned dispatch_width);
-   ~fs_visitor();
 
    fs_reg *variable_storage(ir_variable *var);
    int virtual_grf_alloc(int size);
@@ -522,7 +521,6 @@ public:
     */
    int *push_constant_loc;
 
-   struct hash_table *variable_ht;
    fs_reg frag_depth;
    fs_reg sample_mask;
    fs_reg outputs[BRW_MAX_DRAW_BUFFERS];
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index f0715bc..d4e02d2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2973,9 +2973,6 @@ fs_visitor::fs_visitor(struct brw_context *brw,
    this->failed = false;
    this->simd16_unsupported = false;
    this->no16_msg = NULL;
-   this->variable_ht = hash_table_ctor(0,
-                                       hash_table_pointer_hash,
-                                       hash_table_pointer_compare);
 
    memset(&this->payload, 0, sizeof(this->payload));
    memset(this->outputs, 0, sizeof(this->outputs));
@@ -3008,8 +3005,3 @@ fs_visitor::fs_visitor(struct brw_context *brw,
    if (dispatch_width == 8)
       this->param_size = rzalloc_array(mem_ctx, int, stage_prog_data->nr_params);
 }
-
-fs_visitor::~fs_visitor()
-{
-   hash_table_dtor(this->variable_ht);
-}
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 6b9c0b7..c73fa8b 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -552,7 +552,10 @@ backend_emitter::backend_emitter(struct brw_context *brw, void *mem_ctx)
    : brw(brw),
      ctx(&brw->ctx),
      mem_ctx(mem_ctx),
-     max_grf(brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF)
+     max_grf(brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF),
+     variable_ht(hash_table_ctor(0,
+                                 hash_table_pointer_hash,
+                                 hash_table_pointer_compare))
 {
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index e7f8911..1c5c9f1 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -121,6 +121,8 @@ public:
    /** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
    const unsigned max_grf;
 
+   struct hash_table * const variable_ht;
+
    virtual void dump_instruction(backend_instruction *inst) = 0;
    virtual void dump_instructions();
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index b6585bc..b44a3dc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -299,7 +299,6 @@ public:
                 shader_time_shader_type st_base,
                 shader_time_shader_type st_written,
                 shader_time_shader_type st_reset);
-   ~vec4_visitor();
 
    dst_reg dst_null_f()
    {
@@ -398,8 +397,6 @@ public:
 
    src_reg shader_start_time;
 
-   struct hash_table *variable_ht;
-
    bool run(void);
    void fail(const char *msg, ...);
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 5b95ed6..a17d6f6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3384,10 +3384,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
    this->current_annotation = NULL;
    memset(this->output_reg_annotation, 0, sizeof(this->output_reg_annotation));
 
-   this->variable_ht = hash_table_ctor(0,
-				       hash_table_pointer_hash,
-				       hash_table_pointer_compare);
-
    this->virtual_grf_start = NULL;
    this->virtual_grf_end = NULL;
    this->virtual_grf_sizes = NULL;
@@ -3411,11 +3407,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
    this->uniform_vector_size = rzalloc_array(mem_ctx, int, this->uniform_array_size);
 }
 
-vec4_visitor::~vec4_visitor()
-{
-   hash_table_dtor(this->variable_ht);
-}
-
 
 void
 vec4_visitor::fail(const char *format, ...)
-- 
1.8.3.1



More information about the mesa-dev mailing list