diff options
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
15 files changed, 596 insertions, 159 deletions
diff --git a/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h b/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h index 12e3175b..ee9bcf4b 100644 --- a/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h @@ -33,17 +33,20 @@ #include "../../GraphicsEngine/interface/Buffer.h" #include "../../GraphicsEngine/interface/DeviceContext.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {3E9B15ED-A289-48DC-8214-C6E3E6177378} -static constexpr INTERFACE_ID IID_BufferD3D12 = +static const INTERFACE_ID IID_BufferD3D12 = {0x3e9b15ed, 0xa289, 0x48dc, {0x82, 0x14, 0xc6, 0xe3, 0xe6, 0x17, 0x73, 0x78}}; +#define DILIGENT_INTERFACE_NAME IBufferD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Exposes Direct3D12-specific functionality of a buffer object. -class IBufferD3D12 : public IBuffer +DILIGENT_INTERFACE(IBufferD3D12, IBuffer) { -public: /// Returns a pointer to the ID3D12Resource interface of the internal Direct3D12 object. /// The method does *NOT* call AddRef() on the returned interface, @@ -53,17 +56,43 @@ public: /// is required for dynamic buffers, which are /// suballocated in a dynamic upload heap /// \param [in] pContext - Device context within which address of the buffer is requested. - virtual ID3D12Resource* GetD3D12Buffer(Uint64& DataStartByteOffset, IDeviceContext* pContext) = 0; + VIRTUAL ID3D12Resource* METHOD(GetD3D12Buffer)(THIS_ + Uint64 REF DataStartByteOffset, + IDeviceContext* pContext) PURE; /// Sets the buffer usage state /// \param [in] state - D3D12 resource state to be set for this buffer - virtual void SetD3D12ResourceState(D3D12_RESOURCE_STATES state) = 0; + VIRTUAL void METHOD(SetD3D12ResourceState)(THIS_ + D3D12_RESOURCE_STATES state) PURE; /// Returns current D3D12 buffer state. /// If the state is unknown to the engine (Diligent::RESOURCE_STATE_UNKNOWN), /// returns D3D12_RESOURCE_STATE_COMMON (0). - virtual D3D12_RESOURCE_STATES GetD3D12ResourceState() const = 0; + VIRTUAL D3D12_RESOURCE_STATES METHOD(GetD3D12ResourceState)(THIS) CONST PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IBufferD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IBufferMethods Buffer; + struct IBufferD3D12Methods BufferD3D12; }; -} // namespace Diligent +typedef struct IBufferD3D12 +{ + struct IBufferD3D12Vtbl* pVtbl; +} IBufferD3D12; + +# define IBufferD3D12_GetD3D12Buffer(This, ...) (This)->pVtbl->BufferD3D12.GetD3D12Buffer ((IBufferD3D12*)(This), __VA_ARGS__) +# define IBufferD3D12_SetD3D12ResourceState(This, ...) (This)->pVtbl->BufferD3D12.SetD3D12ResourceState((IBufferD3D12*)(This), __VA_ARGS__) +# define IBufferD3D12_GetD3D12ResourceState(This) (This)->pVtbl->BufferD3D12.GetD3D12ResourceState((IBufferD3D12*)(This)) + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h b/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h index 3dc67863..8575e220 100644 --- a/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h @@ -32,19 +32,41 @@ #include "../../GraphicsEngine/interface/BufferView.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {09643F2F-40D4-4076-B086-9E5CDC2CC4FC} -static constexpr INTERFACE_ID IID_BufferViewD3D12 = +static const INTERFACE_ID IID_BufferViewD3D12 = {0x9643f2f, 0x40d4, 0x4076, {0xb0, 0x86, 0x9e, 0x5c, 0xdc, 0x2c, 0xc4, 0xfc}}; +#define DILIGENT_INTERFACE_NAME IBufferViewD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D12-specific functionality of a buffer view object. -class IBufferViewD3D12 : public IBufferView +DILIGENT_INTERFACE(IBufferViewD3D12, IBufferView) { -public: /// Returns CPU descriptor handle of the buffer view. - virtual D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle() = 0; + VIRTUAL D3D12_CPU_DESCRIPTOR_HANDLE METHOD(GetCPUDescriptorHandle)(THIS) PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IBufferViewD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IBufferViewMethods BufferView; + struct IBufferViewD3D12Methods BufferViewD3D12; +}; + +typedef struct IBufferViewD3D12 +{ + struct IBufferViewD3D12Vtbl* pVtbl; +} IBufferViewD3D12; + +# define IBufferViewD3D12_GetCPUDescriptorHandle(This) (This)->pVtbl->BufferViewD3D12.GetCPUDescriptorHandle((IBufferViewD3D12*)(This)) + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h b/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h index e5078cdd..60086779 100644 --- a/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h @@ -30,36 +30,74 @@ /// \file /// Definition of the Diligent::ICommandQueueD3D12 interface -namespace Diligent -{ +#include "../../../Primitives/interface/Object.h" + +DILIGENT_BEGIN_NAMESPACE(Diligent) // {D89693CE-F3F4-44B5-B7EF-24115AAD085E} -static constexpr INTERFACE_ID IID_CommandQueueD3D12 = +static const INTERFACE_ID IID_CommandQueueD3D12 = {0xd89693ce, 0xf3f4, 0x44b5, {0xb7, 0xef, 0x24, 0x11, 0x5a, 0xad, 0x8, 0x5e}}; +#define DILIGENT_INTERFACE_NAME ICommandQueueD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Command queue interface -class ICommandQueueD3D12 : public IObject +DILIGENT_INTERFACE(ICommandQueueD3D12, IObject) { -public: /// Returns the fence value that will be signaled next time - virtual Uint64 GetNextFenceValue() const = 0; + VIRTUAL Uint64 METHOD(GetNextFenceValue)(THIS) CONST PURE; /// Executes a given command list /// \return Fence value associated with the executed command list - virtual Uint64 Submit(ID3D12GraphicsCommandList* commandList) = 0; + VIRTUAL Uint64 METHOD(Submit)(THIS_ + ID3D12GraphicsCommandList* commandList) PURE; /// Returns D3D12 command queue. May return null if queue is anavailable - virtual ID3D12CommandQueue* GetD3D12CommandQueue() = 0; + VIRTUAL ID3D12CommandQueue* METHOD(GetD3D12CommandQueue)(THIS) PURE; /// Returns value of the last completed fence - virtual Uint64 GetCompletedFenceValue() = 0; + VIRTUAL Uint64 METHOD(GetCompletedFenceValue)(THIS) PURE; /// Blocks execution until all pending GPU commands are complete - virtual Uint64 WaitForIdle() = 0; + VIRTUAL Uint64 METHOD(WaitForIdle)(THIS) PURE; /// Signals the given fence - virtual void SignalFence(ID3D12Fence* pFence, Uint64 Value) = 0; + VIRTUAL void METHOD(SignalFence)(THIS_ + ID3D12Fence* pFence, + Uint64 Value) PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct ICommandQueueD3D12Vtbl +{ + struct IObjectMethods Object; + struct ICommandQueueD3D12Methods CommandQueueD3D12; }; -} // namespace Diligent +typedef struct ICommandQueueD3D12 +{ + struct ICommandQueueD3D12Vtbl* pVtbl; +} ICommandQueueD3D12; + +// clang-format off + +# define ICommandQueueD3D12_GetNextFenceValue(This) (This)->pVtbl->CommandQueueD3D12.GetNextFenceValue ((ICommandQueueD3D12*)(This)) +# define ICommandQueueD3D12_Submit(This, ...) (This)->pVtbl->CommandQueueD3D12.Submit ((ICommandQueueD3D12*)(This), __VA_ARGS__) +# define ICommandQueueD3D12_GetD3D12CommandQueue(This) (This)->pVtbl->CommandQueueD3D12.GetD3D12CommandQueue ((ICommandQueueD3D12*)(This)) +# define ICommandQueueD3D12_GetCompletedFenceValue(This) (This)->pVtbl->CommandQueueD3D12.GetCompletedFenceValue((ICommandQueueD3D12*)(This)) +# define ICommandQueueD3D12_WaitForIdle(This) (This)->pVtbl->CommandQueueD3D12.WaitForIdle ((ICommandQueueD3D12*)(This)) +# define ICommandQueueD3D12_SignalFence(This, ...) (This)->pVtbl->CommandQueueD3D12.SignalFence ((ICommandQueueD3D12*)(This), __VA_ARGS__) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h b/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h index c4e2ed89..ca55515c 100644 --- a/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h @@ -33,28 +33,35 @@ #include "../../GraphicsEngine/interface/DeviceContext.h" #include "CommandQueueD3D12.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {DDE9E3AB-5109-4026-92B7-F5E7EC83E21E} -static constexpr INTERFACE_ID IID_DeviceContextD3D12 = +static const INTERFACE_ID IID_DeviceContextD3D12 = {0xdde9e3ab, 0x5109, 0x4026, {0x92, 0xb7, 0xf5, 0xe7, 0xec, 0x83, 0xe2, 0x1e}}; +#define DILIGENT_INTERFACE_NAME IDeviceContextD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Exposes Direct3D12-specific functionality of a device context. -class IDeviceContextD3D12 : public IDeviceContext +DILIGENT_INTERFACE(IDeviceContextD3D12, IDeviceContext) { -public: /// Transitions internal D3D12 texture object to a specified state /// \param [in] pTexture - texture to transition /// \param [in] State - D3D12 resource state this texture to transition to - virtual void TransitionTextureState(ITexture* pTexture, D3D12_RESOURCE_STATES State) = 0; + VIRTUAL void METHOD(TransitionTextureState)(THIS_ + ITexture* pTexture, + D3D12_RESOURCE_STATES State) PURE; /// Transitions internal D3D12 buffer object to a specified state /// \param [in] pBuffer - Buffer to transition /// \param [in] State - D3D12 resource state this buffer to transition to - virtual void TransitionBufferState(IBuffer* pBuffer, D3D12_RESOURCE_STATES State) = 0; + VIRTUAL void METHOD(TransitionBufferState)(THIS_ + IBuffer* pBuffer, + D3D12_RESOURCE_STATES State) PURE; /// Returns a pointer to Direct3D12 graphics command list that is currently being recorded @@ -73,7 +80,7 @@ public: /// states in the command list, it must invalidate the engine's internal state tracking by /// calling IDeviceContext::InvalidateState() and then manually restore all required states via /// appropriate Diligent API calls. - virtual ID3D12GraphicsCommandList* GetD3D12CommandList() = 0; + VIRTUAL ID3D12GraphicsCommandList* METHOD(GetD3D12CommandList)(THIS) PURE; /// Locks the internal mutex and returns a pointer to the command queue that is associated with this device context. @@ -91,10 +98,41 @@ public: /// /// The engine manages the lifetimes of command queues and all other device objects, /// so an application must not call AddRef/Release methods on the returned interface. - virtual ICommandQueueD3D12* LockCommandQueue() = 0; + VIRTUAL ICommandQueueD3D12* METHOD(LockCommandQueue)(THIS) PURE; /// Unlocks the command queue that was previously locked by IDeviceContextD3D12::LockCommandQueue(). - virtual void UnlockCommandQueue() = 0; + VIRTUAL void METHOD(UnlockCommandQueue)(THIS) PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct IDeviceContextD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IDeviceContextMethods DeviceContext; + struct IDeviceContextD3D12Methods DeviceContextD3D12; +}; + +typedef struct IDeviceContextD3D12 +{ + struct IDeviceContextD3D12Vtbl* pVtbl; +} IDeviceContextD3D12; + +// clang-format off + +# define IDeviceContextD3D12_TransitionTextureState(This, ...) (This)->pVtbl->DeviceContextD3D12.TransitionTextureState((IDeviceContextD3D12*)(This), __VA_ARGS__) +# define IDeviceContextD3D12_TransitionBufferState(This, ...) (This)->pVtbl->DeviceContextD3D12.TransitionBufferState ((IDeviceContextD3D12*)(This), __VA_ARGS__) +# define IDeviceContextD3D12_GetD3D12CommandList(This) (This)->pVtbl->DeviceContextD3D12.GetD3D12CommandList ((IDeviceContextD3D12*)(This)) +# define IDeviceContextD3D12_LockCommandQueue(This) (This)->pVtbl->DeviceContextD3D12.LockCommandQueue ((IDeviceContextD3D12*)(This)) +# define IDeviceContextD3D12_UnlockCommandQueue(This) (This)->pVtbl->DeviceContextD3D12.UnlockCommandQueue ((IDeviceContextD3D12*)(This)) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h index 01bf3bae..a7e0304e 100644 --- a/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h @@ -30,8 +30,6 @@ /// \file /// Declaration of functions that initialize Direct3D12-based engine implementation -#include <sstream> - #include "../../GraphicsEngine/interface/EngineFactory.h" #include "../../GraphicsEngine/interface/RenderDevice.h" #include "../../GraphicsEngine/interface/DeviceContext.h" @@ -41,17 +39,22 @@ # include "../../GraphicsEngine/interface/LoadEngineDll.h" #endif -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) + +struct ICommandQueueD3D12; // {72BD38B0-684A-4889-9C68-0A80EC802DDE} static const INTERFACE_ID IID_EngineFactoryD3D12 = {0x72bd38b0, 0x684a, 0x4889, {0x9c, 0x68, 0xa, 0x80, 0xec, 0x80, 0x2d, 0xde}}; +#define DILIGENT_INTERFACE_NAME IEngineFactoryD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Engine factory for Direct3D12 rendering backend -class IEngineFactoryD3D12 : public IEngineFactory +DILIGENT_INTERFACE(IEngineFactoryD3D12, IEngineFactory) { -public: /// Loads D3D12 DLL and entry points. /// \param [in] DllName - D3D12 dll name. @@ -62,7 +65,8 @@ public: /// load the DLL if it has not be loaded already. /// /// This method has no effect on UWP. - virtual bool LoadD3D12(const char* DllName = "d3d12.dll") = 0; + VIRTUAL bool METHOD(LoadD3D12)(THIS_ + const char* DllName DEFAULT_VALUE("d3d12.dll")) PURE; /// Creates a render device and device contexts for Direct3D12-based engine implementation. @@ -73,9 +77,10 @@ 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 CreateDeviceAndContextsD3D12(const EngineD3D12CreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts) = 0; + VIRTUAL void METHOD(CreateDeviceAndContextsD3D12)(THIS_ + const EngineD3D12CreateInfo REF EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts) PURE; /// Attaches to existing Direct3D12 device. @@ -90,12 +95,13 @@ 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 AttachToD3D12Device(void* pd3d12NativeDevice, - size_t CommandQueueCount, - class ICommandQueueD3D12** ppCommandQueues, - const EngineD3D12CreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts) = 0; + VIRTUAL void METHOD(AttachToD3D12Device)(THIS_ + void* pd3d12NativeDevice, + size_t CommandQueueCount, + struct ICommandQueueD3D12** ppCommandQueues, + const EngineD3D12CreateInfo REF EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts) PURE; /// Creates a swap chain for Direct3D12-based engine implementation. @@ -112,12 +118,13 @@ public: /// /// \param [out] ppSwapChain - Address of the memory location where pointer to the new /// swap chain will be written - virtual void CreateSwapChainD3D12(IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SwapChainDesc, - const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, - ISwapChain** ppSwapChain) = 0; + VIRTUAL void METHOD(CreateSwapChainD3D12)(THIS_ + IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc REF SwapChainDesc, + const FullScreenModeDesc REF FSDesc, + void* pNativeWndHandle, + ISwapChain** ppSwapChain) PURE; /// Enumerates hardware adapters available on this machine. @@ -135,9 +142,10 @@ public: /// NumAdapters /// /// \note D3D12 must be loaded before this method can be called, see IEngineFactoryD3D12::LoadD3D12. - 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. @@ -154,30 +162,60 @@ public: /// the actual number of display modes written. /// /// \note D3D12 must be loaded before this method can be called, see IEngineFactoryD3D12::LoadD3D12. - 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; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct IEngineFactoryD3D12Vtbl +{ + struct IObjectMethods Object; + struct IEngineFactoryMethods EngineFactory; + struct IEngineFactoryD3D12Methods EngineFactoryD3D12; }; +typedef struct IEngineFactoryD3D12 +{ + struct IEngineFactoryD3D12Vtbl* pVtbl; +} IEngineFactoryD3D12; + +// clang-format off + +# define IEngineFactoryD3D12_LoadD3D12(This, ...) (This)->pVtbl->EngineFactoryD3D12.LoadD3D12 ((IEngineFactoryD3D12*)(This), __VA_ARGS__) +# define IEngineFactoryD3D12_CreateDeviceAndContextsD3D12(This, ...) (This)->pVtbl->EngineFactoryD3D12.CreateDeviceAndContextsD3D12((IEngineFactoryD3D12*)(This), __VA_ARGS__) +# define IEngineFactoryD3D12_CreateSwapChainD3D12(This, ...) (This)->pVtbl->EngineFactoryD3D12.CreateSwapChainD3D12 ((IEngineFactoryD3D12*)(This), __VA_ARGS__) +# define IEngineFactoryD3D12_AttachToD3D12Device(This, ...) (This)->pVtbl->EngineFactoryD3D12.AttachToD3D12Device ((IEngineFactoryD3D12*)(This), __VA_ARGS__) +# define IEngineFactoryD3D12_EnumerateAdapters(This, ...) (This)->pVtbl->EngineFactoryD3D12.EnumerateAdapters ((IEngineFactoryD3D12*)(This), __VA_ARGS__) +# define IEngineFactoryD3D12_EnumerateDisplayModes(This, ...) (This)->pVtbl->EngineFactoryD3D12.EnumerateDisplayModes ((IEngineFactoryD3D12*)(This), __VA_ARGS__) + +// clang-format on + +#endif + #if ENGINE_DLL -using GetEngineFactoryD3D12Type = IEngineFactoryD3D12* (*)(); +typedef struct IEngineFactoryD3D12* (*GetEngineFactoryD3D12Type)(); -static bool LoadGraphicsEngineD3D12(GetEngineFactoryD3D12Type& GetFactoryFunc) +inline GetEngineFactoryD3D12Type LoadGraphicsEngineD3D12() { - auto ProcAddress = LoadEngineDll("GraphicsEngineD3D12", "GetEngineFactoryD3D12"); - GetFactoryFunc = reinterpret_cast<GetEngineFactoryD3D12Type>(ProcAddress); - return GetFactoryFunc != nullptr; + return (GetEngineFactoryD3D12Type)LoadEngineDll("GraphicsEngineD3D12", "GetEngineFactoryD3D12"); } #else -IEngineFactoryD3D12* GetEngineFactoryD3D12(); +struct IEngineFactoryD3D12* DILIGENT_GLOBAL_FUNCTION(GetEngineFactoryD3D12)(); #endif -} // namespace Diligent +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/FenceD3D12.h b/Graphics/GraphicsEngineD3D12/interface/FenceD3D12.h index 4719431e..25fc5c04 100644 --- a/Graphics/GraphicsEngineD3D12/interface/FenceD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/FenceD3D12.h @@ -32,26 +32,57 @@ #include "../../GraphicsEngine/interface/Fence.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {053C0D8C-3757-4220-A9CC-4749EC4794AD} -static constexpr INTERFACE_ID IID_FenceD3D12 = +static const INTERFACE_ID IID_FenceD3D12 = {0x53c0d8c, 0x3757, 0x4220, {0xa9, 0xcc, 0x47, 0x49, 0xec, 0x47, 0x94, 0xad}}; +#define DILIGENT_INTERFACE_NAME IFenceD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off /// Exposes Direct3D12-specific functionality of a fence object. -class IFenceD3D12 : public IFence +DILIGENT_INTERFACE(IFenceD3D12, IFence) { -public: /// Returns a pointer to the ID3D12Fence interface of the internal Direct3D12 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D12Fence* GetD3D12Fence() = 0; + VIRTUAL ID3D12Fence* METHOD(GetD3D12Fence)(THIS) PURE; /// Waits until the fence reaches the specified value, on the host. - virtual void WaitForCompletion(Uint64 Value) = 0; + VIRTUAL void METHOD(WaitForCompletion)(THIS_ + Uint64 Value) PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format off + +struct IFenceD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IFenceMethods Fence; + struct IFenceD3D12Methods FenceD3D12; }; -} // namespace Diligent +typedef struct IFenceD3D12 +{ + struct IFenceD3D12Vtbl* pVtbl; +} IFenceD3D12; + +// clang-format off + +# define IFenceD3D12_GetD3D12Fence(This) (This)->pVtbl->FenceD3D12.GetD3D12Fence ((IFenceD3D12*)(This)) +# define IFenceD3D12_WaitForCompletion(This, ...) (This)->pVtbl->FenceD3D12.WaitForCompletion((IFenceD3D12*)(This), __VA_ARGS__) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h b/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h index 349bff44..41cff8d9 100644 --- a/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h @@ -32,29 +32,56 @@ #include "../../GraphicsEngine/interface/PipelineState.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {33C9BE4B-6F23-4F83-A665-5AC1836DF35A} -static constexpr INTERFACE_ID IID_PipelineStateD3D12 = +static const INTERFACE_ID IID_PipelineStateD3D12 = {0x33c9be4b, 0x6f23, 0x4f83, {0xa6, 0x65, 0x5a, 0xc1, 0x83, 0x6d, 0xf3, 0x5a}}; +#define DILIGENT_INTERFACE_NAME IPipelineStateD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" /// Exposes Direct3D12-specific functionality of a pipeline state object. -class IPipelineStateD3D12 : public IPipelineState +DILIGENT_INTERFACE(IPipelineStateD3D12, IPipelineState) { -public: /// Returns ID3D12PipelineState interface of the internal D3D12 pipeline state object object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D12PipelineState* GetD3D12PipelineState() const = 0; + VIRTUAL ID3D12PipelineState* METHOD(GetD3D12PipelineState)(THIS) CONST PURE; /// Returns a pointer to the root signature object associated with this pipeline state. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D12RootSignature* GetD3D12RootSignature() const = 0; + VIRTUAL ID3D12RootSignature* METHOD(GetD3D12RootSignature)(THIS) CONST PURE; +}; + + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IPipelineStateD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IPipelineStateMethods PipelineState; + struct IPipelineStateD3D12Methods PipelineStateD3D12; }; -} // namespace Diligent +typedef struct IPipelineStateD3D12 +{ + struct IPipelineStateD3D12Vtbl* pVtbl; +} IPipelineStateD3D12; + +// clang-format off + +# define IPipelineStateD3D12_GetD3D12PipelineState(This) (This)->pVtbl->PipelineStateD3D12.GetD3D12PipelineState((IPipelineStateD3D12*)(This)) +# define IPipelineStateD3D12_GetD3D12RootSignature(This) (This)->pVtbl->PipelineStateD3D12.GetD3D12RootSignature((IPipelineStateD3D12*)(This)) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/QueryD3D12.h b/Graphics/GraphicsEngineD3D12/interface/QueryD3D12.h index 6dad3772..918172ca 100644 --- a/Graphics/GraphicsEngineD3D12/interface/QueryD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/QueryD3D12.h @@ -32,21 +32,45 @@ #include "../../GraphicsEngine/interface/Query.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {72D109BE-7D70-4E54-84EF-C649DA190B2C} -static constexpr INTERFACE_ID IID_QueryD3D12 = +static const INTERFACE_ID IID_QueryD3D12 = {0x72d109be, 0x7d70, 0x4e54, {0x84, 0xef, 0xc6, 0x49, 0xda, 0x19, 0xb, 0x2c}}; +#define DILIGENT_INTERFACE_NAME IQueryD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D12-specific functionality of a Query object. -class IQueryD3D12 : public IQuery +DILIGENT_INTERFACE(IQueryD3D12, IQuery) { /// Returns the Direct3D12 query heap that internal query object resides in. - virtual ID3D12QueryHeap* GetD3D12QueryHeap() = 0; + VIRTUAL ID3D12QueryHeap* METHOD(GetD3D12QueryHeap)(THIS) PURE; /// Returns the index of a query object in Direct3D12 query heap. - virtual Uint32 GetQueryHeapIndex() const = 0; + VIRTUAL Uint32 METHOD(GetQueryHeapIndex)(THIS) CONST PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IQueryD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IQueryMethods Query; + struct IQueryD3D12Methods QueryD3D12; +}; + +typedef struct IQueryD3D12 +{ + struct IQueryD3D12Vtbl* pVtbl; +} IQueryD3D12; + +# define IQueryD3D12_GetD3D12QueryHeap(This) (This)->pVtbl->QueryD3D12.GetD3D12QueryHeap((IQueryD3D12*)(This)) +# define IQueryD3D12_GetQueryHeapIndex(This) (This)->pVtbl->QueryD3D12.GetQueryHeapIndex((IQueryD3D12*)(This)) + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h b/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h index c9ee5b7c..fa61e89c 100644 --- a/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h @@ -32,31 +32,39 @@ #include "../../GraphicsEngine/interface/RenderDevice.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) + // {C7987C98-87FE-4309-AE88-E98F044B00F6} -static constexpr INTERFACE_ID IID_RenderDeviceD3D12 = +static const INTERFACE_ID IID_RenderDeviceD3D12 = {0xc7987c98, 0x87fe, 0x4309, {0xae, 0x88, 0xe9, 0x8f, 0x4, 0x4b, 0x0, 0xf6}}; +#define DILIGENT_INTERFACE_NAME IRenderDeviceD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Exposes Direct3D12-specific functionality of a render device. -class IRenderDeviceD3D12 : public IRenderDevice +DILIGENT_INTERFACE(IRenderDeviceD3D12, IRenderDevice) { -public: /// Returns ID3D12Device interface of the internal Direct3D12 device object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D12Device* GetD3D12Device() = 0; + VIRTUAL ID3D12Device* METHOD(GetD3D12Device)(THIS) PURE; /// Returns the fence value that will be signaled by the GPU command queue next - virtual Uint64 GetNextFenceValue(Uint32 QueueIndex) = 0; + VIRTUAL Uint64 METHOD(GetNextFenceValue)(THIS_ + Uint32 QueueIndex) PURE; /// Returns the last completed fence value for the given command queue - virtual Uint64 GetCompletedFenceValue(Uint32 QueueIndex) = 0; + VIRTUAL Uint64 METHOD(GetCompletedFenceValue)(THIS_ + Uint32 QueueIndex) PURE; /// Checks if the fence value has been signaled by the GPU. True means /// that all associated work has been finished - virtual Bool IsFenceSignaled(Uint32 QueueIndex, Uint64 FenceValue) = 0; + VIRTUAL Bool METHOD(IsFenceSignaled)(THIS_ + Uint32 QueueIndex, + Uint64 FenceValue) PURE; /// Creates a texture object from native d3d12 resource @@ -66,9 +74,10 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D12Resource* pd3d12Texture, - RESOURCE_STATE InitialState, - ITexture** ppTexture) = 0; + VIRTUAL void METHOD(CreateTextureFromD3DResource)(THIS_ + ID3D12Resource* pd3d12Texture, + RESOURCE_STATE InitialState, + ITexture** ppTexture) PURE; /// Creates a buffer object from native d3d12 resoruce @@ -81,10 +90,42 @@ public: /// buffer interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateBufferFromD3DResource(ID3D12Resource* pd3d12Buffer, - const BufferDesc& BuffDesc, - RESOURCE_STATE InitialState, - IBuffer** ppBuffer) = 0; + VIRTUAL void METHOD(CreateBufferFromD3DResource)(THIS_ + ID3D12Resource* pd3d12Buffer, + const BufferDesc REF BuffDesc, + RESOURCE_STATE InitialState, + IBuffer** ppBuffer) PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct IRenderDeviceD3D12Vtbl +{ + struct IObjectMethods Object; + struct IRenderDeviceMethods RenderDevice; + struct IRenderDeviceD3D12Methods RenderDeviceD3D12; }; -} // namespace Diligent +typedef struct IRenderDeviceD3D12 +{ + struct IRenderDeviceD3D12Vtbl* pVtbl; +} IRenderDeviceD3D12; + +// clang-format off + +# define IRenderDeviceD3D12_GetD3D12Device(This) (This)->pVtbl->RenderDeviceD3D12.GetD3D12Device ((IRenderDeviceD3D12*)(This)) +# define IRenderDeviceD3D12_GetNextFenceValue(This, ...) (This)->pVtbl->RenderDeviceD3D12.GetNextFenceValue ((IRenderDeviceD3D12*)(This), __VA_ARGS__) +# define IRenderDeviceD3D12_GetCompletedFenceValue(This, ...) (This)->pVtbl->RenderDeviceD3D12.GetCompletedFenceValue ((IRenderDeviceD3D12*)(This), __VA_ARGS__) +# define IRenderDeviceD3D12_IsFenceSignaled(This, ...) (This)->pVtbl->RenderDeviceD3D12.IsFenceSignaled ((IRenderDeviceD3D12*)(This), __VA_ARGS__) +# define IRenderDeviceD3D12_CreateTextureFromD3DResource(This, ...) (This)->pVtbl->RenderDeviceD3D12.CreateTextureFromD3DResource((IRenderDeviceD3D12*)(This), __VA_ARGS__) +# define IRenderDeviceD3D12_CreateBufferFromD3DResource(This, ...) (This)->pVtbl->RenderDeviceD3D12.CreateBufferFromD3DResource ((IRenderDeviceD3D12*)(This), __VA_ARGS__) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h b/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h index cb4e6b4a..4e19cf83 100644 --- a/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h @@ -32,22 +32,43 @@ #include "../../GraphicsEngine/interface/Sampler.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {31A3BFAF-738E-4D8C-AD18-B021C5D948DD} -static constexpr INTERFACE_ID IID_SamplerD3D12 = +static const INTERFACE_ID IID_SamplerD3D12 = {0x31a3bfaf, 0x738e, 0x4d8c, {0xad, 0x18, 0xb0, 0x21, 0xc5, 0xd9, 0x48, 0xdd}}; +#define DILIGENT_INTERFACE_NAME ISamplerD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D12-specific functionality of a sampler object. -class ISamplerD3D12 : public ISampler +DILIGENT_INTERFACE(ISamplerD3D12, ISampler) { -public: /// Returns a CPU descriptor handle of the D3D12 sampler object /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle() = 0; + VIRTUAL D3D12_CPU_DESCRIPTOR_HANDLE METHOD(GetCPUDescriptorHandle)(THIS) PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ISamplerD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + //struct ISamplerMethods Sampler; + struct ISamplerD3D12Methods SamplerD3D12; }; -} // namespace Diligent +typedef struct ISamplerD3D12 +{ + struct ISamplerD3D12Vtbl* pVtbl; +} ISamplerD3D12; + +# define ISamplerD3D12_GetCPUDescriptorHandle(This) (This)->pVtbl->SamplerD3D12.GetCPUDescriptorHandle((ISamplerD3D12*)(This)) + +#endif +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h b/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h index 5331d9fd..65c8e32f 100644 --- a/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h @@ -32,17 +32,19 @@ #include "../../GraphicsEngineD3DBase/interface/ShaderD3D.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {C059B160-7F31-4029-943D-0996B98EE79A} -static constexpr INTERFACE_ID IID_ShaderD3D12 = +static const INTERFACE_ID IID_ShaderD3D12 = {0xc059b160, 0x7f31, 0x4029, {0x94, 0x3d, 0x9, 0x96, 0xb9, 0x8e, 0xe7, 0x9a}}; +#define DILIGENT_INTERFACE_NAME IShaderD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes Direct3D12-specific functionality of a shader object. -class IShaderD3D12 : public IShaderD3D -{ -public: +DILIGENT_INTERFACE(IShaderD3D12, IShaderD3D){ /// Returns a pointer to the ID3D12DeviceChild interface of the internal Direct3D12 object. /// The method does *NOT* call AddRef() on the returned interface, @@ -50,4 +52,25 @@ public: //virtual ID3D12DeviceChild* GetD3D12Shader() = 0; }; -} // namespace Diligent +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IShaderD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IShaderMethods Shader; + //struct IShaderD3D12Methods ShaderD3D12; +}; + +typedef struct IShaderD3D12 +{ + struct IShaderD3D12Vtbl* pVtbl; +} IShaderD3D12; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h b/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h index 1cd56d9d..b744ecc3 100644 --- a/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h @@ -32,16 +32,39 @@ #include "../../GraphicsEngine/interface/ShaderResourceBinding.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {70DD5C7C-81FA-4D9A-942F-D1B91423FAAC} -static constexpr INTERFACE_ID IID_ShaderResourceBindingD3D12 = +static const INTERFACE_ID IID_ShaderResourceBindingD3D12 = {0x70dd5c7c, 0x81fa, 0x4d9a, {0x94, 0x2f, 0xd1, 0xb9, 0x14, 0x23, 0xfa, 0xac}}; +#define DILIGENT_INTERFACE_NAME IShaderResourceBindingD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes Direct3D12-specific functionality of a shader resource binding. -class IShaderResourceBindingD3D12 : public IShaderResourceBinding +DILIGENT_INTERFACE(IShaderResourceBindingD3D12, IShaderResourceBinding){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IShaderResourceBindingD3D12Vtbl { + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IShaderResourceBindingMethods ShaderResourceBinding; + //struct IShaderResourceBindingD3D12Methods ShaderResourceBindingD3D12; }; -} // namespace Diligent +struct IShaderResourceBindingD3D12 +{ + struct IShaderResourceBindingD3D12Vtbl* pVtbl; +}; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h b/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h index ec70384c..a5dc7bb8 100644 --- a/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h @@ -35,22 +35,48 @@ #include "../../GraphicsEngine/interface/SwapChain.h" #include "TextureViewD3D12.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {C9F8384D-A45E-4970-8447-394177E5B0EE} -static constexpr INTERFACE_ID IID_SwapChainD3D12 = +static const INTERFACE_ID IID_SwapChainD3D12 = {0xc9f8384d, 0xa45e, 0x4970, {0x84, 0x47, 0x39, 0x41, 0x77, 0xe5, 0xb0, 0xee}}; +#define DILIGENT_INTERFACE_NAME ISwapChainD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D12-specific functionality of a swap chain. -class ISwapChainD3D12 : public ISwapChain +DILIGENT_INTERFACE(ISwapChainD3D12, ISwapChain) { -public: /// 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; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ISwapChainD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ISwapChainMethods SwapChain; + struct ISwapChainD3D12Methods SwapChainD3D12; }; -} // namespace Diligent +typedef struct ISwapChainD3D12 +{ + struct ISwapChainD3D12Vtbl* pVtbl; +} ISwapChainD3D12; + +// clang-format off + +# define ISwapChainD3D12_GetDXGISwapChain(This) (This)->pVtbl->SwapChainD3D12.GetDXGISwapChain((ISwapChainD3D12*)(This)) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h b/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h index 4ca67de5..f2e48201 100644 --- a/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h @@ -32,32 +32,65 @@ #include "../../GraphicsEngine/interface/Texture.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {CF5522EF-8116-4D76-ADF1-5CC8FB31FF66} -static constexpr INTERFACE_ID IID_TextureD3D12 = +static const INTERFACE_ID IID_TextureD3D12 = {0xcf5522ef, 0x8116, 0x4d76, {0xad, 0xf1, 0x5c, 0xc8, 0xfb, 0x31, 0xff, 0x66}}; +#define DILIGENT_INTERFACE_NAME ITextureD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Exposes Direct3D12-specific functionality of a texture object. -class ITextureD3D12 : public ITexture +DILIGENT_INTERFACE(ITextureD3D12, ITexture) { -public: /// Returns a pointer to the ID3D12Resource interface of the internal Direct3D12 object. /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D12Resource* GetD3D12Texture() = 0; + VIRTUAL ID3D12Resource* METHOD(GetD3D12Texture)(THIS) PURE; /// Sets the texture usage state /// \param [in] state - D3D12 resource state to be set for this texture - virtual void SetD3D12ResourceState(D3D12_RESOURCE_STATES state) = 0; + VIRTUAL void METHOD(SetD3D12ResourceState)(THIS_ + D3D12_RESOURCE_STATES state) PURE; /// Returns current D3D12 texture state. /// If the state is unknown to the engine (Diligent::RESOURCE_STATE_UNKNOWN), /// returns D3D12_RESOURCE_STATE_COMMON (0). - virtual D3D12_RESOURCE_STATES GetD3D12ResourceState() const = 0; + VIRTUAL D3D12_RESOURCE_STATES METHOD(GetD3D12ResourceState)(THIS) CONST PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct ITextureD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ITextureMethods Texture; + struct ITextureD3D12Methods TextureD3D12; +}; + +typedef struct ITextureD3D12 +{ + struct ITextureD3D12Vtbl* pVtbl; +} ITextureD3D12; + +// clang-format off + +# define ITextureD3D12_GetD3D12Texture(This) (This)->pVtbl->TextureD3D12.GetD3D12Texture ((ITextureD3D12*)(This)) +# define ITextureD3D12_SetD3D12ResourceState(This, ...) (This)->pVtbl->TextureD3D12.SetD3D12ResourceState((ITextureD3D12*)(This), __VA_ARGS__) +# define ITextureD3D12_GetD3D12ResourceState(This) (This)->pVtbl->TextureD3D12.GetD3D12ResourceState((ITextureD3D12*)(This)) + +// clang-format ons + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h b/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h index 8cb5b6f5..cf87716e 100644 --- a/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h @@ -32,19 +32,42 @@ #include "../../GraphicsEngine/interface/TextureView.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {BDFBD325-0699-4720-BC0E-BF84086EC033} -static constexpr INTERFACE_ID IID_TextureViewD3D12 = +static const INTERFACE_ID IID_TextureViewD3D12 = {0xbdfbd325, 0x699, 0x4720, {0xbc, 0xe, 0xbf, 0x84, 0x8, 0x6e, 0xc0, 0x33}}; +#define DILIGENT_INTERFACE_NAME ITextureViewD3D12 +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes Direct3D12-specific functionality of a texture view object. -class ITextureViewD3D12 : public ITextureView +DILIGENT_INTERFACE(ITextureViewD3D12, ITextureView) { -public: /// Returns CPU descriptor handle of the texture view. - virtual D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle() = 0; + VIRTUAL D3D12_CPU_DESCRIPTOR_HANDLE METHOD(GetCPUDescriptorHandle)(THIS) PURE; +}; + + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ITextureViewD3D12Vtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ITextureViewMethods TextureView; + struct ITextureViewD3D12Methods TextureViewD3D12; }; -} // namespace Diligent +typedef struct ITextureViewD3D12 +{ + struct ITextureViewD3D12Vtbl* pVtbl; +} ITextureViewD3D12; + +# define ITextureViewD3D12_GetCPUDescriptorHandle(This) (This)->pVtbl->TextureViewD3D12.GetCPUDescriptorHandle((ITextureViewD3D12*)(This)) + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent |
