From 6ac3c5f99086745e047de9cd0b08b9910b182fa0 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 31 Mar 2024 16:48:12 -0300 Subject: [PATCH] vulkan: fix one validation error when sending a depth-stencil texture to a shader. --- src/modules/graphics/vulkan/Texture.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/graphics/vulkan/Texture.cpp b/src/modules/graphics/vulkan/Texture.cpp index 679859684..e5241fe7f 100644 --- a/src/modules/graphics/vulkan/Texture.cpp +++ b/src/modules/graphics/vulkan/Texture.cpp @@ -355,6 +355,10 @@ void Texture::createTextureImageView() viewInfo.viewType = Vulkan::getImageViewType(getTextureType()); viewInfo.format = vulkanFormat.internalFormat; viewInfo.subresourceRange.aspectMask = imageAspect; + // This view is used in descriptor sets, where having both depth and + // stencil aspects in the same view isn't allowed. + if (imageAspect & VK_IMAGE_ASPECT_DEPTH_BIT) + viewInfo.subresourceRange.aspectMask &= ~VK_IMAGE_ASPECT_STENCIL_BIT; viewInfo.subresourceRange.baseMipLevel = rootView.startMipmap; viewInfo.subresourceRange.levelCount = getMipmapCount(); viewInfo.subresourceRange.baseArrayLayer = rootView.startLayer;