diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2011-10-26 13:51:28 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2011-12-19 16:33:10 -0800 |
commit | 475d70d6ef5feb94efab3923e5607e625f2aee67 (patch) | |
tree | 1d97480557d4a4ab6ba95ac855f0b6084d9c8d62 /src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | |
parent | d93aa54d2dea79d8216e10b6bbbb00b0c8443dc2 (diff) | |
download | external_mesa3d-475d70d6ef5feb94efab3923e5607e625f2aee67.zip external_mesa3d-475d70d6ef5feb94efab3923e5607e625f2aee67.tar.gz external_mesa3d-475d70d6ef5feb94efab3923e5607e625f2aee67.tar.bz2 |
i965/fs: Factor out texture offset bitfield computation.
We'll want to reuse this for the VS, and it's complex enough that I'd
rather not cut and paste it.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_visitor.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 9ce6696..1143951 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1077,24 +1077,7 @@ fs_visitor::visit(ir_texture *ir) fs_reg coordinate = this->result; if (ir->offset != NULL) { - ir_constant *offset = ir->offset->as_constant(); - assert(offset != NULL); - - signed char offsets[3]; - for (unsigned i = 0; i < ir->offset->type->vector_elements; i++) - offsets[i] = (signed char) offset->value.i[i]; - - /* Combine all three offsets into a single unsigned dword: - * - * bits 11:8 - U Offset (X component) - * bits 7:4 - V Offset (Y component) - * bits 3:0 - R Offset (Z component) - */ - unsigned offset_bits = 0; - for (unsigned i = 0; i < ir->offset->type->vector_elements; i++) { - const unsigned shift = 4 * (2 - i); - offset_bits |= (offsets[i] << shift) & (0xF << shift); - } + uint32_t offset_bits = brw_texture_offset(ir->offset->as_constant()); /* Explicitly set up the message header by copying g0 to msg reg m1. */ emit(BRW_OPCODE_MOV, fs_reg(MRF, 1, BRW_REGISTER_TYPE_UD), |