Mesa (main): v3d: restrict formats supported for PIPE_BIND_SHADER_IMAGE

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 3 16:10:51 UTC 2021


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

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Mon Sep  6 01:12:52 2021 +0200

v3d: restrict formats supported for PIPE_BIND_SHADER_IMAGE

So far we were relying on the supported formats filtering when
creating images from the user API.

But for some other (internal) uses, some of the formats that pass the
filter need to be restricted when binding them as shader images, as they
are not supported for this case.

v3 (Iago):
 - Change commit message.

Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

---

 src/gallium/drivers/v3d/v3d_screen.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c
index 1c72dc4af0d..69aa82484e7 100644
--- a/src/gallium/drivers/v3d/v3d_screen.c
+++ b/src/gallium/drivers/v3d/v3d_screen.c
@@ -652,6 +652,23 @@ v3d_screen_is_format_supported(struct pipe_screen *pscreen,
                 return false;
         }
 
+        if (usage & PIPE_BIND_SHADER_IMAGE) {
+                switch (format) {
+                /* FIXME: maybe we can implement a swizzle-on-writes to add
+                 * support for BGRA-alike formats.
+                 */
+                case PIPE_FORMAT_A4B4G4R4_UNORM:
+                case PIPE_FORMAT_A1B5G5R5_UNORM:
+                case PIPE_FORMAT_B5G6R5_UNORM:
+                case PIPE_FORMAT_B8G8R8A8_UNORM:
+                case PIPE_FORMAT_X8Z24_UNORM:
+                case PIPE_FORMAT_Z16_UNORM:
+                        return false;
+                default:
+                        return true;
+                }
+        }
+
         return true;
 }
 



More information about the mesa-commit mailing list