Vulkan: Set the depth/stencil attachment flag bit for depth/stencil textures.

This commit is contained in:
DrChat 2017-08-19 18:34:32 -05:00
parent 2f200f4a75
commit 96ba5d5563
1 changed files with 9 additions and 3 deletions

View File

@ -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(