summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-08-08 23:48:40 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-08 23:48:40 +0000
commitfd6ecbc3e52569119c4e0ff30236bd23f2757737 (patch)
tree1cc09a201840841ecd4bb579dcd23e815fa7bc74 /Graphics/GraphicsEngineD3D11
parentD3D12 backend: implemented render pass attachment state transitons (diff)
downloadDiligentCore-fd6ecbc3e52569119c4e0ff30236bd23f2757737.tar.gz
DiligentCore-fd6ecbc3e52569119c4e0ff30236bd23f2757737.zip
Implemented unified render pass attachment state updates within subpasses and after the render pass ends
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp4
-rwxr-xr-xGraphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp33
2 files changed, 7 insertions, 30 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp
index 4df12602..6da56a4f 100644
--- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp
+++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp
@@ -131,7 +131,7 @@ public:
virtual void DILIGENT_CALL_TYPE NextSubpass() override final;
/// Implementation of IDeviceContext::EndRenderPass() in Direct3D11 backend.
- virtual void DILIGENT_CALL_TYPE EndRenderPass(bool UpdateResourceStates) override final;
+ virtual void DILIGENT_CALL_TYPE EndRenderPass() override final;
/// Implementation of IDeviceContext::Draw() in Direct3D11 backend.
virtual void DILIGENT_CALL_TYPE Draw(const DrawAttribs& Attribs) override final;
@@ -390,8 +390,6 @@ private:
/// Strong references to committed D3D11 shaders
CComPtr<ID3D11DeviceChild> m_CommittedD3DShaders[NumShaderTypes];
- RESOURCE_STATE_TRANSITION_MODE m_RenderPassAttachmentsTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
-
const Uint32 m_DebugFlags;
FixedBlockMemoryAllocator m_CmdListAllocator;
diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
index a40aa77a..748723f5 100755
--- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
@@ -261,7 +261,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState*
{
if (pTexture->IsInKnownState() && !pTexture->CheckState(RESOURCE_STATE_UNORDERED_ACCESS))
{
- if (pTexture->CheckState(RESOURCE_STATE_SHADER_RESOURCE))
+ if (pTexture->CheckAnyState(RESOURCE_STATE_SHADER_RESOURCE | RESOURCE_STATE_INPUT_ATTACHMENT))
UnbindTextureFromInput(pTexture, UAVRes.pd3d11Resource);
pTexture->SetState(RESOURCE_STATE_UNORDERED_ACCESS);
}
@@ -482,7 +482,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState*
{
if (auto* pTexture = ValidatedCast<TextureBaseD3D11>(SRVRes.pTexture))
{
- if (pTexture->IsInKnownState() && !pTexture->CheckState(RESOURCE_STATE_SHADER_RESOURCE))
+ if (pTexture->IsInKnownState() && !pTexture->CheckAnyState(RESOURCE_STATE_SHADER_RESOURCE | RESOURCE_STATE_INPUT_ATTACHMENT))
{
if (pTexture->CheckState(RESOURCE_STATE_UNORDERED_ACCESS))
{
@@ -521,7 +521,8 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState*
VERIFY_EXPR(CommitResources);
if (const auto* pTexture = ValidatedCast<TextureBaseD3D11>(SRVRes.pTexture))
{
- if (pTexture->IsInKnownState() && !pTexture->CheckState(RESOURCE_STATE_SHADER_RESOURCE))
+ if (pTexture->IsInKnownState() &&
+ !(pTexture->CheckState(RESOURCE_STATE_SHADER_RESOURCE) || m_pActiveRenderPass != nullptr && pTexture->CheckState(RESOURCE_STATE_INPUT_ATTACHMENT)))
{
LOG_ERROR_MESSAGE("Texture '", pTexture->GetDesc().Name, "' has not been transitioned to Shader Resource state. Call TransitionShaderResources(), use RESOURCE_STATE_TRANSITION_MODE_TRANSITION mode or explicitly transition the texture to required state.");
}
@@ -1677,8 +1678,6 @@ void DeviceContextD3D11Impl::BeginRenderPass(const BeginRenderPassAttribs& Attri
TDeviceContextBase::BeginRenderPass(Attribs);
// BeginRenderPass() transitions resources to required states
- m_RenderPassAttachmentsTransitionMode = Attribs.StateTransitionMode;
-
CommitRenderTargets();
// Set the viewport to match the framebuffer size
@@ -1761,33 +1760,13 @@ void DeviceContextD3D11Impl::NextSubpass()
TDeviceContextBase::NextSubpass();
- if (m_RenderPassAttachmentsTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION)
- {
- for (Uint32 att = 0; att < RPDesc.AttachmentCount; ++att)
- {
- auto* pTexView = ValidatedCast<TextureViewD3D11Impl>(FBDesc.ppAttachments[att]);
- if (pTexView == nullptr)
- continue;
-
- auto* pTex = ValidatedCast<TextureBaseD3D11>(pTexView->GetTexture());
- if (pTex->IsInKnownState())
- {
- auto CurrState = m_pActiveRenderPass->GetAttachmentState(m_SubpassIndex, att);
- if ((CurrState & RESOURCE_STATE_INPUT_ATTACHMENT) != 0)
- CurrState |= RESOURCE_STATE_SHADER_RESOURCE;
- pTex->SetState(CurrState);
- }
- }
- }
-
CommitRenderTargets();
}
-void DeviceContextD3D11Impl::EndRenderPass(bool UpdateResourceStates)
+void DeviceContextD3D11Impl::EndRenderPass()
{
EndSubpass();
- TDeviceContextBase::EndRenderPass(UpdateResourceStates);
- m_RenderPassAttachmentsTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE;
+ TDeviceContextBase::EndRenderPass();
}