[Mesa-dev] [PATCH 2/8] i965/vs: Pass the brw_context pointer into vec4_visitor and do_vs_prog.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 27 00:42:27 PST 2012


We used to steal it out of the brw_compile struct...but vec4_visitor
isn't going to have one of those in the future.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp         | 9 +++++----
 src/mesa/drivers/dri/i965/brw_vec4.h           | 3 ++-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 5 +++--
 src/mesa/drivers/dri/i965/brw_vs.c             | 2 +-
 src/mesa/drivers/dri/i965/brw_vs.h             | 4 +++-
 5 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 227acca..d203ca9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1128,10 +1128,11 @@ vec4_visitor::run()
 extern "C" {
 
 bool
-brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c)
+brw_vs_emit(struct brw_context *brw,
+            struct gl_shader_program *prog,
+            struct brw_vs_compile *c)
 {
-   struct brw_context *brw = c->func.brw;
-   struct intel_context *intel = &c->func.brw->intel;
+   struct intel_context *intel = &brw->intel;
    bool start_busy = false;
    float start_time = 0;
 
@@ -1168,7 +1169,7 @@ brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c)
       shader->compiled_once = true;
    }
 
-   vec4_visitor v(c, prog, shader);
+   vec4_visitor v(brw, c, prog, shader);
    if (!v.run()) {
       prog->LinkStatus = false;
       ralloc_strcat(&prog->InfoLog, v.fail_msg);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 908d7d8..f474b0f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -198,7 +198,8 @@ public:
 class vec4_visitor : public backend_visitor
 {
 public:
-   vec4_visitor(struct brw_vs_compile *c,
+   vec4_visitor(struct brw_context *brw,
+                struct brw_vs_compile *c,
 		struct gl_shader_program *prog, struct brw_shader *shader);
    ~vec4_visitor();
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index edb66ea..982b74c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2806,13 +2806,14 @@ vec4_visitor::resolve_ud_negate(src_reg *reg)
    *reg = temp;
 }
 
-vec4_visitor::vec4_visitor(struct brw_vs_compile *c,
+vec4_visitor::vec4_visitor(struct brw_context *brw,
+			   struct brw_vs_compile *c,
 			   struct gl_shader_program *prog,
 			   struct brw_shader *shader)
 {
    this->c = c;
    this->p = &c->func;
-   this->brw = p->brw;
+   this->brw = brw;
    this->intel = &brw->intel;
    this->ctx = &intel->ctx;
    this->prog = prog;
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 232600a..8cced4b 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -280,7 +280,7 @@ do_vs_prog(struct brw_context *brw,
 
    /* Emit GEN4 code.
     */
-   if (!brw_vs_emit(prog, &c)) {
+   if (!brw_vs_emit(brw, prog, &c)) {
       ralloc_free(mem_ctx);
       return false;
    }
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 279c18f..2c08547 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -103,7 +103,9 @@ struct brw_vs_compile {
    GLuint last_scratch; /**< measured in 32-byte (register size) units */
 };
 
-bool brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c);
+bool brw_vs_emit(struct brw_context *brw,
+                 struct gl_shader_program *prog,
+                 struct brw_vs_compile *c);
 bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
 void brw_vs_debug_recompile(struct brw_context *brw,
                             struct gl_shader_program *prog,
-- 
1.8.0



More information about the mesa-dev mailing list