[Mesa-dev] [PATCH 02/14] i965: Merge emission memory context setup for shader visitors

Topi Pohjolainen topi.pohjolainen at intel.com
Wed May 28 05:35:58 PDT 2014


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

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index b40a682..0219c81 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2965,12 +2965,11 @@ fs_visitor::fs_visitor(struct brw_context *brw,
                        unsigned dispatch_width)
    : backend_visitor(shader_prog, &fp->Base, &prog_data->base,
                      MESA_SHADER_FRAGMENT),
-     backend_emitter(brw),
+     backend_emitter(brw, mem_ctx),
      key(key), prog_data(prog_data),
      dispatch_width(dispatch_width)
 {
    this->fp = fp;
-   this->mem_ctx = mem_ctx;
    this->failed = false;
    this->simd16_unsupported = false;
    this->no16_msg = NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index aa7ea06..69c8576 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -548,9 +548,10 @@ backend_visitor::backend_visitor(struct gl_shader_program *shader_prog,
 {
 }
 
-backend_emitter::backend_emitter(struct brw_context *brw)
+backend_emitter::backend_emitter(struct brw_context *brw, void *mem_ctx)
    : brw(brw),
-     ctx(&brw->ctx)
+     ctx(&brw->ctx),
+     mem_ctx(mem_ctx)
 {
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 980cd0a..c1343ae 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -102,7 +102,7 @@ public:
 class backend_emitter {
 protected:
 
-   explicit backend_emitter(struct brw_context *brw);
+   backend_emitter(struct brw_context *brw, void *mem_ctx);
 
 public:
 
@@ -110,7 +110,7 @@ public:
    struct gl_context * const ctx;
 
    /** ralloc context for temporary data used during compile */
-   void *mem_ctx;
+   void * const mem_ctx;
 
    /**
     * List of either fs_inst or vec4_instruction (inheriting from
@@ -122,6 +122,10 @@ public:
    virtual void dump_instructions();
 
    virtual void invalidate_live_intervals() = 0;
+
+private:
+   backend_emitter(const backend_emitter& );
+   const backend_emitter& operator=(const backend_emitter& );
 };
 
 uint32_t brw_texture_offset(struct gl_context *ctx, ir_constant *offset);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 5e9d3d8..c46593c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3364,7 +3364,7 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
                            shader_time_shader_type st_written,
                            shader_time_shader_type st_reset)
    : backend_visitor(shader_prog, prog, &prog_data->base, stage),
-     backend_emitter(brw),
+     backend_emitter(brw, mem_ctx),
      c(c),
      key(key),
      prog_data(prog_data),
@@ -3378,7 +3378,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
      st_written(st_written),
      st_reset(st_reset)
 {
-   this->mem_ctx = mem_ctx;
    this->failed = false;
 
    this->base_ir = NULL;
-- 
1.8.3.1



More information about the mesa-dev mailing list