From a72d485f4b157d5c8fb488bc2afb3b9278e465b7 Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 6 Aug 2020 20:41:08 -0700 Subject: Treating subpass render target and depth stencil attachments as current RT and DS buffers --- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 3162e3be..e5f37de3 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -1214,6 +1214,14 @@ void DeviceContextVkImpl::SetRenderTargets(Uint32 NumRen ITextureView* pDepthStencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) { +#ifdef DILIGENT_DEVELOPMENT + if (m_pActiveRenderPass != nullptr) + { + LOG_ERROR_MESSAGE("Calling SetRenderTargets inside active render pass is invalid. End the render pass first"); + return; + } +#endif + if (TDeviceContextBase::SetRenderTargets(NumRenderTargets, ppRenderTargets, pDepthStencil)) { FramebufferCache::FramebufferCacheKey FBKey; @@ -1331,15 +1339,15 @@ void DeviceContextVkImpl::BeginRenderPass(const BeginRenderPassAttribs& Attribs) void DeviceContextVkImpl::NextSubpass() { TDeviceContextBase::NextSubpass(); - EnsureVkCmdBuffer(); + VERIFY_EXPR(m_CommandBuffer.GetVkCmdBuffer() != VK_NULL_HANDLE && m_CommandBuffer.GetState().RenderPass != VK_NULL_HANDLE); m_CommandBuffer.NextSubpass(); } void DeviceContextVkImpl::EndRenderPass(bool UpdateResourceStates) { TDeviceContextBase::EndRenderPass(UpdateResourceStates); - EnsureVkCmdBuffer(); - m_CommandBuffer.EndRenderPass(); + // TDeviceContextBase::EndRenderPass calls ResetRenderTargets() that in turn + // calls m_CommandBuffer.EndRenderPass() if (m_State.NumCommands >= m_NumCommandsToFlush && !m_bIsDeferred && // Never flush deferred context -- cgit v1.2.3