Mesa (main): pan/bi: Add bi_dual_tex_as_u32 helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 12 16:47:45 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Nov  8 14:43:41 2021 -0500

pan/bi: Add bi_dual_tex_as_u32 helper

Type safe cast, making dual texture descriptors easier to manipulate.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13723>

---

 src/panfrost/bifrost/bifrost.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h
index d9b5e1d5e0b..0a951ea175c 100644
--- a/src/panfrost/bifrost/bifrost.h
+++ b/src/panfrost/bifrost/bifrost.h
@@ -28,6 +28,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <string.h>
 #include <assert.h>
 
 #ifdef __cplusplus
@@ -572,6 +573,15 @@ struct bifrost_dual_texture_operation {
         unsigned primary_mask : 4;
 } __attribute__((packed));
 
+static inline uint32_t
+bi_dual_tex_as_u32(struct bifrost_dual_texture_operation desc)
+{
+        uint32_t desc_u;
+        memcpy(&desc_u, &desc, sizeof(desc));
+
+        return desc_u;
+}
+
 #define BIFROST_MEGA_SAMPLE 128
 #define BIFROST_ALL_SAMPLES 255
 #define BIFROST_CURRENT_PIXEL 255



More information about the mesa-commit mailing list