From 8c1bc1b964a5c92995b9285039c945b679496ed8 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 1 May 2023 01:22:56 +0200 Subject: [PATCH] rusticl/nir: finish blob after serializing Signed-off-by: Karol Herbst Reviewed-by: Jesse Natalie Part-of: --- 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 a7cfb6c..0717378 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 2c45804..a5a30db 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 4b28cb3..d07abd9 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); -- 2.7.4