mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
aco: implement replacing frag_coord with pixel_coord in PS prolog
This adds an option to replace frag_coord.xy with pixel_coord when sample shading is disabled, which is most of the time. This reduces the number of input VGPRs. It's already implement in ac_nir_lower_ps_early for monolithic shaders. Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33024>
This commit is contained in:
parent
eddd063420
commit
5c4f737b84
2 changed files with 30 additions and 1 deletions
|
|
@ -11660,6 +11660,33 @@ overwrite_samplemask_arg(isel_context* ctx, const struct aco_ps_prolog_info* fin
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
overwrite_pos_xy_args(isel_context* ctx, const struct aco_ps_prolog_info* finfo)
|
||||
{
|
||||
if (!finfo->get_frag_coord_from_pixel_coord)
|
||||
return;
|
||||
|
||||
Builder bld(ctx->program, ctx->block);
|
||||
Temp pos_fixed_pt = get_arg(ctx, ctx->args->pos_fixed_pt);
|
||||
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
if (!ctx->args->frag_pos[i].used)
|
||||
continue;
|
||||
|
||||
Temp t;
|
||||
if (i)
|
||||
t = bld.vop2(aco_opcode::v_lshrrev_b32, bld.def(v1), Operand::c32(16), pos_fixed_pt);
|
||||
else
|
||||
t = bld.vop2(aco_opcode::v_and_b32, bld.def(v1), Operand::c32(0xffff), pos_fixed_pt);
|
||||
|
||||
t = bld.vop1(aco_opcode::v_cvt_f32_u32, bld.def(v1), t);
|
||||
if (!finfo->pixel_center_integer)
|
||||
t = bld.vop2(aco_opcode::v_add_f32, bld.def(v1), Operand::c32(0x3f000000 /*0.5*/), t);
|
||||
|
||||
ctx->arg_temps[ctx->args->frag_pos[i].arg_index] = t;
|
||||
}
|
||||
}
|
||||
|
||||
Temp
|
||||
get_interp_color(isel_context* ctx, int interp_vgpr, unsigned attr_index, unsigned comp)
|
||||
{
|
||||
|
|
@ -13216,8 +13243,8 @@ select_ps_prolog(Program* program, void* pinfo, ac_shader_config* config,
|
|||
emit_polygon_stipple(&ctx, finfo);
|
||||
|
||||
overwrite_interp_args(&ctx, finfo);
|
||||
|
||||
overwrite_samplemask_arg(&ctx, finfo);
|
||||
overwrite_pos_xy_args(&ctx, finfo);
|
||||
|
||||
std::vector<Operand> regs;
|
||||
passthrough_all_args(&ctx, regs);
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ struct aco_ps_prolog_info {
|
|||
bool force_linear_center_interp;
|
||||
|
||||
unsigned samplemask_log_ps_iter;
|
||||
bool get_frag_coord_from_pixel_coord;
|
||||
bool pixel_center_integer;
|
||||
unsigned num_interp_inputs;
|
||||
unsigned colors_read;
|
||||
int color_interp_vgpr_index[2];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue