[Mesa-dev] [PATCH 08/20] i965: Merge common members of visitors
Topi Pohjolainen
topi.pohjolainen at intel.com
Fri Apr 11 00:28:48 PDT 2014
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.h | 19 -------------------
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 19 -------------------
src/mesa/drivers/dri/i965/brw_shader.cpp | 18 +++++++++++++++++-
src/mesa/drivers/dri/i965/brw_shader.h | 25 +++++++++++++++++++++++++
src/mesa/drivers/dri/i965/brw_vec4.h | 21 ---------------------
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 23 -----------------------
6 files changed, 42 insertions(+), 83 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 4f3a61d..3d2a613 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -253,7 +253,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);
@@ -495,22 +494,13 @@ public:
struct gl_fragment_program *fp;
struct brw_wm_compile *c;
- unsigned int sanity_param_count;
int *param_size;
- int *virtual_grf_sizes;
- int virtual_grf_count;
- int virtual_grf_array_size;
- int *virtual_grf_start;
- int *virtual_grf_end;
brw::fs_live_variables *live_intervals;
int *regs_live_at_ip;
- /** Number of uniform variable components visited. */
- unsigned uniforms;
-
/**
* Array mapping UNIFORM register numbers to the pull parameter index,
* or -1 if this uniform register isn't being uploaded as a pull constant.
@@ -523,25 +513,16 @@ 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];
unsigned output_components[BRW_MAX_DRAW_BUFFERS];
fs_reg dual_src_output;
bool do_dual_src;
- int first_non_payload_grf;
fs_reg *fp_temp_regs;
fs_reg *fp_input_regs;
- /** @{ debug annotation info */
- const char *current_annotation;
- const void *base_ir;
- /** @} */
-
- bool failed;
- char *fail_msg;
bool simd16_unsupported;
char *no16_msg;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index c044f91..5aa8d6c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2958,29 +2958,15 @@ fs_visitor::fs_visitor(struct brw_context *brw,
{
this->c = c;
this->fp = fp;
- 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->outputs, 0, sizeof(this->outputs));
memset(this->output_components, 0, sizeof(this->output_components));
- this->first_non_payload_grf = 0;
- this->current_annotation = NULL;
- this->base_ir = NULL;
-
- this->virtual_grf_sizes = NULL;
- this->virtual_grf_count = 0;
- this->virtual_grf_array_size = 0;
- this->virtual_grf_start = NULL;
- this->virtual_grf_end = NULL;
this->live_intervals = NULL;
this->regs_live_at_ip = NULL;
- this->uniforms = 0;
this->pull_constant_loc = NULL;
this->push_constant_loc = NULL;
@@ -2992,8 +2978,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 26e939f..eec1f61 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -552,12 +552,28 @@ backend_emitter::backend_emitter(struct brw_context *brw)
: brw(brw),
ctx(&brw->ctx),
mem_ctx(ralloc_context(NULL)),
- 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)),
+ uniforms(0),
+ sanity_param_count(0),
+ virtual_grf_sizes(0),
+ virtual_grf_count(0),
+ virtual_grf_array_size(0),
+ virtual_grf_start(NULL),
+ virtual_grf_end(NULL),
+ base_ir(NULL),
+ current_annotation(NULL),
+ first_non_payload_grf(0),
+ fail_msg(NULL),
+ failed(false)
{
}
backend_emitter::~backend_emitter()
{
+ hash_table_dtor(variable_ht);
ralloc_free(mem_ctx);
}
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 3d6e679..068991a 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -109,6 +109,31 @@ public:
/** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
const unsigned max_grf;
+ struct hash_table * const variable_ht;
+
+ /** Number of uniform variable components visited. */
+ unsigned uniforms;
+
+ unsigned int sanity_param_count;
+
+ int *virtual_grf_sizes;
+ int virtual_grf_count;
+ int virtual_grf_array_size;
+ int *virtual_grf_start;
+ int *virtual_grf_end;
+
+ /**
+ * GLSL IR currently being processed, which is associated with our
+ * driver IR instructions for debugging purposes.
+ */
+ const void *base_ir;
+ const char *current_annotation;
+
+ int first_non_payload_grf;
+
+ char *fail_msg;
+ bool failed;
+
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 9684012..f9f6467 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -301,7 +301,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()
{
@@ -321,24 +320,7 @@ public:
struct brw_vec4_compile * const c;
const struct brw_vec4_prog_key * const key;
struct brw_vec4_prog_data * const prog_data;
- unsigned int sanity_param_count;
- char *fail_msg;
- bool failed;
-
- /**
- * GLSL IR currently being processed, which is associated with our
- * driver IR instructions for debugging purposes.
- */
- const void *base_ir;
- const char *current_annotation;
-
- int *virtual_grf_sizes;
- int virtual_grf_count;
- int virtual_grf_array_size;
- int first_non_payload_grf;
- int *virtual_grf_start;
- int *virtual_grf_end;
dst_reg userplane[MAX_CLIP_PLANES];
/**
@@ -396,12 +378,9 @@ public:
int *uniform_size;
int *uniform_vector_size;
unsigned uniform_array_size; /*< Size of uniform_[vector_]size arrays */
- unsigned uniforms;
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 8835ac6..497b3b5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3356,9 +3356,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
c(c),
key(key),
prog_data(prog_data),
- sanity_param_count(0),
- fail_msg(NULL),
- first_non_payload_grf(0),
need_all_constants_in_pull_buffer(false),
debug_flag(debug_flag),
no_spills(no_spills),
@@ -3366,27 +3363,12 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
st_written(st_written),
st_reset(st_reset)
{
- this->failed = false;
-
- this->base_ir = NULL;
- 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;
- this->virtual_grf_count = 0;
this->virtual_grf_reg_map = NULL;
this->virtual_grf_reg_count = 0;
- this->virtual_grf_array_size = 0;
this->live_intervals_valid = false;
- this->uniforms = 0;
-
/* Initialize uniform_array_size to at least 1 because pre-gen6 VS requires
* at least one. See setup_uniforms() in brw_vec4.cpp.
*/
@@ -3399,11 +3381,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