summaryrefslogtreecommitdiffstats
path: root/Graphics
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
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')
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp7
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RootSignature.cpp4
3 files changed, 9 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 2e063c8d..41e83d4e 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -2215,8 +2215,7 @@ DILIGENT_TYPED_ENUM(RESOURCE_STATE, Uint32)
RESOURCE_STATE_INDEX_BUFFER |
RESOURCE_STATE_SHADER_RESOURCE |
RESOURCE_STATE_INDIRECT_ARGUMENT |
- RESOURCE_STATE_COPY_SOURCE |
- RESOURCE_STATE_INPUT_ATTACHMENT
+ RESOURCE_STATE_COPY_SOURCE
};
DEFINE_FLAG_ENUM_OPERATORS(RESOURCE_STATE);
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()),