[Mesa-dev] [PATCH 2/3] nir: drop name and label when serializing
Timothy Arceri
tarceri at itsqueeze.com
Fri Mar 1 06:38:43 UTC 2019
Dropping these makes the shaders more generic which can make it
better when using the serialized NIR as a key for in memory shader
caches such as what we do for radeonsi.
Also it just means we can write/read less to and from the disk cache.
---
src/compiler/nir/nir_serialize.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index da41f2ea3f2..adcc0cf43df 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -1082,16 +1082,6 @@ nir_serialize(struct blob *blob, const nir_shader *nir)
size_t idx_size_offset = blob_reserve_intptr(blob);
struct shader_info info = nir->info;
- uint32_t strings = 0;
- if (info.name)
- strings |= 0x1;
- if (info.label)
- strings |= 0x2;
- blob_write_uint32(blob, strings);
- if (info.name)
- blob_write_string(blob, info.name);
- if (info.label)
- blob_write_string(blob, info.label);
info.name = info.label = NULL;
blob_write_bytes(blob, (uint8_t *) &info, sizeof(info));
@@ -1140,18 +1130,11 @@ nir_deserialize(void *mem_ctx,
ctx.idx_table = calloc(ctx.idx_table_len, sizeof(uintptr_t));
ctx.next_idx = 0;
- uint32_t strings = blob_read_uint32(blob);
- char *name = (strings & 0x1) ? blob_read_string(blob) : NULL;
- char *label = (strings & 0x2) ? blob_read_string(blob) : NULL;
-
struct shader_info info;
blob_copy_bytes(blob, (uint8_t *) &info, sizeof(info));
ctx.nir = nir_shader_create(mem_ctx, info.stage, options, NULL);
- info.name = name ? ralloc_strdup(ctx.nir, name) : NULL;
- info.label = label ? ralloc_strdup(ctx.nir, label) : NULL;
-
ctx.nir->info = info;
read_var_list(&ctx, &ctx.nir->uniforms);
--
2.20.1
More information about the mesa-dev
mailing list