zink: do initial program unref during program creation

this ensures that programs are never created with more than $num_shaders
refs, which is otherwise not necessarily a bug but can lead to bugs

Fixes: a0e69e7601 ("zink: split out first-time shader module creation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23888>
This commit is contained in:
Mike Blumenkrantz
2023-06-27 12:54:47 -04:00
committed by Marge Bot
parent d5884d5bd5
commit 84bb6078f4
+1 -2
View File
@@ -446,7 +446,6 @@ generate_gfx_program_modules(struct zink_context *ctx, struct zink_screen *scree
variant_hash ^= prog->module_hash[i];
}
p_atomic_dec(&prog->base.reference.count);
state->modules_changed = true;
prog->last_variant_hash = variant_hash;
@@ -469,7 +468,6 @@ generate_gfx_program_modules_optimal(struct zink_context *ctx, struct zink_scree
prog->objects[i] = zm->obj.obj;
}
p_atomic_dec(&prog->base.reference.count);
state->modules_changed = true;
prog->last_variant_hash = state->shader_keys_optimal.key.val;
}
@@ -1136,6 +1134,7 @@ zink_create_gfx_program(struct zink_context *ctx,
}
}
_mesa_sha1_final(&sctx, prog->base.sha1);
p_atomic_dec(&prog->base.reference.count);
if (!zink_descriptor_program_init(ctx, &prog->base))
goto fail;