From 38aee1a06d595ab4066240a5c04500dacaa01f6b Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Fri, 13 Jan 2017 14:53:00 -0800 Subject: [PATCH] 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 Reviewed-by: Matt Turner --- src/intel/compiler/brw_fs.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 73617e25804..893a7e2e526 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -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; } -- 2.30.2