summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2014-02-14 11:54:02 +0200
committerTopi Pohjolainen <[email protected]>2014-03-05 10:20:21 +0200
commit81494ec6137d133f999a98474d1660b8c87d2276 (patch)
tree490555758b54928ba47de38aa2b6a352caf8ae01 /src/mesa/drivers
parentafed5354aa7860483113722d2a810cccfa175474 (diff)
i965: Merge initialisation of backend_visitor
Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp9
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h7
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp9
4 files changed, 23 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 6dcdd28bcac..424763bd6cb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2942,16 +2942,11 @@ fs_visitor::fs_visitor(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
unsigned dispatch_width)
- : dispatch_width(dispatch_width)
+ : backend_visitor(brw, shader_prog, &fp->Base, &c->prog_data.base),
+ dispatch_width(dispatch_width)
{
this->c = c;
- this->brw = brw;
this->fp = fp;
- this->prog = &fp->Base;
- this->shader_prog = shader_prog;
- this->prog = &fp->Base;
- this->stage_prog_data = &c->prog_data.base;
- this->ctx = &brw->ctx;
this->mem_ctx = ralloc_context(NULL);
if (shader_prog)
shader = (struct brw_shader *)
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 173aeb6f6de..747137e4a43 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -536,6 +536,18 @@ brw_instruction_name(enum opcode op)
}
}
+backend_visitor::backend_visitor(struct brw_context *brw,
+ struct gl_shader_program *shader_prog,
+ struct gl_program *prog,
+ struct brw_stage_prog_data *stage_prog_data)
+ : brw(brw),
+ ctx(&brw->ctx),
+ shader_prog(shader_prog),
+ prog(prog),
+ stage_prog_data(stage_prog_data)
+{
+}
+
bool
backend_instruction::is_tex()
{
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 4d98cbcdbb5..0163414cecc 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -69,6 +69,13 @@ enum instruction_scheduler_mode {
};
class backend_visitor : public ir_visitor {
+protected:
+
+ backend_visitor(struct brw_context *brw,
+ struct gl_shader_program *shader_prog,
+ struct gl_program *prog,
+ struct brw_stage_prog_data *stage_prog_data);
+
public:
struct brw_context *brw;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 26122ccaa79..87b13614186 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3363,7 +3363,8 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
shader_time_shader_type st_base,
shader_time_shader_type st_written,
shader_time_shader_type st_reset)
- : c(c),
+ : backend_visitor(brw, shader_prog, prog, &prog_data->base),
+ c(c),
key(key),
prog_data(prog_data),
sanity_param_count(0),
@@ -3376,9 +3377,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
st_written(st_written),
st_reset(st_reset)
{
- this->brw = brw;
- this->ctx = &brw->ctx;
- this->shader_prog = shader_prog;
this->shader = shader;
this->mem_ctx = mem_ctx;
@@ -3388,9 +3386,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->prog = prog;
- this->stage_prog_data = &prog_data->base;
-
this->variable_ht = hash_table_ctor(0,
hash_table_pointer_hash,
hash_table_pointer_compare);