summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-06-03 04:20:44 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-06-03 04:20:44 +0000
commitd74ad74732723537bc92271cd4bd6067076c7758 (patch)
treea79748d952c7c6eb2a853b246f2ddbfb7e3f5562 /Graphics/GraphicsEngineVulkan
parentDisabled info message about objects found in state object registry (diff)
downloadDiligentCore-d74ad74732723537bc92271cd4bd6067076c7758.tar.gz
DiligentCore-d74ad74732723537bc92271cd4bd6067076c7758.zip
Fixed issue with partial views of a 3D texture in Vulkan
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
index 58f7f394..886f2e3c 100644
--- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
@@ -86,7 +86,10 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters *pRefCounters,
else if (m_Desc.Type == RESOURCE_DIM_TEX_2D || m_Desc.Type == RESOURCE_DIM_TEX_2D_ARRAY || m_Desc.Type == RESOURCE_DIM_TEX_CUBE || m_Desc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY)
ImageCI.imageType = VK_IMAGE_TYPE_2D;
else if (m_Desc.Type == RESOURCE_DIM_TEX_3D)
+ {
ImageCI.imageType = VK_IMAGE_TYPE_3D;
+ ImageCI.flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
+ }
else
{
LOG_ERROR_AND_THROW("Unknown texture type");
@@ -690,6 +693,19 @@ VulkanUtilities::ImageViewWrapper TextureVkImpl::CreateImageView(TextureViewDesc
ImageViewCI.subresourceRange.baseArrayLayer = ViewDesc.FirstArraySlice;
ImageViewCI.subresourceRange.layerCount = ViewDesc.NumArraySlices;
+ if(ImageViewCI.viewType == VK_IMAGE_VIEW_TYPE_3D)
+ {
+ if(ImageViewCI.subresourceRange.baseArrayLayer == 0 && ImageViewCI.subresourceRange.layerCount == m_Desc.Depth )
+ {
+ // If viewType is VK_IMAGE_VIEW_TYPE_3D, then baseArrayLayer must be 0, and layerCount must be 1 (11.5)
+ ImageViewCI.subresourceRange.layerCount = 1;
+ }
+ else
+ {
+ // Create a 2D texture array view
+ ImageViewCI.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
+ }
+ }
const auto &FmtAttribs = GetTextureFormatAttribs(ViewDesc.Format);
if(ViewDesc.ViewType == TEXTURE_VIEW_DEPTH_STENCIL)