nir/xfb_info: add new fields to describe 16-bit XFB better

for drivers that need this information

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35256>
This commit is contained in:
Marek Olšák 2025-05-27 08:45:05 -04:00 committed by Marge Bot
parent 7b70b419b5
commit 6677d087c0
2 changed files with 8 additions and 1 deletions

View file

@ -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);

View file

@ -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;