diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-10-05 04:51:33 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-10-05 04:51:33 +0000 |
| commit | c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e (patch) | |
| tree | 1ff73fa0f1ae15b057db84bdeb12de1c5b19b97f /Graphics/GraphicsEngineD3D11 | |
| parent | Added ReleaseStaleResources() to IRenderDevice interface + a bunch of minor c... (diff) | |
| download | DiligentCore-c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e.tar.gz DiligentCore-c7391919d2e9d34e7f4fc18e8ffc174a9eabfb5e.zip | |
Reworked context pool management in D3D12
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
5 files changed, 8 insertions, 11 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h index 080926b4..e0329a49 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h @@ -49,7 +49,7 @@ class IMemoryAllocator; class ShaderResourceLayoutD3D11 { public: - ShaderResourceLayoutD3D11(IObject &Owner, IMemoryAllocator& ResLayoutDataAllocator); + ShaderResourceLayoutD3D11(IObject &Owner); ~ShaderResourceLayoutD3D11(); // No copies or moves diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index fc428cd0..9da40de3 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -35,7 +35,7 @@ ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters, const ShaderCreationAttribs& CreationAttribs) : TShaderBase(pRefCounters, pRenderDeviceD3D11, CreationAttribs.Desc), ShaderD3DBase(CreationAttribs), - m_StaticResLayout(*this, GetRawAllocator()), + m_StaticResLayout(*this), m_ShaderTypeIndex(Diligent::GetShaderTypeIndex(CreationAttribs.Desc.ShaderType)) { auto *pDeviceD3D11 = pRenderDeviceD3D11->GetD3D11Device(); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp index 7255f215..e2dbc07e 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp @@ -69,7 +69,7 @@ ShaderResourceBindingD3D11Impl::ShaderResourceBindingD3D11Impl( IReferenceCounte // Shader resource layout will only contain dynamic and mutable variables // http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-cache#Shader-Resource-Cache-Initialization SHADER_VARIABLE_TYPE VarTypes[] = {SHADER_VARIABLE_TYPE_MUTABLE, SHADER_VARIABLE_TYPE_DYNAMIC}; - new (m_pResourceLayouts + s) ShaderResourceLayoutD3D11(*this, ResLayoutDataAllocator); + new (m_pResourceLayouts + s) ShaderResourceLayoutD3D11(*this); m_pResourceLayouts[s].Initialize(pShaderD3D11->GetResources(), VarTypes, _countof(VarTypes), m_pBoundResourceCaches[s], ResCacheDataAllocator, ResLayoutDataAllocator); Resources.InitStaticSamplers(m_pBoundResourceCaches[s]); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 62a3746c..66f7a11b 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -38,12 +38,11 @@ namespace Diligent
{
-ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& Owner, IMemoryAllocator& ResLayoutDataAllocator) :
- m_Owner(Owner),
+ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& Owner) :
+ m_Owner(Owner)
#if USE_VARIABLE_HASH_MAP
- m_VariableHash(STD_ALLOCATOR_RAW_MEM(VariableHashData, GetRawAllocator(), "Allocator for vector<BuffSRVBindInfo>")),
+ , m_VariableHash(STD_ALLOCATOR_RAW_MEM(VariableHashData, GetRawAllocator(), "Allocator for vector<BuffSRVBindInfo>"))
#endif
- m_ResourceBuffer(nullptr, STDDeleterRawMem<void>(ResLayoutDataAllocator))
{
}
@@ -102,8 +101,6 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes {
// http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-layout#Shader-Resource-Layout-Initialization
- VERIFY(&m_ResourceBuffer.get_deleter().m_Allocator == &ResLayoutDataAllocator, "Incosistent memory alloctor");
-
m_pResources = pSrcResources;
m_pResourceCache = &ResourceCache;
@@ -131,7 +128,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes if( MemorySize )
{
auto *pRawMem = ALLOCATE(ResLayoutDataAllocator, "Raw memory buffer for shader resource layout resources", MemorySize);
- m_ResourceBuffer.reset(pRawMem);
+ m_ResourceBuffer = std::unique_ptr<void, STDDeleterRawMem<void> >(pRawMem, ResLayoutDataAllocator);
}
VERIFY_EXPR(NumCBs < 255);
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index 6296deb9..1cf52f39 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -35,7 +35,7 @@ namespace Diligent ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Impl, ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc) :
- ShaderResources(GetRawAllocator(), ShdrDesc.ShaderType),
+ ShaderResources(ShdrDesc.ShaderType),
m_ShaderName(ShdrDesc.Name),
m_StaticSamplers(nullptr, STDDeleterRawMem< void >(GetRawAllocator()))
{
|
