summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-08-09 00:15:53 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-09 00:15:53 +0000
commitfecbd929c60de890f022c35e6b0774ee9db91ca7 (patch)
treee7079135592fdef444acd30a50056cf1604c36e4 /Graphics/GraphicsEngineD3D12
parentImplemented unified render pass attachment state updates within subpasses and... (diff)
downloadDiligentCore-fecbd929c60de890f022c35e6b0774ee9db91ca7.tar.gz
DiligentCore-fecbd929c60de890f022c35e6b0774ee9db91ca7.zip
Fixed RESOURCE_STATE_GENERIC_READ enum value; few updates in D3D12 backend
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp7
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RootSignature.cpp4
2 files changed, 8 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index 32f03319..1902ff45 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -230,7 +230,10 @@ void DeviceContextD3D12Impl::SetPipelineState(IPipelineState* pPipelineState)
{
GraphicsCtx.SetStencilRef(m_StencilRef);
GraphicsCtx.SetBlendFactor(m_BlendFactors);
- CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY);
+ if (PSODesc.GraphicsPipeline.pRenderPass == nullptr)
+ {
+ CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY);
+ }
CommitViewports();
}
@@ -932,6 +935,8 @@ void DeviceContextD3D12Impl::SetScissorRects(Uint32 NumRects, const Rect* pRects
void DeviceContextD3D12Impl::CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
+ VERIFY(m_pActiveRenderPass == nullptr, "This method must not be called inside a render pass");
+
const Uint32 MaxD3D12RTs = D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT;
Uint32 NumRenderTargets = m_NumBoundRenderTargets;
VERIFY(NumRenderTargets <= MaxD3D12RTs, "D3D12 only allows 8 simultaneous render targets");
diff --git a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
index 958df523..418aa8d8 100644
--- a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
@@ -745,7 +745,7 @@ __forceinline void TransitionResource(CommandContext& Ctx,
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV, "Unexpected descriptor range type");
auto* pTexViewD3D12 = Res.pObject.RawPtr<TextureViewD3D12Impl>();
auto* pTexToTransition = pTexViewD3D12->GetTexture<TextureD3D12Impl>();
- if (pTexToTransition->IsInKnownState() && !pTexToTransition->CheckState(RESOURCE_STATE_SHADER_RESOURCE))
+ if (pTexToTransition->IsInKnownState() && !pTexToTransition->CheckAnyState(RESOURCE_STATE_SHADER_RESOURCE | RESOURCE_STATE_INPUT_ATTACHMENT))
Ctx.TransitionResource(pTexToTransition, RESOURCE_STATE_SHADER_RESOURCE);
}
break;
@@ -835,7 +835,7 @@ void RootSignature::DvpVerifyResourceState(const ShaderResourceCacheD3D12::Resou
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV, "Unexpected descriptor range type");
const auto* pTexViewD3D12 = Res.pObject.RawPtr<const TextureViewD3D12Impl>();
const auto* pTexD3D12 = pTexViewD3D12->GetTexture<TextureD3D12Impl>();
- if (pTexD3D12->IsInKnownState() && !pTexD3D12->CheckState(RESOURCE_STATE_SHADER_RESOURCE))
+ if (pTexD3D12->IsInKnownState() && !pTexD3D12->CheckAnyState(RESOURCE_STATE_SHADER_RESOURCE | RESOURCE_STATE_INPUT_ATTACHMENT))
{
LOG_ERROR_MESSAGE("Texture '", pTexD3D12->GetDesc().Name, "' must be in RESOURCE_STATE_SHADER_RESOURCE state. Actual state: ",
GetResourceStateString(pTexD3D12->GetState()),