From 1b9508b08220ccbd8bea7f763508082472dcf1ff Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Mon, 31 Jan 2022 00:53:28 +0100 Subject: [PATCH] [Vulkan] Clean up render-pass-references --- .../Vulkan/Sources/kinc/backend/graphics5/Vulkan.c.h | 1 - .../Sources/kinc/backend/graphics5/commandlist.c.h | 2 +- .../Sources/kinc/backend/graphics5/rendertarget.c.h | 11 +++++------ .../Sources/kinc/backend/graphics5/rendertarget.h | 1 - 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/Vulkan.c.h b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/Vulkan.c.h index 1c27d9bec..50b7582ac 100644 --- a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/Vulkan.c.h +++ b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/Vulkan.c.h @@ -1052,7 +1052,6 @@ bool kinc_g5_swap_buffers() { void kinc_g5_begin(kinc_g5_render_target_t *renderTarget, int window) { if (renderTarget != NULL) { - renderTarget->impl.renderPass = framebuffer_render_pass; renderTarget->impl.framebuffer = framebuffers[current_buffer]; } diff --git a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/commandlist.c.h b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/commandlist.c.h index 9932962c6..024af9b32 100644 --- a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/commandlist.c.h +++ b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/commandlist.c.h @@ -601,7 +601,7 @@ void kinc_g5_command_list_set_render_targets(kinc_g5_command_list_t *list, struc rp_begin.pClearValues = clear_values; if (count == 1) { - rp_begin.renderPass = targets[0]->impl.renderPass; + rp_begin.renderPass = rendertarget_render_pass; rp_begin.framebuffer = targets[0]->impl.framebuffer; } else { diff --git a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.c.h b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.c.h index 3d33e0d5d..2185f3cca 100644 --- a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.c.h +++ b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.c.h @@ -253,8 +253,6 @@ void kinc_g5_render_target_init(kinc_g5_render_target_t *target, int width, int assert(!err); } - target->impl.renderPass = rendertarget_render_pass; - VkImageView attachments[2]; attachments[0] = target->impl.sourceView; @@ -265,7 +263,7 @@ void kinc_g5_render_target_init(kinc_g5_render_target_t *target, int width, int VkFramebufferCreateInfo fbufCreateInfo = {0}; fbufCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; fbufCreateInfo.pNext = NULL; - fbufCreateInfo.renderPass = target->impl.renderPass; + fbufCreateInfo.renderPass = contextId >= 0 ? rendertarget_render_pass : framebuffer_render_pass; fbufCreateInfo.attachmentCount = depthBufferBits > 0 ? 2 : 1; fbufCreateInfo.pAttachments = attachments; fbufCreateInfo.width = width; @@ -377,8 +375,9 @@ void kinc_g5_render_target_set_depth_stencil_from(kinc_g5_render_target_t *targe rp_info.dependencyCount = 2; rp_info.pDependencies = dependencies; - VkResult err = vkCreateRenderPass(device, &rp_info, NULL, &target->impl.renderPass); - assert(!err); + // TODO + // VkResult err = vkCreateRenderPass(device, &rp_info, NULL, &target->impl.renderPass); + // assert(!err); } { @@ -392,7 +391,7 @@ void kinc_g5_render_target_set_depth_stencil_from(kinc_g5_render_target_t *targe VkFramebufferCreateInfo fbufCreateInfo = {0}; fbufCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; fbufCreateInfo.pNext = NULL; - fbufCreateInfo.renderPass = target->impl.renderPass; + fbufCreateInfo.renderPass = VK_NULL_HANDLE; // target->impl.renderPass; // TODO fbufCreateInfo.attachmentCount = target->impl.depthBufferBits > 0 ? 2 : 1; fbufCreateInfo.pAttachments = attachments; fbufCreateInfo.width = target->width; diff --git a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.h b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.h index 2b181cf06..f04ee0590 100644 --- a/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.h +++ b/Backends/Graphics5/Vulkan/Sources/kinc/backend/graphics5/rendertarget.h @@ -14,7 +14,6 @@ typedef struct { VkFramebuffer framebuffer; VkSampler sampler; - VkRenderPass renderPass; VkFormat format;