From 64aaabffdc4813defeb47509f798de62abec7a0d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 31 Aug 2022 22:11:21 -0400 Subject: [PATCH] zink: avoid needing mutable for z/s sampling the aspect flags should be sufficient to determine which component the imageview is created for, which means this can avoid changing the format here to retain the immutable format Reviewed-by: Emma Anholt Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index c3331d86e72..d9d9fc3dde8 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -911,6 +911,9 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres, struct pipe_surface templ = {0}; templ.u.tex.level = state->u.tex.first_level; templ.format = state->format; + /* avoid needing mutable for depth/stencil sampling */ + if (util_format_is_depth_and_stencil(pres->format)) + templ.format = pres->format; if (state->target != PIPE_TEXTURE_3D) { templ.u.tex.first_layer = state->u.tex.first_layer; templ.u.tex.last_layer = state->u.tex.last_layer;