From f70d0798546aca1be89dc93c0fac20b82f9df834 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Fri, 17 Jul 2015 14:48:23 -0700 Subject: [PATCH] vk/image: Remove unneeded data from anv_buffer_view This completes the FINISHME to trim unneeded data from anv_buffer_view. A VkExtent3D doesn't make sense for a VkBufferView. So remove the member anv_surface_view::extent, and push it up to the two objects that actually need it, anv_image_view and anv_attachment_view. --- src/vulkan/image.c | 4 ++-- src/vulkan/meta.c | 24 ++++++++++++------------ src/vulkan/private.h | 5 ++--- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/vulkan/image.c b/src/vulkan/image.c index 340df8a5af1..4b37de54dde 100644 --- a/src/vulkan/image.c +++ b/src/vulkan/image.c @@ -372,7 +372,7 @@ anv_image_view_init(struct anv_image_view *iview, view->offset = image->offset + surface->offset; view->format = pCreateInfo->format; - view->extent = (VkExtent3D) { + iview->extent = (VkExtent3D) { .width = anv_minify(image->extent.width, range->baseMipLevel), .height = anv_minify(image->extent.height, range->baseMipLevel), .depth = anv_minify(image->extent.depth, range->baseMipLevel), @@ -588,7 +588,7 @@ anv_color_attachment_view_init(struct anv_color_attachment_view *aview, view->offset = image->offset + surface->offset; view->format = pCreateInfo->format; - view->extent = (VkExtent3D) { + aview->base.extent = (VkExtent3D) { .width = anv_minify(image->extent.width, pCreateInfo->mipLevel), .height = anv_minify(image->extent.height, pCreateInfo->mipLevel), .depth = anv_minify(image->extent.depth, pCreateInfo->mipLevel), diff --git a/src/vulkan/meta.c b/src/vulkan/meta.c index 8e2556b8218..30809581ad6 100644 --- a/src/vulkan/meta.c +++ b/src/vulkan/meta.c @@ -543,8 +543,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, dest_offset.y + dest_extent.height, }, .tex_coord = { - (float)(src_offset.x + src_extent.width) / (float)src->view.extent.width, - (float)(src_offset.y + src_extent.height) / (float)src->view.extent.height, + (float)(src_offset.x + src_extent.width) / (float)src->extent.width, + (float)(src_offset.y + src_extent.height) / (float)src->extent.height, }, }; @@ -554,8 +554,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, dest_offset.y + dest_extent.height, }, .tex_coord = { - (float)src_offset.x / (float)src->view.extent.width, - (float)(src_offset.y + src_extent.height) / (float)src->view.extent.height, + (float)src_offset.x / (float)src->extent.width, + (float)(src_offset.y + src_extent.height) / (float)src->extent.height, }, }; @@ -565,8 +565,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, dest_offset.y, }, .tex_coord = { - (float)src_offset.x / (float)src->view.extent.width, - (float)src_offset.y / (float)src->view.extent.height, + (float)src_offset.x / (float)src->extent.width, + (float)src_offset.y / (float)src->extent.height, }, }; @@ -622,8 +622,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, .layout = VK_IMAGE_LAYOUT_GENERAL } }, - .width = dest->view.extent.width, - .height = dest->view.extent.height, + .width = dest->base.extent.width, + .height = dest->base.extent.height, .layers = 1 }, &fb); @@ -1274,8 +1274,8 @@ void anv_CmdClearColorImage( .layout = VK_IMAGE_LAYOUT_GENERAL } }, - .width = view.view.extent.width, - .height = view.view.extent.height, + .width = view.base.extent.width, + .height = view.base.extent.height, .layers = 1 }, &fb); @@ -1322,8 +1322,8 @@ void anv_CmdClearColorImage( .renderArea = { .offset = { 0, 0, }, .extent = { - .width = view.view.extent.width, - .height = view.view.extent.height, + .width = view.base.extent.width, + .height = view.base.extent.height, }, }, .renderPass = pass, diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 16ddaefc57e..ac64f294c2d 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -889,17 +889,16 @@ struct anv_surface_view { struct anv_bo *bo; uint32_t offset; /**< VkBufferCreateInfo::offset */ uint32_t range; /**< VkBufferCreateInfo::range */ - VkExtent3D extent; VkFormat format; /**< VkBufferCreateInfo::format */ }; struct anv_buffer_view { - /* FINISHME: Trim unneeded data from this struct. */ struct anv_surface_view view; }; struct anv_image_view { struct anv_surface_view view; + VkExtent3D extent; }; enum anv_attachment_view_type { @@ -909,11 +908,11 @@ enum anv_attachment_view_type { struct anv_attachment_view { enum anv_attachment_view_type attachment_type; + VkExtent3D extent; }; struct anv_color_attachment_view { struct anv_attachment_view base; - struct anv_surface_view view; }; -- 2.30.2