Skip to content

Instantly share code, notes, and snippets.

@mdomrach
Created August 14, 2017 13:46
Show Gist options
  • Save mdomrach/3fbb9e97c4f710bc7147aae6dbe369ff to your computer and use it in GitHub Desktop.
Save mdomrach/3fbb9e97c4f710bc7147aae6dbe369ff to your computer and use it in GitHub Desktop.
CreateDepthResources
void FVulkanApplication::CreateDepthResources()
{
VkFormat depthFormat = FVulkanCalculator::FindDepthFormat(vulkanDevice.physicalDevice);
FVulkanImageCalculator::CreateImage(vulkanDevice, swapChain.extent.width, swapChain.extent.height, depthFormat,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
depthImage, depthImageMemory);
depthImageView = FVulkanFactory::ImageView(vulkanDevice.logicalDevice, depthImage, depthFormat, VK_IMAGE_ASPECT_DEPTH_BIT);
FVulkanImageCalculator::TransitionImageLayout(
vulkanDevice.logicalDevice, commandPool, graphicsQueue,
depthImage, depthFormat, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment