zink: ralloc spirv_shader
This uses ralloc for spirv_shader and it's data-payload, which seems a bit neater than having to remember to free twice. We can now also easily piggy back on more sophisticated ralloc usage as well. No need to use rzalloc here, as we'll write all memory in the struct, and the struct isn't used as a hashmap key, so padding shouldn't matter. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8049>
This commit is contained in:
parent
03ccd3c468
commit
008bf6ca61
|
@ -2602,11 +2602,11 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info,
|
|||
|
||||
size_t num_words = spirv_builder_get_num_words(&ctx.builder);
|
||||
|
||||
ret = CALLOC_STRUCT(spirv_shader);
|
||||
ret = ralloc(NULL, struct spirv_shader);
|
||||
if (!ret)
|
||||
goto fail;
|
||||
|
||||
ret->words = MALLOC(sizeof(uint32_t) * num_words);
|
||||
ret->words = ralloc_size(ret, sizeof(uint32_t) * num_words);
|
||||
if (!ret->words)
|
||||
goto fail;
|
||||
|
||||
|
|
|
@ -269,8 +269,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, struct z
|
|||
ralloc_free(nir);
|
||||
|
||||
/* TODO: determine if there's any reason to cache spirv output? */
|
||||
free(spirv->words);
|
||||
free(spirv);
|
||||
ralloc_free(spirv);
|
||||
return mod;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue