brw: Replace fs_inst::pi_noperspective with a logical control source

We already have logical pixel interpolator messages that get lowered
to send messages.  We can just add an extra boolean source to those
opcodes rather than sticking a opcode-specific boolean in the generic
fs_inst data structure.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33297>
This commit is contained in:
Kenneth Graunke 2025-01-16 15:12:14 -08:00 committed by Marge Bot
parent 168ac07ffd
commit 7390d6189c
5 changed files with 16 additions and 8 deletions

View file

@ -737,6 +737,8 @@ enum interpolator_logical_srcs {
INTERP_SRC_MSG_DESC,
/** Flag register for dynamic mode */
INTERP_SRC_DYNAMIC_MODE,
/** Whether this should use noperspective (0/1 as UD immediate) */
INTERP_SRC_NOPERSPECTIVE,
INTERP_NUM_SRCS
};

View file

@ -2083,12 +2083,11 @@ emit_pixel_interpolater_send(const brw_builder &bld,
srcs[INTERP_SRC_MSG_DESC] = desc;
srcs[INTERP_SRC_DYNAMIC_MODE] = flag_reg;
srcs[INTERP_SRC_NOPERSPECTIVE] = brw_imm_ud(false);
brw_inst *inst = bld.emit(opcode, dst, srcs, INTERP_NUM_SRCS);
/* 2 floats per slot returned */
inst->size_written = 2 * dst.component_size(inst->exec_size);
if (interpolation == INTERP_MODE_NOPERSPECTIVE) {
inst->pi_noperspective = true;
srcs[INTERP_SRC_NOPERSPECTIVE] = brw_imm_ud(true);
/* TGL BSpec says:
* This field cannot be set to "Linear Interpolation"
* unless Non-Perspective Barycentric Enable in 3DSTATE_CLIP is enabled"
@ -2096,6 +2095,10 @@ emit_pixel_interpolater_send(const brw_builder &bld,
wm_prog_data->uses_nonperspective_interp_modes = true;
}
brw_inst *inst = bld.emit(opcode, dst, srcs, INTERP_NUM_SRCS);
/* 2 floats per slot returned */
inst->size_written = 2 * dst.component_size(inst->exec_size);
wm_prog_data->pulls_bary = true;
return inst;

View file

@ -197,10 +197,12 @@ brw_inst::is_control_source(unsigned arg) const
case SHADER_OPCODE_BROADCAST:
case SHADER_OPCODE_SHUFFLE:
case SHADER_OPCODE_QUAD_SWIZZLE:
return arg == 1;
case FS_OPCODE_INTERPOLATE_AT_SAMPLE:
case FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET:
case FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET:
return arg == 1;
return arg == INTERP_SRC_MSG_DESC || arg == INTERP_SRC_NOPERSPECTIVE;
case SHADER_OPCODE_MOV_INDIRECT:
case SHADER_OPCODE_CLUSTER_BROADCAST:

View file

@ -192,7 +192,7 @@ public:
*/
unsigned rcount:4;
unsigned pad:3;
unsigned pad:4;
bool predicate_inverse:1;
bool writes_accumulator:1; /**< instruction implicitly writes accumulator */
@ -215,7 +215,6 @@ public:
bool predicate_trivial:1;
bool eot:1;
bool last_rt:1;
bool pi_noperspective:1; /**< Pixel interpolator noperspective flag */
bool keep_payload_trailing_zeros:1;
/**
* Whether the parameters of the SEND instructions are build with

View file

@ -2072,6 +2072,8 @@ lower_interpolator_logical_send(const brw_builder &bld, brw_inst *inst,
const struct brw_wm_prog_key *wm_prog_key,
const struct brw_wm_prog_data *wm_prog_data)
{
assert(inst->src[INTERP_SRC_NOPERSPECTIVE].file == IMM);
const intel_device_info *devinfo = bld.shader->devinfo;
/* We have to send something */
@ -2110,7 +2112,7 @@ lower_interpolator_logical_send(const brw_builder &bld, brw_inst *inst,
* dynamic, it will be ORed in below.
*/
dynamic_mode ? 0 : mode,
inst->pi_noperspective,
inst->src[INTERP_SRC_NOPERSPECTIVE].ud,
false /* coarse_pixel_rate */,
inst->exec_size, inst->group);