Mesa (master): i965/fs: Remove struct brw_shader * parameter to fs_visitor constructor.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Nov 27 04:48:51 UTC 2012


Module: Mesa
Branch: master
Commit: 7b0d30eb8765066b9f3b5f2a50c426ccbac675fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b0d30eb8765066b9f3b5f2a50c426ccbac675fa

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Nov 20 14:26:49 2012 -0800

i965/fs: Remove struct brw_shader * parameter to fs_visitor constructor.

We can easily recover it from prog, and this makes it clear that we
aren't passing additional information in.

v2: Use an if-statement rather than the ?: operator (suggested by Eric).

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp         |    4 ++--
 src/mesa/drivers/dri/i965/brw_fs.h           |    2 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |    7 +++++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index bcb6727..a370bcd 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2177,7 +2177,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
 
    /* Now the main event: Visit the shader IR and generate our FS IR for it.
     */
-   fs_visitor v(c, prog, shader, 8);
+   fs_visitor v(c, prog, 8);
    if (!v.run()) {
       prog->LinkStatus = false;
       ralloc_strcat(&prog->InfoLog, v.fail_msg);
@@ -2189,7 +2189,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
    }
 
    if (intel->gen >= 5 && c->prog_data.nr_pull_params == 0) {
-      fs_visitor v2(c, prog, shader, 16);
+      fs_visitor v2(c, prog, 16);
       v2.import_uniforms(&v);
       if (!v2.run()) {
          perf_debug("16-wide shader failed to compile, falling back to "
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 2216231..30f2d63 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -185,7 +185,7 @@ class fs_visitor : public backend_visitor
 public:
 
    fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
-              struct brw_shader *shader, unsigned dispatch_width);
+              unsigned dispatch_width);
    ~fs_visitor();
 
    fs_reg *variable_storage(ir_variable *var);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 58e759f..43266ca 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2175,7 +2175,7 @@ fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)
 }
 
 fs_visitor::fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
-                       struct brw_shader *shader, unsigned dispatch_width)
+                       unsigned dispatch_width)
    : dispatch_width(dispatch_width)
 {
    this->c = c;
@@ -2186,7 +2186,10 @@ fs_visitor::fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
    this->intel = &brw->intel;
    this->ctx = &intel->ctx;
    this->mem_ctx = ralloc_context(NULL);
-   this->shader = shader;
+   if (prog)
+      shader = (struct brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
+   else
+      shader = NULL;
    this->failed = false;
    this->variable_ht = hash_table_ctor(0,
                                        hash_table_pointer_hash,




More information about the mesa-commit mailing list