Mesa (main): zink: break out surface info init to helper function

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 13:41:10 UTC 2021


Module: Mesa
Branch: main
Commit: 5e9669650c091074fa887640ecb55e29f43f0e8b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e9669650c091074fa887640ecb55e29f43f0e8b

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Sep 29 13:34:39 2021 -0400

zink: break out surface info init to helper function

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13126>

---

 src/gallium/drivers/zink/zink_surface.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c
index 1a22e19fa3d..44e0c11344a 100644
--- a/src/gallium/drivers/zink/zink_surface.c
+++ b/src/gallium/drivers/zink/zink_surface.c
@@ -101,6 +101,18 @@ create_ivci(struct zink_screen *screen,
    return ivci;
 }
 
+static void
+init_surface_info(struct zink_surface *surface, struct zink_resource *res, VkImageViewCreateInfo *ivci)
+{
+   surface->info.flags = res->obj->vkflags;
+   surface->info.usage = res->obj->vkusage;
+   surface->info.width = surface->base.width;
+   surface->info.height = surface->base.height;
+   surface->info.layerCount = ivci->subresourceRange.layerCount;
+   surface->info.format = ivci->format;
+   surface->info_hash = _mesa_hash_data(&surface->info, sizeof(surface->info));
+}
+
 static struct zink_surface *
 create_surface(struct pipe_context *pctx,
                struct pipe_resource *pres,
@@ -131,13 +143,7 @@ create_surface(struct pipe_context *pctx,
    util_dynarray_init(&surface->framebuffer_refs, NULL);
    util_dynarray_init(&surface->desc_set_refs.refs, NULL);
 
-   surface->info.flags = res->obj->vkflags;
-   surface->info.usage = res->obj->vkusage;
-   surface->info.width = surface->base.width;
-   surface->info.height = surface->base.height;
-   surface->info.layerCount = ivci->subresourceRange.layerCount;
-   surface->info.format = ivci->format;
-   surface->info_hash = _mesa_hash_data(&surface->info, sizeof(surface->info));
+   init_surface_info(surface, res, ivci);
 
    if (VKSCR(CreateImageView)(screen->dev, ivci, NULL,
                          &surface->image_view) != VK_SUCCESS) {



More information about the mesa-commit mailing list