summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-23 06:56:19 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-23 06:56:19 +0000
commitd80f5d9b2d769fd0513ae0e026d8a56b5d56a1fe (patch)
treef4c2d1959618a7e69c23a3819dce15431034d68d /Graphics/GraphicsEngineVulkan
parentAdded clamp() function to math lib (diff)
downloadDiligentCore-d80f5d9b2d769fd0513ae0e026d8a56b5d56a1fe.tar.gz
DiligentCore-d80f5d9b2d769fd0513ae0e026d8a56b5d56a1fe.zip
Implemented split barriers (closed https://github.com/DiligentGraphics/DiligentCore/issues/43).
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 856d20ca..b34daae6 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -1859,7 +1859,6 @@ namespace Diligent
void DeviceContextVkImpl::TransitionBufferState(BufferVkImpl& BufferVk, RESOURCE_STATE OldState, RESOURCE_STATE NewState, bool UpdateBufferState)
{
- EnsureVkCmdBuffer();
if (OldState == RESOURCE_STATE_UNKNOWN)
{
if (BufferVk.IsInKnownState())
@@ -1889,6 +1888,7 @@ namespace Diligent
DEV_CHECK_ERR(BufferVk.m_VulkanBuffer != VK_NULL_HANDLE, "Cannot transition suballocated buffer");
VERIFY_EXPR(BufferVk.GetDynamicOffset(m_ContextId, this) == 0);
+ EnsureVkCmdBuffer();
auto vkBuff = BufferVk.GetVkBuffer();
auto OldAccessFlags = ResourceStateFlagsToVkAccessFlags(OldState);
auto NewAccessFlags = ResourceStateFlagsToVkAccessFlags(NewState);
@@ -1936,7 +1936,7 @@ namespace Diligent
void DeviceContextVkImpl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)
{
- if(BarrierCount == 0)
+ if (BarrierCount == 0)
return;
EnsureVkCmdBuffer();
@@ -1947,6 +1947,14 @@ namespace Diligent
#ifdef DEVELOPMENT
DvpVerifyStateTransitionDesc(Barrier);
#endif
+ if (Barrier.TransitionType == STATE_TRANSITION_TYPE_BEGIN)
+ {
+ // Skip begin-split barriers
+ VERIFY(!Barrier.UpdateResourceState, "Resource state can't be updated in begin-split barrier");
+ continue;
+ }
+ VERIFY(Barrier.TransitionType == STATE_TRANSITION_TYPE_IMMEDIATE || Barrier.TransitionType == STATE_TRANSITION_TYPE_END, "Unexpected barrier type");
+
if (Barrier.pTexture)
{
auto* pTextureVkImpl = ValidatedCast<TextureVkImpl>(Barrier.pTexture);