Module: Mesa Branch: main Commit: a9d2b86c2c80b94281b6f0cfc1f73adde8e0e294 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9d2b86c2c80b94281b6f0cfc1f73adde8e0e294
Author: Mike Blumenkrantz <[email protected]> Date: Wed Feb 9 15:45:49 2022 -0500 zink: store the spirv_shader to the zink_shader struct for generated tcs Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14976> --- src/gallium/drivers/zink/zink_compiler.c | 6 +++++- src/gallium/drivers/zink/zink_compiler.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index f09625e0e4f..1a35bab24a1 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -1162,7 +1162,10 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad ralloc_free(nir); /* TODO: determine if there's any reason to cache spirv output? */ - ralloc_free(spirv); + if (zs->is_generated) + zs->spirv = spirv; + else + ralloc_free(spirv); return mod; } @@ -1961,6 +1964,7 @@ zink_shader_free(struct zink_context *ctx, struct zink_shader *shader) } _mesa_set_destroy(shader->programs, NULL); ralloc_free(shader->nir); + ralloc_free(shader->spirv); FREE(shader); } diff --git a/src/gallium/drivers/zink/zink_compiler.h b/src/gallium/drivers/zink/zink_compiler.h index cb4d349e9c8..71dd2cb7926 100644 --- a/src/gallium/drivers/zink/zink_compiler.h +++ b/src/gallium/drivers/zink/zink_compiler.h @@ -88,6 +88,7 @@ struct zink_shader { uint32_t ubos_used; // bitfield of which ubo indices are used uint32_t ssbos_used; // bitfield of which ssbo indices are used bool bindless; + struct spirv_shader *spirv; simple_mtx_t lock; struct set *programs;
