From 43f3e92348939ba6e0c09d219739001f195a69fd Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 1 Dec 2015 13:09:22 -0800 Subject: [PATCH] vk/0.210.0: Rework render pass description structures --- include/vulkan/vulkan.h | 12 ++++++------ src/vulkan/anv_meta.c | 8 ++++---- src/vulkan/anv_meta_clear.c | 8 ++++---- src/vulkan/anv_pass.c | 30 +++++++++++++++++++----------- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index cdf491cfba9..484ce8fbcd6 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1926,21 +1926,21 @@ typedef struct VkAttachmentReference { typedef struct VkSubpassDescription { VkSubpassDescriptionFlags flags; VkPipelineBindPoint pipelineBindPoint; - uint32_t inputCount; + uint32_t inputAttachmentCount; const VkAttachmentReference* pInputAttachments; - uint32_t colorCount; + uint32_t colorAttachmentCount; const VkAttachmentReference* pColorAttachments; const VkAttachmentReference* pResolveAttachments; - VkAttachmentReference depthStencilAttachment; - uint32_t preserveCount; + const VkAttachmentReference* pDepthStencilAttachment; + uint32_t preserveAttachmentCount; const VkAttachmentReference* pPreserveAttachments; } VkSubpassDescription; typedef struct VkSubpassDependency { uint32_t srcSubpass; - uint32_t destSubpass; + uint32_t dstSubpass; VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags destStageMask; + VkPipelineStageFlags dstStageMask; VkMemoryOutputFlags outputMask; VkMemoryInputFlags inputMask; VkBool32 byRegion; diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 419667a9f30..de5a037b5a8 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -199,18 +199,18 @@ anv_device_init_meta_blit_state(struct anv_device *device) .subpassCount = 1, .pSubpasses = &(VkSubpassDescription) { .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, - .inputCount = 0, - .colorCount = 1, + .inputAttachmentCount = 0, + .colorAttachmentCount = 1, .pColorAttachments = &(VkAttachmentReference) { .attachment = 0, .layout = VK_IMAGE_LAYOUT_GENERAL, }, .pResolveAttachments = NULL, - .depthStencilAttachment = (VkAttachmentReference) { + .pDepthStencilAttachment = &(VkAttachmentReference) { .attachment = VK_ATTACHMENT_UNUSED, .layout = VK_IMAGE_LAYOUT_GENERAL, }, - .preserveCount = 1, + .preserveAttachmentCount = 1, .pPreserveAttachments = &(VkAttachmentReference) { .attachment = 0, .layout = VK_IMAGE_LAYOUT_GENERAL, diff --git a/src/vulkan/anv_meta_clear.c b/src/vulkan/anv_meta_clear.c index 0531eccad9b..76ca1b6df99 100644 --- a/src/vulkan/anv_meta_clear.c +++ b/src/vulkan/anv_meta_clear.c @@ -737,18 +737,18 @@ void anv_CmdClearColorImage( .subpassCount = 1, .pSubpasses = &(VkSubpassDescription) { .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, - .inputCount = 0, - .colorCount = 1, + .inputAttachmentCount = 0, + .colorAttachmentCount = 1, .pColorAttachments = &(VkAttachmentReference) { .attachment = 0, .layout = VK_IMAGE_LAYOUT_GENERAL, }, .pResolveAttachments = NULL, - .depthStencilAttachment = (VkAttachmentReference) { + .pDepthStencilAttachment = &(VkAttachmentReference) { .attachment = VK_ATTACHMENT_UNUSED, .layout = VK_IMAGE_LAYOUT_GENERAL, }, - .preserveCount = 1, + .preserveAttachmentCount = 1, .pPreserveAttachments = &(VkAttachmentReference) { .attachment = 0, .layout = VK_IMAGE_LAYOUT_GENERAL, diff --git a/src/vulkan/anv_pass.c b/src/vulkan/anv_pass.c index a89c494f7e0..4990b6a6c40 100644 --- a/src/vulkan/anv_pass.c +++ b/src/vulkan/anv_pass.c @@ -68,26 +68,28 @@ VkResult anv_CreateRenderPass( const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i]; struct anv_subpass *subpass = &pass->subpasses[i]; - subpass->input_count = desc->inputCount; - subpass->color_count = desc->colorCount; + subpass->input_count = desc->inputAttachmentCount; + subpass->color_count = desc->colorAttachmentCount; - if (desc->inputCount > 0) { + if (desc->inputAttachmentCount > 0) { subpass->input_attachments = - anv_device_alloc(device, desc->inputCount * sizeof(uint32_t), + anv_device_alloc(device, + desc->inputAttachmentCount * sizeof(uint32_t), 8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT); - for (uint32_t j = 0; j < desc->inputCount; j++) { + for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) { subpass->input_attachments[j] = desc->pInputAttachments[j].attachment; } } - if (desc->colorCount > 0) { + if (desc->colorAttachmentCount > 0) { subpass->color_attachments = - anv_device_alloc(device, desc->colorCount * sizeof(uint32_t), + anv_device_alloc(device, + desc->colorAttachmentCount * sizeof(uint32_t), 8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT); - for (uint32_t j = 0; j < desc->colorCount; j++) { + for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) { subpass->color_attachments[j] = desc->pColorAttachments[j].attachment; } @@ -95,16 +97,22 @@ VkResult anv_CreateRenderPass( if (desc->pResolveAttachments) { subpass->resolve_attachments = - anv_device_alloc(device, desc->colorCount * sizeof(uint32_t), + anv_device_alloc(device, + desc->colorAttachmentCount * sizeof(uint32_t), 8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT); - for (uint32_t j = 0; j < desc->colorCount; j++) { + for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) { subpass->resolve_attachments[j] = desc->pResolveAttachments[j].attachment; } } - subpass->depth_stencil_attachment = desc->depthStencilAttachment.attachment; + if (desc->pDepthStencilAttachment) { + subpass->depth_stencil_attachment = + desc->pDepthStencilAttachment->attachment; + } else { + subpass->depth_stencil_attachment = VK_ATTACHMENT_UNUSED; + } } *pRenderPass = anv_render_pass_to_handle(pass); -- 2.30.2