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 <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18358>
This commit is contained in:
Mike Blumenkrantz
2022-08-31 22:11:21 -04:00
committed by Marge Bot
parent cd00a36d47
commit 64aaabffdc

View File

@@ -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;