From e5a8e78e2214ef16a3416d8c1d677336dee6dcd8 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 25 Jan 2020 20:12:57 -0800 Subject: Fixed swap cahin C interface; added test. --- Graphics/GraphicsEngine/include/QueryBase.h | 2 ++ Graphics/GraphicsEngine/interface/SwapChain.h | 39 ++++++++++++++++++++------- 2 files changed, 31 insertions(+), 10 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/QueryBase.h b/Graphics/GraphicsEngine/include/QueryBase.h index 31480f2c..daa0d30e 100644 --- a/Graphics/GraphicsEngine/include/QueryBase.h +++ b/Graphics/GraphicsEngine/include/QueryBase.h @@ -38,6 +38,8 @@ namespace Diligent { +class IDeviceContext; + /// Template class implementing base functionality for a Query object /// \tparam BaseInterface - base interface that this class will inheret diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h index 2cfcc5de..60bdb22f 100644 --- a/Graphics/GraphicsEngine/interface/SwapChain.h +++ b/Graphics/GraphicsEngine/interface/SwapChain.h @@ -94,25 +94,44 @@ public: struct ISwapChain; -struct ISwapChainVtbl +// clang-format off + +struct ISwapChainMethods { - void (*Present)(Uint32 SyncInterval); - const struct SwapChainDesc* (*GetDesc)(); - void (*Resize)(Uint32 NewWidth, Uint32 NewHeight); - void (*SetFullscreenMode)(const struct DisplayModeAttribs* DisplayMode); - void (*SetWindowedMode)(); - struct ITextureView* (*GetCurrentBackBufferRTV)(); - struct ITextureView* (*GetDepthBufferDSV)(); + void (*Present) (struct ISwapChain*, Uint32 SyncInterval); + const struct SwapChainDesc* (*GetDesc) (struct ISwapChain*); + void (*Resize) (struct ISwapChain*, Uint32 NewWidth, Uint32 NewHeight); + void (*SetFullscreenMode) (struct ISwapChain*, const struct DisplayModeAttribs* DisplayMode); + void (*SetWindowedMode) (struct ISwapChain*); + struct ITextureView* (*GetCurrentBackBufferRTV)(struct ISwapChain*); + struct ITextureView* (*GetDepthBufferDSV) (struct ISwapChain*); }; // clang-format on +struct ISwapChainVtbl +{ + struct IObjectMethods Object; + struct ISwapChainMethods SwapChain; +}; + struct ISwapChain { - struct IObjectVtbl* pObjectVtbl; - struct ISwapChain* pSwapChainVtbl; + struct ISwapChainVtbl* pVtbl; }; +// clang-format off + +# define ISwapChain_Present(This, ...) (This)->pVtbl->SwapChain.Present ((struct ISwapChain*)(This), __VA_ARGS__) +# define ISwapChain_GetDesc(This) (This)->pVtbl->SwapChain.GetDesc ((struct ISwapChain*)(This)) +# define ISwapChain_Resize(This, ...) (This)->pVtbl->SwapChain.Resize ((struct ISwapChain*)(This), __VA_ARGS__) +# define ISwapChain_SetFullscreenMode(This, ...) (This)->pVtbl->SwapChain.SetFullscreenMode ((struct ISwapChain*)(This), __VA_ARGS__) +# define ISwapChain_SetWindowedMode(This) (This)->pVtbl->SwapChain.SetWindowedMode ((struct ISwapChain*)(This)) +# define ISwapChain_GetCurrentBackBufferRTV(This) (This)->pVtbl->SwapChain.GetCurrentBackBufferRTV((struct ISwapChain*)(This)) +# define ISwapChain_GetDepthBufferDSV(This) (This)->pVtbl->SwapChain.GetDepthBufferDSV ((struct ISwapChain*)(This)) + +// clang-format on + #endif DILIGENT_END_NAMESPACE // namespace Diligent -- cgit v1.2.3