diff --git a/include/QF/Vulkan/renderpass.h b/include/QF/Vulkan/renderpass.h index 9648e841e..ca14f889c 100644 --- a/include/QF/Vulkan/renderpass.h +++ b/include/QF/Vulkan/renderpass.h @@ -4,50 +4,12 @@ #include "QF/darray.h" #include "QF/simd/types.h" -typedef struct qfv_attachmentdescription_s - DARRAY_TYPE (VkAttachmentDescription) qfv_attachmentdescription_t; - -#define QFV_AllocAttachmentDescription(num, allocator) \ - DARRAY_ALLOCFIXED (qfv_attachmentdescription_t, num, allocator) - -typedef struct qfv_attachmentreference_s - DARRAY_TYPE (VkAttachmentReference) qfv_attachmentreference_t; - -#define QFV_AllocAttachmentReference(num, allocator) \ - DARRAY_ALLOCFIXED (qfv_attachmentreference_t, num, allocator) - -typedef struct qfv_subpassparametersset_s - DARRAY_TYPE (VkSubpassDescription) qfv_subpassparametersset_t; - -#define QFV_AllocSubpassParametersSet(num, allocator) \ - DARRAY_ALLOCFIXED (qfv_subpassparametersset_t, num, allocator) - -typedef struct qfv_subpassdependency_s - DARRAY_TYPE (VkSubpassDependency) qfv_subpassdependency_t; - -#define QFV_AllocSubpassDependencies(num, allocator) \ - DARRAY_ALLOCFIXED (qfv_subpassdependency_t, num, allocator) - typedef struct qfv_framebufferset_s DARRAY_TYPE (VkFramebuffer) qfv_framebufferset_t; #define QFV_AllocFrameBuffers(num, allocator) \ DARRAY_ALLOCFIXED (qfv_framebufferset_t, num, allocator) -struct qfv_device_s; -struct qfv_imageviewset_s; -VkRenderPass -QFV_CreateRenderPass (struct qfv_device_s *device, - qfv_attachmentdescription_t *attachments, - qfv_subpassparametersset_t *subpasses, - qfv_subpassdependency_t *dependencies); - -VkFramebuffer -QFV_CreateFramebuffer (struct qfv_device_s *device, - VkRenderPass renderPass, - struct qfv_imageviewset_s *attachments, - VkExtent2D, uint32_t layers); - typedef struct qfv_subpass_s { vec4f_t color; const char *name; @@ -57,7 +19,7 @@ typedef struct qfv_renderframe_s { struct vulkan_ctx_s *vulkan_ctx; struct qfv_renderpass_s *renderpass; VkSubpassContents subpassContents; - int subpassCount; + int subpassCount; qfv_subpass_t *subpassInfo; struct qfv_cmdbufferset_s *subpassCmdSets; } qfv_renderframe_t; diff --git a/libs/video/renderer/vulkan/renderpass.c b/libs/video/renderer/vulkan/renderpass.c index f69c1bd96..e2f7ff2e9 100644 --- a/libs/video/renderer/vulkan/renderpass.c +++ b/libs/video/renderer/vulkan/renderpass.c @@ -33,109 +33,3 @@ #include "QF/Vulkan/device.h" #include "QF/Vulkan/image.h" #include "QF/Vulkan/renderpass.h" - -VkRenderPass -QFV_CreateRenderPass (qfv_device_t *device, - qfv_attachmentdescription_t *attachments, - qfv_subpassparametersset_t *subpassparams, - qfv_subpassdependency_t *dependencies) -{ - VkDevice dev = device->dev; - qfv_devfuncs_t *dfunc = device->funcs; - - if (developer & SYS_vulkan) { - Sys_Printf ("attachments: %zd\n", attachments->size); - for (size_t i = 0; i < attachments->size; i++) { - Sys_Printf (" attachment: %zd\n", i); - Sys_Printf (" flags: %x\n", attachments->a[i].flags); - Sys_Printf (" format: %d\n", attachments->a[i].format); - Sys_Printf (" samples: %x\n", attachments->a[i].samples); - Sys_Printf (" loadOp: %d\n", attachments->a[i].loadOp); - Sys_Printf (" storeOp: %d\n", attachments->a[i].storeOp); - Sys_Printf (" stencilLoadOp: %d\n", - attachments->a[i].stencilLoadOp); - Sys_Printf (" stencilStoreOp: %d\n", - attachments->a[i].stencilStoreOp); - Sys_Printf (" initialLayout: %d\n", - attachments->a[i].initialLayout); - Sys_Printf (" finalLayout: %d\n", - attachments->a[i].finalLayout); - } - Sys_Printf ("subpassparams: %zd\n", subpassparams->size); - for (size_t i = 0; i < subpassparams->size; i++) { - VkSubpassDescription *sp = &subpassparams->a[i]; - Sys_Printf (" flags: %x\n", sp->flags); - Sys_Printf (" piplineBindPoint: %d\n", sp->pipelineBindPoint); - Sys_Printf (" inputAttachmentCount: %d\n", - sp->inputAttachmentCount); - for (size_t j = 0; j < sp->inputAttachmentCount; j++) { - const VkAttachmentReference *ref = &sp->pInputAttachments[j]; - Sys_Printf (" c %d %d\n", ref->attachment, ref->layout); - } - Sys_Printf (" colorAttachmentCount: %d\n", - sp->colorAttachmentCount); - for (size_t j = 0; j < sp->colorAttachmentCount; j++) { - const VkAttachmentReference *ref = &sp->pColorAttachments[j]; - Sys_Printf (" c %d %d\n", ref->attachment, ref->layout); - } - if (sp->pResolveAttachments) { - for (size_t j = 0; j < sp->colorAttachmentCount; j++) { - const VkAttachmentReference *ref - = &sp->pResolveAttachments[j]; - Sys_Printf (" r %d %d\n", ref->attachment, - ref->layout); - } - } - Sys_Printf (" pDepthStencilAttachment: %p\n", - sp->pDepthStencilAttachment); - if (sp->pDepthStencilAttachment) { - const VkAttachmentReference *ref = sp->pDepthStencilAttachment; - Sys_Printf (" %d %d\n", ref->attachment, ref->layout); - } - Sys_Printf (" preserveAttachmentCount: %d\n", - sp->preserveAttachmentCount); - for (size_t j = 0; j < sp->preserveAttachmentCount; j++) { - Sys_Printf (" %d\n", sp->pPreserveAttachments[j]); - } - } - Sys_Printf ("dependencies: %zd\n", dependencies->size); - for (size_t i = 0; i < dependencies->size; i++) { - Sys_Printf (" srcSubpass: %d\n", dependencies->a[i].srcSubpass); - Sys_Printf (" dstSubpass: %d\n", dependencies->a[i].dstSubpass); - Sys_Printf (" srcStageMask: %x\n", dependencies->a[i].srcStageMask); - Sys_Printf (" dstStageMask: %x\n", dependencies->a[i].dstStageMask); - Sys_Printf (" srcAccessMask: %x\n", dependencies->a[i].srcAccessMask); - Sys_Printf (" dstAccessMask: %x\n", dependencies->a[i].dstAccessMask); - Sys_Printf (" dependencyFlags: %x\n", dependencies->a[i].dependencyFlags); - } - } - VkRenderPassCreateInfo createInfo = { - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, 0, 0, - attachments->size, attachments->a, - subpassparams->size, subpassparams->a, - dependencies->size, dependencies->a, - }; - - VkRenderPass renderpass; - dfunc->vkCreateRenderPass (dev, &createInfo, 0, &renderpass); - return renderpass; -} - -VkFramebuffer -QFV_CreateFramebuffer (qfv_device_t *device, VkRenderPass renderPass, - qfv_imageviewset_t *attachments, - VkExtent2D extent, uint32_t layers) -{ - VkDevice dev = device->dev; - qfv_devfuncs_t *dfunc = device->funcs; - - VkFramebufferCreateInfo createInfo = { - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, 0, 0, - renderPass, attachments->size, attachments->a, - extent.width, extent.height, layers, - }; - - VkFramebuffer framebuffer; - dfunc->vkCreateFramebuffer (dev, &createInfo, 0, &framebuffer); - return framebuffer; -}