summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/shader_cache.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-11 14:59:02 +1000
committerTimothy Arceri <[email protected]>2017-08-24 11:18:48 +1000
commit44918a197905e4e9d09e32b7d07945948ca2da07 (patch)
tree5e9c6c5104dba6a093b4f2c23a7208f21ec1987e /src/compiler/glsl/shader_cache.cpp
parent22154823d21f17a5fdff7b1fe3c92b61f5389d88 (diff)
glsl: always write a name/label string to the cache
In the following patch we will stop writing the pointer to cache. Unfortunately adding empty strings to that cache seems to be the only thing we can do here once we no longer have the pointers. Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/compiler/glsl/shader_cache.cpp')
-rw-r--r--src/compiler/glsl/shader_cache.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 26be9e1f883..0e7744bb0bd 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1315,10 +1315,9 @@ create_linked_shader_and_program(struct gl_context *ctx,
/* Restore shader info */
blob_copy_bytes(metadata, (uint8_t *) &glprog->info, sizeof(shader_info));
- if (glprog->info.name)
- glprog->info.name = ralloc_strdup(glprog, blob_read_string(metadata));
- if (glprog->info.label)
- glprog->info.label = ralloc_strdup(glprog, blob_read_string(metadata));
+
+ glprog->info.name = ralloc_strdup(glprog, blob_read_string(metadata));
+ glprog->info.label = ralloc_strdup(glprog, blob_read_string(metadata));
_mesa_reference_shader_program_data(ctx, &glprog->sh.data, prog->data);
_mesa_reference_program(ctx, &linked->Program, glprog);
@@ -1362,9 +1361,13 @@ shader_cache_write_program_metadata(struct gl_context *ctx,
if (sh->Program->info.name)
blob_write_string(metadata, sh->Program->info.name);
+ else
+ blob_write_string(metadata, "");
if (sh->Program->info.label)
blob_write_string(metadata, sh->Program->info.label);
+ else
+ blob_write_string(metadata, "");
}
}