From 12d9a8cd86ef758c153dbefcf46bb784c4982335 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 1 Aug 2014 18:05:37 -0700 Subject: [PATCH] i965/fs: Make swizzle_result() 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 | 3 ++- src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 2 +- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 2615e407d00..6c99d22817b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -335,7 +335,8 @@ public: void visit(ir_end_primitive *); uint32_t gather_channel(ir_texture *ir, uint32_t sampler); - void swizzle_result(ir_texture *ir, fs_reg orig_val, uint32_t sampler); + void swizzle_result(ir_texture_opcode op, int dest_components, + fs_reg orig_val, uint32_t sampler); fs_inst *emit(fs_inst *inst); void emit(exec_list list); diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 99cdecbbe4a..825d793dc4a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -497,7 +497,7 @@ fs_visitor::emit_fragment_program_code() inst->shadow_compare = fpi->TexShadow; /* Reuse the GLSL swizzle_result() handler. */ - swizzle_result(ir, dst, fpi->TexSrcUnit); + swizzle_result(ir->op, 4, dst, fpi->TexSrcUnit); dst = this->result; break; diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index c16de4ddd14..5c0b0b93f06 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2055,7 +2055,7 @@ fs_visitor::visit(ir_texture *ir) emit_gen6_gather_wa(tex->gen6_gather_wa[sampler], dst); } - swizzle_result(ir, dst, sampler); + swizzle_result(ir->op, ir->type->vector_elements, dst, sampler); } /** @@ -2121,9 +2121,10 @@ fs_visitor::gather_channel(ir_texture *ir, uint32_t sampler) * EXT_texture_swizzle as well as DEPTH_TEXTURE_MODE for shadow comparisons. */ void -fs_visitor::swizzle_result(ir_texture *ir, fs_reg orig_val, uint32_t sampler) +fs_visitor::swizzle_result(ir_texture_opcode op, int dest_components, + fs_reg orig_val, uint32_t sampler) { - if (ir->op == ir_query_levels) { + if (op == ir_query_levels) { /* # levels is in .w */ this->result = offset(orig_val, 3); return; @@ -2134,7 +2135,7 @@ fs_visitor::swizzle_result(ir_texture *ir, fs_reg orig_val, uint32_t sampler) /* txs,lod don't actually sample the texture, so swizzling the result * makes no sense. */ - if (ir->op == ir_txs || ir->op == ir_lod || ir->op == ir_tg4) + if (op == ir_txs || op == ir_lod || op == ir_tg4) return; const struct brw_sampler_prog_key_data *tex = @@ -2142,9 +2143,8 @@ fs_visitor::swizzle_result(ir_texture *ir, fs_reg orig_val, uint32_t sampler) &((brw_wm_prog_key*) this->key)->tex : NULL; assert(tex); - if (ir->type == glsl_type::float_type) { + if (dest_components == 1) { /* Ignore DEPTH_TEXTURE_MODE swizzling. */ - assert(ir->sampler->type->sampler_shadow); } else if (tex->swizzles[sampler] != SWIZZLE_NOOP) { fs_reg swizzled_result = fs_reg(this, glsl_type::vec4_type); swizzled_result.type = orig_val.type; -- 2.30.2