[Mesa-dev] [PATCH 04/41] i965/fs: Make half() divide the register width by 2 and use it more
Jason Ekstrand
jason at jlekstrand.net
Sat Sep 20 10:22:53 PDT 2014
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++++----
src/mesa/drivers/dri/i965/brw_fs.h | 4 +++-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 67bb529..4443cc6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1314,6 +1314,7 @@ fs_visitor::compute_sample_position(fs_reg dst, fs_reg int_sample_pos)
fs_reg *
fs_visitor::emit_samplepos_setup()
{
+ fs_inst *inst;
assert(brw->gen >= 6);
this->current_annotation = "compute sample position";
@@ -1337,8 +1338,10 @@ fs_visitor::emit_samplepos_setup()
stride(retype(brw_vec1_grf(payload.sample_pos_reg, 0),
BRW_REGISTER_TYPE_B), 16, 8, 2);
- fs_inst *inst = emit(MOV(int_sample_x, fs_reg(sample_pos_reg)));
- if (dispatch_width == 16) {
+ if (dispatch_width == 8) {
+ emit(MOV(int_sample_x, fs_reg(sample_pos_reg)));
+ } else {
+ inst = emit(MOV(half(int_sample_x, 0), fs_reg(sample_pos_reg)));
inst->force_uncompressed = true;
inst = emit(MOV(half(int_sample_x, 1),
fs_reg(suboffset(sample_pos_reg, 16))));
@@ -1347,8 +1350,11 @@ fs_visitor::emit_samplepos_setup()
/* Compute gl_SamplePosition.x */
compute_sample_position(pos, int_sample_x);
pos = offset(pos, 1);
- inst = emit(MOV(int_sample_y, fs_reg(suboffset(sample_pos_reg, 1))));
- if (dispatch_width == 16) {
+ if (dispatch_width == 8) {
+ emit(MOV(int_sample_y, fs_reg(suboffset(sample_pos_reg, 1))));
+ } else {
+ inst = emit(MOV(half(int_sample_y, 0),
+ fs_reg(suboffset(sample_pos_reg, 1))));
inst->force_uncompressed = true;
inst = emit(MOV(half(int_sample_y, 1),
fs_reg(suboffset(sample_pos_reg, 17))));
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 5d2fbe5..7da0cba 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -145,10 +145,12 @@ byte_offset(fs_reg reg, unsigned delta)
* Note: this also works if \c reg represents a SIMD16 pair of registers.
*/
static inline fs_reg
-half(const fs_reg ®, unsigned idx)
+half(fs_reg reg, unsigned idx)
{
assert(idx < 2);
assert(idx == 0 || (reg.file != HW_REG && reg.file != IMM));
+ assert(reg.width == 16);
+ reg.width = 8;
return byte_offset(reg, 8 * idx * reg.stride * type_sz(reg.type));
}
--
2.1.0
More information about the mesa-dev
mailing list