Mesa (main): zink: add a target param to create_ivci()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 10 01:01:17 UTC 2021
Module: Mesa
Branch: main
Commit: b243b1d963657cdf7b27435bc0342f08080c391e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b243b1d963657cdf7b27435bc0342f08080c391e
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Sat Apr 3 10:57:33 2021 -0400
zink: add a target param to create_ivci()
allow creating views of different types than the base resource
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10703>
---
src/gallium/drivers/zink/zink_surface.c | 9 +++++----
src/gallium/drivers/zink/zink_surface.h | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c
index 4cae6fd11ec..e61ccb2f3dd 100644
--- a/src/gallium/drivers/zink/zink_surface.c
+++ b/src/gallium/drivers/zink/zink_surface.c
@@ -34,13 +34,14 @@
VkImageViewCreateInfo
create_ivci(struct zink_screen *screen,
struct zink_resource *res,
- const struct pipe_surface *templ)
+ const struct pipe_surface *templ,
+ enum pipe_texture_target target)
{
VkImageViewCreateInfo ivci = {};
ivci.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
ivci.image = res->obj->image;
- switch (res->base.b.target) {
+ switch (target) {
case PIPE_TEXTURE_1D:
ivci.viewType = VK_IMAGE_VIEW_TYPE_1D;
break;
@@ -175,7 +176,7 @@ zink_create_surface(struct pipe_context *pctx,
{
VkImageViewCreateInfo ivci = create_ivci(zink_screen(pctx->screen),
- zink_resource(pres), templ);
+ zink_resource(pres), templ, pres->target);
if (pres->target == PIPE_TEXTURE_3D)
ivci.viewType = VK_IMAGE_VIEW_TYPE_2D;
@@ -248,7 +249,7 @@ zink_rebind_surface(struct zink_context *ctx, struct pipe_surface **psurface)
if (surface->simage_view)
return false;
VkImageViewCreateInfo ivci = create_ivci(screen,
- zink_resource((*psurface)->texture), (*psurface));
+ zink_resource((*psurface)->texture), (*psurface), surface->base.texture->target);
uint32_t hash = hash_ivci(&ivci);
simple_mtx_lock(&screen->surface_mtx);
diff --git a/src/gallium/drivers/zink/zink_surface.h b/src/gallium/drivers/zink/zink_surface.h
index c8931ca32fe..4f29509835e 100644
--- a/src/gallium/drivers/zink/zink_surface.h
+++ b/src/gallium/drivers/zink/zink_surface.h
@@ -69,7 +69,8 @@ zink_context_surface_init(struct pipe_context *context);
VkImageViewCreateInfo
create_ivci(struct zink_screen *screen,
struct zink_resource *res,
- const struct pipe_surface *templ);
+ const struct pipe_surface *templ,
+ enum pipe_texture_target target);
struct pipe_surface *
zink_get_surface(struct zink_context *ctx,
More information about the mesa-commit
mailing list