intel/fs: Simplify fs_visitor::emit_samplepos_setup

The original code manually handled splitting the MOVs to 8-wide to
handle various regioning restrictions.  Now that we have a SIMD width
splitting pass that handles these things, we can just emit everything at
the full width and let the SIMD splitting pass handle it.  We also now
have a useful "subscript" helper which is designed exactly for the case
where you want to take a W type and read it as a vector of Bs so we may
as well use that too.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Francisco Jerez
2017-01-13 14:53:00 -08:00
committed by Jason Ekstrand
parent 244a0ff3a8
commit 38aee1a06d

View File

@@ -1213,30 +1213,16 @@ fs_visitor::emit_samplepos_setup()
* The X, Y sample positions come in as bytes in thread payload. So, read
* the positions using vstride=16, width=8, hstride=2.
*/
struct brw_reg sample_pos_reg =
stride(retype(brw_vec1_grf(payload.sample_pos_reg, 0),
BRW_REGISTER_TYPE_B), 16, 8, 2);
const fs_reg sample_pos_reg = retype(brw_vec8_grf(payload.sample_pos_reg, 0),
BRW_REGISTER_TYPE_W);
if (dispatch_width == 8) {
abld.MOV(int_sample_x, fs_reg(sample_pos_reg));
} else {
abld.half(0).MOV(half(int_sample_x, 0), fs_reg(sample_pos_reg));
abld.half(1).MOV(half(int_sample_x, 1),
fs_reg(suboffset(sample_pos_reg, 16)));
}
/* Compute gl_SamplePosition.x */
compute_sample_position(pos, int_sample_x);
pos = offset(pos, abld, 1);
if (dispatch_width == 8) {
abld.MOV(int_sample_y, fs_reg(suboffset(sample_pos_reg, 1)));
} else {
abld.half(0).MOV(half(int_sample_y, 0),
fs_reg(suboffset(sample_pos_reg, 1)));
abld.half(1).MOV(half(int_sample_y, 1),
fs_reg(suboffset(sample_pos_reg, 17)));
}
abld.MOV(int_sample_x, subscript(sample_pos_reg, BRW_REGISTER_TYPE_B, 0));
compute_sample_position(offset(pos, abld, 0), int_sample_x);
/* Compute gl_SamplePosition.y */
compute_sample_position(pos, int_sample_y);
abld.MOV(int_sample_y, subscript(sample_pos_reg, BRW_REGISTER_TYPE_B, 1));
compute_sample_position(offset(pos, abld, 1), int_sample_y);
return reg;
}