diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-28 03:02:49 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-28 03:02:49 +0000 |
| commit | 461ceb7feac0317aed4f19a6fc5f35efd561c808 (patch) | |
| tree | 2398902f0c0a8676621948a70ac62c79abe4558f /Graphics/GraphicsEngineD3D11 | |
| parent | Fixed class vs struct issues. Implemented HLSL2GLSL Convertor C interfaces (diff) | |
| download | DiligentCore-461ceb7feac0317aed4f19a6fc5f35efd561c808.tar.gz DiligentCore-461ceb7feac0317aed4f19a6fc5f35efd561c808.zip | |
Refactored D3D11 C interface
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
17 files changed, 259 insertions, 257 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp index 2c23841c..e3c3bf3d 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp @@ -79,13 +79,13 @@ public: virtual void CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer) override final; /// Implementation of IRenderDeviceD3D11::CreateTextureFromD3DResource() for 1D textures in Direct3D11 backend. - virtual void CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) override final; + virtual void CreateTexture1DFromD3DResource(ID3D11Texture1D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) override final; /// Implementation of IRenderDeviceD3D11::CreateTextureFromD3DResource() for 2D textures in Direct3D11 backend. - virtual void CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) override final; + virtual void CreateTexture2DFromD3DResource(ID3D11Texture2D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) override final; /// Implementation of IRenderDeviceD3D11::CreateTextureFromD3DResource() for 3D textures in Direct3D11 backend. - virtual void CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) override final; + virtual void CreateTexture3DFromD3DResource(ID3D11Texture3D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) override final; /// Implementation of IRenderDevice::ReleaseStaleResources() in Direct3D11 backend. virtual void ReleaseStaleResources(bool ForceRelease = false) override final {} diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h index d2003a4a..75c4da50 100644 --- a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h @@ -38,26 +38,22 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_BufferD3D11 = {0x4a696d2e, 0x44bb, 0x4c4b, {0x9d, 0xe2, 0x3a, 0xf7, 0xc9, 0x4d, 0xcf, 0xc0}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IBufferD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a buffer object. -class IBufferD3D11 : public IBuffer +DILIGENT_INTERFACE(IBufferD3D11, IBuffer) { -public: /// Returns a pointer to the ID3D11Buffer interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11Buffer* GetD3D11Buffer() = 0; + VIRTUAL ID3D11Buffer* METHOD(GetD3D11Buffer)(THIS) PURE; }; -#else - -struct IBufferD3D11Methods -{ - ID3D11Buffer* (*GetD3D11Buffer)(); -}; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" +#if DILIGENT_C_INTERFACE struct IBufferD3D11Vtbl { @@ -67,12 +63,12 @@ struct IBufferD3D11Vtbl struct IBufferD3D11Methods BufferD3D11; }; -struct IBufferD3D11 +typedef struct IBufferD3D11 { struct IBufferD3D11Vtbl* pVtbl; -}; +} IBufferD3D11; -# define IBufferD3D11_GetD3D11Buffer(This) (This)->pVtbl->BufferD3D11.GetD3D11Buffer((struct IBufferD3D11*)(This)) +# define IBufferD3D11_GetD3D11Buffer(This) (This)->pVtbl->BufferD3D11.GetD3D11Buffer((IBufferD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h index f849e13e..82676456 100644 --- a/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/BufferViewD3D11.h @@ -34,30 +34,26 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) -#if DILIGENT_CPP_INTERFACE - // {6ABA95FC-CD7D-4C03-8CAE-AFC45F9696B7} static const struct INTERFACE_ID IID_BufferViewD3D11 = {0x6aba95fc, 0xcd7d, 0x4c03, {0x8c, 0xae, 0xaf, 0xc4, 0x5f, 0x96, 0x96, 0xb7}}; +#define DILIGENT_INTERFACE_NAME IBufferViewD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D11-specific functionality of a buffer view object. -class IBufferViewD3D11 : public IBufferView +DILIGENT_INTERFACE(IBufferViewD3D11, IBufferView) { -public: /// Returns a pointer to the ID3D11View interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11View* GetD3D11View() = 0; + VIRTUAL ID3D11View* METHOD(GetD3D11View)(THIS) PURE; }; -#else - -struct IBufferViewD3D11Methods -{ - ID3D11View* (*GetD3D11View)(); -}; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" +#if DILIGENT_C_INTERFACE struct IBufferViewD3D11Vtbl { @@ -67,12 +63,12 @@ struct IBufferViewD3D11Vtbl struct IBufferViewD3D11Methods BufferViewD3D11; }; -struct IBufferViewD3D11 +typedef struct IBufferViewD3D11 { struct IBufferViewD3D11Vtbl* pVtbl; -}; +} IBufferViewD3D11; -# define IBufferViewD3D11_GetD3D11View(This) (This)->pVtbl->BufferViewD3D11.GetD3D11View((struct IBufferViewD3D11*)(This)) +# define IBufferViewD3D11_GetD3D11View(This) (This)->pVtbl->BufferViewD3D11.GetD3D11View((IBufferViewD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h b/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h index 257d36e9..cd85ca5c 100644 --- a/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/DeviceContextD3D11.h @@ -38,25 +38,22 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_DeviceContextD3D11 = {0xf0ee0335, 0xc8ab, 0x4ec1, {0xbb, 0x15, 0xb8, 0xee, 0x5f, 0x0, 0x3b, 0x99}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IDeviceContextD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a device context. -class IDeviceContextD3D11 : public IDeviceContext +DILIGENT_INTERFACE(IDeviceContextD3D11, IDeviceContext) { -public: /// Returns a pointer to the ID3D11DeviceContext interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11DeviceContext* GetD3D11DeviceContext() = 0; + VIRTUAL ID3D11DeviceContext* METHOD(GetD3D11DeviceContext)(THIS) PURE; }; -#else +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -struct IDeviceContextD3D11Methods -{ - ID3D11DeviceContext* (*GetD3D11DeviceContext)(); -}; +#if DILIGENT_C_INTERFACE struct IDeviceContextD3D11Vtbl { @@ -66,12 +63,12 @@ struct IDeviceContextD3D11Vtbl struct IDeviceContextD3D11Methods DeviceContextD3D11; }; -struct IDeviceContextD3D11 +typedef struct IDeviceContextD3D11 { struct IDeviceContextD3D11Vtbl* pVtbl; -}; +} IDeviceContextD3D11; -# define IDeviceContextD3D11_GetD3D11DeviceContext(This) (This)->pVtbl->DeviceContextD3D11.GetD3D11DeviceContext((struct IDeviceContextD3D11*)(This)) +# define IDeviceContextD3D11_GetD3D11DeviceContext(This) (This)->pVtbl->DeviceContextD3D11.GetD3D11DeviceContext((IDeviceContextD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h index 924b5631..855081a1 100644 --- a/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/EngineFactoryD3D11.h @@ -45,12 +45,14 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_EngineFactoryD3D11 = {0x62663a30, 0xaaf0, 0x4a9a, {0x97, 0x29, 0x9e, 0xac, 0x6b, 0xf7, 0x89, 0xf2}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IEngineFactoryD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off /// Engine factory for Direct3D11 rendering backend. -struct IEngineFactoryD3D11 : public IEngineFactory +DILIGENT_INTERFACE(IEngineFactoryD3D11, IEngineFactory) { -public: /// Creates a render device and device contexts for Direct3D11-based engine implementation. /// \param [in] EngineCI - Engine creation info. @@ -60,9 +62,10 @@ public: /// the contexts will be written. Immediate context goes at /// position 0. If EngineCI.NumDeferredContexts > 0, /// pointers to deferred contexts are written afterwards. - virtual void CreateDeviceAndContextsD3D11(const EngineD3D11CreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts) = 0; + VIRTUAL void METHOD(CreateDeviceAndContextsD3D11)(THIS_ + const EngineD3D11CreateInfo REF EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts) PURE; /// Creates a swap chain for Direct3D11-based engine implementation. @@ -79,12 +82,13 @@ public: /// /// \param [out] ppSwapChain - Address of the memory location where pointer to the new /// swap chain will be written. - virtual void CreateSwapChainD3D11(IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SCDesc, - const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, - ISwapChain** ppSwapChain) = 0; + VIRTUAL void METHOD(CreateSwapChainD3D11)(THIS_ + IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc REF SCDesc, + const FullScreenModeDesc REF FSDesc, + void* pNativeWndHandle, + ISwapChain** ppSwapChain) PURE; /// Attaches to existing Direct3D11 render device and immediate context. @@ -98,11 +102,12 @@ public: /// the contexts will be written. Immediate context goes at /// position 0. If EngineCI.NumDeferredContexts > 0, /// pointers to the deferred contexts are written afterwards. - virtual void AttachToD3D11Device(void* pd3d11NativeDevice, - void* pd3d11ImmediateContext, - const EngineD3D11CreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts) = 0; + VIRTUAL void METHOD(AttachToD3D11Device)(THIS_ + void* pd3d11NativeDevice, + void* pd3d11ImmediateContext, + const EngineD3D11CreateInfo REF EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts) PURE; /// Enumerates adapters available on this machine. @@ -118,9 +123,10 @@ public: /// \param [out] Adapters - Pointer to the array conataining adapter information. If /// null is provided, the number of available adapters is /// written to NumAdapters. - virtual void EnumerateAdapters(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, - Uint32& NumAdapters, - AdapterAttribs* Adapters) = 0; + VIRTUAL void METHOD(EnumerateAdapters)(THIS_ + DIRECT3D_FEATURE_LEVEL MinFeatureLevel, + Uint32 REF NumAdapters, + AdapterAttribs* Adapters) PURE; /// Enumerates available display modes for the specified output of the specified adapter. @@ -135,54 +141,20 @@ public: /// this value should contain the maximum number of elements /// to be written to DisplayModes array. It is overwritten with /// the actual number of display modes written. - virtual void EnumerateDisplayModes(DIRECT3D_FEATURE_LEVEL MinFeatureLevel, - Uint32 AdapterId, - Uint32 OutputId, - TEXTURE_FORMAT Format, - Uint32& NumDisplayModes, - DisplayModeAttribs* DisplayModes) = 0; + VIRTUAL void METHOD(EnumerateDisplayModes)(THIS_ + DIRECT3D_FEATURE_LEVEL MinFeatureLevel, + Uint32 AdapterId, + Uint32 OutputId, + TEXTURE_FORMAT Format, + Uint32 REF NumDisplayModes, + DisplayModeAttribs* DisplayModes) PURE; }; -#else + // clang-format on -struct IEngineFactoryD3D11; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -struct IEngineFactoryD3D11Methods -{ - void (*CreateDeviceAndContextsD3D11)(struct IEngineFactoryD3D11*, - const struct EngineD3D11CreateInfo* EngineCI, - struct IRenderDevice** ppDevice, - struct IDeviceContext** ppContexts); - - void (*CreateSwapChainD3D11)(struct IEngineFactoryD3D11*, - struct IRenderDevice* pDevice, - struct IDeviceContext* pImmediateContext, - const struct SwapChainDesc* SCDesc, - const struct FullScreenModeDesc* FSDesc, - void* pNativeWndHandle, - struct ISwapChain** ppSwapChain); - - void (*AttachToD3D11Device)(struct IEngineFactoryD3D11*, - void* pd3d11NativeDevice, - void* pd3d11ImmediateContext, - const struct EngineD3D11CreateInfo* EngineCI, - struct IRenderDevice** ppDevice, - struct 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); -}; +#if DILIGENT_C_INTERFACE struct IEngineFactoryD3D11Vtbl { @@ -191,18 +163,18 @@ struct IEngineFactoryD3D11Vtbl struct IEngineFactoryD3D11Methods EngineFactoryD3D11; }; -struct IEngineFactoryD3D11 +typedef struct IEngineFactoryD3D11 { struct IEngineFactoryD3D11Vtbl* pVtbl; -}; +} IEngineFactoryD3D11; // 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__) +# define IEngineFactoryD3D11_CreateDeviceAndContextsD3D11(This, ...) (This)->pVtbl->EngineFactoryD3D11.CreateDeviceAndContextsD3D11((IEngineFactoryD3D11*)(This), __VA_ARGS__) +# define IEngineFactoryD3D11_CreateSwapChainD3D11(This, ...) (This)->pVtbl->EngineFactoryD3D11.CreateSwapChainD3D11 ((IEngineFactoryD3D11*)(This), __VA_ARGS__) +# define IEngineFactoryD3D11_AttachToD3D11Device(This, ...) (This)->pVtbl->EngineFactoryD3D11.AttachToD3D11Device ((IEngineFactoryD3D11*)(This), __VA_ARGS__) +# define IEngineFactoryD3D11_EnumerateAdapters(This, ...) (This)->pVtbl->EngineFactoryD3D11.EnumerateAdapters ((IEngineFactoryD3D11*)(This), __VA_ARGS__) +# define IEngineFactoryD3D11_EnumerateDisplayModes(This, ...) (This)->pVtbl->EngineFactoryD3D11.EnumerateDisplayModes ((IEngineFactoryD3D11*)(This), __VA_ARGS__) // clang-format on diff --git a/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h b/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h index 6d9349fa..969cb8c3 100644 --- a/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h @@ -38,6 +38,9 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_FenceD3D11 = {0x45f2be28, 0x652b, 0x4180, {0xb6, 0xe4, 0xe7, 0x5f, 0x83, 0xf6, 0x3c, 0xc7}}; +#define DILIGENT_INTERFACE_NAME IFenceD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + #if DILIGENT_CPP_INTERFACE /// Exposes Direct3D11-specific functionality of a fence object. @@ -45,11 +48,11 @@ class IFenceD3D11 : public IFence { }; -#else +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -//struct IFenceD3D11Methods -//{ -//}; +#if DILIGENT_C_INTERFACE struct IFenceD3D11Vtbl { @@ -59,10 +62,10 @@ struct IFenceD3D11Vtbl //struct IFenceD3D11Methods FenceD3D11; }; -struct IFenceD3D11 +typedef struct IFenceD3D11 { struct IFenceD3D11Vtbl* pVtbl; -}; +} IFenceD3D11; #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h b/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h index 2311ade1..fd277602 100644 --- a/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/PipelineStateD3D11.h @@ -38,97 +38,79 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_PipelineStateD3D11 = {0x3ea6e3f4, 0x9966, 0x47fc, {0x8c, 0xe8, 0xe, 0xb3, 0xe2, 0x27, 0x30, 0x61}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IPipelineStateD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a pipeline state object. -class IPipelineStateD3D11 : public IPipelineState +DILIGENT_INTERFACE(IPipelineStateD3D11, IPipelineState) { -public: /// Returns a pointer to the ID3D11BlendState interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11BlendState* GetD3D11BlendState() = 0; + VIRTUAL ID3D11BlendState* METHOD(GetD3D11BlendState)(THIS) PURE; /// Returns a pointer to the ID3D11RasterizerState interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11RasterizerState* GetD3D11RasterizerState() = 0; + VIRTUAL ID3D11RasterizerState* METHOD(GetD3D11RasterizerState)(THIS) PURE; /// Returns a pointer to the ID3D11DepthStencilState interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11DepthStencilState* GetD3D11DepthStencilState() = 0; + VIRTUAL ID3D11DepthStencilState* METHOD(GetD3D11DepthStencilState)(THIS) PURE; /// Returns a pointer to the ID3D11InputLayout interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11InputLayout* GetD3D11InputLayout() = 0; + VIRTUAL ID3D11InputLayout* METHOD(GetD3D11InputLayout)(THIS) PURE; /// Returns a pointer to the ID3D11VertexShader interface of the internal vertex shader object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11VertexShader* GetD3D11VertexShader() = 0; + VIRTUAL ID3D11VertexShader* METHOD(GetD3D11VertexShader)(THIS) PURE; /// Returns a pointer to the ID3D11PixelShader interface of the internal pixel shader object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11PixelShader* GetD3D11PixelShader() = 0; + VIRTUAL ID3D11PixelShader* METHOD(GetD3D11PixelShader)(THIS) PURE; /// Returns a pointer to the ID3D11GeometryShader interface of the internal geometry shader object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11GeometryShader* GetD3D11GeometryShader() = 0; + VIRTUAL ID3D11GeometryShader* METHOD(GetD3D11GeometryShader)(THIS) PURE; /// Returns a pointer to the ID3D11DomainShader interface of the internal domain shader object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11DomainShader* GetD3D11DomainShader() = 0; + VIRTUAL ID3D11DomainShader* METHOD(GetD3D11DomainShader)(THIS) PURE; /// Returns a pointer to the ID3D11HullShader interface of the internal hull shader object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11HullShader* GetD3D11HullShader() = 0; + VIRTUAL ID3D11HullShader* METHOD(GetD3D11HullShader)(THIS) PURE; /// Returns a pointer to the ID3D11ComputeShader interface of the internal compute shader object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11ComputeShader* GetD3D11ComputeShader() = 0; + VIRTUAL ID3D11ComputeShader* METHOD(GetD3D11ComputeShader)(THIS) PURE; }; -#else +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -// 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 +#if DILIGENT_C_INTERFACE struct IPipelineStateD3D11Vtbl { @@ -138,23 +120,23 @@ struct IPipelineStateD3D11Vtbl struct IPipelineStateD3D11Methods PipelineStateD3D11; }; -struct IPipelineStateD3D11 +typedef struct IPipelineStateD3D11 { struct IPipelineStateD3D11Vtbl* pVtbl; -}; +} IPipelineStateD3D11; // 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)) +# define IPipelineStateD3D11_GetD3D11BlendState(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11BlendState ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11RasterizerState(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11RasterizerState ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11DepthStencilState(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11DepthStencilState((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11InputLayout(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11InputLayout ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11VertexShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11VertexShader ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11PixelShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11PixelShader ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11GeometryShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11GeometryShader ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11DomainShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11DomainShader ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11HullShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11HullShader ((IPipelineStateD3D11*)(This)) +# define IPipelineStateD3D11_GetD3D11ComputeShader(This) (This)->pVtbl->PipelineStateD3D11.GetD3D11ComputeShader ((IPipelineStateD3D11*)(This)) // clang-format on diff --git a/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h index 26f5dd61..65e4c306 100644 --- a/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/QueryD3D11.h @@ -38,21 +38,19 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_QueryD3D11 = {0x77d95eaa, 0xd16e, 0x43f4, {0xb0, 0xeb, 0xbe, 0xbc, 0xd2, 0xec, 0x8c, 0x57}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IPipelineStateD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a Query object. -class IQueryD3D11 : public IQuery +DILIGENT_INTERFACE(IQueryD3D11, IQuery) { /// Returns a pointer to the internal ID3D11Query object. - virtual ID3D11Query* GetD3D11Query() = 0; + VIRTUAL ID3D11Query* METHOD(GetD3D11Query)(THIS) PURE; }; -#else +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -struct IQueryD3D11Methods -{ - ID3D11Query* (*GetD3D11Query)(); -}; +#if DILIGENT_C_INTERFACE struct IQueryD3D11Vtbl { @@ -62,12 +60,12 @@ struct IQueryD3D11Vtbl struct IQueryD3D11Methods QueryD3D11; }; -struct IQueryD3D11 +typedef struct IQueryD3D11 { struct IQueryD3D11Vtbl* pVtbl; -}; +} IQueryD3D11; -# define IQueryD3D11_GetD3D11Query(This) (This)->pVtbl->QueryD3D11.GetD3D11Query((struct IQueryD3D11*)(This)) +# define IQueryD3D11_GetD3D11Query(This) (This)->pVtbl->QueryD3D11.GetD3D11Query((IQueryD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h index 87f3c00c..e6e81a55 100644 --- a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h @@ -38,17 +38,19 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_RenderDeviceD3D11 = {0x5b1cbb8, 0xfcad, 0x49ee, {0xba, 0xda, 0x78, 0x1, 0x22, 0x3e, 0xc3, 0xfe}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IRenderDeviceD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off /// Exposes Direct3D11-specific functionality of a render device. -class IRenderDeviceD3D11 : public IRenderDevice +DILIGENT_INTERFACE(IRenderDeviceD3D11, IRenderDevice) { -public: /// Returns a pointer to the ID3D11Device interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11Device* GetD3D11Device() = 0; + VIRTUAL ID3D11Device* METHOD(GetD3D11Device)(THIS) PURE; /// Creates a buffer object from native d3d11 buffer @@ -62,10 +64,11 @@ public: /// buffer interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, - const BufferDesc& BuffDesc, - RESOURCE_STATE InitialState, - IBuffer** ppBuffer) = 0; + VIRTUAL void METHOD(CreateBufferFromD3DResource)(THIS_ + ID3D11Buffer* pd3d11Buffer, + const BufferDesc REF BuffDesc, + RESOURCE_STATE InitialState, + IBuffer** ppBuffer) PURE; /// Creates a texture object from native d3d11 1D texture @@ -75,9 +78,10 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, - RESOURCE_STATE InitialState, - ITexture** ppTexture) = 0; + VIRTUAL void METHOD(CreateTexture1DFromD3DResource)(THIS_ + ID3D11Texture1D* pd3d11Texture, + RESOURCE_STATE InitialState, + ITexture** ppTexture) PURE; /// Creates a texture object from native d3d11 2D texture @@ -87,9 +91,10 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, - RESOURCE_STATE InitialState, - ITexture** ppTexture) = 0; + VIRTUAL void METHOD(CreateTexture2DFromD3DResource)(THIS_ + ID3D11Texture2D* pd3d11Texture, + RESOURCE_STATE InitialState, + ITexture** ppTexture) PURE; /// Creates a texture object from native d3d11 3D texture @@ -99,14 +104,39 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, - RESOURCE_STATE InitialState, - ITexture** ppTexture) = 0; + VIRTUAL void METHOD(CreateTexture3DFromD3DResource)(THIS_ + ID3D11Texture3D* pd3d11Texture, + RESOURCE_STATE InitialState, + ITexture** ppTexture) PURE; }; -#else + // clang-format on + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IRenderDeviceD3D11Vtbl +{ + struct IObjectMethods Object; + struct IRenderDeviceMethods RenderDevice; + struct IRenderDeviceD3D11Methods RenderDeviceD3D11; +}; + +typedef struct IRenderDeviceD3D11 +{ + struct IRenderDeviceD3D11Vtbl* pVtbl; +} IRenderDeviceD3D11; + +// clang-format off +# define IRenderDeviceD3D11_GetD3D11Device(This) (This)->pVtbl->RenderDeviceD3D11.GetD3D11Device ((IRenderDeviceD3D11*)(This)) +# define IRenderDeviceD3D11_CreateBufferFromD3DResource(This, ...) (This)->pVtbl->RenderDeviceD3D11.CreateBufferFromD3DResource ((IRenderDeviceD3D11*)(This), __VA_ARGS__) +# define IRenderDeviceD3D11_CreateTexture1DFromD3DResource(This, ...) (This)->pVtbl->RenderDeviceD3D11.CreateTexture1DFromD3DResource((IRenderDeviceD3D11*)(This), __VA_ARGS__) +# define IRenderDeviceD3D11_CreateTexture2DFromD3DResource(This, ...) (This)->pVtbl->RenderDeviceD3D11.CreateTexture2DFromD3DResource((IRenderDeviceD3D11*)(This), __VA_ARGS__) +# define IRenderDeviceD3D11_CreateTexture3DFromD3DResource(This, ...) (This)->pVtbl->RenderDeviceD3D11.CreateTexture3DFromD3DResource((IRenderDeviceD3D11*)(This), __VA_ARGS__) +// clang-format on #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h index 5c86298b..8dbd054d 100644 --- a/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/SamplerD3D11.h @@ -38,25 +38,22 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_SamplerD3D11 = {0x31a3bfaf, 0x738e, 0x4d8c, {0xad, 0x18, 0xb0, 0x21, 0xc5, 0xd9, 0x48, 0xdd}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME ISamplerD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a sampler object. -class ISamplerD3D11 : public ISampler +DILIGENT_INTERFACE(ISamplerD3D11, ISampler) { -public: /// Returns a pointer to the ID3D11SamplerState interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11SamplerState* GetD3D11SamplerState() = 0; + VIRTUAL ID3D11SamplerState* METHOD(GetD3D11SamplerState)(THIS) PURE; }; -#else +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -struct ISamplerD3D11Methods -{ - ID3D11SamplerState* (*GetD3D11Sampler)(); -}; +#if DILIGENT_C_INTERFACE struct ISamplerD3D11Vtbl { @@ -66,12 +63,12 @@ struct ISamplerD3D11Vtbl struct ISamplerD3D11Methods SamplerD3D11; }; -struct ISamplerD3D11 +typedef struct ISamplerD3D11 { struct ISamplerD3D11Vtbl* pVtbl; -}; +} ISamplerD3D11; -# define ISamplerD3D11_GetD3D11Sampler(This) (This)->pVtbl->SamplerD3D11.GetD3D11Sampler((struct ISamplerD3D11*)(This)) +# define ISamplerD3D11_GetD3D11SamplerState(This) (This)->pVtbl->SamplerD3D11.GetD3D11SamplerState((ISamplerD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h index f105cae6..f7240f90 100644 --- a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h @@ -38,25 +38,22 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_ShaderD3D11 = {0xc513e83e, 0xb037, 0x405b, {0x8b, 0x49, 0xbf, 0x8f, 0x5c, 0x22, 0xd, 0xee}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME IShaderD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a shader object. -class IShaderD3D11 : public IShaderD3D +DILIGENT_INTERFACE(IShaderD3D11, IShaderD3D) { -public: /// Returns a pointer to the ID3D11DeviceChild interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11DeviceChild* GetD3D11Shader() = 0; + VIRTUAL ID3D11DeviceChild* METHOD(GetD3D11Shader)(THIS) PURE; }; -#else +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -struct IShaderD3D11Methods -{ - ID3D11DeviceChild* (*GetD3D11Shader)(); -}; +#if DILIGENT_C_INTERFACE struct IShaderD3D11Vtbl { diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h index dc4fa996..dd9da9fd 100644 --- a/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/ShaderResourceBindingD3D11.h @@ -38,6 +38,9 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_ShaderResourceBindingD3D11 = {0x97a6d4ac, 0xd4af, 0x4aa9, {0xb4, 0x6c, 0x67, 0x41, 0x7b, 0x89, 0x2, 0x6a}}; +#define DILIGENT_INTERFACE_NAME IShaderResourceBindingD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + #if DILIGENT_CPP_INTERFACE /// Exposes Direct3D11-specific functionality of a shader resource binding object. @@ -45,7 +48,24 @@ class IShaderResourceBindingD3D11 : public IShaderResourceBinding { }; -#else +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IShaderResourceBindingD3D11Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IShaderResourceBindingMethods ShaderResourceBinding; + //struct IShaderResourceBindingD3D11Methods ShaderResourceBindingD3D11; +}; + +struct IShaderResourceBindingD3D11 +{ + struct IShaderResourceBindingD3D11Vtbl* pVtbl; +}; #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h index cb89ade5..a7c743de 100644 --- a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h @@ -39,26 +39,49 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const struct INTERFACE_ID IID_SwapChainD3D11 = {0x4daf2e76, 0x9204, 0x4dc4, {0xa5, 0x3a, 0xb0, 0x0, 0x97, 0x41, 0x2d, 0x3a}}; -#if DILIGENT_CPP_INTERFACE +#define DILIGENT_INTERFACE_NAME ISwapChainD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D11-specific functionality of a swap chain. -class ISwapChainD3D11 : public ISwapChain +DILIGENT_INTERFACE(ISwapChainD3D11, ISwapChain) { -public: /// Returns render target view of the back buffer in the swap chain - virtual ITextureViewD3D11* GetCurrentBackBufferRTV() = 0; + VIRTUAL struct ITextureViewD3D11* METHOD(GetCurrentBackBufferRTV)(THIS) PURE; /// Returns depth-stencil view of the depth buffer - virtual ITextureViewD3D11* GetDepthBufferDSV() = 0; + VIRTUAL struct ITextureViewD3D11* METHOD(GetDepthBufferDSV)(THIS) PURE; /// Returns a pointer to the IDXGISwapChain interface of the internal DXGI object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual IDXGISwapChain* GetDXGISwapChain() = 0; + VIRTUAL IDXGISwapChain* METHOD(GetDXGISwapChain)(THIS) PURE; }; -#else +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ISwapChainD3D11Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ISwapChainMethods SwapChain; + struct ISwapChainD3D11Methods SwapChainD3D11; +}; + +typedef struct ISwapChainD3D11 +{ + struct ISwapChainD3D11Vtbl* pVtbl; +} ISwapChainD3D11; + +// clang-format off + +# define ISwapChainD3D11_GetCurrentBackBufferRTV(This) (This)->pVtbl->SwapChainD3D11.GetCurrentBackBufferRTV((ISwapChainD3D11*)(This)) +# define ISwapChainD3D11_GetDepthBufferDSV(This) (This)->pVtbl->SwapChainD3D11.GetDepthBufferDSV ((ISwapChainD3D11*)(This)) +# define ISwapChainD3D11_GetDXGISwapChain(This) (This)->pVtbl->SwapChainD3D11.GetDXGISwapChain ((ISwapChainD3D11*)(This)) + +// clang-format on #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h b/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h index 2ef98277..df0390b4 100644 --- a/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/TextureD3D11.h @@ -34,30 +34,26 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) -#if DILIGENT_CPP_INTERFACE - // {F3A84CC2-E485-4E72-A08A-437D7FFBA3AB} -static constexpr INTERFACE_ID IID_TextureD3D11 = +static const INTERFACE_ID IID_TextureD3D11 = {0xf3a84cc2, 0xe485, 0x4e72, {0xa0, 0x8a, 0x43, 0x7d, 0x7f, 0xfb, 0xa3, 0xab}}; +#define DILIGENT_INTERFACE_NAME ITextureD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D11-specific functionality of a texture object. -class ITextureD3D11 : public ITexture +DILIGENT_INTERFACE(ITextureD3D11, ITexture) { -public: /// Returns a pointer to the ID3D11Resource interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11Resource* GetD3D11Texture() = 0; + VIRTUAL ID3D11Resource* METHOD(GetD3D11Texture)(THIS) PURE; }; -#else - -struct ITextureD3D11Methods -{ - ID3D11Resource* (*GetD3D11Texture)(); -}; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" +#if DILIGENT_C_INTERFACE struct ITextureD3D11Vtbl { @@ -67,12 +63,12 @@ struct ITextureD3D11Vtbl struct ITextureD3D11Methods TextureD3D11; }; -struct ITextureD3D11 +typedef struct ITextureD3D11 { struct ITextureD3D11Vtbl* pVtbl; -}; +} ITextureD3D11; -# define ITextureD3D11_GetD3D11Texture(This) (This)->pVtbl->TextureD3D11.GetD3D11Texture((struct ITextureD3D11*)(This)) +# define ITextureD3D11_GetD3D11Texture(This) (This)->pVtbl->TextureD3D11.GetD3D11Texture((ITextureD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h b/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h index b4d52ca1..dca5db9e 100644 --- a/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/TextureViewD3D11.h @@ -34,31 +34,26 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) -#if DILIGENT_CPP_INTERFACE - // {0767EBE4-AD47-4E70-9B65-38C6B9CAC37D} -static constexpr INTERFACE_ID IID_TextureViewD3D11 = +static const INTERFACE_ID IID_TextureViewD3D11 = {0x767ebe4, 0xad47, 0x4e70, {0x9b, 0x65, 0x38, 0xc6, 0xb9, 0xca, 0xc3, 0x7d}}; +#define DILIGENT_INTERFACE_NAME ITextureViewD3D11 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D11-specific functionality of a texture view object. -class ITextureViewD3D11 : public ITextureView +DILIGENT_INTERFACE(ITextureViewD3D11, ITextureView) { -public: /// Returns a pointer to the ID3D11View interface of the internal Direct3D11 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11View* GetD3D11View() = 0; + VIRTUAL ID3D11View* METHOD(GetD3D11View)(THIS) PURE; }; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" -#else - -struct ITextureViewD3D11Methods -{ - ID3D11View* (*GetD3D11View)(); -}; - +#if DILIGENT_C_INTERFACE struct ITextureViewD3D11Vtbl { @@ -68,12 +63,12 @@ struct ITextureViewD3D11Vtbl struct ITextureViewD3D11Methods TextureViewD3D11; }; -struct ITextureViewD3D11 +typedef struct ITextureViewD3D11 { struct ITextureViewD3D11Vtbl* pVtbl; -}; +} ITextureViewD3D11; -# define ITextureViewD3D11_GetD3D11View(This) (This)->pVtbl->TextureViewD3D11.GetD3D11View((struct ITextureViewD3D11*)(This)) +# define ITextureViewD3D11_GetD3D11View(This) (This)->pVtbl->TextureViewD3D11.GetD3D11View((ITextureViewD3D11*)(This)) #endif diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index 1046f6ff..49b86852 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -239,7 +239,7 @@ void RenderDeviceD3D11Impl::CreateShader(const ShaderCreateInfo& ShaderCI, IShad }); } -void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) +void RenderDeviceD3D11Impl::CreateTexture1DFromD3DResource(ID3D11Texture1D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) { if (pd3d11Texture == nullptr) return; @@ -256,7 +256,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11 }); } -void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) +void RenderDeviceD3D11Impl::CreateTexture2DFromD3DResource(ID3D11Texture2D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) { if (pd3d11Texture == nullptr) return; @@ -273,7 +273,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11 }); } -void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) +void RenderDeviceD3D11Impl::CreateTexture3DFromD3DResource(ID3D11Texture3D* pd3d11Texture, RESOURCE_STATE InitialState, ITexture** ppTexture) { if (pd3d11Texture == nullptr) return; diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp index 0beb5eb8..2dceffc7 100644 --- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp @@ -77,7 +77,7 @@ void SwapChainD3D11Impl::CreateRTVandDSV() DEV_CHECK_ERR(SUCCEEDED(hr), "Failed to set back buffer name"); RefCntAutoPtr<ITexture> pBackBuffer; - pRenderDeviceD3D11Impl->CreateTextureFromD3DResource(pd3dBackBuffer, RESOURCE_STATE_UNDEFINED, &pBackBuffer); + pRenderDeviceD3D11Impl->CreateTexture2DFromD3DResource(pd3dBackBuffer, RESOURCE_STATE_UNDEFINED, &pBackBuffer); TextureViewDesc RTVDesc; RTVDesc.ViewType = TEXTURE_VIEW_RENDER_TARGET; |
