[Mesa-dev] [PATCH 18/23] i965/fs: Remove fs_reg::retype.
Francisco Jerez
currojerez at riseup.net
Mon Dec 2 11:31:23 PST 2013
There doesn't seem to be any reason for it to be a method, and it's
surprising that the expression 'reg.retype(t)' doesn't retype its
object but rather it creates a temporary with the new type. Use
'retype(reg, t)' instead.
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 8 --------
src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 18 +++++++++---------
3 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 6b9c9b5..4408cbe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -448,14 +448,6 @@ fs_reg::equals(const fs_reg &r) const
imm.u == r.imm.u);
}
-fs_reg
-fs_reg::retype(uint32_t type)
-{
- fs_reg result = *this;
- result.type = type;
- return result;
-}
-
fs_reg &
fs_reg::apply_stride(unsigned stride)
{
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index f62da44..4f9767c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -78,7 +78,7 @@ public:
bool equals(const fs_reg &r) const;
bool is_valid_3src() const;
bool is_contiguous() const;
- fs_reg retype(uint32_t type);
+
fs_reg &apply_stride(unsigned stride);
/** Smear a channel of the reg to all channels. */
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 5693dbc..f45f089 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1295,24 +1295,24 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
break;
}
case ir_txs:
- emit(MOV(next.retype(BRW_REGISTER_TYPE_UD), lod));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_UD), lod));
next.reg_offset++;
break;
case ir_query_levels:
- emit(MOV(next.retype(BRW_REGISTER_TYPE_UD), fs_reg(0u)));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_UD), fs_reg(0u)));
next.reg_offset++;
break;
case ir_txf:
/* Unfortunately, the parameters for LD are intermixed: u, lod, v, r. */
- emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_D), coordinate));
coordinate.reg_offset++;
next.reg_offset++;
- emit(MOV(next.retype(BRW_REGISTER_TYPE_D), lod));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_D), lod));
next.reg_offset++;
for (int i = 1; i < ir->coordinate->type->vector_elements; i++) {
- emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_D), coordinate));
coordinate.reg_offset++;
next.reg_offset++;
}
@@ -1320,21 +1320,21 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
coordinate_done = true;
break;
case ir_txf_ms:
- emit(MOV(next.retype(BRW_REGISTER_TYPE_UD), sample_index));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_UD), sample_index));
next.reg_offset++;
/* constant zero MCS; we arrange to never actually have a compressed
* multisample surface here for now. TODO: issue ld_mcs to get this first,
* if we ever support texturing from compressed multisample surfaces
*/
- emit(MOV(next.retype(BRW_REGISTER_TYPE_UD), fs_reg(0u)));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_UD), fs_reg(0u)));
next.reg_offset++;
/* there is no offsetting for this message; just copy in the integer
* texture coordinates
*/
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- emit(MOV(next.retype(BRW_REGISTER_TYPE_D), coordinate));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_D), coordinate));
coordinate.reg_offset++;
next.reg_offset++;
}
@@ -1357,7 +1357,7 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
}
for (int i = 0; i < 2; i++) { /* offu, offv */
- emit(MOV(next.retype(BRW_REGISTER_TYPE_D), offset_value));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_D), offset_value));
offset_value.reg_offset++;
next.reg_offset++;
}
--
1.8.3.4
More information about the mesa-dev
mailing list