summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_serialize.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_serialize.c')
-rw-r--r--src/compiler/nir/nir_serialize.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index cc4bf23aa0f..6a30738c2d7 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -1116,6 +1116,10 @@ nir_serialize(struct blob *blob, const nir_shader *nir)
write_function_impl(&ctx, fxn->impl);
}
+ blob_write_uint32(blob, nir->constant_data_size);
+ if (nir->constant_data_size > 0)
+ blob_write_bytes(blob, nir->constant_data, nir->constant_data_size);
+
*(uintptr_t *)(blob->data + idx_size_offset) = ctx.next_idx;
_mesa_hash_table_destroy(ctx.remap_table, NULL);
@@ -1169,6 +1173,14 @@ nir_deserialize(void *mem_ctx,
nir_foreach_function(fxn, ctx.nir)
fxn->impl = read_function_impl(&ctx, fxn);
+ ctx.nir->constant_data_size = blob_read_uint32(blob);
+ if (ctx.nir->constant_data_size > 0) {
+ ctx.nir->constant_data =
+ ralloc_size(ctx.nir, ctx.nir->constant_data_size);
+ blob_copy_bytes(blob, ctx.nir->constant_data,
+ ctx.nir->constant_data_size);
+ }
+
free(ctx.idx_table);
return ctx.nir;