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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Sat Feb 18 12:14:03 2023 -0500

agx: Add agx_internal_format_supports_mask helper

Not all formats can be masked, add a query to check which can be.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21431>

---

 src/asahi/compiler/agx_internal_formats.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/asahi/compiler/agx_internal_formats.h 
b/src/asahi/compiler/agx_internal_formats.h
index 03240f057c9..9232243d22a 100644
--- a/src/asahi/compiler/agx_internal_formats.h
+++ b/src/asahi/compiler/agx_internal_formats.h
@@ -6,6 +6,7 @@
 #ifndef AGX_INTERNAL_FORMATS_H
 #define AGX_INTERNAL_FORMATS_H
 
+#include <stdbool.h>
 #include "util/format/u_formats.h"
 
 /* Define aliases for the subset formats that are accessible in the ISA. These
@@ -27,4 +28,21 @@ enum agx_internal_formats {
    AGX_INTERNAL_FORMAT_RGB9E5 = PIPE_FORMAT_R9G9B9E5_FLOAT
 };
 
+/*
+ * The architecture load/store instructions support masking, but packed formats
+ * are not compatible with masking. Check if a format is packed.
+ */
+static inline bool
+agx_internal_format_supports_mask(enum agx_internal_formats format)
+{
+   switch (format) {
+   case AGX_INTERNAL_FORMAT_RGB10A2:
+   case AGX_INTERNAL_FORMAT_RG11B10F:
+   case AGX_INTERNAL_FORMAT_RGB9E5:
+      return false;
+   default:
+      return true;
+   }
+}
+
 #endif

Reply via email to