From dfa8c15164c2f005d4690b6b9b652451c59e1917 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 29 Mar 2023 08:08:00 -0400 Subject: [PATCH] zink: break out nir blob deserializing Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 12 +++++++++--- src/gallium/drivers/zink/zink_compiler.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 442cbb2..27d0f48 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -5176,11 +5176,17 @@ zink_shader_has_cubes(nir_shader *nir) } nir_shader * +zink_shader_blob_deserialize(struct zink_screen *screen, struct blob *blob) +{ + struct blob_reader blob_reader; + blob_reader_init(&blob_reader, blob->data, blob->size); + return nir_deserialize(NULL, &screen->nir_options, &blob_reader); +} + +nir_shader * zink_shader_deserialize(struct zink_screen *screen, struct zink_shader *zs) { - struct blob_reader blob; - blob_reader_init(&blob, zs->blob.data, zs->blob.size); - return nir_deserialize(NULL, &screen->nir_options, &blob); + return zink_shader_blob_deserialize(screen, &zs->blob); } void diff --git a/src/gallium/drivers/zink/zink_compiler.h b/src/gallium/drivers/zink/zink_compiler.h index 574db1b..343ee9b 100644 --- a/src/gallium/drivers/zink/zink_compiler.h +++ b/src/gallium/drivers/zink/zink_compiler.h @@ -97,6 +97,8 @@ zink_shader_descriptor_is_buffer(struct zink_shader *zs, enum zink_descriptor_ty bool zink_shader_has_cubes(nir_shader *nir); nir_shader * +zink_shader_blob_deserialize(struct zink_screen *screen, struct blob *blob); +nir_shader * zink_shader_deserialize(struct zink_screen *screen, struct zink_shader *zs); void zink_shader_serialize_blob(nir_shader *nir, struct blob *blob); -- 2.7.4