summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-06-19 15:52:56 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-06-19 15:52:56 +0000
commita44916beab60f1f86372386b0e996eb95be75aa1 (patch)
tree26ef9857c3a65b89c9a71d41260b569d4c35017c /Graphics
parentImplemented resource names string pool for D3D backends (diff)
downloadDiligentCore-a44916beab60f1f86372386b0e996eb95be75aa1.tar.gz
DiligentCore-a44916beab60f1f86372386b0e996eb95be75aa1.zip
Fixed layout transition for depth textures in Vulkan
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/include/TextureViewBase.h5
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp10
2 files changed, 14 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngine/include/TextureViewBase.h b/Graphics/GraphicsEngine/include/TextureViewBase.h
index 0b8ddc45..25c2c436 100644
--- a/Graphics/GraphicsEngine/include/TextureViewBase.h
+++ b/Graphics/GraphicsEngine/include/TextureViewBase.h
@@ -92,6 +92,11 @@ public:
return m_pTexture;
}
+ const ITexture* GetTexture()const
+ {
+ return m_pTexture;
+ }
+
protected:
/// Strong reference to the sampler
Diligent::RefCntAutoPtr<ISampler> m_pSampler;
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
index b63c106c..9f548fa4 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
@@ -266,7 +266,15 @@ VkDescriptorImageInfo ShaderResourceCacheVk::Resource::GetImageDescriptorWriteIn
// If descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, for each descriptor that will be accessed
// via load or store operations the imageLayout member for corresponding elements of pImageInfo
// MUST be VK_IMAGE_LAYOUT_GENERAL (13.2.4)
- DescrImgInfo.imageLayout = IsStorageImage ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ if(IsStorageImage)
+ DescrImgInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+ else
+ {
+ if(ValidatedCast<const TextureVkImpl>(pTexViewVk->GetTexture())->GetDesc().BindFlags & BIND_DEPTH_STENCIL)
+ DescrImgInfo.imageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
+ else
+ DescrImgInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
+ }
return DescrImgInfo;
}