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

Author: Karol Herbst <[email protected]>
Date:   Mon May  1 01:22:56 2023 +0200

rusticl/nir: finish blob after serializing

Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Jesse Natalie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22776>

---

 src/gallium/frontends/rusticl/mesa/compiler/nir.rs                  | 4 +++-
 .../frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.c        | 6 ++++++
 .../frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.h        | 4 ++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/rusticl/mesa/compiler/nir.rs 
b/src/gallium/frontends/rusticl/mesa/compiler/nir.rs
index a7cfb6c8beb..07173780e31 100644
--- a/src/gallium/frontends/rusticl/mesa/compiler/nir.rs
+++ b/src/gallium/frontends/rusticl/mesa/compiler/nir.rs
@@ -70,7 +70,9 @@ impl NirShader {
         unsafe {
             blob_init(&mut blob);
             nir_serialize(&mut blob, self.nir.as_ptr(), false);
-            slice::from_raw_parts(blob.data, blob.size).to_vec()
+            let res = slice::from_raw_parts(blob.data, blob.size).to_vec();
+            blob_finish(&mut blob);
+            res
         }
     }
 
diff --git 
a/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.c 
b/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.c
index 2c4580451fd..a5a30db9524 100644
--- a/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.c
+++ b/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.c
@@ -1,6 +1,12 @@
 #include "rusticl_mesa_inline_bindings_wrapper.h"
 #include "git_sha1.h"
 
+void
+blob_finish(struct blob *blob)
+{
+    __blob_finish(blob);
+}
+
 nir_function_impl *
 nir_shader_get_entrypoint(const nir_shader *shader)
 {
diff --git 
a/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.h 
b/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.h
index 4b28cb3a834..d07abd93c82 100644
--- a/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.h
+++ b/src/gallium/frontends/rusticl/rusticl_mesa_inline_bindings_wrapper.h
@@ -1,13 +1,17 @@
+#define blob_finish __blob_finish
 #define nir_shader_get_entrypoint __nir_shader_get_entrypoint_wraped
 #define pipe_resource_reference __pipe_resource_reference_wraped
 #define util_format_pack_rgba __util_format_pack_rgba
 #include "nir.h"
+#include "util/blob.h"
 #include "util/u_inlines.h"
 #include "util/format/u_format.h"
+#undef blob_finish
 #undef nir_shader_get_entrypoint
 #undef pipe_resource_reference
 #undef util_format_pack_rgba
 
+void blob_finish(struct blob *);
 const char* mesa_version_string(void);
 nir_function_impl *nir_shader_get_entrypoint(const nir_shader *shader);
 void pipe_resource_reference(struct pipe_resource **dst, struct pipe_resource 
*src);

Reply via email to