From 6677d087c086cdfc65bf55b0a9db838ab800f5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 27 May 2025 08:45:05 -0400 Subject: [PATCH] nir/xfb_info: add new fields to describe 16-bit XFB better for drivers that need this information Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_gather_xfb_info.c | 4 ++++ src/compiler/nir/nir_xfb_info.h | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c index 0565900fb05..c89d8b18dce 100644 --- a/src/compiler/nir/nir_gather_xfb_info.c +++ b/src/compiler/nir/nir_gather_xfb_info.c @@ -348,7 +348,11 @@ nir_gather_xfb_info_from_intrinsics(nir_shader *nir) out.component_mask = BITFIELD_RANGE(index, xfb.out[index % 2].num_components); out.location = sem.location; + out.data_is_16bit = intr->src[0].ssa->bit_size == 16; out.high_16bits = sem.high_16bits; + out.mediump = sem.medium_precision; + out.mediump_upconvert_type = nir_intrinsic_src_type(intr) & + (nir_type_float | nir_type_int | nir_type_uint); out.buffer = xfb.out[index % 2].buffer; out.offset = (uint32_t)xfb.out[index % 2].offset * 4; util_dynarray_append(&array, nir_xfb_output_info, out); diff --git a/src/compiler/nir/nir_xfb_info.h b/src/compiler/nir/nir_xfb_info.h index 78311b3d740..a514e093329 100644 --- a/src/compiler/nir/nir_xfb_info.h +++ b/src/compiler/nir/nir_xfb_info.h @@ -44,7 +44,10 @@ typedef struct { uint8_t buffer; uint16_t offset; uint8_t location; - bool high_16bits; + bool data_is_16bit; /* whether the src data has bit_size=16 */ + bool high_16bits; /* whether the src data comes from high 16 bits */ + bool mediump; /* whether 16-bit data must be upconverted to 32 bits before memory stores */ + nir_alu_type mediump_upconvert_type; /* the type of upconversion (float, int, or uint) */ uint8_t component_mask; uint8_t component_offset; } nir_xfb_output_info;