panvk: fix image size for cube-arrays on bifrost

We're parsing the descriptors here to read the size of the resource, but
what the HW wants and imageSize() wants is not the same. So let's fix up
the result for imageSize(), by dividing the result by 6.

If we change the descriptor instead, we end up failing shader-image
reads and writes instead.

I also looked for some unused bits in the descriptor that I could use
instead, but unfortunately there's only a few bits free here - not
enough for our needs.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Benjamin Lee <benjamin.lee@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32612>
This commit is contained in:
Erik Faye-Lund
2024-12-12 13:34:08 +01:00
committed by Marge Bot
parent f5763e80f4
commit 3c40aba8b6
@@ -630,6 +630,15 @@ load_img_size(nir_builder *b, nir_deref_instr *deref, enum glsl_sampler_dim dim,
nir_def *tex_sz = load_resource_deref_desc(
b, deref, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 18, 3, 16, ctx);
#if PAN_ARCH <= 7
if (is_array && dim == GLSL_SAMPLER_DIM_CUBE)
tex_sz =
nir_vector_insert_imm(b, tex_sz,
nir_udiv_imm(b, nir_channel(b, tex_sz, 2),
6),
2);
#endif
if (is_array && dim == GLSL_SAMPLER_DIM_1D)
tex_sz =
nir_vec2(b, nir_channel(b, tex_sz, 0), nir_channel(b, tex_sz, 2));