Mesa (master): radv: Drop CreateRenderPass
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Mar 10 18:29:59 UTC 2021
Module: Mesa
Branch: master
Commit: 5d8fa880d6c47c79026799c7bdd95ed7bd1dfa1a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d8fa880d6c47c79026799c7bdd95ed7bd1dfa1a
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Tue Mar 9 21:59:53 2021 -0600
radv: Drop CreateRenderPass
We can use the generic fall-back which calls CreateRenderPass2 instead.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857>
---
src/amd/vulkan/radv_pass.c | 182 ---------------------------------------------
1 file changed, 182 deletions(-)
diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c
index b9de5d8285e..bdc12638f67 100644
--- a/src/amd/vulkan/radv_pass.c
+++ b/src/amd/vulkan/radv_pass.c
@@ -291,15 +291,6 @@ radv_render_pass_compile(struct radv_render_pass *pass)
}
}
-static unsigned
-radv_num_subpass_attachments(const VkSubpassDescription *desc)
-{
- return desc->inputAttachmentCount +
- desc->colorAttachmentCount +
- (desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
- (desc->pDepthStencilAttachment != NULL);
-}
-
static void
radv_destroy_render_pass(struct radv_device *device,
const VkAllocationCallbacks *pAllocator,
@@ -310,179 +301,6 @@ radv_destroy_render_pass(struct radv_device *device,
vk_free2(&device->vk.alloc, pAllocator, pass);
}
-VkResult radv_CreateRenderPass(
- VkDevice _device,
- const VkRenderPassCreateInfo* pCreateInfo,
- const VkAllocationCallbacks* pAllocator,
- VkRenderPass* pRenderPass)
-{
- RADV_FROM_HANDLE(radv_device, device, _device);
- struct radv_render_pass *pass;
- size_t size;
- size_t attachments_offset;
- VkRenderPassMultiviewCreateInfo *multiview_info = NULL;
-
- assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO);
-
- size = sizeof(*pass);
- size += pCreateInfo->subpassCount * sizeof(pass->subpasses[0]);
- attachments_offset = size;
- size += pCreateInfo->attachmentCount * sizeof(pass->attachments[0]);
-
- pass = vk_alloc2(&device->vk.alloc, pAllocator, size, 8,
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (pass == NULL)
- return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
-
- memset(pass, 0, size);
-
- vk_object_base_init(&device->vk, &pass->base,
- VK_OBJECT_TYPE_RENDER_PASS);
-
- pass->attachment_count = pCreateInfo->attachmentCount;
- pass->subpass_count = pCreateInfo->subpassCount;
- pass->attachments = (struct radv_render_pass_attachment *)((uint8_t *) pass + attachments_offset);
-
- vk_foreach_struct(ext, pCreateInfo->pNext) {
- switch(ext->sType) {
- case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO:
- multiview_info = (VkRenderPassMultiviewCreateInfo*)ext;
- break;
- default:
- break;
- }
- }
-
- for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
- struct radv_render_pass_attachment *att = &pass->attachments[i];
-
- att->format = pCreateInfo->pAttachments[i].format;
- att->samples = pCreateInfo->pAttachments[i].samples;
- att->load_op = pCreateInfo->pAttachments[i].loadOp;
- att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
- att->initial_layout = pCreateInfo->pAttachments[i].initialLayout;
- att->final_layout = pCreateInfo->pAttachments[i].finalLayout;
- att->stencil_initial_layout = pCreateInfo->pAttachments[i].initialLayout;
- att->stencil_final_layout = pCreateInfo->pAttachments[i].finalLayout;
- // att->store_op = pCreateInfo->pAttachments[i].storeOp;
- // att->stencil_store_op = pCreateInfo->pAttachments[i].stencilStoreOp;
- }
- uint32_t subpass_attachment_count = 0;
- struct radv_subpass_attachment *p;
- for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
- subpass_attachment_count +=
- radv_num_subpass_attachments(&pCreateInfo->pSubpasses[i]);
- }
-
- if (subpass_attachment_count) {
- pass->subpass_attachments =
- vk_alloc2(&device->vk.alloc, pAllocator,
- subpass_attachment_count * sizeof(struct radv_subpass_attachment), 8,
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (pass->subpass_attachments == NULL) {
- radv_destroy_render_pass(device, pAllocator, pass);
- return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
- }
- } else
- pass->subpass_attachments = NULL;
-
- p = pass->subpass_attachments;
- for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
- const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i];
- struct radv_subpass *subpass = &pass->subpasses[i];
-
- subpass->input_count = desc->inputAttachmentCount;
- subpass->color_count = desc->colorAttachmentCount;
- subpass->attachment_count = radv_num_subpass_attachments(desc);
- subpass->attachments = p;
-
- if (multiview_info)
- subpass->view_mask = multiview_info->pViewMasks[i];
-
- if (desc->inputAttachmentCount > 0) {
- subpass->input_attachments = p;
- p += desc->inputAttachmentCount;
-
- for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
- subpass->input_attachments[j] = (struct radv_subpass_attachment) {
- .attachment = desc->pInputAttachments[j].attachment,
- .layout = desc->pInputAttachments[j].layout,
- .stencil_layout = desc->pInputAttachments[j].layout,
- };
- }
- }
-
- if (desc->colorAttachmentCount > 0) {
- subpass->color_attachments = p;
- p += desc->colorAttachmentCount;
-
- for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
- subpass->color_attachments[j] = (struct radv_subpass_attachment) {
- .attachment = desc->pColorAttachments[j].attachment,
- .layout = desc->pColorAttachments[j].layout,
- };
- }
- }
-
- if (desc->pResolveAttachments) {
- subpass->resolve_attachments = p;
- p += desc->colorAttachmentCount;
-
- for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
- subpass->resolve_attachments[j] = (struct radv_subpass_attachment) {
- .attachment = desc->pResolveAttachments[j].attachment,
- .layout = desc->pResolveAttachments[j].layout,
- .stencil_layout = desc->pResolveAttachments[j].layout,
- };
- }
- }
-
- if (desc->pDepthStencilAttachment) {
- subpass->depth_stencil_attachment = p++;
-
- *subpass->depth_stencil_attachment = (struct radv_subpass_attachment) {
- .attachment = desc->pDepthStencilAttachment->attachment,
- .layout = desc->pDepthStencilAttachment->layout,
- .stencil_layout = desc->pDepthStencilAttachment->layout,
- };
- }
- }
-
- bool has_ingoing_dep = false;
- bool has_outgoing_dep = false;
-
- for (unsigned i = 0; i < pCreateInfo->dependencyCount; ++i) {
- /* Convert to a Dependency2 */
- struct VkSubpassDependency2 dep2 = {
- .srcSubpass = pCreateInfo->pDependencies[i].srcSubpass,
- .dstSubpass = pCreateInfo->pDependencies[i].dstSubpass,
- .srcStageMask = pCreateInfo->pDependencies[i].srcStageMask,
- .dstStageMask = pCreateInfo->pDependencies[i].dstStageMask,
- .srcAccessMask = pCreateInfo->pDependencies[i].srcAccessMask,
- .dstAccessMask = pCreateInfo->pDependencies[i].dstAccessMask,
- .dependencyFlags = pCreateInfo->pDependencies[i].dependencyFlags,
- };
- radv_render_pass_add_subpass_dep(pass, &dep2);
-
- /* Determine if the subpass has explicit dependencies from/to
- * VK_SUBPASS_EXTERNAL.
- */
- if (pCreateInfo->pDependencies[i].srcSubpass == VK_SUBPASS_EXTERNAL)
- has_ingoing_dep = true;
- if (pCreateInfo->pDependencies[i].dstSubpass == VK_SUBPASS_EXTERNAL)
- has_outgoing_dep = true;
- }
-
- radv_render_pass_add_implicit_deps(pass,
- has_ingoing_dep, has_outgoing_dep);
-
- radv_render_pass_compile(pass);
-
- *pRenderPass = radv_render_pass_to_handle(pass);
-
- return VK_SUCCESS;
-}
-
static unsigned
radv_num_subpass_attachments2(const VkSubpassDescription2 *desc)
{
More information about the mesa-commit
mailing list