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 <jason@jlekstrand.net>
This commit is contained in:
@@ -4198,6 +4198,38 @@ setup_color_payload(const fs_builder &bld, const brw_wm_prog_key *key,
|
|||||||
dst[i] = offset(color, bld, i);
|
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
|
static void
|
||||||
lower_fb_write_logical_send(const fs_builder &bld, fs_inst *inst,
|
lower_fb_write_logical_send(const fs_builder &bld, fs_inst *inst,
|
||||||
const struct brw_wm_prog_data *prog_data,
|
const struct brw_wm_prog_data *prog_data,
|
||||||
|
@@ -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,
|
enum brw_barycentric_mode brw_barycentric_mode(enum glsl_interp_mode mode,
|
||||||
nir_intrinsic_op op);
|
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 */
|
#endif /* BRW_FS_H */
|
||||||
|
@@ -298,8 +298,6 @@ fs_generator::fire_fb_write(fs_inst *inst,
|
|||||||
struct brw_reg implied_header,
|
struct brw_reg implied_header,
|
||||||
GLuint nr)
|
GLuint nr)
|
||||||
{
|
{
|
||||||
uint32_t msg_control;
|
|
||||||
|
|
||||||
struct brw_wm_prog_data *prog_data = brw_wm_prog_data(this->prog_data);
|
struct brw_wm_prog_data *prog_data = brw_wm_prog_data(this->prog_data);
|
||||||
|
|
||||||
if (devinfo->gen < 6) {
|
if (devinfo->gen < 6) {
|
||||||
@@ -313,30 +311,7 @@ fs_generator::fire_fb_write(fs_inst *inst,
|
|||||||
brw_pop_insn_state(p);
|
brw_pop_insn_state(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->opcode == FS_OPCODE_REP_FB_WRITE) {
|
uint32_t msg_control = brw_fb_write_msg_control(inst, prog_data);
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We assume render targets start at 0, because headerless FB write
|
/* We assume render targets start at 0, because headerless FB write
|
||||||
* messages set "Render Target Index" to 0. Using a different binding
|
* messages set "Render Target Index" to 0. Using a different binding
|
||||||
|
Reference in New Issue
Block a user