diff options
author | Kenneth Graunke <[email protected]> | 2019-08-25 23:59:25 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-08-27 14:20:07 -0700 |
commit | 86a63b1098c9b5a7550398830982299e49fa61f9 (patch) | |
tree | ac176276df7d7b18d34ec3455ded80ca8025619b /src/intel | |
parent | b6fe25c7f531ebb56893255cd5a2cfb21e361785 (diff) |
intel/compiler: Refactor FB write message control setup into a helper.
This will be used by visitor code to convert directly to SEND in a bit.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/compiler/brw_fs.cpp | 32 | ||||
-rw-r--r-- | src/intel/compiler/brw_fs.h | 4 | ||||
-rw-r--r-- | src/intel/compiler/brw_fs_generator.cpp | 27 |
3 files changed, 37 insertions, 26 deletions
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 8fbb118ea41..5aeffabfd82 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -4198,6 +4198,38 @@ setup_color_payload(const fs_builder &bld, const brw_wm_prog_key *key, dst[i] = offset(color, bld, i); } +uint32_t +brw_fb_write_msg_control(const fs_inst *inst, + const struct brw_wm_prog_data *prog_data) +{ + uint32_t mctl; + + if (inst->opcode == FS_OPCODE_REP_FB_WRITE) { + assert(inst->group == 0 && inst->exec_size == 16); + mctl = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED; + } else if (prog_data->dual_src_blend) { + assert(inst->exec_size == 8); + + if (inst->group % 16 == 0) + mctl = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01; + else if (inst->group % 16 == 8) + mctl = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23; + else + unreachable("Invalid dual-source FB write instruction group"); + } else { + assert(inst->group == 0 || (inst->group == 16 && inst->exec_size == 16)); + + if (inst->exec_size == 16) + mctl = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; + else if (inst->exec_size == 8) + mctl = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01; + else + unreachable("Invalid FB write execution size"); + } + + return mctl; +} + static void lower_fb_write_logical_send(const fs_builder &bld, fs_inst *inst, const struct brw_wm_prog_data *prog_data, diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index cce846908b0..6eef13bb317 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -586,4 +586,8 @@ fs_reg setup_imm_ub(const brw::fs_builder &bld, enum brw_barycentric_mode brw_barycentric_mode(enum glsl_interp_mode mode, nir_intrinsic_op op); +uint32_t brw_fb_write_msg_control(const fs_inst *inst, + const struct brw_wm_prog_data *prog_data); + + #endif /* BRW_FS_H */ diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp index df215a6174b..885e799ae76 100644 --- a/src/intel/compiler/brw_fs_generator.cpp +++ b/src/intel/compiler/brw_fs_generator.cpp @@ -298,8 +298,6 @@ fs_generator::fire_fb_write(fs_inst *inst, struct brw_reg implied_header, GLuint nr) { - uint32_t msg_control; - struct brw_wm_prog_data *prog_data = brw_wm_prog_data(this->prog_data); if (devinfo->gen < 6) { @@ -313,30 +311,7 @@ fs_generator::fire_fb_write(fs_inst *inst, brw_pop_insn_state(p); } - if (inst->opcode == FS_OPCODE_REP_FB_WRITE) { - assert(inst->group == 0 && inst->exec_size == 16); - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED; - - } else if (prog_data->dual_src_blend) { - assert(inst->exec_size == 8); - - if (inst->group % 16 == 0) - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01; - else if (inst->group % 16 == 8) - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23; - else - unreachable("Invalid dual-source FB write instruction group"); - - } else { - assert(inst->group == 0 || (inst->group == 16 && inst->exec_size == 16)); - - if (inst->exec_size == 16) - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE; - else if (inst->exec_size == 8) - msg_control = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01; - else - unreachable("Invalid FB write execution size"); - } + uint32_t msg_control = brw_fb_write_msg_control(inst, prog_data); /* We assume render targets start at 0, because headerless FB write * messages set "Render Target Index" to 0. Using a different binding |