summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-29 06:05:19 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-29 06:05:19 +0000
commit3d92951b74f0e788432a0f3a35f452e74d936fce (patch)
treefe401a2770aac16a5ab39ecf70fdd4a9ff22f38a /Graphics/GraphicsEngine
parentReworked interface definitions to use DILIGENT_BEGIN_INTERFACE/DILIGENT_END_I... (diff)
downloadDiligentCore-3d92951b74f0e788432a0f3a35f452e74d936fce.tar.gz
DiligentCore-3d92951b74f0e788432a0f3a35f452e74d936fce.zip
Reworked C interface to optimize inheritance handling
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/interface/Buffer.h12
-rw-r--r--Graphics/GraphicsEngine/interface/BufferView.h13
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceContext.h12
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceObject.h11
-rw-r--r--Graphics/GraphicsEngine/interface/EngineFactory.h11
-rw-r--r--Graphics/GraphicsEngine/interface/Fence.h12
-rw-r--r--Graphics/GraphicsEngine/interface/PipelineState.h13
-rw-r--r--Graphics/GraphicsEngine/interface/Query.h12
-rw-r--r--Graphics/GraphicsEngine/interface/RenderDevice.h11
-rw-r--r--Graphics/GraphicsEngine/interface/ResourceMapping.h11
-rw-r--r--Graphics/GraphicsEngine/interface/Sampler.h22
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h22
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceBinding.h12
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceVariable.h12
-rw-r--r--Graphics/GraphicsEngine/interface/SwapChain.h11
-rw-r--r--Graphics/GraphicsEngine/interface/Texture.h13
-rw-r--r--Graphics/GraphicsEngine/interface/TextureView.h13
17 files changed, 64 insertions, 159 deletions
diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h
index 94a9d07a..4023233b 100644
--- a/Graphics/GraphicsEngine/interface/Buffer.h
+++ b/Graphics/GraphicsEngine/interface/Buffer.h
@@ -176,6 +176,9 @@ typedef struct BufferData BufferData;
#define DILIGENT_INTERFACE_NAME IBuffer
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IBufferInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ IBufferMethods Buffer
/// Buffer interface
@@ -241,15 +244,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IBufferVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct IBufferMethods Buffer;
-};
-
// clang-format off
# define IBuffer_GetDesc(This) (const struct BufferDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h
index 4005ff10..2b1066ea 100644
--- a/Graphics/GraphicsEngine/interface/BufferView.h
+++ b/Graphics/GraphicsEngine/interface/BufferView.h
@@ -142,6 +142,10 @@ typedef struct BufferViewDesc BufferViewDesc;
#define DILIGENT_INTERFACE_NAME IBufferView
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IBufferViewInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ IBufferViewMethods BufferView
+
/// Buffer view interface
/// To create a buffer view, call IBuffer::CreateView().
@@ -167,15 +171,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IBufferViewVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct IBufferViewMethods BufferView;
-};
-
// clang-format off
# define IBufferView_GetDesc(This) (const struct BufferViewDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h
index 8834fe94..7df48815 100644
--- a/Graphics/GraphicsEngine/interface/DeviceContext.h
+++ b/Graphics/GraphicsEngine/interface/DeviceContext.h
@@ -612,6 +612,10 @@ typedef struct CopyTextureAttribs CopyTextureAttribs;
#define DILIGENT_INTERFACE_NAME IDeviceContext
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IDeviceContextInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IDeviceContextMethods DeviceContext
+
/// Device context interface.
/// \remarks Device context keeps strong references to all objects currently bound to
@@ -1319,14 +1323,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IDeviceContextVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceContextMethods DeviceContext;
-};
-
// clang-format off
# define IDeviceContext_SetPipelineState(This, ...) CALL_IFACE_METHOD(DeviceContext, SetPipelineState, This, __VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/interface/DeviceObject.h b/Graphics/GraphicsEngine/interface/DeviceObject.h
index d9f13185..74409edd 100644
--- a/Graphics/GraphicsEngine/interface/DeviceObject.h
+++ b/Graphics/GraphicsEngine/interface/DeviceObject.h
@@ -42,6 +42,9 @@ static const INTERFACE_ID IID_DeviceObject =
#define DILIGENT_INTERFACE_NAME IDeviceObject
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IDeviceObjectInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IDeviceObjectMethods DeviceObject
/// Base interface for all objects created by the render device Diligent::IRenderDevice
DILIGENT_BEGIN_INTERFACE(IDeviceObject, IObject)
@@ -76,14 +79,6 @@ DILIGENT_END_INTERFACE
// clang-format off
-struct IDeviceObjectVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
-};
-
-// clang-format off
-
# define IDeviceObject_GetDesc(This) CALL_IFACE_METHOD(DeviceObject, GetDesc, This)
# define IDeviceObject_GetUniqueID(This) CALL_IFACE_METHOD(DeviceObject, GetUniqueID, This)
diff --git a/Graphics/GraphicsEngine/interface/EngineFactory.h b/Graphics/GraphicsEngine/interface/EngineFactory.h
index 5f20d358..b289911a 100644
--- a/Graphics/GraphicsEngine/interface/EngineFactory.h
+++ b/Graphics/GraphicsEngine/interface/EngineFactory.h
@@ -44,6 +44,9 @@ static const INTERFACE_ID IID_EngineFactory =
#define DILIGENT_INTERFACE_NAME IEngineFactory
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IEngineFactoryInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IEngineFactoryMethods EngineFactory
// clang-format off
@@ -77,14 +80,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IEngineFactoryVtbl
-{
- struct IObjectMethods Object;
- struct IEngineFactoryMethods EngineFactory;
-};
-
// clang-format off
# define IEngineFactory_GetAPIInfo(This) CALL_IFACE_METHOD(EngineFactory, GetAPIInfo, This)
diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h
index e76ff4f3..754d066e 100644
--- a/Graphics/GraphicsEngine/interface/Fence.h
+++ b/Graphics/GraphicsEngine/interface/Fence.h
@@ -49,6 +49,9 @@ typedef struct FenceDesc FenceDesc;
#define DILIGENT_INTERFACE_NAME IFence
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IFenceInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ IFenceMethods Fence
/// Fence interface
@@ -80,15 +83,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IFenceVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct IFenceMethods Fence;
-};
-
// clang-format off
# define IFence_GetDesc(This) (const struct FenceDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h
index d66a86ac..f572523c 100644
--- a/Graphics/GraphicsEngine/interface/PipelineState.h
+++ b/Graphics/GraphicsEngine/interface/PipelineState.h
@@ -257,6 +257,10 @@ static const struct INTERFACE_ID IID_PipelineState =
#define DILIGENT_INTERFACE_NAME IPipelineState
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IPipelineStateInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ IPipelineStateMethods PipelineState
+
// clang-format off
/// Pipeline state interface
@@ -352,15 +356,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IPipelineStateVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct IPipelineStateMethods PipelineState;
-};
-
// clang-format off
# define IPipelineState_GetDesc(This) (const struct PipelineStateDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/Query.h b/Graphics/GraphicsEngine/interface/Query.h
index 80a6d13a..4abd6e1b 100644
--- a/Graphics/GraphicsEngine/interface/Query.h
+++ b/Graphics/GraphicsEngine/interface/Query.h
@@ -175,6 +175,9 @@ typedef struct QueryDesc QueryDesc;
#define DILIGENT_INTERFACE_NAME IQuery
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IQueryInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ IQueryMethods Query
// clang-format off
@@ -222,15 +225,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IQueryVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct IQueryMethods Query;
-};
-
// clang-format off
# define IQuery_GetDesc(This) (const struct QueryDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h
index c60c1422..2c97ac60 100644
--- a/Graphics/GraphicsEngine/interface/RenderDevice.h
+++ b/Graphics/GraphicsEngine/interface/RenderDevice.h
@@ -60,6 +60,9 @@ static const INTERFACE_ID IID_RenderDevice =
#define DILIGENT_INTERFACE_NAME IRenderDevice
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IRenderDeviceInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IRenderDeviceMethods RenderDevice
// clang-format off
@@ -242,14 +245,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IRenderDeviceVtbl
-{
- struct IObjectMethods Object;
- struct IRenderDeviceMethods RenderDevice;
-};
-
// clang-format off
# define IRenderDevice_CreateBuffer(This, ...) CALL_IFACE_METHOD(RenderDevice, CreateBuffer, This, __VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/interface/ResourceMapping.h b/Graphics/GraphicsEngine/interface/ResourceMapping.h
index 62a81214..85feaa68 100644
--- a/Graphics/GraphicsEngine/interface/ResourceMapping.h
+++ b/Graphics/GraphicsEngine/interface/ResourceMapping.h
@@ -93,6 +93,9 @@ typedef struct ResourceMappingDesc ResourceMappingDesc;
#define DILIGENT_INTERFACE_NAME IResourceMapping
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IResourceMappingInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IResourceMappingMethods ResourceMapping
// clang-format off
@@ -170,14 +173,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IResourceMappingVtbl
-{
- struct IObjectMethods Object;
- struct IResourceMappingMethods ResourceMapping;
-};
-
// clang-format off
# define IResourceMapping_AddResource(This, ...) CALL_IFACE_METHOD(ResourceMapping, AddResource, This, __VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h
index 721ed33f..7d782cee 100644
--- a/Graphics/GraphicsEngine/interface/Sampler.h
+++ b/Graphics/GraphicsEngine/interface/Sampler.h
@@ -174,6 +174,12 @@ typedef struct SamplerDesc SamplerDesc;
#define DILIGENT_INTERFACE_NAME ISampler
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+// clang-format off
+#define ISamplerInclusiveMethods \
+ IDeviceObjectInclusiveMethods \
+ /*ISamplerMethods Sampler*/
+// clang-format on
+
#if DILIGENT_CPP_INTERFACE
// clang-format off
@@ -199,20 +205,10 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct ISampler;
-
-//struct ISamplerMethods
-//{
-//};
-
-struct ISamplerVtbl
+typedef struct ISamplerVtbl
{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- //struct ISamplerMethods Sampler;
-};
+ ISamplerInclusiveMethods;
+} ISamplerVtbl;
typedef struct ISampler
{
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index 39849a22..73e948dc 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -88,6 +88,9 @@ static const INTERFACE_ID IID_IShaderSourceInputStreamFactory =
#define DILIGENT_INTERFACE_NAME IShaderSourceInputStreamFactory
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IShaderSourceInputStreamFactoryInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IShaderSourceInputStreamFactoryMethods ShaderSourceInputStreamFactory
/// Shader source stream factory interface
DILIGENT_BEGIN_INTERFACE(IShaderSourceInputStreamFactory, IObject)
@@ -104,12 +107,6 @@ DILIGENT_END_INTERFACE
// clang-format on
-struct IShaderSourceInputStreamFactoryVtbl
-{
- struct IObjectMethods Object;
- struct IShaderSourceInputStreamFactoryMethods ShaderSourceInputStreamFactory;
-};
-
# define IShaderSourceInputStreamFactory_CreateInputStream(This, ...) CALL_IFACE_METHOD(ShaderSourceInputStreamFactory, CreateInputStream, This, __VA_ARGS__)
#endif
@@ -314,6 +311,10 @@ typedef struct ShaderResourceDesc ShaderResourceDesc;
#define DILIGENT_INTERFACE_NAME IShader
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define IShaderInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ IShaderMethods Shader
+
// clang-format off
/// Shader interface
@@ -338,15 +339,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IShaderVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct IShaderMethods Shader;
-};
-
// clang-format off
# define IShader_GetDesc(This) (const struct ShaderDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
index 8a314f70..54d7bba1 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h
@@ -47,7 +47,9 @@ static const INTERFACE_ID IID_ShaderResourceBinding =
#define DILIGENT_INTERFACE_NAME IShaderResourceBinding
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
-
+#define IShaderResourceBindingInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IShaderResourceBindingMethods ShaderResourceBinding
// clang-format off
@@ -133,14 +135,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IShaderResourceBindingVtbl
-{
- struct IObjectMethods Object;
- struct IShaderResourceBindingMethods ShaderResourceBinding;
-};
-
// clang-format off
# define IShaderResourceBinding_GetPipelineState(This) CALL_IFACE_METHOD(ShaderResourceBinding, GetPipelineState, This)
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
index 777ddaf2..445f8e8d 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
@@ -107,7 +107,9 @@ DILIGENT_TYPED_ENUM(BIND_SHADER_RESOURCES_FLAGS, Uint32)
#define DILIGENT_INTERFACE_NAME IShaderResourceVariable
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
-
+#define IShaderResourceVariableInclusiveMethods \
+ IObjectInclusiveMethods; \
+ IShaderResourceVariableMethods ShaderResourceVariable
// clang-format off
@@ -159,14 +161,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct IShaderResourceVariableVtbl
-{
- struct IObjectMethods Object;
- struct IShaderResourceVariableMethods ShaderResourceVariable;
-};
-
// clang-format off
# define IShaderResourceVariable_Set(This, ...) CALL_IFACE_METHOD(ShaderResourceVariable, Set, This, __VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h
index eea56ea7..2bbefca8 100644
--- a/Graphics/GraphicsEngine/interface/SwapChain.h
+++ b/Graphics/GraphicsEngine/interface/SwapChain.h
@@ -44,6 +44,9 @@ static const INTERFACE_ID IID_SwapChain =
#define DILIGENT_INTERFACE_NAME ISwapChain
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
+#define ISwapChainInclusiveMethods \
+ IObjectInclusiveMethods; \
+ ISwapChainMethods SwapChain
// clang-format off
@@ -100,14 +103,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct ISwapChainVtbl
-{
- struct IObjectMethods Object;
- struct ISwapChainMethods SwapChain;
-};
-
// clang-format off
# define ISwapChain_Present(This, ...) CALL_IFACE_METHOD(SwapChain, Present, This, __VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h
index dbc27a20..e4059740 100644
--- a/Graphics/GraphicsEngine/interface/Texture.h
+++ b/Graphics/GraphicsEngine/interface/Texture.h
@@ -311,7 +311,9 @@ typedef struct MappedTextureSubresource MappedTextureSubresource;
#define DILIGENT_INTERFACE_NAME ITexture
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
-
+#define ITextureInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ ITextureMethods Texture
/// Texture inteface
DILIGENT_BEGIN_INTERFACE(ITexture, IDeviceObject)
@@ -381,15 +383,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct ITextureVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct ITextureMethods Texture;
-};
-
// clang-format off
# define ITexture_GetDesc(This) (const struct TextureDesc*)IDeviceObject_GetDesc(This)
diff --git a/Graphics/GraphicsEngine/interface/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h
index a577349b..28af771d 100644
--- a/Graphics/GraphicsEngine/interface/TextureView.h
+++ b/Graphics/GraphicsEngine/interface/TextureView.h
@@ -187,7 +187,9 @@ typedef struct TextureViewDesc TextureViewDesc;
#define DILIGENT_INTERFACE_NAME ITextureView
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
-
+#define ITextureViewInclusiveMethods \
+ IDeviceObjectInclusiveMethods; \
+ ITextureViewMethods TextureView
/// Texture view interface
@@ -229,15 +231,6 @@ DILIGENT_END_INTERFACE
#if DILIGENT_C_INTERFACE
-// clang-format on
-
-struct ITextureViewVtbl
-{
- struct IObjectMethods Object;
- struct IDeviceObjectMethods DeviceObject;
- struct ITextureViewMethods TextureView;
-};
-
# define ITextureView_GetDesc(This) (const struct TextureViewDesc*)IDeviceObject_GetDesc(This)
// clang-format off