From b715aaa5f1eb86e5d8af244b54979b2bdd1fd7f2 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 2 Apr 2021 14:51:17 -0400 Subject: [PATCH] zink: only set layer info for samplerviews if there are multiple layers fixes a bunch of validation errors Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 45b98cabc31..6da5d1b3dd0 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -530,8 +530,10 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres, struct pipe_surface templ = {}; templ.u.tex.level = state->u.tex.first_level; templ.format = state->format; - templ.u.tex.first_layer = state->u.tex.first_layer; - templ.u.tex.last_layer = state->u.tex.last_layer; + 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; + } ivci = create_ivci(screen, res, &templ, state->target); ivci.subresourceRange.levelCount = state->u.tex.last_level - state->u.tex.first_level + 1;