Mesa (master): i965/fs: Make gather_channel() not use ir_texture.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Oct 16 00:02:50 UTC 2014


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

Author: Connor Abbott <connor.abbott at intel.com>
Date:   Fri Aug  1 18:08:08 2014 -0700

i965/fs: Make gather_channel() not use ir_texture.

Our new IR won't have ir_texture objects.

Signed-off-by: Connor Abbott <connor.abbott at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 6c99d22..dc4e0c8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -334,7 +334,7 @@ public:
    void visit(ir_emit_vertex *);
    void visit(ir_end_primitive *);
 
-   uint32_t gather_channel(ir_texture *ir, uint32_t sampler);
+   uint32_t gather_channel(int orig_chan, uint32_t sampler);
    void swizzle_result(ir_texture_opcode op, int dest_components,
                        fs_reg orig_val, uint32_t sampler);
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 5c0b0b9..9008e16 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2024,7 +2024,7 @@ fs_visitor::visit(ir_texture *ir)
       inst->texture_offset = offset_value.fixed_hw_reg.dw1.ud;
 
    if (ir->op == ir_tg4)
-      inst->texture_offset |= gather_channel(ir, sampler) << 16; // M0.2:16-17
+      inst->texture_offset |= gather_channel(ir->lod_info.component->as_constant()->value.i[0], sampler) << 16; // M0.2:16-17
 
    if (ir->shadow_comparitor)
       inst->shadow_compare = true;
@@ -2092,14 +2092,13 @@ fs_visitor::emit_gen6_gather_wa(uint8_t wa, fs_reg dst)
  * Set up the gather channel based on the swizzle, for gather4.
  */
 uint32_t
-fs_visitor::gather_channel(ir_texture *ir, uint32_t sampler)
+fs_visitor::gather_channel(int orig_chan, uint32_t sampler)
 {
    const struct brw_sampler_prog_key_data *tex =
       (stage == MESA_SHADER_FRAGMENT) ?
       &((brw_wm_prog_key*) this->key)->tex : NULL;
    assert(tex);
-   ir_constant *chan = ir->lod_info.component->as_constant();
-   int swiz = GET_SWZ(tex->swizzles[sampler], chan->value.i[0]);
+   int swiz = GET_SWZ(tex->swizzles[sampler], orig_chan);
    switch (swiz) {
       case SWIZZLE_X: return 0;
       case SWIZZLE_Y:




More information about the mesa-commit mailing list