diff options
author | Chris Forbes <[email protected]> | 2013-10-13 00:02:04 +1300 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2013-10-26 22:56:27 +1300 |
commit | 598ca510b8a118c3c7e18b5d031a2b116120e0a6 (patch) | |
tree | 45e80e8cf6f2f1a4ef5f56443b4ccf9f7173517d /src/mesa | |
parent | 06de9f8ff15559dffddf26d1969d35e74fbf253f (diff) |
i965: Remove ir_txf coord+offset special case in visitors
Just let it be handled by the lowering pass.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 56 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 25 |
2 files changed, 16 insertions, 65 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 4d41f9dedf1..9a5378a982b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1093,34 +1093,19 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate, const int vector_elements = ir->coordinate ? ir->coordinate->type->vector_elements : 0; - if (ir->offset != NULL && ir->op == ir_txf) { - /* It appears that the ld instruction used for txf does its - * address bounds check before adding in the offset. To work - * around this, just add the integer offset to the integer texel - * coordinate, and don't put the offset in the header. + if (ir->offset) { + /* The offsets set up by the ir_texture visitor are in the + * m1 header, so we can't go headerless. */ - ir_constant *offset = ir->offset->as_constant(); - for (int i = 0; i < vector_elements; i++) { - emit(ADD(fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type), - coordinate, - offset->value.i[i])); - coordinate.reg_offset++; - } - } else { - if (ir->offset) { - /* The offsets set up by the ir_texture visitor are in the - * m1 header, so we can't go headerless. - */ - header_present = true; - mlen++; - base_mrf--; - } + header_present = true; + mlen++; + base_mrf--; + } - for (int i = 0; i < vector_elements; i++) { - emit(MOV(fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type), - coordinate)); - coordinate.reg_offset++; - } + for (int i = 0; i < vector_elements; i++) { + emit(MOV(fs_reg(MRF, base_mrf + mlen + i * reg_width, coordinate.type), + coordinate)); + coordinate.reg_offset++; } mlen += vector_elements * reg_width; @@ -1229,7 +1214,6 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate, { int reg_width = dispatch_width / 8; bool header_present = false; - int offsets[3]; fs_reg payload = fs_reg(this, glsl_type::float_type); fs_reg next = payload; @@ -1305,22 +1289,8 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate, next.reg_offset++; break; case ir_txf: - /* It appears that the ld instruction used for txf does its - * address bounds check before adding in the offset. To work - * around this, just add the integer offset to the integer texel - * coordinate, and don't put the offset in the header. - */ - if (ir->offset) { - ir_constant *offset = ir->offset->as_constant(); - offsets[0] = offset->value.i[0]; - offsets[1] = offset->value.i[1]; - offsets[2] = offset->value.i[2]; - } else { - memset(offsets, 0, sizeof(offsets)); - } - /* Unfortunately, the parameters for LD are intermixed: u, lod, v, r. */ - emit(ADD(next.retype(BRW_REGISTER_TYPE_D), coordinate, offsets[0])); + emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate)); coordinate.reg_offset++; next.reg_offset++; @@ -1328,7 +1298,7 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate, next.reg_offset++; for (int i = 1; i < ir->coordinate->type->vector_elements; i++) { - emit(ADD(next.retype(BRW_REGISTER_TYPE_D), coordinate, offsets[i])); + emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate)); coordinate.reg_offset++; next.reg_offset++; } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 1854325c3e2..64f869cdfd4 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -2317,28 +2317,9 @@ vec4_visitor::visit(ir_texture *ir) int coord_mask = (1 << ir->coordinate->type->vector_elements) - 1; int zero_mask = 0xf & ~coord_mask; - if (ir->offset && ir->op == ir_txf) { - /* It appears that the ld instruction used for txf does its - * address bounds check before adding in the offset. To work - * around this, just add the integer offset to the integer - * texel coordinate, and don't put the offset in the header. - */ - ir_constant *offset = ir->offset->as_constant(); - assert(offset); - - for (int j = 0; j < ir->coordinate->type->vector_elements; j++) { - src_reg src = coordinate; - src.swizzle = BRW_SWIZZLE4(BRW_GET_SWZ(src.swizzle, j), - BRW_GET_SWZ(src.swizzle, j), - BRW_GET_SWZ(src.swizzle, j), - BRW_GET_SWZ(src.swizzle, j)); - emit(ADD(dst_reg(MRF, param_base, ir->coordinate->type, 1 << j), - src, offset->value.i[j])); - } - } else { - emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, coord_mask), - coordinate)); - } + emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, coord_mask), + coordinate)); + if (zero_mask != 0) { emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, zero_mask), src_reg(0))); |