Mesa (main): tu: Enable uniform texture buffers with NPOT formats
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 23:27:21 UTC 2022
Module: Mesa
Branch: main
Commit: 2e63c570ddc75b9f68327a9bc5402599bb443dbf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e63c570ddc75b9f68327a9bc5402599bb443dbf
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Fri Jun 10 17:15:09 2022 +0200
tu: Enable uniform texture buffers with NPOT formats
This is enough for zink to expose ARB_texture_buffer_object_rgb32 and
therefore GL 4.0. We could enable sampled images with a few more
workarounds, but the blob doesn't bother and there isn't any need at the
moment.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16980>
---
src/freedreno/vulkan/tu_formats.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 600088835bc..e1c8fbbb4e8 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -120,14 +120,6 @@ tu6_format_texture_unchecked(enum pipe_format format, enum a6xx_tile_mode tile_m
.swap = fd6_texture_swap(format, tile_mode),
};
- /* No texturing support for NPOT textures yet. See
- * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5536
- */
- if (util_format_is_plain(format) &&
- !util_is_power_of_two_nonzero(util_format_get_blocksize(format))) {
- fmt.fmt = FMT6_NONE;
- }
-
switch (format) {
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
@@ -172,17 +164,28 @@ tu_physical_device_get_format_properties(
bool supported_vtx = tu6_format_vtx_supported(vk_format);
bool supported_color = tu6_format_color_supported(format);
bool supported_tex = tu6_format_texture_supported(format);
+ bool is_npot = !util_is_power_of_two_or_zero(desc->block.bits);
if (format == PIPE_FORMAT_NONE ||
!(supported_vtx || supported_color || supported_tex)) {
goto end;
}
- buffer |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
+ /* We don't support BufferToImage/ImageToBuffer for npot formats */
+ if (!is_npot)
+ buffer |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
+
if (supported_vtx)
buffer |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
- if (supported_tex) {
+ if (supported_tex)
+ buffer |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
+
+ /* Don't support anything but texel buffers for non-power-of-two formats
+ * with 3 components. We'd need several workarounds for copying and
+ * clearing them because they're not renderable.
+ */
+ if (supported_tex && !is_npot) {
optimal |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
@@ -190,8 +193,6 @@ tu_physical_device_get_format_properties(
VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT |
VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT;
- buffer |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
-
/* no blit src bit for YUYV/NV12/I420 formats */
if (desc->layout != UTIL_FORMAT_LAYOUT_SUBSAMPLED &&
desc->layout != UTIL_FORMAT_LAYOUT_PLANAR2 &&
More information about the mesa-commit
mailing list