Re-fix depth buffer initialization

This commit is contained in:
Henrik Rydgard committed 2016-03-20 19:30:39 +01:00
1 parent 9c457da4c9
commit b06cf4e688
1 file changed
+7 -3
+7 -3
View File
@@ -695,8 +695,12 @@ void VulkanContext::InitDepthStencilBuffer(VkCommandBuffer cmd) {
VkResult U_ASSERT_ONLY res;
bool U_ASSERT_ONLY pass;
VkImageCreateInfo image_info = {};
const VkFormat depth_format = VK_FORMAT_D16_UNORM;
// const VkFormat depth_format = VK_FORMAT_D24_UNORM_S8_UINT;
// const VkFormat depth_format = VK_FORMAT_D16_UNORM;
// int aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
const VkFormat depth_format = VK_FORMAT_D24_UNORM_S8_UINT;
int aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
VkFormatProperties props;
vkGetPhysicalDeviceFormatProperties(physical_devices_[0], depth_format, &props);
if (props.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) {
@@ -772,7 +776,7 @@ void VulkanContext::InitDepthStencilBuffer(VkCommandBuffer cmd) {
view_info.components.g = VK_COMPONENT_SWIZZLE_G;
view_info.components.b = VK_COMPONENT_SWIZZLE_B;
view_info.components.a = VK_COMPONENT_SWIZZLE_A;
view_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
view_info.subresourceRange.aspectMask = aspectMask;
view_info.subresourceRange.baseMipLevel = 0;
view_info.subresourceRange.levelCount = 1;
view_info.subresourceRange.baseArrayLayer = 0;