summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-06-19 03:58:48 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-06-19 03:58:48 +0000
commitd0ad1a73ccc0b74bd1be01a14cabcc463bde08cc (patch)
tree57451989871cd67315796deb602e436f0e87a9f0 /Graphics/GraphicsEngineVulkan
parentFixed creation of views of a depth-stencil textures in Vulkan (diff)
downloadDiligentCore-d0ad1a73ccc0b74bd1be01a14cabcc463bde08cc.tar.gz
DiligentCore-d0ad1a73ccc0b74bd1be01a14cabcc463bde08cc.zip
Updated 3D texture clears in Vulkan backend
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp14
-rw-r--r--Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp2
3 files changed, 14 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 4a739279..9585d612 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -753,8 +753,18 @@ namespace Diligent
auto ClearValue = ClearValueToVkClearValue(RGBA, ViewDesc.Format);
VkImageSubresourceRange Subresource;
Subresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- Subresource.baseArrayLayer = ViewDesc.FirstArraySlice;
- Subresource.layerCount = ViewDesc.NumArraySlices;
+ if(ViewDesc.TextureDim == RESOURCE_DIM_TEX_3D)
+ {
+ if(ViewDesc.NumDepthSlices != pTextureVk->GetDesc().Depth || ViewDesc.FirstDepthSlice != 0)
+ LOG_ERROR_MESSAGE("Partial clears of 3D textures are not supported in Vulkan. Texture '", pTextureVk->GetDesc().Name,"' will be cleared entirely.");
+ Subresource.baseArrayLayer = 0;
+ Subresource.layerCount = 1;
+ }
+ else
+ {
+ Subresource.baseArrayLayer = ViewDesc.FirstArraySlice;
+ Subresource.layerCount = ViewDesc.NumArraySlices;
+ }
Subresource.baseMipLevel = ViewDesc.MostDetailedMip;
Subresource.levelCount = ViewDesc.NumMipLevels;
VERIFY(ViewDesc.NumMipLevels, "RTV must contain single mip level");
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
index 4b6671d2..b63c106c 100644
--- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp
@@ -153,7 +153,7 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl *pCtxVkImpl)
// VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL must only be used as a read - only depth / stencil attachment
// in a VkFramebuffer and/or as a read - only image in a shader (which can be read as a sampled image, combined
// image / sampler and /or input attachment). This layout is valid only for image subresources of images created
- // with the VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT usage bit enabled.
+ // with the VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT usage bit enabled. (11.4)
RequiredLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;
}
else
diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
index efd292ab..86248839 100644
--- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
@@ -641,7 +641,7 @@ 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.viewType == VK_IMAGE_VIEW_TYPE_3D)
{
if(ImageViewCI.subresourceRange.baseArrayLayer == 0 && ImageViewCI.subresourceRange.layerCount == m_Desc.Depth )
{