zink: break out surface info init to helper function

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13126>
This commit is contained in:
Mike Blumenkrantz 2021-09-29 13:34:39 -04:00 committed by Marge Bot
parent fed9243078
commit 5e9669650c
1 changed files with 13 additions and 7 deletions

View File

@ -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) {