aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2013-12-08 04:59:11 +0100
committerFrancisco Jerez <[email protected]>2014-02-19 16:27:25 +0100
commit6f56d5dc6047d0f926706e28fe1d809622c5b7e3 (patch)
treecf0e712110124800c510cbbf5f22633d2f508903
parent3b032732753b18c84482e30dd3675403eec7919f (diff)
i965/fs: Remove fs_reg::retype.
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. Reviewed-by: Paul Berry <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp8
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp22
3 files changed, 12 insertions, 20 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 76de9fd4fce..b7495f4a3fb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -443,14 +443,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 4845156d74b..5f9cb596539 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -83,7 +83,7 @@ public:
bool is_null() const;
bool is_valid_3src() const;
bool is_contiguous() const;
- fs_reg retype(uint32_t type);
+
fs_reg &apply_stride(unsigned stride);
/** Register file: GRF, MRF, IMM. */
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 9d8dfd91087..169eaf1279b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1317,24 +1317,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++;
}
@@ -1342,18 +1342,18 @@ 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++;
/* data from the multisample control surface */
- emit(MOV(next.retype(BRW_REGISTER_TYPE_UD), mcs));
+ emit(MOV(retype(next, BRW_REGISTER_TYPE_UD), mcs));
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++;
}
@@ -1376,7 +1376,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++;
}
@@ -1549,7 +1549,7 @@ fs_visitor::emit_mcs_fetch(ir_texture *ir, fs_reg coordinate, int sampler)
/* parameters are: u, v, r, lod; missing parameters are treated as zero */
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++;
}
@@ -1719,7 +1719,7 @@ fs_visitor::emit_gen6_gather_wa(uint8_t wa, fs_reg dst)
int width = (wa & WA_8BIT) ? 8 : 16;
for (int i = 0; i < 4; i++) {
- fs_reg dst_f = dst.retype(BRW_REGISTER_TYPE_F);
+ fs_reg dst_f = retype(dst, BRW_REGISTER_TYPE_F);
/* Convert from UNORM to UINT */
emit(MUL(dst_f, dst_f, fs_reg((float)((1 << width) - 1))));
emit(MOV(dst, dst_f));