Mesa (main): lavapipe: query formats for shader-image support

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 12 16:54:07 UTC 2021


Module: Mesa
Branch: main
Commit: dc9343b42d141a644bb7647145a8e422c22969d9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc9343b42d141a644bb7647145a8e422c22969d9

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon May 31 17:39:03 2021 +0200

lavapipe: query formats for shader-image support

Assuming all formats are supported here isn't a good plan; we
don't actually support all formats.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10467>

---

 src/gallium/frontends/lavapipe/lvp_formats.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_formats.c b/src/gallium/frontends/lavapipe/lvp_formats.c
index 10bca26ee35..b33337b9947 100644
--- a/src/gallium/frontends/lavapipe/lvp_formats.c
+++ b/src/gallium/frontends/lavapipe/lvp_formats.c
@@ -239,7 +239,7 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d
       out_properties->bufferFeatures = buffer_features;
       return;
    }
-   buffer_features = VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
+
    if (!util_format_is_srgb(pformat) &&
        physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat,
                                                      PIPE_BUFFER, 0, 0, PIPE_BIND_VERTEX_BUFFER)) {
@@ -251,6 +251,10 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d
       buffer_features |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
    }
 
+   if (physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat,
+                                                     PIPE_BUFFER, 0, 0, PIPE_BIND_SHADER_IMAGE)) {
+      buffer_features |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
+   }
 
    if (physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat,
                                                      PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) {
@@ -267,6 +271,10 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d
       /* SNORM blending on llvmpipe fails CTS - disable for now */
       if (!util_format_is_snorm(pformat))
          features |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT;
+   }
+
+   if (physical_device->pscreen->is_format_supported(physical_device->pscreen, pformat,
+                                                     PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SHADER_IMAGE)) {
       features |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
    }
 



More information about the mesa-commit mailing list