From 00238732a3be3f1ce24674e0709147bc67e0d42c Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 4 Jul 2018 13:00:44 -0700 Subject: Fixed few issues with 3D texture views in GL and VK --- Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp index 1695d7eb..253e1300 100644 --- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp @@ -604,11 +604,15 @@ VulkanUtilities::ImageViewWrapper TextureVkImpl::CreateImageView(TextureViewDesc else { ImageViewCI.viewType = VK_IMAGE_VIEW_TYPE_3D; - if (ViewDesc.FirstDepthSlice != 0 || ViewDesc.NumDepthSlices != m_Desc.Depth) + Uint32 MipDepth = std::max(m_Desc.Depth >> ViewDesc.MostDetailedMip, 1U); + if (ViewDesc.FirstDepthSlice != 0 || ViewDesc.NumDepthSlices != MipDepth) { - LOG_ERROR_MESSAGE("3D texture views in Vulkan must address all depth slices."); + LOG_ERROR("3D texture view '", (ViewDesc.Name ? ViewDesc.Name : ""), "' (most detailed mip: ", ViewDesc.MostDetailedMip, + "; mip levels: ", ViewDesc.NumMipLevels, "; first slice: ", ViewDesc.FirstDepthSlice, + "; num depth slices: ", ViewDesc.NumDepthSlices, ") of texture '", m_Desc.Name, "' does not references" + " all depth slices (", MipDepth, ") in the mip level. 3D texture views in Vulkan must address all depth slices." ); ViewDesc.FirstDepthSlice = 0; - ViewDesc.NumDepthSlices = m_Desc.Depth; + ViewDesc.NumDepthSlices = MipDepth; } } break; -- cgit v1.2.3