From 13b25a6114fc226b1aa06125fa56bc5fffd900d4 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 3 Feb 2023 16:38:01 -0500 Subject: [PATCH] asahi: Don't use 16-bit inputs to 32-bit st_tile The hardware doesn't extend in this case, we need to extend for it. This fixes 32-bit render target formats with lower_mediump_io. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_nir_lower_tilebuffer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/asahi/lib/agx_nir_lower_tilebuffer.c b/src/asahi/lib/agx_nir_lower_tilebuffer.c index 61a2034ce17..3d49c2841cd 100644 --- a/src/asahi/lib/agx_nir_lower_tilebuffer.c +++ b/src/asahi/lib/agx_nir_lower_tilebuffer.c @@ -50,6 +50,16 @@ tib_impl(nir_builder *b, nir_instr *instr, void *data) /* Trim to format as required by hardware */ value = nir_trim_vector(b, intr->src[0].ssa, comps); + /* The hardware cannot extend for a 32-bit format. Extend ourselves. */ + if (format == PIPE_FORMAT_R32_UINT && value->bit_size == 16) { + if (util_format_is_pure_sint(logical_format)) + value = nir_i2i32(b, value); + else if (util_format_is_pure_uint(logical_format)) + value = nir_u2u32(b, value); + else + value = nir_f2f32(b, value); + } + nir_store_local_pixel_agx( b, value, nir_imm_intN_t(b, ALL_SAMPLES, 16), .base = tib->offset_B[rt],