summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-04 04:52:34 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-04 04:52:34 +0000
commitfefe45978623a7f8dd7e0496fe4877e64d875e2c (patch)
treee7ad50bdffe89a0f471bdec365d9f27698e393d7 /Graphics/GraphicsEngineVulkan
parentRemoved DRAW_FLAG_TRANSITION_VERTEX_BUFFERS, DRAW_FLAG_TRANSITION_INDEX_BUFFE... (diff)
downloadDiligentCore-fefe45978623a7f8dd7e0496fe4877e64d875e2c.tar.gz
DiligentCore-fefe45978623a7f8dd7e0496fe4877e64d875e2c.zip
Replaced SET_RENDER_TARGETS_FLAGS with RESOURCE_STATE_TRANSITION_MODE.
Removed CLEAR_DEPTH_STENCIL_TRANSITION_STATE_FLAG and CLEAR_DEPTH_STENCIL_VERIFY_STATE_FLAG
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h16
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp41
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp4
4 files changed, 29 insertions, 34 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
index 19659935..35274c2b 100644
--- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h
@@ -95,16 +95,20 @@ public:
virtual void SetScissorRects( Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight )override final;
- virtual void SetRenderTargets( Uint32 NumRenderTargets,
- ITextureView* ppRenderTargets[],
- ITextureView* pDepthStencil,
- SET_RENDER_TARGETS_FLAGS Flags )override final;
+ virtual void SetRenderTargets( Uint32 NumRenderTargets,
+ ITextureView* ppRenderTargets[],
+ ITextureView* pDepthStencil,
+ RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final;
virtual void Draw( DrawAttribs &DrawAttribs )override final;
virtual void DispatchCompute( const DispatchComputeAttribs& DispatchAttrs )override final;
- virtual void ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil)override final;
+ virtual void ClearDepthStencil(ITextureView* pView,
+ CLEAR_DEPTH_STENCIL_FLAGS ClearFlags,
+ float fDepth,
+ Uint8 Stencil,
+ RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)override final;
virtual void ClearRenderTarget( ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final;
@@ -244,7 +248,7 @@ public:
Int64 GetContextFrameNumber()const{return m_ContextFrameNumber;}
private:
- void TransitionRenderTargets(SET_RENDER_TARGETS_FLAGS Flags);
+ void TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode);
inline void CommitRenderPassAndFramebuffer();
void CommitVkVertexBuffers();
void CommitViewports();
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 26a5fa06..754325fe 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -384,7 +384,7 @@ namespace Diligent
EnsureVkCmdBuffer();
- const bool VerifyStates = drawAttribs.Flags & DRAW_FLAG_VERIFY_STATES;
+ const bool VerifyStates = (drawAttribs.Flags & DRAW_FLAG_VERIFY_STATES) != 0;
if ( drawAttribs.IsIndexed )
{
#ifdef DEVELOPMENT
@@ -518,7 +518,11 @@ namespace Diligent
++m_State.NumCommands;
}
- void DeviceContextVkImpl::ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil )
+ void DeviceContextVkImpl::ClearDepthStencil(ITextureView* pView,
+ CLEAR_DEPTH_STENCIL_FLAGS ClearFlags,
+ float fDepth,
+ Uint8 Stencil,
+ RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
ITextureViewVk* pVkDSV = nullptr;
if ( pView != nullptr )
@@ -586,13 +590,7 @@ namespace Diligent
auto* pTextureVk = ValidatedCast<TextureVkImpl>(pTexture);
// Image layout must be VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL (17.1)
- auto TransitionMode =
- (ClearFlags & CLEAR_DEPTH_STENCIL_TRANSITION_STATE_FLAG) ?
- RESOURCE_STATE_TRANSITION_MODE_TRANSITION :
- ((ClearFlags & CLEAR_DEPTH_STENCIL_VERIFY_STATE_FLAG) ?
- RESOURCE_STATE_TRANSITION_MODE_VERIFY :
- RESOURCE_STATE_TRANSITION_MODE_NONE);
- TransitionOrVerifyTextureState(*pTextureVk, TransitionMode, RESOURCE_STATE_COPY_DEST, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ TransitionOrVerifyTextureState(*pTextureVk, StateTransitionMode, RESOURCE_STATE_COPY_DEST, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
"Clearing depth-stencil buffer outside of render pass (DeviceContextVkImpl::ClearDepthStencil)");
VkClearDepthStencilValue ClearValue;
@@ -979,18 +977,13 @@ namespace Diligent
}
- void DeviceContextVkImpl::TransitionRenderTargets(SET_RENDER_TARGETS_FLAGS Flags)
+ void DeviceContextVkImpl::TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
if (m_pBoundDepthStencil)
{
auto* pDSVVk = m_pBoundDepthStencil.RawPtr<TextureViewVkImpl>();
auto* pDepthBufferVk = ValidatedCast<TextureVkImpl>(pDSVVk->GetTexture());
- auto DepthTransitionMode = (Flags & SET_RENDER_TARGETS_FLAG_TRANSITION_DEPTH) ?
- RESOURCE_STATE_TRANSITION_MODE_TRANSITION :
- ((Flags & SET_RENDER_TARGETS_FLAG_VERIFY_STATES) ?
- RESOURCE_STATE_TRANSITION_MODE_VERIFY :
- RESOURCE_STATE_TRANSITION_MODE_NONE);
- TransitionOrVerifyTextureState(*pDepthBufferVk, DepthTransitionMode, RESOURCE_STATE_DEPTH_WRITE, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
+ TransitionOrVerifyTextureState(*pDepthBufferVk, StateTransitionMode, RESOURCE_STATE_DEPTH_WRITE, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
"Binding depth-stencil buffer (DeviceContextVkImpl::TransitionRenderTargets)");
}
@@ -1000,12 +993,7 @@ namespace Diligent
{
auto* pRTVVk = ValidatedCast<TextureViewVkImpl>(pRTV);
auto* pRenderTargetVk = ValidatedCast<TextureVkImpl>(pRTVVk->GetTexture());
- auto RTTransitionMode = (Flags & SET_RENDER_TARGETS_FLAG_TRANSITION_COLOR) ?
- RESOURCE_STATE_TRANSITION_MODE_TRANSITION :
- ((Flags & SET_RENDER_TARGETS_FLAG_VERIFY_STATES) ?
- RESOURCE_STATE_TRANSITION_MODE_VERIFY :
- RESOURCE_STATE_TRANSITION_MODE_NONE);
- TransitionOrVerifyTextureState(*pRenderTargetVk, RTTransitionMode, RESOURCE_STATE_RENDER_TARGET, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
+ TransitionOrVerifyTextureState(*pRenderTargetVk, StateTransitionMode, RESOURCE_STATE_RENDER_TARGET, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
"Binding render targets (DeviceContextVkImpl::TransitionRenderTargets)");
}
}
@@ -1023,14 +1011,17 @@ namespace Diligent
{
VERIFY_EXPR(m_RenderPass != VK_NULL_HANDLE);
#ifdef DEVELOPMENT
- TransitionRenderTargets(SET_RENDER_TARGETS_FLAG_VERIFY_STATES);
+ TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY);
#endif
m_CommandBuffer.BeginRenderPass(m_RenderPass, m_Framebuffer, m_FramebufferWidth, m_FramebufferHeight);
}
}
}
- void DeviceContextVkImpl::SetRenderTargets( Uint32 NumRenderTargets, ITextureView *ppRenderTargets[], ITextureView *pDepthStencil, SET_RENDER_TARGETS_FLAGS Flags )
+ void DeviceContextVkImpl::SetRenderTargets( Uint32 NumRenderTargets,
+ ITextureView* ppRenderTargets[],
+ ITextureView* pDepthStencil,
+ RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )
{
if ( TDeviceContextBase::SetRenderTargets( NumRenderTargets, ppRenderTargets, pDepthStencil ) )
{
@@ -1090,7 +1081,7 @@ namespace Diligent
// CommitRenderPassAndFramebuffer() until draw call, otherwise we may have to
// to end render pass and begin it again if we need to transition any resource
// (for instance when CommitShaderResources() is called after SetRenderTargets())
- TransitionRenderTargets(Flags);
+ TransitionRenderTargets(StateTransitionMode);
}
void DeviceContextVkImpl::ResetRenderTargets()
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp
index 654e6bb1..12d46cef 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp
@@ -315,7 +315,7 @@ void EngineFactoryVkImpl::CreateSwapChainVk( IRenderDevice* pDevice,
pDeviceContextVk->SetSwapChain(pSwapChainVk);
// Bind default render target
- pDeviceContextVk->SetRenderTargets( 0, nullptr, nullptr, SET_RENDER_TARGETS_FLAG_TRANSITION_ALL );
+ pDeviceContextVk->SetRenderTargets( 0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION );
// Set default viewport
pDeviceContextVk->SetViewports( 1, nullptr, 0, 0 );
diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp
index ad68c9a0..e8fa7094 100644
--- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp
@@ -499,7 +499,7 @@ void SwapChainVkImpl::Present(Uint32 SyncInterval)
{
// If default framebuffer is bound, we need to call SetRenderTargets()
// to bind new back buffer RTV
- pImmediateCtxVk->SetRenderTargets(0, nullptr, nullptr, SET_RENDER_TARGETS_FLAG_TRANSITION_ALL);
+ pImmediateCtxVk->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
}
}
}
@@ -551,7 +551,7 @@ void SwapChainVkImpl::Resize( Uint32 NewWidth, Uint32 NewHeight )
if( bIsDefaultFBBound )
{
// Set default render target and viewport
- pDeviceContext->SetRenderTargets( 0, nullptr, nullptr, SET_RENDER_TARGETS_FLAG_TRANSITION_ALL );
+ pDeviceContext->SetRenderTargets( 0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
pDeviceContext->SetViewports( 1, nullptr, 0, 0 );
}
}