summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-24 01:32:30 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-24 01:32:30 +0000
commit3c7f55a9e031ec4d0fb469ee8c1a6b86debe345a (patch)
tree86c370aea12a764d46680064f41d960a2c50c03f /Graphics/GraphicsEngineD3D12
parentAdded IShaderResourceBinding::InitializeStaticResources() method to allow exp... (diff)
downloadDiligentCore-3c7f55a9e031ec4d0fb469ee8c1a6b86debe345a.tar.gz
DiligentCore-3c7f55a9e031ec4d0fb469ee8c1a6b86debe345a.zip
Removed default shader resource binding object
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp6
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp37
3 files changed, 11 insertions, 36 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h
index 0ecda4a1..233ca058 100644
--- a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h
@@ -87,10 +87,6 @@ private:
SRBMemoryAllocator m_SRBMemAllocator;
ShaderResourceLayoutD3D12* m_pShaderResourceLayouts;
-
- // Do not use strong reference to avoid cyclic references
- // Default SRB must be defined after m_SRBMemAllocator
- std::unique_ptr<class ShaderResourceBindingD3D12Impl, STDDeleter<ShaderResourceBindingD3D12Impl, FixedBlockMemoryAllocator> > m_pDefaultShaderResBinding;
};
}
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index 494986d3..5c5e0998 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -342,7 +342,7 @@ namespace Diligent
D3D12_VERTEX_BUFFER_VIEW VBViews[MaxBufferSlots];// = {}
VERIFY( m_NumVertexStreams <= MaxBufferSlots, "Too many buffers are being set" );
const auto *Strides = m_pPipelineState->GetBufferStrides();
- DEV_CHECK_ERR( m_NumVertexStreams >= m_pPipelineState->GetNumBufferSlotsUsed(), "Currently bound pipeline state \"", m_pPipelineState->GetDesc().Name, "\" expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound");
+ DEV_CHECK_ERR( m_NumVertexStreams >= m_pPipelineState->GetNumBufferSlotsUsed(), "Currently bound pipeline state '", m_pPipelineState->GetDesc().Name, "' expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound");
bool DynamicBufferPresent = false;
for( UINT Buff = 0; Buff < m_NumVertexStreams; ++Buff )
{
@@ -478,7 +478,7 @@ namespace Diligent
else
{
if( m_pPipelineState->dbgContainsShaderResources() )
- LOG_ERROR_MESSAGE("Pipeline state \"", m_pPipelineState->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
+ LOG_ERROR_MESSAGE("Pipeline state '", m_pPipelineState->GetDesc().Name, "' contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
}
#endif
@@ -540,7 +540,7 @@ namespace Diligent
else
{
if( m_pPipelineState->dbgContainsShaderResources() )
- LOG_ERROR_MESSAGE("Pipeline state \"", m_pPipelineState->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
+ LOG_ERROR_MESSAGE("Pipeline state '", m_pPipelineState->GetDesc().Name, "' contains shader resources, but IDeviceContext::CommitShaderResources() was not called" );
}
#endif
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
index 8fc17cb2..713c5caa 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
@@ -64,8 +64,7 @@ PipelineStateD3D12Impl :: PipelineStateD3D12Impl(IReferenceCounters* pRefCo
RenderDeviceD3D12Impl* pDeviceD3D12,
const PipelineStateDesc& PipelineDesc) :
TPipelineStateBase(pRefCounters, pDeviceD3D12, PipelineDesc),
- m_SRBMemAllocator(GetRawAllocator()),
- m_pDefaultShaderResBinding(nullptr, STDDeleter<ShaderResourceBindingD3D12Impl, FixedBlockMemoryAllocator>(pDeviceD3D12->GetSRBAllocator()) )
+ m_SRBMemAllocator(GetRawAllocator())
{
auto pd3d12Device = pDeviceD3D12->GetD3D12Device();
@@ -194,9 +193,9 @@ PipelineStateD3D12Impl :: PipelineStateD3D12Impl(IReferenceCounters* pRefCo
if (*m_Desc.Name != 0)
{
m_pd3d12PSO->SetName(WidenString(m_Desc.Name).c_str());
- String RootSignatureDesc("Root signature for PSO \"");
+ String RootSignatureDesc("Root signature for PSO '");
RootSignatureDesc.append(m_Desc.Name);
- RootSignatureDesc.push_back('\"');
+ RootSignatureDesc.push_back('\'');
m_RootSig.GetD3D12RootSignature()->SetName(WidenString(RootSignatureDesc).c_str());
}
@@ -214,19 +213,6 @@ PipelineStateD3D12Impl :: PipelineStateD3D12Impl(IReferenceCounters* pRefCo
m_SRBMemAllocator.Initialize(PipelineDesc.SRBAllocationGranularity, m_NumShaders, ShaderVarMgrDataSizes.data(), 1, &CacheMemorySize);
}
- // If pipeline state contains only static resources, create default SRB
- if( (m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_STATIC) != 0 || m_RootSig.GetTotalRootViews(SHADER_VARIABLE_TYPE_STATIC) != 0 ) &&
- m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_MUTABLE) == 0 &&
- m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_DYNAMIC) == 0 &&
- m_RootSig.GetTotalRootViews(SHADER_VARIABLE_TYPE_MUTABLE) == 0 &&
- m_RootSig.GetTotalRootViews(SHADER_VARIABLE_TYPE_DYNAMIC) == 0)
- {
- auto& SRBAllocator = pDeviceD3D12->GetSRBAllocator();
- // Default shader resource binding must be initialized after resource layouts are parsed!
- m_pDefaultShaderResBinding.reset( NEW_RC_OBJ(SRBAllocator, "ShaderResourceBindingD3D12Impl instance", ShaderResourceBindingD3D12Impl, this)(this, true) );
- m_pDefaultShaderResBinding->InitializeStaticResources(this);
- }
-
m_ShaderResourceLayoutHash = m_RootSig.GetHash();
}
@@ -309,23 +295,16 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou
bool TransitionResources)const
{
#ifdef DEVELOPMENT
- if (pShaderResourceBinding == nullptr &&
- (m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_MUTABLE) != 0 ||
- m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_DYNAMIC) != 0 ||
- m_RootSig.GetTotalRootViews(SHADER_VARIABLE_TYPE_MUTABLE) != 0 ||
- m_RootSig.GetTotalRootViews(SHADER_VARIABLE_TYPE_DYNAMIC) != 0) )
+ if (pShaderResourceBinding == nullptr && dbgContainsShaderResources())
{
- LOG_ERROR_MESSAGE("Pipeline state \"", m_Desc.Name, "\" contains mutable/dynamic shader variables and requires shader resource binding to commit all resources, but none is provided.");
+ LOG_ERROR_MESSAGE("Pipeline state '", m_Desc.Name, "' requires shader resource binding object to commit resources, but none is provided.");
}
#endif
- // If the shaders contain no resources or static resources only, shader resource binding may be null.
- // In this case use special internal SRB object
- auto* pResBindingD3D12Impl = pShaderResourceBinding ? ValidatedCast<ShaderResourceBindingD3D12Impl>(pShaderResourceBinding) : m_pDefaultShaderResBinding.get();
+ auto* pResBindingD3D12Impl = ValidatedCast<ShaderResourceBindingD3D12Impl>(pShaderResourceBinding);
if (pResBindingD3D12Impl == nullptr)
{
- VERIFY_EXPR(!dbgContainsShaderResources());
- if(CommitResources)
+ if (CommitResources)
{
if(m_Desc.IsComputePipeline)
Ctx.AsComputeContext().SetRootSignature( GetD3D12RootSignature() );
@@ -340,7 +319,7 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou
auto* pRefPSO = pResBindingD3D12Impl->GetPipelineState();
if ( IsIncompatibleWith(pRefPSO) )
{
- LOG_ERROR_MESSAGE("Shader resource binding is incompatible with the pipeline state \"", m_Desc.Name, "\". Operation will be ignored.");
+ LOG_ERROR_MESSAGE("Shader resource binding is incompatible with the pipeline state '", m_Desc.Name, "'. Operation will be ignored.");
return nullptr;
}
}