diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-27 20:04:26 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-27 20:04:26 +0000 |
| commit | 3ed4072f25c4c08f2be2deea41f67c3988458038 (patch) | |
| tree | 0944ba58679a2d0191da16fa266c61124303dabf /Graphics/GraphicsEngine | |
| parent | Reworked C interfaces to share declaration with c++ (diff) | |
| download | DiligentCore-3ed4072f25c4c08f2be2deea41f67c3988458038.tar.gz DiligentCore-3ed4072f25c4c08f2be2deea41f67c3988458038.zip | |
Guarded interface definitions by define-undef macro helper include pairs to avoid macro conflicts
Diffstat (limited to 'Graphics/GraphicsEngine')
17 files changed, 83 insertions, 124 deletions
diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h index 1a1f79d1..a7a999a1 100644 --- a/Graphics/GraphicsEngine/interface/Buffer.h +++ b/Graphics/GraphicsEngine/interface/Buffer.h @@ -173,10 +173,8 @@ struct BufferData }; typedef struct BufferData BufferData; -#if DILIGENT_C_INTERFACE -# define THIS struct IBuffer* -# define THIS_ struct IBuffer*, -#endif +#define DILIGENT_INTERFACE_NAME IBuffer +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Buffer interface @@ -238,10 +236,9 @@ DILIGENT_INTERFACE(IBuffer, IDeviceObject) VIRTUAL RESOURCE_STATE METHOD(GetState)(THIS) CONST PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -#undef THIS -#undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h index fbdb6636..613f552b 100644 --- a/Graphics/GraphicsEngine/interface/BufferView.h +++ b/Graphics/GraphicsEngine/interface/BufferView.h @@ -139,12 +139,8 @@ struct BufferViewDesc DILIGENT_DERIVE(DeviceObjectAttribs) }; typedef struct BufferViewDesc BufferViewDesc; - - -#if DILIGENT_C_INTERFACE -# define THIS struct IBufferView* -# define THIS_ struct IBufferView*, -#endif +#define DILIGENT_INTERFACE_NAME IBufferView +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Buffer view interface @@ -166,10 +162,9 @@ DILIGENT_INTERFACE(IBufferView, IDeviceObject) VIRTUAL struct IBuffer* METHOD(GetBuffer)(THIS) PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index 8484be67..38cbfa61 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -609,11 +609,8 @@ struct CopyTextureAttribs }; typedef struct CopyTextureAttribs CopyTextureAttribs; - -#if DILIGENT_C_INTERFACE -# define THIS struct IDeviceContext* -# define THIS_ struct IDeviceContext*, -#endif +#define DILIGENT_INTERFACE_NAME IDeviceContext +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Device context interface. @@ -1317,10 +1314,9 @@ DILIGENT_INTERFACE(IDeviceContext, IObject) const ResolveTextureSubresourceAttribs REF ResolveAttribs) PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/DeviceObject.h b/Graphics/GraphicsEngine/interface/DeviceObject.h index 3feba088..98d7f26f 100644 --- a/Graphics/GraphicsEngine/interface/DeviceObject.h +++ b/Graphics/GraphicsEngine/interface/DeviceObject.h @@ -40,10 +40,8 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const INTERFACE_ID IID_DeviceObject = {0x5b4cca0b, 0x5075, 0x4230, {0x97, 0x59, 0xf4, 0x87, 0x69, 0xee, 0x55, 0x2}}; -#if DILIGENT_C_INTERFACE -# define THIS struct IDeviceObject* -# define THIS_ struct IDeviceObject*, -#endif +#define DILIGENT_INTERFACE_NAME IDeviceObject +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Base interface for all objects created by the render device Diligent::IRenderDevice DILIGENT_INTERFACE(IDeviceObject, IObject) @@ -71,10 +69,9 @@ DILIGENT_INTERFACE(IDeviceObject, IObject) VIRTUAL Int32 METHOD(GetUniqueID)(THIS) CONST PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format off diff --git a/Graphics/GraphicsEngine/interface/EngineFactory.h b/Graphics/GraphicsEngine/interface/EngineFactory.h index 829e9ccd..7e401b37 100644 --- a/Graphics/GraphicsEngine/interface/EngineFactory.h +++ b/Graphics/GraphicsEngine/interface/EngineFactory.h @@ -41,10 +41,9 @@ struct IShaderSourceInputStreamFactory; static const INTERFACE_ID IID_EngineFactory = {0xd932b052, 0x4ed6, 0x4729, {0xa5, 0x32, 0xf3, 0x1d, 0xee, 0xc1, 0x0, 0xf3}}; -#if DILIGENT_C_INTERFACE -# define THIS struct IEngineFactory* -# define THIS_ struct IEngineFactory*, -#endif +#define DILIGENT_INTERFACE_NAME IEngineFactory +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + // clang-format off @@ -73,10 +72,9 @@ DILIGENT_INTERFACE(IEngineFactory, IObject) #endif }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h index b1fe06c1..7387495c 100644 --- a/Graphics/GraphicsEngine/interface/Fence.h +++ b/Graphics/GraphicsEngine/interface/Fence.h @@ -46,10 +46,9 @@ typedef struct FenceDesc FenceDesc; // clang-format off -#if DILIGENT_C_INTERFACE -# define THIS struct IFence* -# define THIS_ struct IFence*, -#endif +#define DILIGENT_INTERFACE_NAME IFence +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Fence interface @@ -76,12 +75,10 @@ DILIGENT_INTERFACE(IFence, IDeviceObject) Uint64 Value) PURE; }; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" #if DILIGENT_C_INTERFACE -# undef THIS -# undef THIS_ - // clang-format on struct IFenceVtbl diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index 95f42972..de24d071 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -254,11 +254,8 @@ typedef struct PipelineStateDesc PipelineStateDesc; static const struct INTERFACE_ID IID_PipelineState = {0x6084ae5, 0x6a71, 0x4fe8, {0x84, 0xb9, 0x39, 0x5d, 0xd4, 0x89, 0xa2, 0x8c}}; - -#if DILIGENT_C_INTERFACE -# define THIS struct IPipelineState* -# define THIS_ struct IPipelineState*, -#endif +#define DILIGENT_INTERFACE_NAME IPipelineState +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" // clang-format off @@ -350,10 +347,9 @@ DILIGENT_INTERFACE(IPipelineState, IDeviceObject) const struct IPipelineState* pPSO) CONST PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/Query.h b/Graphics/GraphicsEngine/interface/Query.h index 61834232..4f4cfd98 100644 --- a/Graphics/GraphicsEngine/interface/Query.h +++ b/Graphics/GraphicsEngine/interface/Query.h @@ -172,10 +172,9 @@ struct QueryDesc DILIGENT_DERIVE(DeviceObjectAttribs) }; typedef struct QueryDesc QueryDesc; -#if DILIGENT_C_INTERFACE -# define THIS struct IQuery* -# define THIS_ struct IQuery*, -#endif +#define DILIGENT_INTERFACE_NAME IQuery +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + // clang-format off @@ -218,10 +217,9 @@ DILIGENT_INTERFACE(IQuery, IDeviceObject) VIRTUAL void METHOD(Invalidate)(THIS) PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h index 93d70a83..71d0bff3 100644 --- a/Graphics/GraphicsEngine/interface/RenderDevice.h +++ b/Graphics/GraphicsEngine/interface/RenderDevice.h @@ -57,10 +57,9 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const INTERFACE_ID IID_RenderDevice = {0xf0e9b607, 0xae33, 0x4b2b, {0xb1, 0xaf, 0xa8, 0xb2, 0xc3, 0x10, 0x40, 0x22}}; -#if DILIGENT_C_INTERFACE -# define THIS struct IRenderDevice* -# define THIS_ struct IRenderDevice*, -#endif +#define DILIGENT_INTERFACE_NAME IRenderDevice +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + // clang-format off @@ -238,12 +237,10 @@ DILIGENT_INTERFACE(IRenderDevice, IObject) VIRTUAL IEngineFactory* METHOD(GetEngineFactory)(THIS) CONST PURE; }; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" #if DILIGENT_C_INTERFACE -# undef THIS -# undef THIS - // clang-format on struct IRenderDeviceVtbl diff --git a/Graphics/GraphicsEngine/interface/ResourceMapping.h b/Graphics/GraphicsEngine/interface/ResourceMapping.h index 5de0e935..3078cf13 100644 --- a/Graphics/GraphicsEngine/interface/ResourceMapping.h +++ b/Graphics/GraphicsEngine/interface/ResourceMapping.h @@ -90,11 +90,9 @@ struct ResourceMappingDesc }; typedef struct ResourceMappingDesc ResourceMappingDesc; +#define DILIGENT_INTERFACE_NAME IResourceMapping +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" -#if DILIGENT_C_INTERFACE -# define THIS struct IResourceMapping* -# define THIS_ struct IResourceMapping*, -#endif // clang-format off @@ -167,10 +165,9 @@ DILIGENT_INTERFACE(IResourceMapping, IObject) VIRTUAL size_t METHOD(GetSize)(THIS) PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h index 97d4b99c..b265ff8e 100644 --- a/Graphics/GraphicsEngine/interface/Sampler.h +++ b/Graphics/GraphicsEngine/interface/Sampler.h @@ -171,6 +171,8 @@ struct SamplerDesc DILIGENT_DERIVE(DeviceObjectAttribs) }; typedef struct SamplerDesc SamplerDesc; +#define DILIGENT_INTERFACE_NAME ISampler +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" #if DILIGENT_CPP_INTERFACE @@ -191,6 +193,9 @@ DILIGENT_INTERFACE(ISampler, IDeviceObject) #endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + #if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 971302af..63c788d9 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -85,10 +85,9 @@ static const INTERFACE_ID IID_IShaderSourceInputStreamFactory = // clang-format off -#if DILIGENT_C_INTERFACE -# define THIS struct IShaderSourceInputStreamFactory* -# define THIS_ struct IShaderSourceInputStreamFactory*, -#endif +#define DILIGENT_INTERFACE_NAME IShaderSourceInputStreamFactory +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Shader source stream factory interface DILIGENT_INTERFACE(IShaderSourceInputStreamFactory, IObject) @@ -99,10 +98,9 @@ DILIGENT_INTERFACE(IShaderSourceInputStreamFactory, IObject) }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on @@ -318,11 +316,8 @@ struct ShaderResourceDesc }; typedef struct ShaderResourceDesc ShaderResourceDesc; - -#if DILIGENT_C_INTERFACE -# define THIS struct IShader* -# define THIS_ struct IShader*, -#endif +#define DILIGENT_INTERFACE_NAME IShader +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" // clang-format off @@ -343,10 +338,10 @@ DILIGENT_INTERFACE(IShader, IDeviceObject) ShaderResourceDesc REF ResourceDesc) CONST PURE; }; -#if DILIGENT_C_INTERFACE -# undef THIS -# undef THIS_ +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h index d18c8060..11889a86 100644 --- a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h +++ b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h @@ -44,10 +44,10 @@ static const INTERFACE_ID IID_ShaderResourceBinding = {0x61f8774, 0x9a09, 0x48e8, {0x84, 0x11, 0xb5, 0xbd, 0x20, 0x56, 0x1, 0x4}}; -#if DILIGENT_C_INTERFACE -# define THIS struct IShaderResourceBinding* -# define THIS_ struct IShaderResourceBinding*, -#endif +#define DILIGENT_INTERFACE_NAME IShaderResourceBinding +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + + // clang-format off @@ -128,10 +128,9 @@ DILIGENT_INTERFACE(IShaderResourceBinding, IObject) const struct IPipelineState* pPipelineState DEFAULT_VALUE(nullptr)) PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h index 6001f99b..889ecce0 100644 --- a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h +++ b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h @@ -104,10 +104,10 @@ DILIGENT_TYPED_ENUM(BIND_SHADER_RESOURCES_FLAGS, Uint32) // clang-format on -#if DILIGENT_C_INTERFACE -# define THIS struct IShaderResourceVariable* -# define THIS_ struct IShaderResourceVariable*, -#endif +#define DILIGENT_INTERFACE_NAME IShaderResourceVariable +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + + // clang-format off @@ -154,12 +154,10 @@ DILIGENT_INTERFACE(IShaderResourceVariable, IObject) Uint32 ArrayIndex) CONST PURE; }; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" #if DILIGENT_C_INTERFACE -# undef THIS -# undef THIS_ - // clang-format on struct IShaderResourceVariableVtbl diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h index b1d435e6..c73800d3 100644 --- a/Graphics/GraphicsEngine/interface/SwapChain.h +++ b/Graphics/GraphicsEngine/interface/SwapChain.h @@ -41,11 +41,9 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const INTERFACE_ID IID_SwapChain = {0x1c703b77, 0x6607, 0x4eec, {0xb1, 0xfe, 0x15, 0xc8, 0x2d, 0x3b, 0x41, 0x30}}; +#define DILIGENT_INTERFACE_NAME ISwapChain +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" -#if DILIGENT_C_INTERFACE -# define THIS struct ISwapChain* -# define THIS_ struct ISwapChain*, -#endif // clang-format off @@ -97,12 +95,10 @@ DILIGENT_INTERFACE(ISwapChain, IObject) VIRTUAL ITextureView* METHOD(GetDepthBufferDSV)(THIS) PURE; }; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" #if DILIGENT_C_INTERFACE -# undef THIS -# undef THIS_ - // clang-format on struct ISwapChainVtbl diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h index e5bd316c..261664bf 100644 --- a/Graphics/GraphicsEngine/interface/Texture.h +++ b/Graphics/GraphicsEngine/interface/Texture.h @@ -308,10 +308,10 @@ struct MappedTextureSubresource }; typedef struct MappedTextureSubresource MappedTextureSubresource; -#if DILIGENT_C_INTERFACE -# define THIS struct ITexture* -# define THIS_ struct ITexture*, -#endif +#define DILIGENT_INTERFACE_NAME ITexture +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + + /// Texture inteface DILIGENT_INTERFACE(ITexture, IDeviceObject) @@ -376,10 +376,9 @@ DILIGENT_INTERFACE(ITexture, IDeviceObject) VIRTUAL RESOURCE_STATE METHOD(GetState)(THIS) CONST PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on diff --git a/Graphics/GraphicsEngine/interface/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h index 4182d85d..21e8b6f8 100644 --- a/Graphics/GraphicsEngine/interface/TextureView.h +++ b/Graphics/GraphicsEngine/interface/TextureView.h @@ -184,10 +184,10 @@ typedef struct TextureViewDesc TextureViewDesc; // clang-format on -#if DILIGENT_C_INTERFACE -# define THIS struct ITextureView* -# define THIS_ struct ITextureView*, -#endif +#define DILIGENT_INTERFACE_NAME ITextureView +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + + /// Texture view interface @@ -224,10 +224,9 @@ DILIGENT_INTERFACE(ITextureView, IDeviceObject) VIRTUAL struct ITexture* METHOD(GetTexture)(THIS) PURE; }; -#if DILIGENT_C_INTERFACE +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -# undef THIS -# undef THIS_ +#if DILIGENT_C_INTERFACE // clang-format on |
