zink: create new transient image if the sample count doesn't match

otherwise this will keep reusing the previous transient

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39336>
This commit is contained in:
Mike Blumenkrantz 2026-01-15 17:28:03 -05:00 committed by Marge Bot
parent 957e19e8a7
commit 9fd8041d24

View file

@ -295,7 +295,7 @@ zink_create_transient_surface(struct zink_context *ctx, const struct pipe_surfac
struct zink_resource *res = zink_resource(psurf->texture);
struct zink_resource *transient = res->transient;
assert(nr_samples > 1);
if (!res->transient) {
if (!res->transient || res->transient->base.b.nr_samples != nr_samples) {
/* transient fb attachment: not cached */
struct pipe_resource rtempl = *psurf->texture;
rtempl.nr_samples = nr_samples;
@ -303,6 +303,7 @@ zink_create_transient_surface(struct zink_context *ctx, const struct pipe_surfac
rtempl.bind |= ZINK_BIND_TRANSIENT;
if (zink_format_needs_mutable(rtempl.format, psurf->format, true))
rtempl.bind |= ZINK_BIND_MUTABLE;
zink_resource_reference(&res->transient, NULL);
res->transient = zink_resource(ctx->base.screen->resource_create(ctx->base.screen, &rtempl));
transient = res->transient;
if (unlikely(!transient)) {