From 9e95d8ebf811cd741e689174c4080bb93e8bec5e Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 1 Aug 2014 18:08:08 -0700 Subject: [PATCH] i965/fs: Make gather_channel() not use ir_texture. Our new IR won't have ir_texture objects. Signed-off-by: Connor Abbott Reviewed-by: Kenneth Graunke Reviewed-by: Chris Forbes --- 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 6c99d22817b..dc4e0c8c933 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 5c0b0b93f06..9008e167df1 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: -- 2.30.2