From 1f7dcf9d75cb64195b5fdfb654249c002226c649 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 13 May 2015 17:37:12 -0700 Subject: [PATCH] vk/image: Stash more information in images and views --- src/vulkan/image.c | 11 ++++++++--- src/vulkan/private.h | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vulkan/image.c b/src/vulkan/image.c index 4dd96ceac3b..c1504211cad 100644 --- a/src/vulkan/image.c +++ b/src/vulkan/image.c @@ -244,6 +244,7 @@ VkResult VKAPI vkCreateImage( image->bo = NULL; image->offset = 0; image->type = pCreateInfo->imageType; + image->format = pCreateInfo->format; image->extent = pCreateInfo->extent; assert(image->extent.width > 0); @@ -362,6 +363,9 @@ VkResult VKAPI vkCreateImageView( view->surface_state = create_surface_state(device, view->image, format); + /* TODO: Miplevels */ + view->extent = view->image->extent; + *pView = (VkImageView) view; return VK_SUCCESS; @@ -374,7 +378,6 @@ VkResult VKAPI vkCreateColorAttachmentView( { struct anv_device *device = (struct anv_device *) _device; struct anv_color_attachment_view *view; - struct anv_image *image; const struct anv_format *format = anv_format_for_vk_format(pCreateInfo->format); @@ -386,9 +389,11 @@ VkResult VKAPI vkCreateColorAttachmentView( return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); view->image = (struct anv_image *) pCreateInfo->image; - image = view->image; - view->surface_state = create_surface_state(device, image, format); + view->surface_state = create_surface_state(device, view->image, format); + + /* TODO: Miplevels */ + view->extent = view->image->extent; *pView = (VkColorAttachmentView) view; diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 09535a73b64..fec29306064 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -610,6 +610,7 @@ anv_format_for_vk_format(VkFormat format); struct anv_image { VkImageType type; + VkFormat format; VkExtent3D extent; uint32_t tile_mode; VkDeviceSize size; @@ -630,11 +631,15 @@ struct anv_buffer_view { struct anv_color_attachment_view { struct anv_image * image; struct anv_state surface_state; + + VkExtent3D extent; }; struct anv_image_view { struct anv_image * image; struct anv_state surface_state; + + VkExtent3D extent; }; struct anv_sampler { -- 2.30.2