diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2022-02-22 16:10:05 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-02-28 17:42:58 +0000 |
commit | 8e67928862de069d3e6892a1ecbb7ca8d1a648b6 (patch) | |
tree | 51dd95495c84df111d57af81fd29ba577b14a1f1 | |
parent | 59b0105e658b757b152a55dc6f062b16b7324ef4 (diff) |
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>
-rw-r--r-- | src/gallium/drivers/zink/zink_surface.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c index 8c95aacc218..e305a19d19f 100644 --- a/src/gallium/drivers/zink/zink_surface.c +++ b/src/gallium/drivers/zink/zink_surface.c @@ -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) |