iris: Ref count the uncompiled shaders
I tried /just/ ref counting the uncompiled shaders, but that is not sufficient. At the very least, it's a problem for blorp shaders that only have variants (and no uncompiled shader). This is in prepartion for using the live shader cache. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11229>
This commit is contained in:
@@ -371,6 +371,8 @@ enum iris_predicate_state {
|
||||
* See iris_compiled_shader, which represents a compiled shader variant.
|
||||
*/
|
||||
struct iris_uncompiled_shader {
|
||||
struct pipe_reference ref;
|
||||
|
||||
/**
|
||||
* NIR for the shader.
|
||||
*
|
||||
@@ -955,6 +957,26 @@ struct iris_compiled_shader *iris_upload_shader(struct iris_screen *screen,
|
||||
const struct iris_binding_table *bt);
|
||||
void iris_delete_shader_variant(struct iris_compiled_shader *shader);
|
||||
|
||||
void iris_destroy_shader_state(struct pipe_context *ctx, void *state);
|
||||
|
||||
static inline void
|
||||
iris_uncompiled_shader_reference(struct pipe_context *ctx,
|
||||
struct iris_uncompiled_shader **dst,
|
||||
struct iris_uncompiled_shader *src)
|
||||
{
|
||||
if (*dst == src)
|
||||
return;
|
||||
|
||||
struct iris_uncompiled_shader *old_dst = *dst;
|
||||
|
||||
if (pipe_reference(old_dst != NULL ? &old_dst->ref : NULL,
|
||||
src != NULL ? &src->ref : NULL)) {
|
||||
iris_destroy_shader_state(ctx, *dst);
|
||||
}
|
||||
|
||||
*dst = src;
|
||||
}
|
||||
|
||||
static inline void
|
||||
iris_shader_variant_reference(struct iris_compiled_shader **dst,
|
||||
struct iris_compiled_shader *src)
|
||||
|
Reference in New Issue
Block a user