summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-01 19:45:38 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-01 19:45:38 +0000
commitda6bb5d0d93e550a32da19550df21521ce2da505 (patch)
tree82a17cbe9c06967e93e3d258a329ce55afe829ec /Graphics/GraphicsEngineVulkan
parentAdded explicit state transition mode to ClearRenderTarget() command (diff)
downloadDiligentCore-da6bb5d0d93e550a32da19550df21521ce2da505.tar.gz
DiligentCore-da6bb5d0d93e550a32da19550df21521ce2da505.zip
Added explicit state transition control flags to CLEAR_DEPTH_STENCIL_FLAGS
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index db958c57..1be1f045 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -703,15 +703,30 @@ namespace Diligent
auto* pTexture = pVkDSV->GetTexture();
auto* pTextureVk = ValidatedCast<TextureVkImpl>(pTexture);
- // Image layout must be VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL (17.1)
- if (pTextureVk->IsInKnownState())
+ if (ClearFlags & CLEAR_DEPTH_STENCIL_TRANSITION_STATE_FLAG)
+ {
+ // Image layout must be VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL (17.1)
+ if (pTextureVk->IsInKnownState())
+ {
+ if (!pTextureVk->CheckState(RESOURCE_STATE_COPY_DEST))
+ {
+ TransitionTextureState(*pTextureVk, RESOURCE_STATE_UNKNOWN, RESOURCE_STATE_COPY_DEST, true);
+ }
+ VERIFY_EXPR(pTextureVk->GetLayout() == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
+ }
+ }
+#ifdef DEVELOPMENT
+ else if(ClearFlags & CLEAR_DEPTH_STENCIL_VERIFY_STATE_FLAG)
{
- if (!pTextureVk->CheckState(RESOURCE_STATE_COPY_DEST))
+ if (pTextureVk->IsInKnownState() && !pTextureVk->CheckState(RESOURCE_STATE_COPY_DEST))
{
- TransitionTextureState(*pTextureVk, RESOURCE_STATE_UNKNOWN, RESOURCE_STATE_COPY_DEST, true);
+ LOG_ERROR_MESSAGE("Depth-stencil buffer '", pTextureVk->GetDesc().Name, "' being cleared outside of render pass not transitioned to RESOURCE_STATE_COPY_DEST state. "
+ "Actual texture state: ", GetResourceStateString(pTexture->GetState()), ". "
+ "Use CLEAR_DEPTH_STENCIL_TRANSITION_STATE_FLAG flag or explicitly transition the resource using IDeviceContext::TransitionResourceStates() method.");
}
- VERIFY_EXPR(pTextureVk->GetLayout() == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
}
+#endif
+
VkClearDepthStencilValue ClearValue;
ClearValue.depth = fDepth;