From 96ba5d55631b23ac9fc1798fbe759acd2226cc4b Mon Sep 17 00:00:00 2001 From: DrChat Date: Sat, 19 Aug 2017 18:34:32 -0500 Subject: [PATCH] Vulkan: Set the depth/stencil attachment flag bit for depth/stencil textures. --- src/xenia/gpu/vulkan/texture_cache.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/xenia/gpu/vulkan/texture_cache.cc b/src/xenia/gpu/vulkan/texture_cache.cc index b6ddc1530..661971ce7 100644 --- a/src/xenia/gpu/vulkan/texture_cache.cc +++ b/src/xenia/gpu/vulkan/texture_cache.cc @@ -353,10 +353,16 @@ TextureCache::Texture* TextureCache::DemandResolveTexture( } } + VkFormatFeatureFlags required_flags = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; + if (texture_info.texture_format == TextureFormat::k_24_8 || + texture_info.texture_format == TextureFormat::k_24_8_FLOAT) { + required_flags |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT; + } else { + required_flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + } + // No texture at this location. Make a new one. - auto texture = - AllocateTexture(texture_info, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | - VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT); + auto texture = AllocateTexture(texture_info, required_flags); // Setup a debug name for the texture. device_->DbgSetObjectName(