mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-08 07:51:19 +12:00
Vulkan: Fix swapchain renderpass validation errors
Fix validation error introduced in 17060752b6
Make renderpass discard previous image content and clear during renderpass instead of before
This commit is contained in:
parent
3cff05edcf
commit
e09f85f8d3
4 changed files with 13 additions and 5 deletions
|
@ -60,7 +60,7 @@ void SwapchainInfoVk::Create()
|
|||
VkAttachmentDescription colorAttachment = {};
|
||||
colorAttachment.format = m_surfaceFormat.format;
|
||||
colorAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
colorAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
colorAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
colorAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
|
|
|
@ -70,6 +70,7 @@ struct SwapchainInfoVk
|
|||
VkSurfaceFormatKHR m_surfaceFormat{};
|
||||
VkSwapchainKHR m_swapchain{};
|
||||
Vector2i m_desiredExtent{};
|
||||
VkExtent2D m_actualExtent{};
|
||||
uint32 swapchainImageIndex = (uint32)-1;
|
||||
uint64 m_presentId = 1;
|
||||
uint64 m_queueDepth = 0; // number of frames with pending presentation requests
|
||||
|
@ -92,5 +93,4 @@ private:
|
|||
VkSemaphore m_currentSemaphore = VK_NULL_HANDLE;
|
||||
|
||||
std::array<uint32, 2> m_swapchainQueueFamilyIndices;
|
||||
VkExtent2D m_actualExtent{};
|
||||
};
|
||||
|
|
|
@ -165,6 +165,7 @@ VKFUNC_DEVICE(vkCmdDraw);
|
|||
VKFUNC_DEVICE(vkCmdCopyBufferToImage);
|
||||
VKFUNC_DEVICE(vkCmdCopyImageToBuffer);
|
||||
VKFUNC_DEVICE(vkCmdClearColorImage);
|
||||
VKFUNC_DEVICE(vkCmdClearAttachments);
|
||||
VKFUNC_DEVICE(vkCmdBindIndexBuffer);
|
||||
VKFUNC_DEVICE(vkCmdBindVertexBuffers);
|
||||
VKFUNC_DEVICE(vkCmdDrawIndexed);
|
||||
|
|
|
@ -2912,9 +2912,6 @@ void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
|
|||
LatteTextureViewVk* texViewVk = (LatteTextureViewVk*)texView;
|
||||
draw_endRenderPass();
|
||||
|
||||
if (clearBackground)
|
||||
ClearColorbuffer(padView);
|
||||
|
||||
// barrier for input texture
|
||||
VkMemoryBarrier memoryBarrier{};
|
||||
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
||||
|
@ -2951,6 +2948,16 @@ void VulkanRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
|
|||
|
||||
vkCmdBeginRenderPass(m_state.currentCommandBuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
|
||||
|
||||
if (clearBackground)
|
||||
{
|
||||
VkClearAttachment clearAttachment{};
|
||||
clearAttachment.clearValue = {0,0,0,0};
|
||||
clearAttachment.colorAttachment = 0;
|
||||
clearAttachment.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
VkClearRect clearExtent = {{{0,0},chainInfo.m_actualExtent}, 0, 1};
|
||||
vkCmdClearAttachments(m_state.currentCommandBuffer, 1, &clearAttachment, 1, &clearExtent);
|
||||
}
|
||||
|
||||
vkCmdBindPipeline(m_state.currentCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
m_state.currentPipeline = pipeline;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue