diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-08-05 02:21:19 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-08-05 02:21:19 +0000 |
| commit | 3ce2d21558fa0568ab7d332a5c300a661e444f44 (patch) | |
| tree | d0e437d0d88658844e0134b1c8ac6ef27e96a296 /Graphics | |
| parent | Implemented input attachments in Vulkan backend; added test (diff) | |
| download | DiligentCore-3ce2d21558fa0568ab7d332a5c300a661e444f44.tar.gz DiligentCore-3ce2d21558fa0568ab7d332a5c300a661e444f44.zip | |
Added more renderpass-related checks
Diffstat (limited to 'Graphics')
5 files changed, 129 insertions, 27 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp index 9e478675..c932d3b4 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp @@ -438,6 +438,9 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: template <typename BaseInterface, typename ImplementationTraits> inline void DeviceContextBase<BaseInterface, ImplementationTraits>::InvalidateState() { + if (m_pActiveRenderPass != nullptr) + LOG_ERROR_MESSAGE("Invalidating context inside an active render pass. Call EndRenderPass() to finish the pass."); + DeviceContextBase<BaseInterface, ImplementationTraits>::ClearStateCache(); } @@ -778,7 +781,7 @@ bool DeviceContextBase<BaseInterface, ImplementationTraits>::CheckIfBoundAsDepth template <typename BaseInterface, typename ImplementationTraits> bool DeviceContextBase<BaseInterface, ImplementationTraits>::UnbindTextureFromFramebuffer(TextureImplType* pTexture, bool bShowMessage) { - VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside render pass"); + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass."); if (pTexture == nullptr) return false; @@ -884,18 +887,18 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::BeginRenderP ResetRenderTargets(); - m_pActiveRenderPass = ValidatedCast<RenderPassImplType>(Attribs.pRenderPass); - m_pBoundFramebuffer = ValidatedCast<FramebufferImplType>(Attribs.pFramebuffer); - m_SubpassIndex = 0; + auto* pNewRenderPass = ValidatedCast<RenderPassImplType>(Attribs.pRenderPass); + auto* pNewFramebuffer = ValidatedCast<FramebufferImplType>(Attribs.pFramebuffer); + m_SubpassIndex = 0; - const auto& FBDesc = m_pBoundFramebuffer->GetDesc(); + const auto& FBDesc = pNewFramebuffer->GetDesc(); m_FramebufferWidth = FBDesc.Width; m_FramebufferHeight = FBDesc.Height; m_FramebufferSlices = FBDesc.NumArraySlices; if (Attribs.StateTransitionMode != RESOURCE_STATE_TRANSITION_MODE_NONE) { - const auto& RPDesc = m_pActiveRenderPass->GetDesc(); + const auto& RPDesc = pNewRenderPass->GetDesc(); VERIFY(RPDesc.AttachmentCount <= FBDesc.AttachmentCount, "The number of attachments (", FBDesc.AttachmentCount, ") in currently bound framebuffer is smaller than the number of attachments in the render pass (", RPDesc.AttachmentCount, ")"); @@ -918,12 +921,17 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::BeginRenderP } } } + + m_pActiveRenderPass = pNewRenderPass; + m_pBoundFramebuffer = pNewFramebuffer; + m_SubpassIndex = 0; } template <typename BaseInterface, typename ImplementationTraits> inline void DeviceContextBase<BaseInterface, ImplementationTraits>::NextSubpass() { VERIFY(m_pActiveRenderPass != nullptr, "There is no active render pass"); + VERIFY(m_SubpassIndex + 1 < m_pActiveRenderPass->GetDesc().SubpassCount, "The render pass has reached the final subpass already"); ++m_SubpassIndex; } @@ -932,6 +940,9 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::EndRenderPas { VERIFY(m_pActiveRenderPass != nullptr, "There is no active render pass"); VERIFY(m_pBoundFramebuffer != nullptr, "There is no active framebuffer"); + VERIFY(m_pActiveRenderPass->GetDesc().SubpassCount == m_SubpassIndex + 1, + "Ending render pass at subpass ", m_SubpassIndex, " before reaching the final subpass"); + if (UpdateResourceStates) { const auto& RPDesc = m_pActiveRenderPass->GetDesc(); @@ -1247,7 +1258,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData, RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, RESOURCE_STATE_TRANSITION_MODE TextureTransitionMode) { VERIFY(pTexture != nullptr, "pTexture must not be null"); - VERIFY(m_pActiveRenderPass == nullptr, "UpdateTexture must be used outside of render pass."); + VERIFY(m_pActiveRenderPass == nullptr, "UpdateTexture command must be used outside of render pass."); ValidateUpdateTextureParams(pTexture->GetDesc(), MipLevel, Slice, DstBox, SubresData); } @@ -1257,7 +1268,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: { VERIFY(CopyAttribs.pSrcTexture, "Src texture must not be null"); VERIFY(CopyAttribs.pDstTexture, "Dst texture must not be null"); - VERIFY(m_pActiveRenderPass == nullptr, "CopyTexture must be used outside of render pass."); + VERIFY(m_pActiveRenderPass == nullptr, "CopyTexture command must be used outside of render pass."); ValidateCopyTextureParams(CopyAttribs); } @@ -1289,7 +1300,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: GenerateMips(ITextureView* pTexView) { VERIFY(pTexView != nullptr, "pTexView must not be null"); - VERIFY(m_pActiveRenderPass == nullptr, "GenerateMips must be used outside of render pass."); + VERIFY(m_pActiveRenderPass == nullptr, "GenerateMips command must be used outside of render pass."); #ifdef DILIGENT_DEVELOPMENT { const auto& ViewDesc = pTexView->GetDesc(); @@ -1346,7 +1357,7 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>:: DEV_CHECK_ERR(!ResolveFmtAttribs.IsTypeless, "Format of a resolve operation must not be typeless when one of the texture formats is typeless"); } - VERIFY(m_pActiveRenderPass == nullptr, "ResolveTextureSubresource must be used outside of render pass."); + VERIFY(m_pActiveRenderPass == nullptr, "ResolveTextureSubresource command must be used outside of render pass."); #endif } @@ -1448,10 +1459,6 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: pAttribsBuffer->GetDesc().Name, "' was not created with BIND_INDIRECT_DRAW_ARGS flag."); return false; } - - VERIFY(!(m_pActiveRenderPass != nullptr && Attribs.IndirectAttribsBufferStateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION), - "Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. " - "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first."); } else { @@ -1459,6 +1466,13 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: return false; } + if (m_pActiveRenderPass != nullptr && Attribs.IndirectAttribsBufferStateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION) + { + LOG_ERROR_MESSAGE("Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. " + "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first."); + return false; + } + return true; } @@ -1503,10 +1517,6 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: pAttribsBuffer->GetDesc().Name, "' was not created with BIND_INDIRECT_DRAW_ARGS flag."); return false; } - - VERIFY(!(m_pActiveRenderPass != nullptr && Attribs.IndirectAttribsBufferStateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION), - "Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. " - "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first."); } else { @@ -1514,6 +1524,13 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: return false; } + if (m_pActiveRenderPass != nullptr && Attribs.IndirectAttribsBufferStateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION) + { + LOG_ERROR_MESSAGE("Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. " + "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first."); + return false; + } + return true; } @@ -1588,6 +1605,12 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: return false; } + if (m_pActiveRenderPass != nullptr) + { + LOG_ERROR_MESSAGE("DispatchCompute command must be performed outside of render pass"); + return false; + } + if (Attribs.ThreadGroupCountX == 0) LOG_WARNING_MESSAGE("DispatchCompute command arguments are invalid: ThreadGroupCountX is zero."); @@ -1617,6 +1640,12 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: return false; } + if (m_pActiveRenderPass != nullptr) + { + LOG_ERROR_MESSAGE("DispatchComputeIndirect command must be performed outside of render pass"); + return false; + } + if (pAttribsBuffer != nullptr) { if ((pAttribsBuffer->GetDesc().BindFlags & BIND_INDIRECT_DRAW_ARGS) == 0) diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index 857ed7c5..c6f9d289 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -627,6 +627,12 @@ void DeviceContextD3D11Impl::TransitionShaderResources(IPipelineState* pPipeline {
DEV_CHECK_ERR(pPipelineState != nullptr, "Pipeline state must not be null");
DEV_CHECK_ERR(pShaderResourceBinding != nullptr, "Shader resource binding must not be null");
+ if (m_pActiveRenderPass)
+ {
+ LOG_ERROR_MESSAGE("State transitions are not allowed inside a render pass.");
+ return;
+ }
+
TransitionAndCommitShaderResources<true, false>(pPipelineState, pShaderResourceBinding, false);
}
@@ -955,6 +961,11 @@ void DeviceContextD3D11Impl::ClearRenderTarget(ITextureView* pView, const float* void DeviceContextD3D11Impl::Flush()
{
+ if (m_pActiveRenderPass != nullptr)
+ {
+ LOG_ERROR_MESSAGE("Flushing device context inside an active render pass.");
+ }
+
m_pd3d11DeviceContext->Flush();
}
@@ -1721,6 +1732,8 @@ void DeviceContextD3D11Impl::ReleaseCommittedShaderResources() void DeviceContextD3D11Impl::FinishCommandList(ICommandList** ppCommandList)
{
+ VERIFY(m_pActiveRenderPass == nullptr, "Finishing command list inside an active render pass.");
+
CComPtr<ID3D11CommandList> pd3d11CmdList;
m_pd3d11DeviceContext->FinishCommandList(
FALSE, // A Boolean flag that determines whether the runtime saves deferred context state before it
@@ -1963,6 +1976,8 @@ void DeviceContextD3D11Impl::InvalidateState() void DeviceContextD3D11Impl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)
{
+ VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass");
+
for (Uint32 i = 0; i < BarrierCount; ++i)
{
const auto& Barrier = pResourceBarriers[i];
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 4ab5455d..c5ebdc84 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -245,7 +245,12 @@ void DeviceContextD3D12Impl::SetPipelineState(IPipelineState* pPipelineState) void DeviceContextD3D12Impl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) { - VERIFY_EXPR(pPipelineState != nullptr); + DEV_CHECK_ERR(pPipelineState != nullptr, "Pipeline state must mot be null"); + if (m_pActiveRenderPass) + { + LOG_ERROR_MESSAGE("State transitions are not allowed inside a render pass."); + return; + } auto& Ctx = GetCmdContext(); @@ -707,6 +712,11 @@ void DeviceContextD3D12Impl::Flush() return; } + if (m_pActiveRenderPass != nullptr) + { + LOG_ERROR_MESSAGE("Flushing device context inside an active render pass."); + } + Flush(true); } @@ -1670,6 +1680,8 @@ void DeviceContextD3D12Impl::GenerateMips(ITextureView* pTexView) void DeviceContextD3D12Impl::FinishCommandList(ICommandList** ppCommandList) { + VERIFY(m_pActiveRenderPass == nullptr, "Finishing command list inside an active render pass."); + CommandListD3D12Impl* pCmdListD3D12(NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D12Impl instance", CommandListD3D12Impl)(m_pDevice, this, std::move(m_CurrCmdCtx))); pCmdListD3D12->QueryInterface(IID_CommandList, reinterpret_cast<IObject**>(ppCommandList)); Flush(true); @@ -1757,6 +1769,8 @@ void DeviceContextD3D12Impl::EndQuery(IQuery* pQuery) void DeviceContextD3D12Impl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); + auto& CmdCtx = GetCmdContext(); for (Uint32 i = 0; i < BarrierCount; ++i) { diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index d1df47e3..6d353e35 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -147,6 +147,11 @@ void DeviceContextGLImpl::SetPipelineState(IPipelineState* pPipelineState) void DeviceContextGLImpl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) { + if (m_pActiveRenderPass) + { + LOG_ERROR_MESSAGE("State transitions are not allowed inside a render pass."); + return; + } } void DeviceContextGLImpl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) @@ -1037,6 +1042,11 @@ void DeviceContextGLImpl::ClearRenderTarget(ITextureView* pView, const float* RG void DeviceContextGLImpl::Flush() { + if (m_pActiveRenderPass != nullptr) + { + LOG_ERROR_MESSAGE("Flushing device context inside an active render pass."); + } + glFlush(); } @@ -1396,6 +1406,7 @@ void DeviceContextGLImpl::GenerateMips(ITextureView* pTexView) void DeviceContextGLImpl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); } void DeviceContextGLImpl::ResolveTextureSubresource(ITexture* pSrcTexture, diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 6a5d5ced..5f26479d 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -179,7 +179,7 @@ void DeviceContextVkImpl::DisposeVkCmdBuffer(Uint32 CmdQueue, VkCommandBuffer vk public: // clang-format off CmdBufferDeleter(VkCommandBuffer _vkCmdBuff, - VulkanUtilities::VulkanCommandBufferPool& _Pool) noexcept : + VulkanUtilities::VulkanCommandBufferPool& _Pool) noexcept : vkCmdBuff {_vkCmdBuff}, Pool {&_Pool } { @@ -236,7 +236,7 @@ void DeviceContextVkImpl::SetPipelineState(IPipelineState* pPipelineState) if (m_State.NumCommands >= m_NumCommandsToFlush && !m_bIsDeferred && // Never flush deferred context - !m_pActiveRenderPass && // Never flush inside active render pass + !m_pActiveRenderPass && // Never flush inside active render pass (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-vkEndCommandBuffer-commandBuffer-00060) m_ActiveQueriesCounter == 0 // A query must begin and end in the same command buffer (17.2) ) { @@ -305,7 +305,12 @@ void DeviceContextVkImpl::SetPipelineState(IPipelineState* pPipelineState) void DeviceContextVkImpl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) { - VERIFY_EXPR(pPipelineState != nullptr); + DEV_CHECK_ERR(pPipelineState != nullptr, "Pipeline state must mot be null"); + if (m_pActiveRenderPass) + { + LOG_ERROR_MESSAGE("State transitions are not allowed inside a render pass."); + return; + } auto* pPipelineStateVk = ValidatedCast<PipelineStateVkImpl>(pPipelineState); pPipelineStateVk->CommitAndTransitionShaderResources(pShaderResourceBinding, this, false, RESOURCE_STATE_TRANSITION_MODE_TRANSITION, nullptr); @@ -935,14 +940,19 @@ void DeviceContextVkImpl::Flush() { if (m_bIsDeferred) { - LOG_ERROR_MESSAGE("Flush() should only be called for immediate contexts"); + LOG_ERROR_MESSAGE("Flush() should only be called for immediate contexts."); return; } if (m_ActiveQueriesCounter > 0) { LOG_ERROR_MESSAGE("Flushing device context that has ", m_ActiveQueriesCounter, - " active queries. Vulkan requires that queries are begun and ended in the same command buffer"); + " active queries. Vulkan requires that queries are begun and ended in the same command buffer."); + } + + if (m_pActiveRenderPass != nullptr) + { + LOG_ERROR_MESSAGE("Flushing device context inside an active render pass."); } VkSubmitInfo SubmitInfo = {}; @@ -1147,6 +1157,9 @@ void DeviceContextVkImpl::SetScissorRects(Uint32 NumRects, const Rect* pRects, U void DeviceContextVkImpl::TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) { + VERIFY(StateTransitionMode != RESOURCE_STATE_TRANSITION_MODE_TRANSITION || m_pActiveRenderPass == nullptr, + "State transitions are not allowed inside a render pass."); + if (m_pBoundDepthStencil) { auto* pDepthBufferVk = ValidatedCast<TextureVkImpl>(m_pBoundDepthStencil->GetTexture()); @@ -1167,7 +1180,7 @@ void DeviceContextVkImpl::TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE void DeviceContextVkImpl::CommitRenderPassAndFramebuffer(bool VerifyStates) { - VERIFY(m_pActiveRenderPass == nullptr, "This method should not be called inside an active render pass."); + VERIFY(m_pActiveRenderPass == nullptr, "This method must not be called inside an active render pass."); const auto& CmdBufferState = m_CommandBuffer.GetState(); if (CmdBufferState.Framebuffer != m_vkFramebuffer) @@ -1265,8 +1278,11 @@ void DeviceContextVkImpl::BeginRenderPass(const BeginRenderPassAttribs& Attribs) { TDeviceContextBase::BeginRenderPass(Attribs); - VERIFY_EXPR(m_pActiveRenderPass); - VERIFY_EXPR(m_pBoundFramebuffer); + VERIFY_EXPR(m_pActiveRenderPass != nullptr); + VERIFY_EXPR(m_pBoundFramebuffer != nullptr); + VERIFY_EXPR(m_vkRenderPass == VK_NULL_HANDLE); + VERIFY_EXPR(m_vkFramebuffer == VK_NULL_HANDLE); + m_vkRenderPass = m_pActiveRenderPass->GetVkRenderPass(); m_vkFramebuffer = m_pBoundFramebuffer->GetVkFramebuffer(); @@ -1317,6 +1333,14 @@ void DeviceContextVkImpl::EndRenderPass(bool UpdateResourceStates) TDeviceContextBase::EndRenderPass(UpdateResourceStates); EnsureVkCmdBuffer(); m_CommandBuffer.EndRenderPass(); + + if (m_State.NumCommands >= m_NumCommandsToFlush && + !m_bIsDeferred && // Never flush deferred context + m_ActiveQueriesCounter == 0 // A query must begin and end in the same command buffer (17.2) + ) + { + Flush(); + } } void DeviceContextVkImpl::UpdateBufferRegion(BufferVkImpl* pBuffVk, @@ -2077,6 +2101,8 @@ void DeviceContextVkImpl::UnmapTextureSubresource(ITexture* pTexture, void DeviceContextVkImpl::FinishCommandList(class ICommandList** ppCommandList) { + VERIFY(m_pActiveRenderPass == nullptr, "Finishing command list inside an active render pass."); + if (m_CommandBuffer.GetState().RenderPass != VK_NULL_HANDLE) { m_CommandBuffer.EndRenderPass(); @@ -2241,6 +2267,7 @@ void DeviceContextVkImpl::EndQuery(IQuery* pQuery) void DeviceContextVkImpl::TransitionImageLayout(ITexture* pTexture, VkImageLayout NewLayout) { VERIFY_EXPR(pTexture != nullptr); + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); auto pTextureVk = ValidatedCast<TextureVkImpl>(pTexture); if (!pTextureVk->IsInKnownState()) { @@ -2260,6 +2287,7 @@ void DeviceContextVkImpl::TransitionTextureState(TextureVkImpl& Textur bool UpdateTextureState, VkImageSubresourceRange* pSubresRange /* = nullptr*/) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); if (OldState == RESOURCE_STATE_UNKNOWN) { if (TextureVk.IsInKnownState()) @@ -2335,6 +2363,7 @@ void DeviceContextVkImpl::TransitionOrVerifyTextureState(TextureVkImpl& { if (TransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); if (Texture.IsInKnownState()) { if (!Texture.CheckState(RequiredState)) @@ -2382,6 +2411,7 @@ void DeviceContextVkImpl::BufferMemoryBarrier(IBuffer* pBuffer, VkAccessFlags Ne void DeviceContextVkImpl::TransitionBufferState(BufferVkImpl& BufferVk, RESOURCE_STATE OldState, RESOURCE_STATE NewState, bool UpdateBufferState) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); if (OldState == RESOURCE_STATE_UNKNOWN) { if (BufferVk.IsInKnownState()) @@ -2431,6 +2461,7 @@ void DeviceContextVkImpl::TransitionOrVerifyBufferState(BufferVkImpl& { if (TransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); if (Buffer.IsInKnownState()) { if (!Buffer.CheckState(RequiredState)) @@ -2459,6 +2490,8 @@ VulkanDynamicAllocation DeviceContextVkImpl::AllocateDynamicSpace(Uint32 SizeInB void DeviceContextVkImpl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) { + VERIFY(m_pActiveRenderPass == nullptr, "State transitions are not allowed inside a render pass"); + if (BarrierCount == 0) return; |
