zink: more accurately clamp 3d fb surfaces to corresponding 2d target

if more than 1 layer is being bound, this is an array, otherwise it's just
regular 2d

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15172>
This commit is contained in:
Mike Blumenkrantz
2022-02-22 16:10:05 -05:00
committed by Marge Bot
parent 59b0105e65
commit 8e67928862
+5 -5
View File
@@ -228,11 +228,11 @@ zink_create_surface(struct pipe_context *pctx,
struct pipe_resource *pres,
const struct pipe_surface *templ)
{
VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen),
zink_resource(pres), templ, pres->target);
if (pres->target == PIPE_TEXTURE_3D)
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D;
struct zink_resource *res = zink_resource(pres);
bool is_array = templ->u.tex.last_layer != templ->u.tex.first_layer;
enum pipe_texture_target target_2d[] = {PIPE_TEXTURE_2D, PIPE_TEXTURE_2D_ARRAY};
VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen), res, templ,
pres->target == PIPE_TEXTURE_3D ? target_2d[is_array] : pres->target);
struct pipe_surface *psurf = zink_get_surface(zink_context(pctx), pres, templ, &ivci);
if (!psurf)