summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-04-06 15:49:17 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-04-06 15:49:17 +0000
commit696a3cbb5a5f30d2f5000c0db90125d614ea09ca (patch)
treef1c03f120f1cccfa94a583801179212d32d20711 /Graphics
parentAdded API info query (diff)
downloadDiligentCore-696a3cbb5a5f30d2f5000c0db90125d614ea09ca.tar.gz
DiligentCore-696a3cbb5a5f30d2f5000c0db90125d614ea09ca.zip
Made IShaderSourceInputStreamFactory derived from IObject (upgraded API Version to 240021)
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/CMakeLists.txt2
-rw-r--r--Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h (renamed from Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h)13
-rw-r--r--Graphics/GraphicsEngine/include/EngineFactoryBase.h7
-rw-r--r--Graphics/GraphicsEngine/include/RenderDeviceBase.h94
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h2
-rw-r--r--Graphics/GraphicsEngine/interface/EngineFactory.h8
-rw-r--r--Graphics/GraphicsEngine/interface/RenderDevice.h7
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h6
-rw-r--r--Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp115
-rw-r--r--Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h1
-rw-r--r--Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp23
-rw-r--r--Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp23
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.h19
-rw-r--r--Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h1
-rw-r--r--Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm2
-rw-r--r--Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm23
-rw-r--r--Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h39
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h1
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h1
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp4
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLESImpl.cpp3
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp23
-rw-r--r--Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h1
-rw-r--r--Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp23
-rw-r--r--Graphics/GraphicsTools/CMakeLists.txt2
-rw-r--r--Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp87
30 files changed, 313 insertions, 226 deletions
diff --git a/Graphics/GraphicsEngine/CMakeLists.txt b/Graphics/GraphicsEngine/CMakeLists.txt
index 4eb8d9aa..b7fbc23d 100644
--- a/Graphics/GraphicsEngine/CMakeLists.txt
+++ b/Graphics/GraphicsEngine/CMakeLists.txt
@@ -6,6 +6,7 @@ set(INCLUDE
include/BufferBase.h
include/BufferViewBase.h
include/CommandListBase.h
+ include/DefaultShaderSourceStreamFactory.h
include/Defines.h
include/DeviceContextBase.h
include/DeviceObjectBase.h
@@ -57,6 +58,7 @@ set(INTERFACE
set(SOURCE
src/APIInfo.cpp
+ src/DefaultShaderSourceStreamFactory.cpp
src/EngineMemory.cpp
src/ResourceMapping.cpp
src/Texture.cpp
diff --git a/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h b/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
index 625df71f..9cd9b8ad 100644
--- a/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h
+++ b/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
@@ -28,14 +28,11 @@
namespace Diligent
{
- class BasicShaderSourceStreamFactory : public IShaderSourceInputStreamFactory
- {
- public:
- BasicShaderSourceStreamFactory( const Char *SearchDirectories = nullptr );
- virtual void CreateInputStream( const Char *Name, IFileStream **ppStream )override;
+/// Creates default shader source stream factory
+/// \param [in] SearchDirectories - Semicolon-seprated list of search directories.
+/// \param [out] ppShaderSourceStreamFactory - Memory address where pointer to the shader source stream factory will be written.
+void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
+ IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory);
- private:
- std::vector<String> m_SearchDirectories;
- };
}
diff --git a/Graphics/GraphicsEngine/include/EngineFactoryBase.h b/Graphics/GraphicsEngine/include/EngineFactoryBase.h
index c382afff..eb3e6aeb 100644
--- a/Graphics/GraphicsEngine/include/EngineFactoryBase.h
+++ b/Graphics/GraphicsEngine/include/EngineFactoryBase.h
@@ -28,6 +28,7 @@
#include "Object.h"
#include "EngineFactory.h"
+#include "DefaultShaderSourceStreamFactory.h"
namespace Diligent
{
@@ -84,6 +85,12 @@ public:
return Diligent::GetAPIInfo();
}
+ virtual void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
+ IShaderSourceInputStreamFactory** ppShaderSourceFactory)const override final
+ {
+ Diligent::CreateDefaultShaderSourceStreamFactory(SearchDirectories, ppShaderSourceFactory);
+ }
+
private:
class DummyReferenceCounters final : public IReferenceCounters
{
diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.h b/Graphics/GraphicsEngine/include/RenderDeviceBase.h
index 3ef856e7..ee713c2e 100644
--- a/Graphics/GraphicsEngine/include/RenderDeviceBase.h
+++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.h
@@ -184,48 +184,67 @@ public:
using TObjectBase = ObjectBase<BaseInterface>;
- /// \param pRefCounters - reference counters object that controls the lifetime of this render device
- /// \param RawMemAllocator - allocator that will be used to allocate memory for all device objects (including render device itself)
+ /// Describes the sizes of device objects
+ struct DeviceObjectSizes
+ {
+ /// Size of the texture object (TextureD3D12Impl, TextureVkImpl, etc.), in bytes
+ const size_t TextureObjSize;
+
+ /// Size of the texture view object (TextureViewD3D12Impl, TextureViewVkImpl, etc.), in bytes
+ const size_t TexViewObjSize;
+
+ /// Size of the buffer object (BufferD3D12Impl, BufferVkImpl, etc.), in bytes
+ const size_t BufferObjSize;
+
+ /// Size of the buffer view object (BufferViewD3D12Impl, BufferViewVkImpl, etc.), in bytes
+ const size_t BuffViewObjSize;
+
+ /// Size of the shader object (ShaderD3D12Impl, ShaderVkImpl, etc.), in bytes
+ const size_t ShaderObjSize;
+
+ /// Size of the sampler object (SamplerD3D12Impl, SamplerVkImpl, etc.), in bytes
+ const size_t SamplerObjSize;
+
+ /// Size of the pipeline state object (PipelineStateD3D12Impl, PipelineStateVkImpl, etc.), in bytes
+ const size_t PSOSize;
+
+ /// Size of the shader resource binding object (ShaderResourceBindingD3D12Impl, ShaderResourceBindingVkImpl, etc.), in bytes
+ const size_t SRBSize;
+
+ /// Size of the fence object (FenceD3D12Impl, FenceVkImpl, etc.), in bytes
+ const size_t FenceSize;
+ };
+
+ /// \param pRefCounters - reference counters object that controls the lifetime of this render device
+ /// \param RawMemAllocator - allocator that will be used to allocate memory for all device objects (including render device itself)
+ /// \param pEngineFactory - engine factory that was used to create this device
/// \param NumDeferredContexts - number of deferred device contexts
- /// \param TextureObjSize - size of the texture object, in bytes
- /// \param TexViewObjSize - size of the texture view object, in bytes
- /// \param BufferObjSize - size of the buffer object, in bytes
- /// \param BuffViewObjSize - size of the buffer view object, in bytes
- /// \param ShaderObjSize - size of the shader object, in bytes
- /// \param SamplerObjSize - size of the sampler object, in bytes
- /// \param PSOSize - size of the pipeline state object, in bytes
- /// \param SRBSize - size of the shader resource binding object, in bytes
- /// \param FenceSize - size of the fence object, in bytes
+ /// \param ObjectSizes - device object sizes
+ ///
/// \remarks Render device uses fixed block allocators (see FixedBlockMemoryAllocator) to allocate memory for
/// device objects. The object sizes provided to constructor are used to initialize the allocators.
- RenderDeviceBase(IReferenceCounters* pRefCounters,
- IMemoryAllocator& RawMemAllocator,
- Uint32 NumDeferredContexts,
- size_t TextureObjSize,
- size_t TexViewObjSize,
- size_t BufferObjSize,
- size_t BuffViewObjSize,
- size_t ShaderObjSize,
- size_t SamplerObjSize,
- size_t PSOSize,
- size_t SRBSize,
- size_t FenceSize) :
+ RenderDeviceBase(IReferenceCounters* pRefCounters,
+ IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
+ Uint32 NumDeferredContexts,
+ const DeviceObjectSizes& ObjectSizes) :
TObjectBase (pRefCounters),
+ m_pEngineFactory (pEngineFactory),
m_SamplersRegistry (RawMemAllocator, "sampler"),
m_TextureFormatsInfo (TEX_FORMAT_NUM_FORMATS, TextureFormatInfoExt(), STD_ALLOCATOR_RAW_MEM(TextureFormatInfoExt, RawMemAllocator, "Allocator for vector<TextureFormatInfoExt>") ),
m_TexFmtInfoInitFlags (TEX_FORMAT_NUM_FORMATS, false, STD_ALLOCATOR_RAW_MEM(bool, RawMemAllocator, "Allocator for vector<bool>") ),
m_wpDeferredContexts (NumDeferredContexts, RefCntWeakPtr<IDeviceContext>(), STD_ALLOCATOR_RAW_MEM(RefCntWeakPtr<IDeviceContext>, RawMemAllocator, "Allocator for vector< RefCntWeakPtr<IDeviceContext> >")),
m_RawMemAllocator (RawMemAllocator),
- m_TexObjAllocator (RawMemAllocator, TextureObjSize, 64),
- m_TexViewObjAllocator (RawMemAllocator, TexViewObjSize, 64),
- m_BufObjAllocator (RawMemAllocator, BufferObjSize, 128),
- m_BuffViewObjAllocator (RawMemAllocator, BuffViewObjSize, 128),
- m_ShaderObjAllocator (RawMemAllocator, ShaderObjSize, 32),
- m_SamplerObjAllocator (RawMemAllocator, SamplerObjSize, 32),
- m_PSOAllocator (RawMemAllocator, PSOSize, 128),
- m_SRBAllocator (RawMemAllocator, SRBSize, 1024),
- m_ResMappingAllocator (RawMemAllocator, sizeof(ResourceMappingImpl), 16),
- m_FenceAllocator (RawMemAllocator, FenceSize, 16)
+ m_TexObjAllocator (RawMemAllocator, ObjectSizes.TextureObjSize, 64),
+ m_TexViewObjAllocator (RawMemAllocator, ObjectSizes.TexViewObjSize, 64),
+ m_BufObjAllocator (RawMemAllocator, ObjectSizes.BufferObjSize, 128),
+ m_BuffViewObjAllocator (RawMemAllocator, ObjectSizes.BuffViewObjSize, 128),
+ m_ShaderObjAllocator (RawMemAllocator, ObjectSizes.ShaderObjSize, 32),
+ m_SamplerObjAllocator (RawMemAllocator, ObjectSizes.SamplerObjSize, 32),
+ m_PSOAllocator (RawMemAllocator, ObjectSizes.PSOSize, 128),
+ m_SRBAllocator (RawMemAllocator, ObjectSizes.SRBSize, 1024),
+ m_ResMappingAllocator (RawMemAllocator, sizeof(ResourceMappingImpl), 16),
+ m_FenceAllocator (RawMemAllocator, ObjectSizes.FenceSize, 16)
{
// Initialize texture format info
for( Uint32 Fmt = TEX_FORMAT_UNKNOWN; Fmt < TEX_FORMAT_NUM_FORMATS; ++Fmt )
@@ -323,7 +342,12 @@ public:
return TexFmtInfo;
}
- void OnCreateDeviceObject( IDeviceObject* pNewObject )
+ virtual IEngineFactory* GetEngineFactory() const override final
+ {
+ return m_pEngineFactory.RawPtr<IEngineFactory>();
+ }
+
+ void OnCreateDeviceObject(IDeviceObject* pNewObject)
{
}
@@ -364,6 +388,8 @@ protected:
template<typename TObjectType, typename TObjectDescType, typename TObjectConstructor>
void CreateDeviceObject( const Char *ObjectTypeName, const TObjectDescType &Desc, TObjectType **ppObject, TObjectConstructor ConstructObject );
+ RefCntAutoPtr<IEngineFactory> m_pEngineFactory;
+
DeviceCaps m_DeviceCaps;
// All state object registries hold raw pointers.
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 32230be1..e4db0bf3 100644
--- a/Graphics/GraphicsEngine/interface/APIInfo.h
+++ b/Graphics/GraphicsEngine/interface/APIInfo.h
@@ -26,7 +26,7 @@
/// \file
/// Diligent API information
-#define DILIGENT_API_VERSION 240020
+#define DILIGENT_API_VERSION 240021
#include "../../../Primitives/interface/BasicTypes.h"
diff --git a/Graphics/GraphicsEngine/interface/EngineFactory.h b/Graphics/GraphicsEngine/interface/EngineFactory.h
index aebb654a..5508d841 100644
--- a/Graphics/GraphicsEngine/interface/EngineFactory.h
+++ b/Graphics/GraphicsEngine/interface/EngineFactory.h
@@ -32,6 +32,8 @@
namespace Diligent
{
+class IShaderSourceInputStreamFactory;
+
// {D932B052-4ED6-4729-A532-F31DEEC100F3}
static constexpr INTERFACE_ID IID_EngineFactory =
{ 0xd932b052, 0x4ed6, 0x4729, { 0xa5, 0x32, 0xf3, 0x1d, 0xee, 0xc1, 0x0, 0xf3 } };
@@ -43,6 +45,12 @@ class IEngineFactory : public IObject
public:
/// Returns API info structure
virtual const APIInfo& GetAPIInfo() const = 0;
+
+ /// Creates default shader source input stream factory
+ /// \param [in] SearchDirectories - Semicolon-seprated list of search directories.
+ /// \param [out] ppShaderSourceStreamFactory - Memory address where pointer to the shader source stream factory will be written.
+ virtual void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
+ IShaderSourceInputStreamFactory** ppShaderSourceFactory)const = 0;
};
}
diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h
index ece8eda3..333263cc 100644
--- a/Graphics/GraphicsEngine/interface/RenderDevice.h
+++ b/Graphics/GraphicsEngine/interface/RenderDevice.h
@@ -27,6 +27,7 @@
/// Definition of the Diligent::IRenderDevice interface and related data structures
#include "../../../Primitives/interface/Object.h"
+#include "EngineFactory.h"
#include "GraphicsTypes.h"
#include "DeviceCaps.h"
#include "Constants.h"
@@ -188,6 +189,12 @@ public:
/// great care only if you are sure the resources are not
/// in use by the GPU (such as when the device has just been idled).
virtual void ReleaseStaleResources(bool ForceRelease = false) = 0;
+
+
+ /// Returns engine factory this device was created from.
+ /// \remark This method does not increment the reference counter of the returned interface,
+ /// so the application should not call Release().
+ virtual IEngineFactory* GetEngineFactory() const = 0;
};
}
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index c993bf4a..7b243a38 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -82,8 +82,12 @@ struct ShaderDesc : DeviceObjectAttribs
};
+// {3EA98781-082F-4413-8C30-B9BA6D82DBB7}
+static constexpr INTERFACE_ID IID_IShaderSourceInputStreamFactory =
+{ 0x3ea98781, 0x82f, 0x4413, { 0x8c, 0x30, 0xb9, 0xba, 0x6d, 0x82, 0xdb, 0xb7 } };
+
/// Shader source stream factory interface
-class IShaderSourceInputStreamFactory
+class IShaderSourceInputStreamFactory : public IObject
{
public:
virtual void CreateInputStream(const Diligent::Char *Name, IFileStream **ppStream) = 0;
diff --git a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
new file mode 100644
index 00000000..d3bfbd77
--- /dev/null
+++ b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
@@ -0,0 +1,115 @@
+/* Copyright 2015-2019 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#include "pch.h"
+#include "DefaultShaderSourceStreamFactory.h"
+#include "ObjectBase.h"
+#include "RefCntAutoPtr.h"
+#include "EngineMemory.h"
+
+namespace Diligent
+{
+
+class DefaultShaderSourceStreamFactory final : public ObjectBase<IShaderSourceInputStreamFactory>
+{
+public:
+ DefaultShaderSourceStreamFactory(IReferenceCounters* pRefCounters, const Char *SearchDirectories);
+
+ virtual void CreateInputStream(const Char *Name, IFileStream **ppStream)override final;
+
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_IShaderSourceInputStreamFactory, ObjectBase<IShaderSourceInputStreamFactory>);
+
+private:
+ std::vector<String> m_SearchDirectories;
+};
+
+DefaultShaderSourceStreamFactory::DefaultShaderSourceStreamFactory(IReferenceCounters* pRefCounters, const Char* SearchDirectories) :
+ ObjectBase<IShaderSourceInputStreamFactory>(pRefCounters)
+{
+ while( SearchDirectories )
+ {
+ const char* Semicolon = strchr( SearchDirectories, ';' );
+ String SearchPath;
+ if( Semicolon == nullptr )
+ {
+ SearchPath = SearchDirectories;
+ SearchDirectories = nullptr;
+ }
+ else
+ {
+ SearchPath = String( SearchDirectories, Semicolon );
+ SearchDirectories = Semicolon + 1;
+ }
+
+ if( SearchPath.length() > 0 )
+ {
+ if( SearchPath.back() != '\\' && SearchPath.back() != '/' )
+ SearchPath.push_back( '\\' );
+ m_SearchDirectories.push_back( SearchPath );
+ }
+ }
+ m_SearchDirectories.push_back( "" );
+}
+
+void DefaultShaderSourceStreamFactory::CreateInputStream( const Diligent::Char *Name, IFileStream **ppStream )
+{
+ bool bFileCreated = false;
+ Diligent::RefCntAutoPtr<BasicFileStream> pBasicFileStream;
+ for (const auto &SearchDir : m_SearchDirectories)
+ {
+ String FullPath = SearchDir + ( (Name[0] == '\\' || Name[0] == '/') ? Name + 1 : Name);
+ if (!FileSystem::FileExists(FullPath.c_str()))
+ continue;
+ pBasicFileStream = MakeNewRCObj<BasicFileStream>()( FullPath.c_str(), EFileAccessMode::Read );
+ if (pBasicFileStream->IsValid())
+ {
+ bFileCreated = true;
+ break;
+ }
+ else
+ {
+ pBasicFileStream.Release();
+ }
+ }
+ if (bFileCreated)
+ {
+ pBasicFileStream->QueryInterface( IID_FileStream, reinterpret_cast<IObject**>(ppStream) );
+ }
+ else
+ {
+ *ppStream = nullptr;
+ LOG_ERROR( "Failed to create input stream for source file ", Name );
+ }
+}
+
+void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
+ IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory)
+{
+
+ auto& Allocator = GetRawAllocator();
+ DefaultShaderSourceStreamFactory* pStreamFactory =
+ NEW_RC_OBJ(Allocator, "DefaultShaderSourceStreamFactory instance", DefaultShaderSourceStreamFactory)(SearchDirectories);
+ pStreamFactory->QueryInterface(IID_IShaderSourceInputStreamFactory, reinterpret_cast<IObject**>(ppShaderSourceStreamFactory));
+}
+
+}
diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h
index b325554f..5416d9b1 100644
--- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h
@@ -41,6 +41,7 @@ public:
RenderDeviceD3D11Impl( IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineD3D11CreateInfo& EngineAttribs,
ID3D11Device* pd3d11Device,
Uint32 NumDeferredContexts );
diff --git a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
index 581250f8..7be30f0c 100644
--- a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
@@ -234,7 +234,7 @@ void EngineFactoryD3D11Impl::AttachToD3D11Device(void* pd
SetRawAllocator(EngineCI.pRawMemAllocator);
auto &RawAlloctor = GetRawAllocator();
RenderDeviceD3D11Impl *pRenderDeviceD3D11(NEW_RC_OBJ(RawAlloctor, "RenderDeviceD3D11Impl instance", RenderDeviceD3D11Impl)
- (RawAlloctor, EngineCI, pd3d11Device, EngineCI.NumDeferredContexts));
+ (RawAlloctor, this, EngineCI, pd3d11Device, EngineCI.NumDeferredContexts));
pRenderDeviceD3D11->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice));
RefCntAutoPtr<DeviceContextD3D11Impl> pDeviceContextD3D11(NEW_RC_OBJ(RawAlloctor, "DeviceContextD3D11Impl instance", DeviceContextD3D11Impl)
diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
index 04f54ad5..ebae97fc 100644
--- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
@@ -42,6 +42,7 @@ namespace Diligent
RenderDeviceD3D11Impl :: RenderDeviceD3D11Impl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineD3D11CreateInfo& EngineAttribs,
ID3D11Device* pd3d11Device,
Uint32 NumDeferredContexts) :
@@ -49,16 +50,20 @@ RenderDeviceD3D11Impl :: RenderDeviceD3D11Impl(IReferenceCounters* pRef
{
pRefCounters,
RawMemAllocator,
+ pEngineFactory,
NumDeferredContexts,
- sizeof(TextureBaseD3D11),
- sizeof(TextureViewD3D11Impl),
- sizeof(BufferD3D11Impl),
- sizeof(BufferViewD3D11Impl),
- sizeof(ShaderD3D11Impl),
- sizeof(SamplerD3D11Impl),
- sizeof(PipelineStateD3D11Impl),
- sizeof(ShaderResourceBindingD3D11Impl),
- sizeof(FenceD3D11Impl)
+ DeviceObjectSizes
+ {
+ sizeof(TextureBaseD3D11),
+ sizeof(TextureViewD3D11Impl),
+ sizeof(BufferD3D11Impl),
+ sizeof(BufferViewD3D11Impl),
+ sizeof(ShaderD3D11Impl),
+ sizeof(SamplerD3D11Impl),
+ sizeof(PipelineStateD3D11Impl),
+ sizeof(ShaderResourceBindingD3D11Impl),
+ sizeof(FenceD3D11Impl)
+ }
},
m_EngineAttribs(EngineAttribs),
m_pd3d11Device(pd3d11Device)
diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h
index a44d40ff..0551f7d0 100644
--- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h
@@ -46,7 +46,8 @@ public:
using TRenderDeviceBase = RenderDeviceNextGenBase< RenderDeviceD3DBase<IRenderDeviceD3D12>, ICommandQueueD3D12 >;
RenderDeviceD3D12Impl(IReferenceCounters* pRefCounters,
- IMemoryAllocator& RawMemAllocator,
+ IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineD3D12CreateInfo& EngineCI,
ID3D12Device* pD3D12Device,
size_t CommandQueueCount,
diff --git a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
index 6806fafc..53ede9e3 100644
--- a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
@@ -300,7 +300,7 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd
SetRawAllocator(EngineCI.pRawMemAllocator);
auto &RawMemAllocator = GetRawAllocator();
auto d3d12Device = reinterpret_cast<ID3D12Device*>(pd3d12NativeDevice);
- RenderDeviceD3D12Impl *pRenderDeviceD3D12( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceD3D12Impl instance", RenderDeviceD3D12Impl)(RawMemAllocator, EngineCI, d3d12Device, CommandQueueCount, ppCommandQueues) );
+ RenderDeviceD3D12Impl *pRenderDeviceD3D12( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceD3D12Impl instance", RenderDeviceD3D12Impl)(RawMemAllocator, this, EngineCI, d3d12Device, CommandQueueCount, ppCommandQueues) );
pRenderDeviceD3D12->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) );
RefCntAutoPtr<DeviceContextD3D12Impl> pImmediateCtxD3D12( NEW_RC_OBJ(RawMemAllocator, "DeviceContextD3D12Impl instance", DeviceContextD3D12Impl)(pRenderDeviceD3D12, false, EngineCI, 0, 0) );
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
index 3d35d334..15e48743 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
@@ -39,6 +39,7 @@ namespace Diligent
RenderDeviceD3D12Impl :: RenderDeviceD3D12Impl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineD3D12CreateInfo& EngineCI,
ID3D12Device* pd3d12Device,
size_t CommandQueueCount,
@@ -47,18 +48,22 @@ RenderDeviceD3D12Impl :: RenderDeviceD3D12Impl(IReferenceCounters* pRe
{
pRefCounters,
RawMemAllocator,
+ pEngineFactory,
CommandQueueCount,
ppCmdQueues,
EngineCI.NumDeferredContexts,
- sizeof(TextureD3D12Impl),
- sizeof(TextureViewD3D12Impl),
- sizeof(BufferD3D12Impl),
- sizeof(BufferViewD3D12Impl),
- sizeof(ShaderD3D12Impl),
- sizeof(SamplerD3D12Impl),
- sizeof(PipelineStateD3D12Impl),
- sizeof(ShaderResourceBindingD3D12Impl),
- sizeof(FenceD3D12Impl)
+ DeviceObjectSizes
+ {
+ sizeof(TextureD3D12Impl),
+ sizeof(TextureViewD3D12Impl),
+ sizeof(BufferD3D12Impl),
+ sizeof(BufferViewD3D12Impl),
+ sizeof(ShaderD3D12Impl),
+ sizeof(SamplerD3D12Impl),
+ sizeof(PipelineStateD3D12Impl),
+ sizeof(ShaderResourceBindingD3D12Impl),
+ sizeof(FenceD3D12Impl)
+ }
},
m_pd3d12Device (pd3d12Device),
m_EngineAttribs (EngineCI),
diff --git a/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.h b/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.h
index 1715cd48..c784bcce 100644
--- a/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.h
+++ b/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.h
@@ -37,19 +37,12 @@ template<typename BaseInterface>
class RenderDeviceD3DBase : public RenderDeviceBase<BaseInterface>
{
public:
- RenderDeviceD3DBase(IReferenceCounters *pRefCounters,
- IMemoryAllocator &RawMemAllocator,
- Uint32 NumDeferredContexts,
- size_t TextureObjSize,
- size_t TexViewObjSize,
- size_t BufferObjSize,
- size_t BuffViewObjSize,
- size_t ShaderObjSize,
- size_t SamplerObjSize,
- size_t PSOSize,
- size_t SRBSize,
- size_t FenceSize) :
- RenderDeviceBase<BaseInterface>(pRefCounters, RawMemAllocator, NumDeferredContexts, TextureObjSize, TexViewObjSize, BufferObjSize, BuffViewObjSize, ShaderObjSize, SamplerObjSize, PSOSize, SRBSize, FenceSize)
+ RenderDeviceD3DBase(IReferenceCounters* pRefCounters,
+ IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
+ Uint32 NumDeferredContexts,
+ const DeviceObjectSizes& ObjectSizes) :
+ RenderDeviceBase<BaseInterface>(pRefCounters, RawMemAllocator, pEngineFactory, NumDeferredContexts, ObjectSizes)
{
// Flag texture formats always supported in D3D11 and D3D12
diff --git a/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h b/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h
index 9760c92a..0b10967f 100644
--- a/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h
+++ b/Graphics/GraphicsEngineMetal/include/RenderDeviceMtlImpl.h
@@ -41,6 +41,7 @@ public:
RenderDeviceMtlImpl( IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineMtlCreateInfo& EngineAttribs,
void* pMtlDevice);
diff --git a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm
index ebead420..e87dbc27 100644
--- a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm
+++ b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm
@@ -123,7 +123,7 @@ void EngineFactoryMtlImpl::AttachToMtlDevice(void* pMtlNat
SetRawAllocator(EngineCI.pRawMemAllocator);
auto& RawAlloctor = GetRawAllocator();
RenderDeviceMtlImpl* pRenderDeviceMtl(NEW_RC_OBJ(RawAlloctor, "RenderDeviceMtlImpl instance", RenderDeviceMtlImpl)
- (RawAlloctor, EngineCI, pMtlNativeDevice));
+ (RawAlloctor, this, EngineCI, pMtlNativeDevice));
pRenderDeviceMtl->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice));
RefCntAutoPtr<DeviceContextMtlImpl> pDeviceContextMtl(NEW_RC_OBJ(RawAlloctor, "DeviceContextMtlImpl instance", DeviceContextMtlImpl)
diff --git a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm
index 55f57208..181314db 100644
--- a/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm
+++ b/Graphics/GraphicsEngineMetal/src/RenderDeviceMtlImpl.mm
@@ -39,22 +39,27 @@ namespace Diligent
RenderDeviceMtlImpl :: RenderDeviceMtlImpl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineMtlCreateInfo& EngineAttribs,
void* pMtlDevice) :
TRenderDeviceBase
{
pRefCounters,
RawMemAllocator,
+ pEngineFactory,
EngineAttribs.NumDeferredContexts,
- sizeof(TextureMtlImpl),
- sizeof(TextureViewMtlImpl),
- sizeof(BufferMtlImpl),
- sizeof(BufferViewMtlImpl),
- sizeof(ShaderMtlImpl),
- sizeof(SamplerMtlImpl),
- sizeof(PipelineStateMtlImpl),
- sizeof(ShaderResourceBindingMtlImpl),
- sizeof(FenceMtlImpl)
+ DeviceObjectSizes
+ {
+ sizeof(TextureMtlImpl),
+ sizeof(TextureViewMtlImpl),
+ sizeof(BufferMtlImpl),
+ sizeof(BufferViewMtlImpl),
+ sizeof(ShaderMtlImpl),
+ sizeof(SamplerMtlImpl),
+ sizeof(PipelineStateMtlImpl),
+ sizeof(ShaderResourceBindingMtlImpl),
+ sizeof(FenceMtlImpl)
+ }
},
m_EngineAttribs(EngineAttribs)
{
diff --git a/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h b/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h
index c2022c2a..10e2baeb 100644
--- a/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h
+++ b/Graphics/GraphicsEngineNextGenBase/include/RenderDeviceNextGenBase.h
@@ -26,6 +26,7 @@
#include <vector>
#include <mutex>
+#include "EngineFactory.h"
#include "Atomics.h"
#include "BasicTypes.h"
#include "ReferenceCounters.h"
@@ -43,33 +44,17 @@ template<class TBase, typename CommandQueueType>
class RenderDeviceNextGenBase : public TBase
{
public:
- RenderDeviceNextGenBase(IReferenceCounters* pRefCounters,
- IMemoryAllocator& RawMemAllocator,
- size_t CmdQueueCount,
- CommandQueueType** Queues,
- Uint32 NumDeferredContexts,
- size_t TextureObjSize,
- size_t TexViewObjSize,
- size_t BufferObjSize,
- size_t BuffViewObjSize,
- size_t ShaderObjSize,
- size_t SamplerObjSize,
- size_t PSOSize,
- size_t SRBSize,
- size_t FenceSize) :
- TBase(pRefCounters,
- RawMemAllocator,
- NumDeferredContexts,
- TextureObjSize,
- TexViewObjSize,
- BufferObjSize,
- BuffViewObjSize,
- ShaderObjSize,
- SamplerObjSize,
- PSOSize,
- SRBSize,
- FenceSize),
- m_CmdQueueCount(CmdQueueCount)
+ using typename TBase::DeviceObjectSizes;
+
+ RenderDeviceNextGenBase(IReferenceCounters* pRefCounters,
+ IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
+ size_t CmdQueueCount,
+ CommandQueueType** Queues,
+ Uint32 NumDeferredContexts,
+ const DeviceObjectSizes& ObjectSizes) :
+ TBase (pRefCounters, RawMemAllocator, pEngineFactory, NumDeferredContexts, ObjectSizes),
+ m_CmdQueueCount (CmdQueueCount)
{
m_CommandQueues = reinterpret_cast<CommandQueue*>(ALLOCATE(this->m_RawMemAllocator, "Raw memory for the device command/release queues", sizeof(CommandQueue)*m_CmdQueueCount));
for(size_t q=0; q < m_CmdQueueCount; ++q)
diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h
index 57a966f2..c8e23561 100644
--- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h
+++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLESImpl.h
@@ -33,6 +33,7 @@ class RenderDeviceGLESImpl final : public RenderDeviceGLImpl
public:
RenderDeviceGLESImpl( IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineGLCreateInfo& InitAttribs,
const SwapChainDesc* pSCDesc = nullptr);
diff --git a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h
index cb278aa8..ce3aaee5 100644
--- a/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h
+++ b/Graphics/GraphicsEngineOpenGL/include/RenderDeviceGLImpl.h
@@ -56,6 +56,7 @@ public:
RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineGLCreateInfo& InitAttribs,
const SwapChainDesc* pSCDesc = nullptr);
~RenderDeviceGLImpl();
diff --git a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
index c44021d6..1e0c470f 100644
--- a/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/EngineFactoryOpenGL.cpp
@@ -126,7 +126,7 @@ void EngineFactoryOpenGLImpl::CreateDeviceAndSwapChainGL(const EngineGLCreateInf
SetRawAllocator(EngineCI.pRawMemAllocator);
auto &RawMemAllocator = GetRawAllocator();
- RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, EngineCI, &SCDesc) );
+ RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, this, EngineCI, &SCDesc) );
pRenderDeviceOpenGL->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) );
DeviceContextGLImpl* pDeviceContextOpenGL( NEW_RC_OBJ(RawMemAllocator, "DeviceContextGLImpl instance", DeviceContextGLImpl)(pRenderDeviceOpenGL, false ) );
@@ -199,7 +199,7 @@ void EngineFactoryOpenGLImpl::AttachToActiveGLContext(const EngineGLCreateInfo&
SetRawAllocator(EngineCI.pRawMemAllocator);
auto &RawMemAllocator = GetRawAllocator();
- RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, EngineCI) );
+ RenderDeviceGLImpl *pRenderDeviceOpenGL( NEW_RC_OBJ(RawMemAllocator, "TRenderDeviceGLImpl instance", TRenderDeviceGLImpl)(RawMemAllocator, this, EngineCI) );
pRenderDeviceOpenGL->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) );
DeviceContextGLImpl* pDeviceContextOpenGL( NEW_RC_OBJ(RawMemAllocator, "DeviceContextGLImpl instance", DeviceContextGLImpl)(pRenderDeviceOpenGL, false ) );
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLESImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLESImpl.cpp
index 8edc0fcf..3ee32be7 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLESImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLESImpl.cpp
@@ -29,9 +29,10 @@ namespace Diligent
{
RenderDeviceGLESImpl::RenderDeviceGLESImpl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineGLCreateInfo& InitAttribs,
const SwapChainDesc* pSCDesc) :
- RenderDeviceGLImpl(pRefCounters, RawMemAllocator, InitAttribs, pSCDesc)
+ RenderDeviceGLImpl(pRefCounters, RawMemAllocator, pEngineFactory, InitAttribs, pSCDesc)
{
}
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index 6e5ba17c..4951be30 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -49,22 +49,27 @@ namespace Diligent
RenderDeviceGLImpl :: RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineGLCreateInfo& InitAttribs,
const SwapChainDesc* pSCDesc):
TRenderDeviceBase
{
pRefCounters,
RawMemAllocator,
+ pEngineFactory,
0,
- sizeof(TextureBaseGL),
- sizeof(TextureViewGLImpl),
- sizeof(BufferGLImpl),
- sizeof(BufferViewGLImpl),
- sizeof(ShaderGLImpl),
- sizeof(SamplerGLImpl),
- sizeof(PipelineStateGLImpl),
- sizeof(ShaderResourceBindingGLImpl),
- sizeof(FenceGLImpl)
+ DeviceObjectSizes
+ {
+ sizeof(TextureBaseGL),
+ sizeof(TextureViewGLImpl),
+ sizeof(BufferGLImpl),
+ sizeof(BufferViewGLImpl),
+ sizeof(ShaderGLImpl),
+ sizeof(SamplerGLImpl),
+ sizeof(PipelineStateGLImpl),
+ sizeof(ShaderResourceBindingGLImpl),
+ sizeof(FenceGLImpl)
+ }
},
// Device caps must be filled in before the constructor of Pipeline Cache is called!
m_GLContext(InitAttribs, m_DeviceCaps, pSCDesc),
diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h
index ec762ec9..c4cd3210 100644
--- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h
@@ -57,6 +57,7 @@ public:
RenderDeviceVkImpl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineVkCreateInfo& EngineCI,
size_t CommandQueueCount,
ICommandQueueVk** pCmdQueues,
diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
index 40db1ccf..57b36201 100644
--- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
@@ -251,7 +251,7 @@ void EngineFactoryVkImpl::AttachToVulkanDevice(std::shared_ptr<VulkanUtilities::
try
{
auto &RawMemAllocator = GetRawAllocator();
- RenderDeviceVkImpl *pRenderDeviceVk( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceVkImpl instance", RenderDeviceVkImpl)(RawMemAllocator, EngineCI, CommandQueueCount, ppCommandQueues, Instance, std::move(PhysicalDevice), LogicalDevice) );
+ RenderDeviceVkImpl *pRenderDeviceVk( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceVkImpl instance", RenderDeviceVkImpl)(RawMemAllocator, this, EngineCI, CommandQueueCount, ppCommandQueues, Instance, std::move(PhysicalDevice), LogicalDevice) );
pRenderDeviceVk->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) );
std::shared_ptr<GenerateMipsVkHelper> GenerateMipsHelper(new GenerateMipsVkHelper(*pRenderDeviceVk));
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
index e31acc55..271af6e0 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
@@ -39,6 +39,7 @@ namespace Diligent
RenderDeviceVkImpl :: RenderDeviceVkImpl(IReferenceCounters* pRefCounters,
IMemoryAllocator& RawMemAllocator,
+ IEngineFactory* pEngineFactory,
const EngineVkCreateInfo& EngineCI,
size_t CommandQueueCount,
ICommandQueueVk** CmdQueues,
@@ -49,18 +50,22 @@ RenderDeviceVkImpl :: RenderDeviceVkImpl(IReferenceCounters*
{
pRefCounters,
RawMemAllocator,
+ pEngineFactory,
CommandQueueCount,
CmdQueues,
EngineCI.NumDeferredContexts,
- sizeof(TextureVkImpl),
- sizeof(TextureViewVkImpl),
- sizeof(BufferVkImpl),
- sizeof(BufferViewVkImpl),
- sizeof(ShaderVkImpl),
- sizeof(SamplerVkImpl),
- sizeof(PipelineStateVkImpl),
- sizeof(ShaderResourceBindingVkImpl),
- sizeof(FenceVkImpl)
+ DeviceObjectSizes
+ {
+ sizeof(TextureVkImpl),
+ sizeof(TextureViewVkImpl),
+ sizeof(BufferVkImpl),
+ sizeof(BufferViewVkImpl),
+ sizeof(ShaderVkImpl),
+ sizeof(SamplerVkImpl),
+ sizeof(PipelineStateVkImpl),
+ sizeof(ShaderResourceBindingVkImpl),
+ sizeof(FenceVkImpl)
+ }
},
m_VulkanInstance(Instance),
m_PhysicalDevice(std::move(PhysicalDevice)),
diff --git a/Graphics/GraphicsTools/CMakeLists.txt b/Graphics/GraphicsTools/CMakeLists.txt
index c6f2144e..05061415 100644
--- a/Graphics/GraphicsTools/CMakeLists.txt
+++ b/Graphics/GraphicsTools/CMakeLists.txt
@@ -3,7 +3,6 @@ cmake_minimum_required (VERSION 3.6)
project(GraphicsTools CXX)
set(INCLUDE
- include/BasicShaderSourceStreamFactory.h
include/CommonlyUsedStates.h
include/GraphicsUtilities.h
include/pch.h
@@ -14,7 +13,6 @@ set(INCLUDE
)
set(SOURCE
- src/BasicShaderSourceStreamFactory.cpp
src/GraphicsUtilities.cpp
src/ScreenCapture.cpp
src/pch.cpp
diff --git a/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp b/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp
deleted file mode 100644
index 43c6baae..00000000
--- a/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright 2015-2019 Egor Yusov
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
- *
- * In no event and under no legal theory, whether in tort (including negligence),
- * contract, or otherwise, unless required by applicable law (such as deliberate
- * and grossly negligent acts) or agreed to in writing, shall any Contributor be
- * liable for any damages, including any direct, indirect, special, incidental,
- * or consequential damages of any character arising as a result of this License or
- * out of the use or inability to use the software (including but not limited to damages
- * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
- * all other commercial damages or losses), even if such Contributor has been advised
- * of the possibility of such damages.
- */
-
-#include "pch.h"
-#include "BasicShaderSourceStreamFactory.h"
-#include "RefCntAutoPtr.h"
-
-namespace Diligent
-{
- BasicShaderSourceStreamFactory::BasicShaderSourceStreamFactory( const Char *SearchDirectories )
- {
- while( SearchDirectories )
- {
- const char* Semicolon = strchr( SearchDirectories, ';' );
- String SearchPath;
- if( Semicolon == nullptr )
- {
- SearchPath = SearchDirectories;
- SearchDirectories = nullptr;
- }
- else
- {
- SearchPath = String( SearchDirectories, Semicolon );
- SearchDirectories = Semicolon + 1;
- }
-
- if( SearchPath.length() > 0 )
- {
- if( SearchPath.back() != '\\' && SearchPath.back() != '/' )
- SearchPath.push_back( '\\' );
- m_SearchDirectories.push_back( SearchPath );
- }
- }
- m_SearchDirectories.push_back( "" );
- }
-
- void BasicShaderSourceStreamFactory::CreateInputStream( const Diligent::Char *Name, IFileStream **ppStream )
- {
- bool bFileCreated = false;
- Diligent::RefCntAutoPtr<BasicFileStream> pBasicFileStream;
- for( const auto &SearchDir : m_SearchDirectories )
- {
- String FullPath = SearchDir + ( (Name[0] == '\\' || Name[0] == '/') ? Name + 1 : Name);
- if( !FileSystem::FileExists( FullPath.c_str() ) )
- continue;
- pBasicFileStream = MakeNewRCObj<BasicFileStream>()( FullPath.c_str(), EFileAccessMode::Read );
- if( pBasicFileStream->IsValid() )
- {
- bFileCreated = true;
- break;
- }
- else
- {
- pBasicFileStream.Release();
- }
- }
- if( bFileCreated )
- {
- pBasicFileStream->QueryInterface( IID_FileStream, reinterpret_cast<IObject**>(ppStream) );
- }
- else
- {
- *ppStream = nullptr;
- LOG_ERROR( "Failed to create input stream for source file ", Name );
- }
- }
-} \ No newline at end of file