summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Piñeiro <[email protected]>2018-02-28 13:01:56 +0100
committerAlejandro Piñeiro <[email protected]>2018-03-01 08:23:33 +0100
commite72fb4e61128684efc28647931a793910e190656 (patch)
treed6db7bcf1db21e935b8f99a59e8fcf2815a28f68
parentba642ee3ee36d7aefd21e8b8d4da0c5c24ec0ec8 (diff)
nir/serialize: handle var->name being NULL
var->name could be NULL under ARB_gl_spirv for example. And in any case, the code is already handing var name being NULL when reading a variable, so it is consistent to do it writing a variable too. Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/compiler/nir/nir_serialize.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c
index 9fe46a675f6..00df49c2ef3 100644
--- a/src/compiler/nir/nir_serialize.c
+++ b/src/compiler/nir/nir_serialize.c
@@ -137,7 +137,8 @@ write_variable(write_ctx *ctx, const nir_variable *var)
write_add_object(ctx, var);
encode_type_to_blob(ctx->blob, var->type);
blob_write_uint32(ctx->blob, !!(var->name));
- blob_write_string(ctx->blob, var->name);
+ if (var->name)
+ blob_write_string(ctx->blob, var->name);
blob_write_bytes(ctx->blob, (uint8_t *) &var->data, sizeof(var->data));
blob_write_uint32(ctx->blob, var->num_state_slots);
blob_write_bytes(ctx->blob, (uint8_t *) var->state_slots,