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

otherwise this will keep reusing the previous transient

cc: mesa-stable

(cherry picked from commit 9fd8041d24)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This commit is contained in:
Mike Blumenkrantz 2026-01-15 17:28:03 -05:00 committed by Dylan Baker
parent 067cbd9d82
commit 86752ce4e8
2 changed files with 3 additions and 2 deletions

View file

@ -734,7 +734,7 @@
"description": "zink: create new transient image if the sample count doesn't match",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -291,7 +291,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;
@ -299,6 +299,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))
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)) {