vc4: use tlb_color_brcm intrinsic

Instead of hacking the load_input to read the TLB color, let's use the
intrinsic created for originally for V3D.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29119>
This commit is contained in:
Juan A. Suarez Romero 2024-05-09 13:05:25 +02:00 committed by Marge Bot
parent 87cd11ecd2
commit 5272a813f2
3 changed files with 7 additions and 17 deletions

View file

@ -57,8 +57,8 @@ blend_depends_on_dst_color(struct vc4_compile *c)
static nir_def *
vc4_nir_get_dst_color(nir_builder *b, int sample)
{
return nir_load_input(b, 1, 32, nir_imm_int(b, 0),
.base = VC4_NIR_TLB_COLOR_READ_INPUT + sample);
return nir_load_tlb_color_brcm(b, 1, 32, nir_imm_int(b, 0),
.base = sample);
}
static nir_def *

View file

@ -220,13 +220,6 @@ vc4_nir_lower_fs_input(struct vc4_compile *c, nir_builder *b,
{
b->cursor = nir_after_instr(&intr->instr);
if (nir_intrinsic_base(intr) >= VC4_NIR_TLB_COLOR_READ_INPUT &&
nir_intrinsic_base(intr) < (VC4_NIR_TLB_COLOR_READ_INPUT +
VC4_MAX_SAMPLES)) {
/* This doesn't need any lowering. */
return;
}
nir_variable *input_var =
nir_find_variable_with_driver_location(c->s, nir_var_shader_in,
nir_intrinsic_base(intr));

View file

@ -1676,8 +1676,7 @@ ntq_emit_color_read(struct vc4_compile *c, nir_intrinsic_instr *instr)
/* Reads of the per-sample color need to be done in
* order.
*/
int sample_index = (nir_intrinsic_base(instr) -
VC4_NIR_TLB_COLOR_READ_INPUT);
int sample_index = nir_intrinsic_base(instr);
for (int i = 0; i <= sample_index; i++) {
if (c->color_reads[i].file == QFILE_NULL) {
c->color_reads[i] =
@ -1695,12 +1694,6 @@ ntq_emit_load_input(struct vc4_compile *c, nir_intrinsic_instr *instr)
assert(nir_src_is_const(instr->src[0]) &&
"vc4 doesn't support indirect inputs");
if (c->stage == QSTAGE_FRAG &&
nir_intrinsic_base(instr) >= VC4_NIR_TLB_COLOR_READ_INPUT) {
ntq_emit_color_read(c, instr);
return;
}
uint32_t offset = nir_intrinsic_base(instr) +
nir_src_as_uint(instr->src[0]);
int comp = nir_intrinsic_component(instr);
@ -1792,6 +1785,10 @@ ntq_emit_intrinsic(struct vc4_compile *c, nir_intrinsic_instr *instr)
ntq_emit_load_input(c, instr);
break;
case nir_intrinsic_load_tlb_color_brcm:
ntq_emit_color_read(c, instr);
break;
case nir_intrinsic_store_output:
assert(nir_src_is_const(instr->src[1]) &&
"vc4 doesn't support indirect outputs");