mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
zink: store some surface metadata to struct during creation
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12661>
This commit is contained in:
parent
cf8997ab58
commit
9643f0b8fc
2 changed files with 20 additions and 0 deletions
|
|
@ -108,6 +108,7 @@ create_surface(struct pipe_context *pctx,
|
|||
VkImageViewCreateInfo *ivci)
|
||||
{
|
||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
unsigned int level = templ->u.tex.level;
|
||||
|
||||
struct zink_surface *surface = CALLOC_STRUCT(zink_surface);
|
||||
|
|
@ -128,6 +129,14 @@ 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));
|
||||
|
||||
if (vkCreateImageView(screen->dev, ivci, NULL,
|
||||
&surface->image_view) != VK_SUCCESS) {
|
||||
FREE(surface);
|
||||
|
|
|
|||
|
|
@ -30,9 +30,20 @@
|
|||
|
||||
struct pipe_context;
|
||||
|
||||
struct zink_surface_info {
|
||||
VkImageCreateFlags flags;
|
||||
VkImageUsageFlags usage;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t layerCount;
|
||||
VkFormat format;
|
||||
};
|
||||
|
||||
struct zink_surface {
|
||||
struct pipe_surface base;
|
||||
VkImageViewCreateInfo ivci;
|
||||
struct zink_surface_info info; //TODO: union with fb refs
|
||||
uint32_t info_hash;
|
||||
VkImageView image_view;
|
||||
VkImageView simage_view;//old iview after storage replacement/rebind
|
||||
void *obj; //backing resource object
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue