pco: enable translation of vs sysvals
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33998>
This commit is contained in:
committed by
Marge Bot
parent
410bba0463
commit
0751eb576d
@@ -33,6 +33,8 @@ static const nir_shader_compiler_options nir_options = {
|
||||
|
||||
.has_fused_comp_and_csel = true,
|
||||
|
||||
.instance_id_includes_base_index = true,
|
||||
|
||||
.lower_fdiv = true,
|
||||
.lower_fquantize2f16 = true,
|
||||
.lower_layer_fs_input_to_sysval = true,
|
||||
|
||||
@@ -481,6 +481,27 @@ static pco_instr *trans_load_ubo(trans_ctx *tctx,
|
||||
addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Translates a NIR vs load system value intrinsic into PCO.
|
||||
*
|
||||
* \param[in,out] tctx Translation context.
|
||||
* \param[in] intr System value intrinsic.
|
||||
* \param[in] dest Instruction destination.
|
||||
* \return The translated PCO instruction.
|
||||
*/
|
||||
static pco_instr *
|
||||
trans_load_sysval_vs(trans_ctx *tctx, nir_intrinsic_instr *intr, pco_ref dest)
|
||||
{
|
||||
gl_system_value sys_val = nir_system_value_from_intrinsic(intr->intrinsic);
|
||||
const pco_range *range = &tctx->shader->data.common.sys_vals[sys_val];
|
||||
|
||||
unsigned chans = pco_ref_get_chans(dest);
|
||||
assert(chans == range->count);
|
||||
|
||||
pco_ref src = pco_ref_hwreg_vec(range->start, PCO_REG_CLASS_VTXIN, chans);
|
||||
return pco_mov(&tctx->b, dest, src, .rpt = chans);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Translates a NIR intrinsic instruction into PCO.
|
||||
*
|
||||
@@ -523,6 +544,14 @@ static pco_instr *trans_intr(trans_ctx *tctx, nir_intrinsic_instr *intr)
|
||||
instr = trans_load_ubo(tctx, intr, dest, src[1]);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_vertex_id:
|
||||
case nir_intrinsic_load_instance_id:
|
||||
case nir_intrinsic_load_base_instance:
|
||||
case nir_intrinsic_load_base_vertex:
|
||||
case nir_intrinsic_load_draw_id:
|
||||
instr = trans_load_sysval_vs(tctx, intr, dest);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported intrinsic: \"");
|
||||
nir_print_instr(&intr->instr, stdout);
|
||||
|
||||
Reference in New Issue
Block a user