etnaviv: Rework uniform handling for UBO addresses

We are not using this 'feature'. Doing this in the
compiler would be lot of pain, as there is no backend
IR. The right way to do it would be nir address opt pass,
that does some offset and shift lowering. Lets see this
commit as prep change for a nir pass and/or backend IR.

Use the content to store the index of the UBO.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30331>
This commit is contained in:
Christian Gmeiner
2024-06-24 18:36:19 +02:00
committed by Marge Bot
parent 9b7bb6cc9f
commit a885f91617
3 changed files with 5 additions and 8 deletions

View File

@@ -599,7 +599,7 @@ emit_intrinsic(struct etna_compile *c, nir_intrinsic_instr * intr)
.type = ISA_TYPE_U32,
.dst = ra_def(c, &intr->def, &dst_swiz),
.src[0] = get_src(c, &intr->src[1]),
.src[1] = const_src(c, &CONST_VAL(ETNA_UNIFORM_UBO0_ADDR + idx, 0), 1),
.src[1] = const_src(c, &CONST_VAL(ETNA_UNIFORM_UBO_ADDR, idx), 1),
});
} break;
case nir_intrinsic_load_front_face:

View File

@@ -99,8 +99,7 @@ enum etna_uniform_contents {
ETNA_UNIFORM_TEXTURE_WIDTH,
ETNA_UNIFORM_TEXTURE_HEIGHT,
ETNA_UNIFORM_TEXTURE_DEPTH,
ETNA_UNIFORM_UBO0_ADDR,
ETNA_UNIFORM_UBOMAX_ADDR = ETNA_UNIFORM_UBO0_ADDR + ETNA_MAX_CONST_BUF - 1,
ETNA_UNIFORM_UBO_ADDR,
};
struct etna_shader_uniform_info {

View File

@@ -117,7 +117,6 @@ etna_uniforms_write(const struct etna_context *ctx,
const struct etna_shader_uniform_info *uinfo = &sobj->uniforms;
bool frag = (sobj == ctx->shader.fs);
uint32_t base = frag ? screen->specs.ps_uniforms_offset : screen->specs.vs_uniforms_offset;
unsigned idx;
if (!uinfo->count)
return;
@@ -151,12 +150,11 @@ etna_uniforms_write(const struct etna_context *ctx,
get_texture_size(ctx, frag, uinfo->contents[i], val));
break;
case ETNA_UNIFORM_UBO0_ADDR ... ETNA_UNIFORM_UBOMAX_ADDR:
idx = uinfo->contents[i] - ETNA_UNIFORM_UBO0_ADDR;
case ETNA_UNIFORM_UBO_ADDR:
etna_cmd_stream_reloc(stream, &(struct etna_reloc) {
.bo = etna_resource(cb[idx].buffer)->bo,
.bo = etna_resource(cb[val].buffer)->bo,
.flags = ETNA_RELOC_READ,
.offset = cb[idx].buffer_offset + val,
.offset = cb[val].buffer_offset,
});
break;