From: Iago Toral Quiroga <ito...@igalia.com> This does the inverse operation of SHUFFLE_32BIT_LOAD_RESULT_TO_64BIT_DATA and we will use it when we need to write 64-bit data in the layout expected by untyped write messages.
Again, this needs to operate with WE_all set for the same reasons as the inverse operation. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 42 ++++++++++++++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_fs.h | 5 +++++ 2 files changed, 47 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 709e4b8..80803a6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -285,6 +285,48 @@ fs_visitor::SHUFFLE_32BIT_LOAD_RESULT_TO_64BIT_DATA(const fs_builder &bld, } /** + * This helper does the inverse operation of + * SHUFFLE_32BIT_LOAD_RESULT_TO_64BIT_DATA. + * + * We need to do this when we are going to use untyped write messsages that + * operate with 32-bit components in order to arrange our 64-bit data i to be + * in the expected layout. + */ +void +fs_visitor::SHUFFLE_32BIT_DATA_FOR_64BIT_WRITE(const fs_builder &bld, + const fs_reg dst, + const fs_reg src, + uint32_t components) +{ + int multiplier = bld.dispatch_width() / 8; + + /* A temporary that we will use to shuffle the 64-bit data of each + * component in the vector into 32-bit data that we can write. + */ + fs_reg tmp = + fs_reg(VGRF, alloc.allocate(2 * multiplier), BRW_REGISTER_TYPE_F); + + /* We are going to operate the source in units of 32-bit */ + fs_reg src_data = retype(src, BRW_REGISTER_TYPE_F); + + /* We are going to operate on the dst in units of 64-bit */ + fs_reg dst_data = retype(dst, BRW_REGISTER_TYPE_DF); + + /* Shuffle the data */ + for (unsigned i = 0; i < components; i++) { + fs_reg component_i = horiz_offset(src_data, multiplier * 16 * i); + + bld.MOV(tmp, stride(component_i, 2))->force_writemask_all = true; + bld.MOV(horiz_offset(tmp, 8 * multiplier), + stride(horiz_offset(component_i, 1), 2)) + ->force_writemask_all = true; + + bld.MOV(horiz_offset(dst_data, multiplier * 8 * i), + retype(tmp, BRW_REGISTER_TYPE_DF))->force_writemask_all = true; + } +} + +/** * A helper for MOV generation for fixing up broken hardware SEND dependency * handling. */ diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 1e78f0c..9178347 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -111,6 +111,11 @@ public: const fs_reg src, uint32_t components); + void SHUFFLE_32BIT_DATA_FOR_64BIT_WRITE(const brw::fs_builder &bld, + const fs_reg dst, + const fs_reg src, + uint32_t components); + void do_untyped_vector_read(const brw::fs_builder &bld, const fs_reg surf_index, const fs_reg offset_reg, -- 2.5.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev