[Mesa-dev] [RFC 16/27] i965: Merge common members of visitors
Topi Pohjolainen
topi.pohjolainen at intel.com
Sat Feb 22 01:05:42 PST 2014
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.h | 20 --------------------
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(+), 84 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index b98d43b..9ad2049 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -251,7 +251,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);
@@ -489,22 +488,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;
-
/* This is the map from UNIFORM hw_reg + reg_offset as generated by
* the visitor to the packed uniform number after
* remove_dead_constants() that represents the actual uploaded
@@ -513,25 +503,15 @@ public:
int *params_remap;
int nr_params_remap;
- 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;
- 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;
-
/* Result of last visit() method. */
fs_reg result;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 5758741..b1ca533 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2954,27 +2954,13 @@ fs_visitor::fs_visitor(struct brw_context *brw,
{
this->c = c;
this->fp = fp;
- this->failed = false;
- 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->params_remap = NULL;
this->nr_params_remap = 0;
@@ -2984,8 +2970,3 @@ fs_visitor::fs_visitor(struct brw_context *brw,
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 23c060c..2722011 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -553,12 +553,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 e44a6dc..3af6ace 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -108,6 +108,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 1495e0b..0076bde 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -293,7 +293,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()
{
@@ -313,24 +312,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];
/**
@@ -387,12 +369,9 @@ public:
const char *output_reg_annotation[BRW_VARYING_SLOT_COUNT];
int uniform_size[MAX_UNIFORMS];
int uniform_vector_size[MAX_UNIFORMS];
- 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 8843f6b..67ba63d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3319,9 +3319,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),
@@ -3329,31 +3326,11 @@ 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;
-}
-
-vec4_visitor::~vec4_visitor()
-{
- hash_table_dtor(this->variable_ht);
}
--
1.8.3.1
More information about the mesa-dev
mailing list