i965: Merge initialisation of backend_visitor
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 14 Feb 2014 09:54:02 +0000 (11:54 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Wed, 5 Mar 2014 08:20:21 +0000 (10:20 +0200)
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 6dcdd28bcac5fd62b492ee447637c17dc72194ca..424763bd6cb453b7f85b86e12d9c4c84b1176a31 100644 (file)
@@ -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 *)
index 173aeb6f6de4c0009ea9723863ce29515511fc08..747137e4a430a8119a8b15ca682152c8aeb0cb23 100644 (file)
@@ -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()
 {
index 4d98cbcdbb5807a598d1fc0cc7735967c1446071..0163414cecc39da460af26781dc0340f8634494b 100644 (file)
@@ -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;
index 26122ccaa7904f2148d2b8090fd80a967965e800..87b13614186fff6e17e1a67fd60c6015e87c6fe6 100644 (file)
@@ -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);