summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-27 06:01:27 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-27 06:01:27 +0000
commit87029a3f6979c79c65f9828bf886d01dcd94b936 (patch)
tree75e1a88d398d03bbd29258af6f20be6203238d8b /Graphics/GraphicsEngineD3D11
parentFixed BufferViewMtlImpl (diff)
downloadDiligentCore-87029a3f6979c79c65f9828bf886d01dcd94b936.tar.gz
DiligentCore-87029a3f6979c79c65f9828bf886d01dcd94b936.zip
Implemented D3D11 engine C interface (mostly)
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h34
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h34
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h33
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h85
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h29
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h61
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h33
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h15
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h33
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h33
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h13
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h13
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h32
-rw-r--r--Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h33
-rw-r--r--Graphics/GraphicsEngineD3D11/readme.md3
-rw-r--r--Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp10
16 files changed, 431 insertions, 63 deletions
diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h
index cae3e7ff..d2003a4a 100644
--- a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngine/interface/Buffer.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {4A696D2E-44BB-4C4B-9DE2-3AF7C94DCFC0}
-static constexpr INTERFACE_ID IID_BufferD3D11 =
+static const struct INTERFACE_ID IID_BufferD3D11 =
{0x4a696d2e, 0x44bb, 0x4c4b, {0x9d, 0xe2, 0x3a, 0xf7, 0xc9, 0x4d, 0xcf, 0xc0}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a buffer object.
class IBufferD3D11 : public IBuffer
{
@@ -50,4 +51,29 @@ public:
virtual ID3D11Buffer* GetD3D11Buffer() = 0;
};
-} // namespace Diligent
+#else
+
+struct IBufferD3D11Methods
+{
+ ID3D11Buffer* (*GetD3D11Buffer)();
+};
+
+
+struct IBufferD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IBufferMethods Buffer;
+ struct IBufferD3D11Methods BufferD3D11;
+};
+
+struct IBufferD3D11
+{
+ struct IBufferD3D11Vtbl* pVtbl;
+};
+
+# define IBufferD3D11_GetD3D11Buffer(This) (This)->pVtbl->BufferD3D11.GetD3D11Buffer((struct IBufferD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h
index 7e085d13..f849e13e 100644
--- a/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h
@@ -32,11 +32,12 @@
#include "../../GraphicsEngine/interface/BufferView.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
+#if DILIGENT_CPP_INTERFACE
// {6ABA95FC-CD7D-4C03-8CAE-AFC45F9696B7}
-static constexpr INTERFACE_ID IID_BufferViewD3D11 =
+static const struct INTERFACE_ID IID_BufferViewD3D11 =
{0x6aba95fc, 0xcd7d, 0x4c03, {0x8c, 0xae, 0xaf, 0xc4, 0x5f, 0x96, 0x96, 0xb7}};
/// Exposes Direct3D11-specific functionality of a buffer view object.
@@ -50,4 +51,29 @@ public:
virtual ID3D11View* GetD3D11View() = 0;
};
-} // namespace Diligent
+#else
+
+struct IBufferViewD3D11Methods
+{
+ ID3D11View* (*GetD3D11View)();
+};
+
+
+struct IBufferViewD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IBufferViewMethods BufferView;
+ struct IBufferViewD3D11Methods BufferViewD3D11;
+};
+
+struct IBufferViewD3D11
+{
+ struct IBufferViewD3D11Vtbl* pVtbl;
+};
+
+# define IBufferViewD3D11_GetD3D11View(This) (This)->pVtbl->BufferViewD3D11.GetD3D11View((struct IBufferViewD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h b/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h
index 4bfffa92..257d36e9 100644
--- a/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngine/interface/DeviceContext.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {F0EE0335-C8AB-4EC1-BB15-B8EE5F003B99}
-static constexpr INTERFACE_ID IID_DeviceContextD3D11 =
+static const struct INTERFACE_ID IID_DeviceContextD3D11 =
{0xf0ee0335, 0xc8ab, 0x4ec1, {0xbb, 0x15, 0xb8, 0xee, 0x5f, 0x0, 0x3b, 0x99}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a device context.
class IDeviceContextD3D11 : public IDeviceContext
{
@@ -50,4 +51,28 @@ public:
virtual ID3D11DeviceContext* GetD3D11DeviceContext() = 0;
};
-} // namespace Diligent
+#else
+
+struct IDeviceContextD3D11Methods
+{
+ ID3D11DeviceContext* (*GetD3D11DeviceContext)();
+};
+
+struct IDeviceContextD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IDeviceContextMethods DeviceContext;
+ struct IDeviceContextD3D11Methods DeviceContextD3D11;
+};
+
+struct IDeviceContextD3D11
+{
+ struct IDeviceContextD3D11Vtbl* pVtbl;
+};
+
+# define IDeviceContextD3D11_GetD3D11DeviceContext(This) (This)->pVtbl->DeviceContextD3D11.GetD3D11DeviceContext((struct IDeviceContextD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h
index 45545811..13ec43ea 100644
--- a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h
@@ -39,13 +39,14 @@
# include "../../GraphicsEngine/interface/LoadEngineDll.h"
#endif
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {62663A30-AAF0-4A9A-9729-9EAC6BF789F2}
-static const INTERFACE_ID IID_EngineFactoryD3D11 =
+static const struct INTERFACE_ID IID_EngineFactoryD3D11 =
{0x62663a30, 0xaaf0, 0x4a9a, {0x97, 0x29, 0x9e, 0xac, 0x6b, 0xf7, 0x89, 0xf2}};
+#if DILIGENT_CPP_INTERFACE
+
/// Engine factory for Direct3D11 rendering backend.
class IEngineFactoryD3D11 : public IEngineFactory
{
@@ -142,21 +143,85 @@ public:
DisplayModeAttribs* DisplayModes) = 0;
};
+#else
+
+struct IEngineFactoryD3D11;
+
+struct IEngineFactoryD3D11Methods
+{
+ void (*CreateDeviceAndContextsD3D11)(struct IEngineFactoryD3D11*,
+ const struct EngineD3D11CreateInfo* EngineCI,
+ class IRenderDevice** ppDevice,
+ class IDeviceContext** ppContexts);
+
+ void (*CreateSwapChainD3D11)(struct IEngineFactoryD3D11*,
+ class IRenderDevice* pDevice,
+ class IDeviceContext* pImmediateContext,
+ const struct SwapChainDesc* SCDesc,
+ const struct FullScreenModeDesc* FSDesc,
+ void* pNativeWndHandle,
+ class ISwapChain** ppSwapChain);
+
+ void (*AttachToD3D11Device)(struct IEngineFactoryD3D11*,
+ void* pd3d11NativeDevice,
+ void* pd3d11ImmediateContext,
+ const struct EngineD3D11CreateInfo* EngineCI,
+ class IRenderDevice** ppDevice,
+ class IDeviceContext** ppContexts);
+
+ void (*EnumerateAdapters)(struct IEngineFactoryD3D11*,
+ DIRECT3D_FEATURE_LEVEL MinFeatureLevel,
+ Uint32* NumAdapters,
+ struct AdapterAttribs* Adapters);
+
+
+ void (*EnumerateDisplayModes)(struct IEngineFactoryD3D11*,
+ DIRECT3D_FEATURE_LEVEL MinFeatureLevel,
+ Uint32 AdapterId,
+ Uint32 OutputId,
+ TEXTURE_FORMAT Format,
+ Uint32* NumDisplayModes,
+ struct DisplayModeAttribs* DisplayModes);
+};
+
+struct IEngineFactoryD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IEngineFactoryMethods EngineFactory;
+ struct IEngineFactoryD3D11Methods EngineFactoryD3D11;
+};
+
+struct IEngineFactoryD3D11
+{
+ struct IEngineFactoryD3D11Vtbl* pVtbl;
+};
+
+// clang-format off
+
+# define IEngineFactoryD3D11_CreateDeviceAndContextsD3D11(This, ...) (This)->pVtbl->EngineFactoryD3D11.CreateDeviceAndContextsD3D11((struct IEngineFactoryD3D11*)(This), __VA_ARGS__)
+# define IEngineFactoryD3D11_CreateSwapChainD3D11(This, ...) (This)->pVtbl->EngineFactoryD3D11.CreateSwapChainD3D11 ((struct IEngineFactoryD3D11*)(This), __VA_ARGS__)
+# define IEngineFactoryD3D11_AttachToD3D11Device(This, ...) (This)->pVtbl->EngineFactoryD3D11.AttachToD3D11Device ((struct IEngineFactoryD3D11*)(This), __VA_ARGS__)
+# define IEngineFactoryD3D11_EnumerateAdapters(This, ...) (This)->pVtbl->EngineFactoryD3D11.EnumerateAdapters ((struct IEngineFactoryD3D11*)(This), __VA_ARGS__)
+# define IEngineFactoryD3D11_EnumerateDisplayModes(This, ...) (This)->pVtbl->EngineFactoryD3D11.EnumerateDisplayModes ((struct IEngineFactoryD3D11*)(This), __VA_ARGS__)
+
+// clang-format on
+
+#endif
+
+
#if ENGINE_DLL
-using GetEngineFactoryD3D11Type = IEngineFactoryD3D11* (*)();
+typedef class IEngineFactoryD3D11* (*GetEngineFactoryD3D11Type)();
-static bool LoadGraphicsEngineD3D11(GetEngineFactoryD3D11Type& GetFactoryFunc)
+inline GetEngineFactoryD3D11Type LoadGraphicsEngineD3D11()
{
- auto ProcAddress = LoadEngineDll("GraphicsEngineD3D11", "GetEngineFactoryD3D11");
- GetFactoryFunc = reinterpret_cast<GetEngineFactoryD3D11Type>(ProcAddress);
- return GetFactoryFunc != nullptr;
+ return (GetEngineFactoryD3D11Type)LoadEngineDll("GraphicsEngineD3D11", "GetEngineFactoryD3D11");
}
#else
-IEngineFactoryD3D11* GetEngineFactoryD3D11();
+class IEngineFactoryD3D11* DILIGENT_GLOBAL_FUNCTION(GetEngineFactoryD3D11)();
#endif
-} // namespace Diligent
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h b/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h
index 50813a48..6d9349fa 100644
--- a/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h
@@ -32,17 +32,38 @@
#include "../../GraphicsEngine/interface/Fence.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {45F2BE28-652B-4180-B6E4-E75F83F63CC7}
-static constexpr INTERFACE_ID IID_FenceD3D11 =
+static const struct INTERFACE_ID IID_FenceD3D11 =
{0x45f2be28, 0x652b, 0x4180, {0xb6, 0xe4, 0xe7, 0x5f, 0x83, 0xf6, 0x3c, 0xc7}};
+#if DILIGENT_CPP_INTERFACE
/// Exposes Direct3D11-specific functionality of a fence object.
class IFenceD3D11 : public IFence
{
};
-} // namespace Diligent
+#else
+
+//struct IFenceD3D11Methods
+//{
+//};
+
+struct IFenceD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IFenceMethods Fence;
+ //struct IFenceD3D11Methods FenceD3D11;
+};
+
+struct IFenceD3D11
+{
+ struct IFenceD3D11Vtbl* pVtbl;
+};
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h b/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h
index 8080a24d..2311ade1 100644
--- a/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngine/interface/PipelineState.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {3EA6E3F4-9966-47FC-8CE8-0EB3E2273061}
-static constexpr INTERFACE_ID IID_PipelineStateD3D11 =
+static const struct INTERFACE_ID IID_PipelineStateD3D11 =
{0x3ea6e3f4, 0x9966, 0x47fc, {0x8c, 0xe8, 0xe, 0xb3, 0xe2, 0x27, 0x30, 0x61}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a pipeline state object.
class IPipelineStateD3D11 : public IPipelineState
{
@@ -107,4 +108,56 @@ public:
virtual ID3D11ComputeShader* GetD3D11ComputeShader() = 0;
};
-} // namespace Diligent
+#else
+
+// clang-format off
+
+struct IPipelineStateD3D11;
+
+struct IPipelineStateD3D11Methods
+{
+ ID3D11BlendState* (*GetD3D11BlendState) (struct IPipelineStateD3D11*);
+ ID3D11RasterizerState* (*GetD3D11RasterizerState) (struct IPipelineStateD3D11*);
+ ID3D11DepthStencilState*(*GetD3D11DepthStencilState)(struct IPipelineStateD3D11*);
+ ID3D11InputLayout* (*GetD3D11InputLayout) (struct IPipelineStateD3D11*);
+ ID3D11VertexShader* (*GetD3D11VertexShader) (struct IPipelineStateD3D11*);
+ ID3D11PixelShader* (*GetD3D11PixelShader) (struct IPipelineStateD3D11*);
+ ID3D11GeometryShader* (*GetD3D11GeometryShader) (struct IPipelineStateD3D11*);
+ ID3D11DomainShader* (*GetD3D11DomainShader) (struct IPipelineStateD3D11*);
+ ID3D11HullShader* (*GetD3D11HullShader) (struct IPipelineStateD3D11*);
+ ID3D11ComputeShader* (*GetD3D11ComputeShader) (struct IPipelineStateD3D11*);
+};
+
+// clang-format on
+
+struct IPipelineStateD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IPipelineStateMethods PipelineState;
+ struct IPipelineStateD3D11Methods PipelineStateD3D11;
+};
+
+struct IPipelineStateD3D11
+{
+ struct IPipelineStateD3D11Vtbl* pVtbl;
+};
+
+// clang-format off
+
+# define IPipelineStateD3D11_GetD3D11BlendState(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11BlendState ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11RasterizerState(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11RasterizerState ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11DepthStencilState(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11DepthStencilState((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11InputLayout(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11InputLayout ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11VertexShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11VertexShader ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11PixelShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11PixelShader ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11GeometryShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11GeometryShader ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11DomainShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11DomainShader ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11HullShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11HullShader ((struct IPipelineStateD3D11*)(This))
+# define IPipelineStateD3D11_GetD3D11ComputeShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11ComputeShader ((struct IPipelineStateD3D11*)(This))
+
+// clang-format on
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h
index 9096ca37..26f5dd61 100644
--- a/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngine/interface/Query.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {77D95EAA-D16E-43F4-B0EB-BEBCD2EC8C57}
-static constexpr INTERFACE_ID IID_QueryD3D11 =
+static const struct INTERFACE_ID IID_QueryD3D11 =
{0x77d95eaa, 0xd16e, 0x43f4, {0xb0, 0xeb, 0xbe, 0xbc, 0xd2, 0xec, 0x8c, 0x57}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a Query object.
class IQueryD3D11 : public IQuery
{
@@ -46,4 +47,28 @@ class IQueryD3D11 : public IQuery
virtual ID3D11Query* GetD3D11Query() = 0;
};
-} // namespace Diligent
+#else
+
+struct IQueryD3D11Methods
+{
+ ID3D11Query* (*GetD3D11Query)();
+};
+
+struct IQueryD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IQueryMethods Query;
+ struct IQueryD3D11Methods QueryD3D11;
+};
+
+struct IQueryD3D11
+{
+ struct IQueryD3D11Vtbl* pVtbl;
+};
+
+# define IQueryD3D11_GetD3D11Query(This) (This)->pVtbl->QueryD3D11.GetD3D11Query((struct IQueryD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h
index f04293fd..87f3c00c 100644
--- a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngine/interface/RenderDevice.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {05B1CBB8-FCAD-49EE-BADA-7801223EC3FE}
-static constexpr INTERFACE_ID IID_RenderDeviceD3D11 =
+static const struct INTERFACE_ID IID_RenderDeviceD3D11 =
{0x5b1cbb8, 0xfcad, 0x49ee, {0xba, 0xda, 0x78, 0x1, 0x22, 0x3e, 0xc3, 0xfe}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a render device.
class IRenderDeviceD3D11 : public IRenderDevice
{
@@ -103,4 +104,10 @@ public:
ITexture** ppTexture) = 0;
};
-} // namespace Diligent
+#else
+
+
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h
index c043d790..5c86298b 100644
--- a/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngine/interface/Sampler.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {31A3BFAF-738E-4D8C-AD18-B021C5D948DD}
-static constexpr INTERFACE_ID IID_SamplerD3D11 =
+static const struct INTERFACE_ID IID_SamplerD3D11 =
{0x31a3bfaf, 0x738e, 0x4d8c, {0xad, 0x18, 0xb0, 0x21, 0xc5, 0xd9, 0x48, 0xdd}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a sampler object.
class ISamplerD3D11 : public ISampler
{
@@ -50,4 +51,28 @@ public:
virtual ID3D11SamplerState* GetD3D11SamplerState() = 0;
};
-} // namespace Diligent
+#else
+
+struct ISamplerD3D11Methods
+{
+ ID3D11SamplerState* (*GetD3D11Sampler)();
+};
+
+struct ISamplerD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ //struct ISamplerMethods Sampler;
+ struct ISamplerD3D11Methods SamplerD3D11;
+};
+
+struct ISamplerD3D11
+{
+ struct ISamplerD3D11Vtbl* pVtbl;
+};
+
+# define ISamplerD3D11_GetD3D11Sampler(This) (This)->pVtbl->SamplerD3D11.GetD3D11Sampler((struct ISamplerD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h
index f9351b7c..f105cae6 100644
--- a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h
@@ -32,13 +32,14 @@
#include "../../GraphicsEngineD3DBase/interface/ShaderD3D.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {C513E83E-B037-405B-8B49-BF8F5C220DEE}
-static constexpr INTERFACE_ID IID_ShaderD3D11 =
+static const struct INTERFACE_ID IID_ShaderD3D11 =
{0xc513e83e, 0xb037, 0x405b, {0x8b, 0x49, 0xbf, 0x8f, 0x5c, 0x22, 0xd, 0xee}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a shader object.
class IShaderD3D11 : public IShaderD3D
{
@@ -50,4 +51,28 @@ public:
virtual ID3D11DeviceChild* GetD3D11Shader() = 0;
};
-} // namespace Diligent
+#else
+
+struct IShaderD3D11Methods
+{
+ ID3D11DeviceChild* (*GetD3D11Shader)();
+};
+
+struct IShaderD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IShaderMethods Shader;
+ struct IShaderD3D11Methods ShaderD3D11;
+};
+
+struct IShaderD3D11
+{
+ struct IShaderD3D11Vtbl* pVtbl;
+};
+
+# define IShaderD3D11_GetD3D11Shader(This) (This)->pVtbl->ShaderD3D11.GetD3D11Shader((struct IShaderD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h
index 19eafcda..dc4fa996 100644
--- a/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h
@@ -32,16 +32,21 @@
#include "../../GraphicsEngine/interface/ShaderResourceBinding.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {97A6D4AC-D4AF-4AA9-B46C-67417B89026A}
-static constexpr INTERFACE_ID IID_ShaderResourceBindingD3D11 =
+static const struct INTERFACE_ID IID_ShaderResourceBindingD3D11 =
{0x97a6d4ac, 0xd4af, 0x4aa9, {0xb4, 0x6c, 0x67, 0x41, 0x7b, 0x89, 0x2, 0x6a}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a shader resource binding object.
class IShaderResourceBindingD3D11 : public IShaderResourceBinding
{
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h
index 5eaa7981..cb89ade5 100644
--- a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h
@@ -33,13 +33,14 @@
#include "../../GraphicsEngine/interface/SwapChain.h"
#include "TextureViewD3D11.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
// {4DAF2E76-9204-4DC4-A53A-B00097412D3A}
-static constexpr INTERFACE_ID IID_SwapChainD3D11 =
+static const struct INTERFACE_ID IID_SwapChainD3D11 =
{0x4daf2e76, 0x9204, 0x4dc4, {0xa5, 0x3a, 0xb0, 0x0, 0x97, 0x41, 0x2d, 0x3a}};
+#if DILIGENT_CPP_INTERFACE
+
/// Exposes Direct3D11-specific functionality of a swap chain.
class ISwapChainD3D11 : public ISwapChain
{
@@ -57,4 +58,8 @@ public:
virtual IDXGISwapChain* GetDXGISwapChain() = 0;
};
-} // namespace Diligent
+#else
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h b/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h
index 358cf770..2ef98277 100644
--- a/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h
@@ -32,8 +32,9 @@
#include "../../GraphicsEngine/interface/Texture.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
+#if DILIGENT_CPP_INTERFACE
// {F3A84CC2-E485-4E72-A08A-437D7FFBA3AB}
static constexpr INTERFACE_ID IID_TextureD3D11 =
@@ -50,4 +51,29 @@ public:
virtual ID3D11Resource* GetD3D11Texture() = 0;
};
-} // namespace Diligent
+#else
+
+struct ITextureD3D11Methods
+{
+ ID3D11Resource* (*GetD3D11Texture)();
+};
+
+
+struct ITextureD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct ITextureMethods Texture;
+ struct ITextureD3D11Methods TextureD3D11;
+};
+
+struct ITextureD3D11
+{
+ struct ITextureD3D11Vtbl* pVtbl;
+};
+
+# define ITextureD3D11_GetD3D11Texture(This) (This)->pVtbl->TextureD3D11.GetD3D11Texture((struct ITextureD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h b/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h
index afa2a22e..b4d52ca1 100644
--- a/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h
@@ -32,8 +32,9 @@
#include "../../GraphicsEngine/interface/TextureView.h"
-namespace Diligent
-{
+DILIGENT_BEGIN_NAMESPACE(Diligent)
+
+#if DILIGENT_CPP_INTERFACE
// {0767EBE4-AD47-4E70-9B65-38C6B9CAC37D}
static constexpr INTERFACE_ID IID_TextureViewD3D11 =
@@ -50,4 +51,30 @@ public:
virtual ID3D11View* GetD3D11View() = 0;
};
-} // namespace Diligent
+
+#else
+
+struct ITextureViewD3D11Methods
+{
+ ID3D11View* (*GetD3D11View)();
+};
+
+
+struct ITextureViewD3D11Vtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct ITextureViewMethods TextureView;
+ struct ITextureViewD3D11Methods TextureViewD3D11;
+};
+
+struct ITextureViewD3D11
+{
+ struct ITextureViewD3D11Vtbl* pVtbl;
+};
+
+# define ITextureViewD3D11_GetD3D11View(This) (This)->pVtbl->TextureViewD3D11.GetD3D11View((struct ITextureViewD3D11*)(This))
+
+#endif
+
+DILIGENT_END_NAMESPACE // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/readme.md b/Graphics/GraphicsEngineD3D11/readme.md
index 9afc1f81..7d3a7dc2 100644
--- a/Graphics/GraphicsEngineD3D11/readme.md
+++ b/Graphics/GraphicsEngineD3D11/readme.md
@@ -19,9 +19,8 @@ EngineCI.DebugFlags =
// Get pointer to the function that returns the factory
#if ENGINE_DLL
- GetEngineFactoryD3D11Type GetEngineFactoryD3D11 = nullptr;
// Load the dll and import GetEngineFactoryD3D11() function
- LoadGraphicsEngineD3D11(GetEngineFactoryD3D11);
+ auto GetEngineFactoryD3D11 = LoadGraphicsEngineD3D11();
#endif
auto* pFactoryD3D11 = GetEngineFactoryD3D11();
diff --git a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
index 5b11cf12..28ffb248 100644
--- a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
@@ -324,7 +324,7 @@ void EngineFactoryD3D11Impl::CreateSwapChainD3D11(IRenderDevice* pDev
/// x86 | GraphicsEngineD3D11_32d.dll | GraphicsEngineD3D11_32r.dll
/// x64 | GraphicsEngineD3D11_64d.dll | GraphicsEngineD3D11_64r.dll
///
-void LoadGraphicsEngineD3D11(GetEngineFactoryD3D11Type& GetFactoryFunc)
+GetEngineFactoryD3D11Type LoadGraphicsEngineD3D11()
{
// This function is only required because DoxyGen refuses to generate documentation for a static function when SHOW_FILES==NO
# error This function must never be compiled;
@@ -338,3 +338,11 @@ IEngineFactoryD3D11* GetEngineFactoryD3D11()
}
} // namespace Diligent
+
+extern "C"
+{
+ Diligent::IEngineFactoryD3D11* Diligent_GetEngineFactoryD3D11()
+ {
+ return Diligent::GetEngineFactoryD3D11();
+ }
+}