diff --git a/bin/VulkanSample_Release_2015.exe b/bin/VulkanSample_Release_2015.exe index 05b19db..1fd8967 100644 Binary files a/bin/VulkanSample_Release_2015.exe and b/bin/VulkanSample_Release_2015.exe differ diff --git a/src/VulkanSample.cpp b/src/VulkanSample.cpp index fd20830..acc8d6c 100644 --- a/src/VulkanSample.cpp +++ b/src/VulkanSample.cpp @@ -754,64 +754,6 @@ static void CreateSwapchain() ERR_GUARD_VULKAN( vkCreateImageView(g_hDevice, &depthImageViewInfo, nullptr, &g_hDepthImageView) ); - BeginSingleTimeCommands(); - - // Transition image layout of g_SwapchainImages. - for(uint32_t i = 0; i < swapchainImageCount; ++i) - { - VkImageMemoryBarrier imgMemBarrier = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER }; - imgMemBarrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - imgMemBarrier.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - imgMemBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - imgMemBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - imgMemBarrier.image = g_SwapchainImages[i]; - imgMemBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - imgMemBarrier.subresourceRange.baseMipLevel = 0; - imgMemBarrier.subresourceRange.levelCount = 1; - imgMemBarrier.subresourceRange.baseArrayLayer = 0; - imgMemBarrier.subresourceRange.layerCount = 1; - imgMemBarrier.srcAccessMask = 0; - imgMemBarrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - - vkCmdPipelineBarrier( - g_hTemporaryCommandBuffer, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, - 0, - 0, nullptr, - 0, nullptr, - 1, &imgMemBarrier); - } - - // Transition image layout of g_hDepthImage. - - VkImageMemoryBarrier imgMemBarrier = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER }; - imgMemBarrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; - imgMemBarrier.newLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; - imgMemBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - imgMemBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - imgMemBarrier.image = g_hDepthImage; - imgMemBarrier.subresourceRange.aspectMask = g_DepthFormat == VK_FORMAT_D32_SFLOAT ? - VK_IMAGE_ASPECT_DEPTH_BIT : - VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; - imgMemBarrier.subresourceRange.baseMipLevel = 0; - imgMemBarrier.subresourceRange.levelCount = 1; - imgMemBarrier.subresourceRange.baseArrayLayer = 0; - imgMemBarrier.subresourceRange.layerCount = 1; - imgMemBarrier.srcAccessMask = 0; - imgMemBarrier.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; - - vkCmdPipelineBarrier( - g_hTemporaryCommandBuffer, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, - VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, - 0, - 0, nullptr, - 0, nullptr, - 1, &imgMemBarrier); - - EndSingleTimeCommands(); - // Create pipeline layout { if(g_hPipelineLayout != VK_NULL_HANDLE) @@ -852,7 +794,7 @@ static void CreateSwapchain() attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - attachments[0].initialLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + attachments[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attachments[0].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; attachments[1].format = g_DepthFormat; @@ -861,7 +803,7 @@ static void CreateSwapchain() attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachments[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - attachments[1].initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; + attachments[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; attachments[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; VkAttachmentReference colorAttachmentRef = {};