Removed redundant barrier.
The transition of the swapchain image(s) can happen implicitly in the renderpass. This approach has been stated to be more efficient than using an explicit barrier. See "Vulkan Programming Guide", Chapter 7: "Graphics Pipelines", section "Renderpasses".
This commit is contained in:
parent
33874073dc
commit
eaae754211
@ -130,7 +130,7 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
|
|||||||
attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
attachment.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||||
VkAttachmentReference color_attachment = {};
|
VkAttachmentReference color_attachment = {};
|
||||||
color_attachment.attachment = 0;
|
color_attachment.attachment = 0;
|
||||||
color_attachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
color_attachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
@ -554,19 +554,6 @@ static void frame_end()
|
|||||||
{
|
{
|
||||||
VkResult err;
|
VkResult err;
|
||||||
vkCmdEndRenderPass(g_CommandBuffer[g_FrameIndex]);
|
vkCmdEndRenderPass(g_CommandBuffer[g_FrameIndex]);
|
||||||
{
|
|
||||||
VkImageMemoryBarrier barrier = {};
|
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
|
||||||
barrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
|
||||||
barrier.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
|
|
||||||
barrier.oldLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
|
||||||
barrier.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
|
||||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
barrier.image = g_BackBuffer[g_BackBufferIndex];
|
|
||||||
barrier.subresourceRange = g_ImageRange;
|
|
||||||
vkCmdPipelineBarrier(g_CommandBuffer[g_FrameIndex], VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &barrier);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||||
VkSubmitInfo info = {};
|
VkSubmitInfo info = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user