v3dv: add support for sampling simple 2D linear textures
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 31 Aug 2023 11:14:19 +0000 (13:14 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 11 Sep 2023 12:04:35 +0000 (12:04 +0000)
commit95f881adbd7cce5a0d871b68b79005e1427365fb
tree6ddd7a01294383cbfef3345855dd28b8de542c62
parent151f78150baed79e33d7c18da38e851f9b17a463
v3dv: add support for sampling simple 2D linear textures

V3D can't sample linear images (other than 1D), however, some applications
will require this to work. Particularly, our swapchain images may need to be
linear (for display), so sampling from them won't work.

This change detects the case where we are binding a descriptor which attempts
to sample from a simple 2D linear texture, transparently creates a tiled
copy of the image and rewrites the  descriptor to refer to the tiled image
instead. This will be slow but will allow some applications that require this
to work (i.e. some aspects of Android's user interface).

As of this patch, this only supports sampling linear images with a single
miplevel and layer from single-plane images in non-arrayed descriptors. We
could handle other cases too with a bit more work though.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9712
Tested-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25048>
src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_image.c
src/broadcom/vulkan/v3dv_meta_copy.c
src/broadcom/vulkan/v3dv_private.h