[Mesa-dev] [PATCH 1/3] nir: just drop the register name when serializing

Timothy Arceri tarceri at itsqueeze.com
Fri Mar 1 06:38:42 UTC 2019


We know NIR can handle this because the shaders coming from spirv don't
have names. Dropping the name 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 | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index 743eeaed3d5..da41f2ea3f2 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -224,9 +224,6 @@ write_register(write_ctx *ctx, const nir_register *reg)
    blob_write_uint32(ctx->blob, reg->bit_size);
    blob_write_uint32(ctx->blob, reg->num_array_elems);
    blob_write_uint32(ctx->blob, reg->index);
-   blob_write_uint32(ctx->blob, !!(reg->name));
-   if (reg->name)
-      blob_write_string(ctx->blob, reg->name);
    blob_write_uint32(ctx->blob, reg->is_global << 1 | reg->is_packed);
 }
 
@@ -239,13 +236,7 @@ read_register(read_ctx *ctx)
    reg->bit_size = blob_read_uint32(ctx->blob);
    reg->num_array_elems = blob_read_uint32(ctx->blob);
    reg->index = blob_read_uint32(ctx->blob);
-   bool has_name = blob_read_uint32(ctx->blob);
-   if (has_name) {
-      const char *name = blob_read_string(ctx->blob);
-      reg->name = ralloc_strdup(reg, name);
-   } else {
-      reg->name = NULL;
-   }
+   reg->name = NULL;
    unsigned flags = blob_read_uint32(ctx->blob);
    reg->is_global = flags & 0x2;
    reg->is_packed = flags & 0x1;
-- 
2.20.1



More information about the mesa-dev mailing list