summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-11 09:44:33 -0700
committerJason Ekstrand <[email protected]>2017-10-12 21:47:06 -0700
commit49bb9f785af8349f3245bc223cb7e0e40b9fa243 (patch)
treec4d2ef614b9de4a62d480d0493a1cd857e15ff4e /src/mesa
parent0e3bd56c6ea783dbc93fce71cec98ab859782a81 (diff)
compiler/blob: Switch to init/finish instead of create/destroy
There's no reason why that tiny bit of memory needs to be on the heap. We always put blob_reader on the stack, so why not do the same with the writable blob. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_shader_cache.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index 2c38f27ffd2..2e9b7cc6708 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -69,21 +69,22 @@ st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog,
return;
unsigned char *sha1;
- struct blob *blob = blob_create();
+ struct blob blob;
+ blob_init(&blob);
switch (prog->info.stage) {
case MESA_SHADER_VERTEX: {
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
sha1 = stvp->sha1;
- blob_write_uint32(blob, stvp->num_inputs);
- blob_write_bytes(blob, stvp->index_to_input,
+ blob_write_uint32(&blob, stvp->num_inputs);
+ blob_write_bytes(&blob, stvp->index_to_input,
sizeof(stvp->index_to_input));
- blob_write_bytes(blob, stvp->result_to_output,
+ blob_write_bytes(&blob, stvp->result_to_output,
sizeof(stvp->result_to_output));
- write_stream_out_to_cache(blob, &stvp->tgsi);
- write_tgsi_to_cache(blob, &stvp->tgsi, st, sha1, num_tokens);
+ write_stream_out_to_cache(&blob, &stvp->tgsi);
+ write_tgsi_to_cache(&blob, &stvp->tgsi, st, sha1, num_tokens);
break;
}
case MESA_SHADER_TESS_CTRL:
@@ -92,22 +93,22 @@ st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog,
struct st_common_program *p = st_common_program(prog);
sha1 = p->sha1;
- write_stream_out_to_cache(blob, out_state);
- write_tgsi_to_cache(blob, out_state, st, sha1, num_tokens);
+ write_stream_out_to_cache(&blob, out_state);
+ write_tgsi_to_cache(&blob, out_state, st, sha1, num_tokens);
break;
}
case MESA_SHADER_FRAGMENT: {
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
sha1 = stfp->sha1;
- write_tgsi_to_cache(blob, &stfp->tgsi, st, sha1, num_tokens);
+ write_tgsi_to_cache(&blob, &stfp->tgsi, st, sha1, num_tokens);
break;
}
case MESA_SHADER_COMPUTE: {
struct st_compute_program *stcp = (struct st_compute_program *) prog;
sha1 = stcp->sha1;
- write_tgsi_to_cache(blob, out_state, st, sha1, num_tokens);
+ write_tgsi_to_cache(&blob, out_state, st, sha1, num_tokens);
break;
}
default:
@@ -121,7 +122,7 @@ st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog,
_mesa_shader_stage_to_string(prog->info.stage), sha1_buf);
}
- blob_destroy(blob);
+ blob_finish(&blob);
}
static void