nir: allow get_ssbo_size to return a 64-bit result

to match get_ubo_size, and to support HW where SSBOs can have a 64-bit size.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39743>
This commit is contained in:
Marek Olšák 2026-02-06 12:40:32 -05:00 committed by Marge Bot
parent c151402f35
commit a9df891bc6
4 changed files with 6 additions and 6 deletions

View file

@ -246,7 +246,7 @@ static bool lower_resinfo(nir_builder *b, nir_instr *instr, void *data)
nir_def *desc = nir_ssbo_descriptor_amd(b, intr->src[0].ssa,
.access = nir_intrinsic_access(intr));
result = nir_channel(b, desc, 2);
result = nir_u2uN(b, nir_channel(b, desc, 2), nir_instr_def(instr)->bit_size);
} else if (instr->type == nir_instr_type_intrinsic) {
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
const struct glsl_type *type;

View file

@ -450,7 +450,7 @@ intrinsic("deref_implicit_array_length", src_comp=[-1], dest_comp=1,
# Ask the driver for the size of a given SSBO. It takes the buffer index
# as source.
intrinsic("get_ssbo_size", src_comp=[-1], dest_comp=1, bit_sizes=[32],
intrinsic("get_ssbo_size", src_comp=[-1], dest_comp=1,
indices=[ACCESS], flags=[CAN_ELIMINATE, CAN_REORDER])
intrinsic("get_ubo_size", src_comp=[-1], dest_comp=1,
indices=[ACCESS], flags=[CAN_ELIMINATE, CAN_REORDER])

View file

@ -1690,7 +1690,7 @@ lower_explicit_io_array_length(nir_builder *b, nir_intrinsic_instr *intrin,
offset = addr_to_offset(b, addr, addr_format);
nir_def *index = addr_to_index(b, addr, addr_format);
unsigned access = nir_intrinsic_access(intrin);
size = nir_get_ssbo_size(b, index, .access = access);
size = nir_get_ssbo_size(b, 32, index, .access = access);
break;
}

View file

@ -68,7 +68,7 @@ lower_buffer_load(nir_builder *b, nir_intrinsic_instr *instr)
if (instr->intrinsic == nir_intrinsic_load_ubo) {
size = nir_get_ubo_size(b, 32, index);
} else {
size = nir_get_ssbo_size(b, index);
size = nir_get_ssbo_size(b, 32, index);
}
rewrite_offset(b, instr, type_sz, 1, size);
@ -79,13 +79,13 @@ lower_buffer_store(nir_builder *b, nir_intrinsic_instr *instr)
{
uint32_t type_sz = nir_src_bit_size(instr->src[0]) / 8;
rewrite_offset(b, instr, type_sz, 2,
nir_get_ssbo_size(b, instr->src[1].ssa));
nir_get_ssbo_size(b, 32, instr->src[1].ssa));
}
static void
lower_buffer_atomic(nir_builder *b, nir_intrinsic_instr *instr)
{
rewrite_offset(b, instr, 4, 1, nir_get_ssbo_size(b, instr->src[0].ssa));
rewrite_offset(b, instr, 4, 1, nir_get_ssbo_size(b, 32, instr->src[0].ssa));
}
static void