From 6dea1a9ba1acd7a957feb9ad43504e7accc4f8f8 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Wed, 7 Oct 2015 07:30:52 -0700 Subject: [PATCH] vk/0.170.2: Merge VkAttachmentView into VkImageView --- include/vulkan/vulkan.h | 39 +++++---------------------------------- src/vulkan/anv_device.c | 3 +-- src/vulkan/anv_image.c | 34 ++-------------------------------- src/vulkan/anv_meta.c | 21 ++++----------------- 4 files changed, 12 insertions(+), 85 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index ce1d2d88e9f..4fe9e67fabc 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -91,7 +91,6 @@ VK_DEFINE_NONDISP_HANDLE(VkEvent) VK_DEFINE_NONDISP_HANDLE(VkQueryPool) VK_DEFINE_NONDISP_HANDLE(VkBufferView) VK_DEFINE_NONDISP_HANDLE(VkImageView) -VK_DEFINE_NONDISP_HANDLE(VkAttachmentView) VK_DEFINE_NONDISP_HANDLE(VkShaderModule) VK_DEFINE_NONDISP_HANDLE(VkShader) VK_DEFINE_NONDISP_HANDLE(VkPipelineCache) @@ -962,10 +961,10 @@ typedef enum { typedef VkFlags VkImageAspectFlags; typedef enum { - VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_DEPTH_BIT = 0x00000001, - VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_STENCIL_BIT = 0x00000002, -} VkAttachmentViewCreateFlagBits; -typedef VkFlags VkAttachmentViewCreateFlags; + VK_IMAGE_VIEW_CREATE_READ_ONLY_DEPTH_BIT = 0x00000001, + VK_IMAGE_VIEW_CREATE_READ_ONLY_STENCIL_BIT = 0x00000002, +} VkImageViewCreateFlagBits; +typedef VkFlags VkImageViewCreateFlags; typedef VkFlags VkShaderModuleCreateFlags; typedef VkFlags VkShaderCreateFlags; @@ -1508,17 +1507,6 @@ typedef struct { VkImageSubresourceRange subresourceRange; } VkImageViewCreateInfo; -typedef struct { - VkStructureType sType; - const void* pNext; - VkImage image; - VkFormat format; - uint32_t mipLevel; - uint32_t baseArraySlice; - uint32_t arraySize; - VkAttachmentViewCreateFlags flags; -} VkAttachmentViewCreateInfo; - typedef struct { VkStructureType sType; const void* pNext; @@ -1784,7 +1772,6 @@ typedef struct { VkBufferView bufferView; VkSampler sampler; VkImageView imageView; - VkAttachmentView attachmentView; VkImageLayout imageLayout; } VkDescriptorInfo; @@ -1845,17 +1832,12 @@ typedef struct { uint32_t stencilBackRef; } VkDynamicDepthStencilStateCreateInfo; -typedef struct { - VkAttachmentView view; - VkImageLayout layout; -} VkAttachmentBindInfo; - typedef struct { VkStructureType sType; const void* pNext; VkRenderPass renderPass; uint32_t attachmentCount; - const VkAttachmentBindInfo* pAttachments; + const VkImageView* pAttachments; uint32_t width; uint32_t height; uint32_t layers; @@ -2137,8 +2119,6 @@ typedef void (VKAPI *PFN_vkDestroyImage)(VkDevice device, VkImage image); typedef VkResult (VKAPI *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout); typedef VkResult (VKAPI *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView); typedef void (VKAPI *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView); -typedef VkResult (VKAPI *PFN_vkCreateAttachmentView)(VkDevice device, const VkAttachmentViewCreateInfo* pCreateInfo, VkAttachmentView* pView); -typedef void (VKAPI *PFN_vkDestroyAttachmentView)(VkDevice device, VkAttachmentView attachmentView); typedef VkResult (VKAPI *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, VkShaderModule* pShaderModule); typedef void (VKAPI *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule); typedef VkResult (VKAPI *PFN_vkCreateShader)(VkDevice device, const VkShaderCreateInfo* pCreateInfo, VkShader* pShader); @@ -2542,15 +2522,6 @@ void VKAPI vkDestroyImageView( VkDevice device, VkImageView imageView); -VkResult VKAPI vkCreateAttachmentView( - VkDevice device, - const VkAttachmentViewCreateInfo* pCreateInfo, - VkAttachmentView* pView); - -void VKAPI vkDestroyAttachmentView( - VkDevice device, - VkAttachmentView attachmentView); - VkResult VKAPI vkCreateShaderModule( VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index e7f74266e68..b10cc4512b4 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1968,8 +1968,7 @@ VkResult anv_CreateFramebuffer( framebuffer->attachment_count = pCreateInfo->attachmentCount; for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) { - VkAttachmentView _aview = pCreateInfo->pAttachments[i].view; - VkImageView _iview = { _aview.handle }; + VkImageView _iview = pCreateInfo->pAttachments[i]; framebuffer->attachments[i] = anv_image_view_from_handle(_iview); } diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index 5973be1391b..8522d0e8318 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -617,23 +617,7 @@ anv_image_get_surface_for_aspect_mask(struct anv_image *image, VkImageAspectFlag } } -VkResult -anv_CreateAttachmentView(VkDevice _device, - const VkAttachmentViewCreateInfo *info, - VkAttachmentView *pView) -{ - ANV_FROM_HANDLE(anv_device, device, _device); - struct anv_image_view *iview; - - assert(info->sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO); - - iview = anv_device_alloc(device, sizeof(*iview), 8, - VK_SYSTEM_ALLOC_TYPE_API_OBJECT); - if (iview == NULL) - return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - - const struct anv_format *format = anv_format_for_vk_format(info->format); - +#if 0 VkImageAspectFlags aspect_mask = 0; if (format->depth_format) aspect_mask |= VK_IMAGE_ASPECT_DEPTH_BIT; @@ -663,18 +647,4 @@ anv_CreateAttachmentView(VkDevice _device, }, }, NULL); - - pView->handle = anv_image_view_to_handle(iview).handle; - - return VK_SUCCESS; -} - -void -anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _aview) -{ - ANV_FROM_HANDLE(anv_device, device, _device); - VkImageView _iview = { .handle = _aview.handle }; - ANV_FROM_HANDLE(anv_image_view, iview, _iview); - - anv_image_view_destroy(device, iview); -} +#endif diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index c7c50ef87a9..a0b7070ebfe 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -738,10 +738,6 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, VkExtent3D dest_extent) { struct anv_device *device = cmd_buffer->device; - - VkImageView dest_iview_h = anv_image_view_to_handle(dest_iview); - VkAttachmentView dest_aview_h = { .handle = dest_iview_h.handle }; - VkDescriptorPool dummy_desc_pool = { .handle = 1 }; struct blit_vb_data { @@ -837,11 +833,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, &(VkFramebufferCreateInfo) { .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .attachmentCount = 1, - .pAttachments = (VkAttachmentBindInfo[]) { - { - .view = dest_aview_h, - .layout = VK_IMAGE_LAYOUT_GENERAL - } + .pAttachments = (VkImageView[]) { + anv_image_view_to_handle(dest_iview), }, .width = dest_iview->extent.width, .height = dest_iview->extent.height, @@ -1639,19 +1632,13 @@ void anv_CmdClearColorImage( }, cmd_buffer); - VkImageView iview_h = anv_image_view_to_handle(&iview); - VkAttachmentView aview_h = { .handle = iview_h.handle }; - VkFramebuffer fb; anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device), &(VkFramebufferCreateInfo) { .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .attachmentCount = 1, - .pAttachments = (VkAttachmentBindInfo[]) { - { - .view = aview_h, - .layout = VK_IMAGE_LAYOUT_GENERAL - } + .pAttachments = (VkImageView[]) { + anv_image_view_to_handle(&iview), }, .width = iview.extent.width, .height = iview.extent.height, -- 2.30.2