From 3d92951b74f0e788432a0f3a35f452e74d936fce Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 28 Jan 2020 22:05:19 -0800 Subject: Reworked C interface to optimize inheritance handling --- Graphics/GraphicsEngineVulkan/interface/BufferViewVk.h | 14 ++++---------- Graphics/GraphicsEngineVulkan/interface/BufferVk.h | 14 ++++---------- Graphics/GraphicsEngineVulkan/interface/CommandQueueVk.h | 12 ++++-------- Graphics/GraphicsEngineVulkan/interface/DeviceContextVk.h | 13 ++++--------- Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h | 13 ++++--------- Graphics/GraphicsEngineVulkan/interface/FenceVk.h | 13 +++++++------ Graphics/GraphicsEngineVulkan/interface/PipelineStateVk.h | 12 ++++-------- Graphics/GraphicsEngineVulkan/interface/QueryVk.h | 13 +++++++------ Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h | 13 ++++--------- Graphics/GraphicsEngineVulkan/interface/SamplerVk.h | 12 ++++-------- .../interface/ShaderResourceBindingVk.h | 13 +++++++------ Graphics/GraphicsEngineVulkan/interface/ShaderVk.h | 4 ++++ Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h | 12 ++++-------- Graphics/GraphicsEngineVulkan/interface/TextureViewVk.h | 14 ++++---------- Graphics/GraphicsEngineVulkan/interface/TextureVk.h | 14 ++++---------- 15 files changed, 69 insertions(+), 117 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/interface/BufferViewVk.h b/Graphics/GraphicsEngineVulkan/interface/BufferViewVk.h index aee3dd94..79972847 100644 --- a/Graphics/GraphicsEngineVulkan/interface/BufferViewVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/BufferViewVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_BufferViewVk = #define DILIGENT_INTERFACE_NAME IBufferViewVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IBufferViewVkInclusiveMethods \ + IBufferViewInclusiveMethods; \ + IBufferViewVkMethods BufferViewVk + // clang-format off /// Exposes Vulkan-specific functionality of a buffer view object. @@ -55,16 +59,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct IBufferViewVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct IBufferViewMethods BufferView; - struct IBufferViewVkMethods BufferViewVk; -}; - // clang-format off # define IBufferViewVk_GetVkBufferView(This) CALL_IFACE_METHOD(BufferViewVk, GetVkBufferView, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/BufferVk.h b/Graphics/GraphicsEngineVulkan/interface/BufferVk.h index 5e444cf1..ea889795 100644 --- a/Graphics/GraphicsEngineVulkan/interface/BufferVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/BufferVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_BufferVk = #define DILIGENT_INTERFACE_NAME IBufferVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IBufferVkInclusiveMethods \ + IBufferInclusiveMethods; \ + IBufferVkMethods BufferVk + // clang-format off /// Exposes Vulkan-specific functionality of a buffer object. @@ -65,16 +69,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct IBufferVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct IBufferMethods Buffer; - struct IBufferVkMethods BufferVk; -}; - # define IBufferVk_GetVkBuffer(This) CALL_IFACE_METHOD(BufferVk, GetVkBuffer, This) # define IBufferVk_SetAccessFlags(This, ...) CALL_IFACE_METHOD(BufferVk, SetAccessFlags, This, __VA_ARGS__) # define IBufferVk_GetAccessFlags(This) CALL_IFACE_METHOD(BufferVk, GetAccessFlags, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/CommandQueueVk.h b/Graphics/GraphicsEngineVulkan/interface/CommandQueueVk.h index 9a93b1ae..bbe77ea8 100644 --- a/Graphics/GraphicsEngineVulkan/interface/CommandQueueVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/CommandQueueVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_CommandQueueVk = #define DILIGENT_INTERFACE_NAME ICommandQueueVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define ICommandQueueVkInclusiveMethods \ + IObjectInclusiveMethods; \ + ICommandQueueVkMethods CommandQueueVk + // clang-format off /// Command queue interface @@ -89,14 +93,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct ICommandQueueVkVtbl -{ - struct IObjectMethods Object; - struct ICommandQueueVkMethods CommandQueueVk; -}; - // clang-format off # define ICommandQueueVk_GetNextFenceValue(This) CALL_IFACE_METHOD(CommandQueueVk, GetNextFenceValue, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/DeviceContextVk.h b/Graphics/GraphicsEngineVulkan/interface/DeviceContextVk.h index bad568e4..7b7db331 100644 --- a/Graphics/GraphicsEngineVulkan/interface/DeviceContextVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/DeviceContextVk.h @@ -42,6 +42,10 @@ static const INTERFACE_ID IID_DeviceContextVk = #define DILIGENT_INTERFACE_NAME IDeviceContextVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IDeviceContextVkInclusiveMethods \ + IDeviceContextInclusiveMethods; \ + IDeviceContextVkMethods DeviceContextVk + // clang-format off /// Exposes Vulkan-specific functionality of a device context. @@ -92,15 +96,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct IDeviceContextVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceContextMethods DeviceContext; - struct IDeviceContextVkMethods DeviceContextVk; -}; - // clang-format off # define IDeviceContextVk_TransitionImageLayout(This, ...) CALL_IFACE_METHOD(DeviceContextVk, TransitionImageLayout, This, __VA_ARGS__) diff --git a/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h b/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h index f9c8ad39..eb9c1f58 100644 --- a/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h @@ -58,6 +58,10 @@ static const INTERFACE_ID IID_EngineFactoryVk = #define DILIGENT_INTERFACE_NAME IEngineFactoryVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IEngineFactoryVkInclusiveMethods \ + IEngineFactoryInclusiveMethods; \ + IEngineFactoryVkMethods EngineFactoryVk + // clang-format off DILIGENT_BEGIN_INTERFACE(IEngineFactoryVk, IEngineFactory) @@ -86,15 +90,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct IEngineFactoryVkVtbl -{ - struct IObjectMethods Object; - struct IEngineFactoryMethods EngineFactory; - struct IEngineFactoryVkMethods EngineFactoryVk; -}; - // clang-format off # define IEngineFactoryVk_CreateDeviceAndContextsVk(This, ...) CALL_IFACE_METHOD(EngineFactoryVk, CreateDeviceAndContextsVk, This, __VA_ARGS__) diff --git a/Graphics/GraphicsEngineVulkan/interface/FenceVk.h b/Graphics/GraphicsEngineVulkan/interface/FenceVk.h index ffa851b8..f11424b4 100644 --- a/Graphics/GraphicsEngineVulkan/interface/FenceVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/FenceVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_FenceVk = #define DILIGENT_INTERFACE_NAME IFenceVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IFenceVkInclusiveMethods \ + IFenceInclusiveMethods +//IFenceVkMethods FenceVk + // clang-format off #if DILIGENT_CPP_INTERFACE @@ -59,13 +63,10 @@ DILIGENT_END_INTERFACE // clang-format off -struct IFenceVkVtbl +typedef struct IFenceVkVtbl { - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct IFenceMethods Fence; - //struct IFenceVkMethods FenceVk; -}; + IFenceVkInclusiveMethods; +} IFenceVkVtbl; typedef struct IFenceVk { diff --git a/Graphics/GraphicsEngineVulkan/interface/PipelineStateVk.h b/Graphics/GraphicsEngineVulkan/interface/PipelineStateVk.h index 453851a7..679b6e73 100644 --- a/Graphics/GraphicsEngineVulkan/interface/PipelineStateVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/PipelineStateVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_PipelineStateVk = #define DILIGENT_INTERFACE_NAME IPipelineStateVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IPipelineStateVkInclusiveMethods \ + IPipelineStateInclusiveMethods; \ + IPipelineStateVkMethods PipelineStateVk + /// Exposes Vulkan-specific functionality of a pipeline state object. DILIGENT_BEGIN_INTERFACE(IPipelineStateVk, IPipelineState) { @@ -56,14 +60,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -struct IPipelineStateVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct IPipelineStateMethods PipelineState; - struct IPipelineStateVkMethods PipelineStateVk; -}; - // clang-format off # define IPipelineStateVk_GetVkRenderPass(This) CALL_IFACE_METHOD(PipelineStateVk, GetVkRenderPass, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/QueryVk.h b/Graphics/GraphicsEngineVulkan/interface/QueryVk.h index a5179258..b096407c 100644 --- a/Graphics/GraphicsEngineVulkan/interface/QueryVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/QueryVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_QueryVk = #define DILIGENT_INTERFACE_NAME IQueryVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IQueryVkInclusiveMethods \ + IQueryInclusiveMethods +//IQueryVkMethods QueryVk + #if DILIGENT_CPP_INTERFACE /// Exposes Vulkan-specific functionality of a Query object. @@ -53,13 +57,10 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -struct IQueryVkVtbl +typedef struct IQueryVkVtbl { - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct IQueryMethods Query; - //struct IQueryVkMethods QueryVk; -}; + IQueryVkInclusiveMethods; +} IQueryVkVtbl; typedef struct IQueryVk { diff --git a/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h b/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h index e0099db7..dfded94f 100644 --- a/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_RenderDeviceVk = #define DILIGENT_INTERFACE_NAME IRenderDeviceVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IRenderDeviceVkInclusiveMethods \ + IRenderDeviceInclusiveMethods; \ + IRenderDeviceVkMethods RenderDeviceVk + // clang-format off /// Exposes Vulkan-specific functionality of a render device. @@ -115,15 +119,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct IRenderDeviceVkVtbl -{ - struct IObjectMethods Object; - struct IRenderDeviceMethods RenderDevice; - struct IRenderDeviceVkMethods RenderDeviceVk; -}; - // clang-format off # define IRenderDeviceVk_GetVkDevice(This) CALL_IFACE_METHOD(RenderDeviceVk, GetVkDevice, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/SamplerVk.h b/Graphics/GraphicsEngineVulkan/interface/SamplerVk.h index a86e1a3e..024cb9ab 100644 --- a/Graphics/GraphicsEngineVulkan/interface/SamplerVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/SamplerVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_SamplerVk = #define DILIGENT_INTERFACE_NAME ISamplerVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define ISamplerVkInclusiveMethods \ + ISamplerInclusiveMethods; \ + ISamplerVkMethods SamplerVk + /// Exposes Vulkan-specific functionality of a sampler object. DILIGENT_BEGIN_INTERFACE(ISamplerVk, ISampler) { @@ -53,14 +57,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -struct ISamplerVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - //struct ISamplerMethods Sampler; - struct ISamplerVkMethods SamplerVk; -}; - # define ISamplerVk_GetVkSampler(This) CALL_IFACE_METHOD(SamplerVk, GetVkSampler, This) #endif diff --git a/Graphics/GraphicsEngineVulkan/interface/ShaderResourceBindingVk.h b/Graphics/GraphicsEngineVulkan/interface/ShaderResourceBindingVk.h index 4c86b7ff..092fc05f 100644 --- a/Graphics/GraphicsEngineVulkan/interface/ShaderResourceBindingVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/ShaderResourceBindingVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_ShaderResourceBindingVk = #define DILIGENT_INTERFACE_NAME IShaderResourceBindingVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define IShaderResourceBindingVkInclusiveMethods \ + IShaderResourceBindingInclusiveMethods +//IShaderResourceBindingVkMethods ShaderResourceBindingVk + #if DILIGENT_CPP_INTERFACE /// Exposes Vulkan-specific functionality of a shader resource binding object. @@ -53,13 +57,10 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -struct IShaderResourceBindingVkVtbl +typedef struct IShaderResourceBindingVkVtbl { - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct IShaderResourceBindingMethods ShaderResourceBinding; - //struct IShaderResourceBindingVkMethods ShaderResourceBindingVk; -}; + IShaderResourceBindingVkInclusiveMethods; +} IShaderResourceBindingVkVtbl; #endif diff --git a/Graphics/GraphicsEngineVulkan/interface/ShaderVk.h b/Graphics/GraphicsEngineVulkan/interface/ShaderVk.h index 9382180a..9436821a 100644 --- a/Graphics/GraphicsEngineVulkan/interface/ShaderVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/ShaderVk.h @@ -43,6 +43,10 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const INTERFACE_ID IID_ShaderVk = {0x8b0c91b4, 0xb1d8, 0x4e03, {0x92, 0x50, 0xa7, 0xe, 0x13, 0x1a, 0x59, 0xfa}}; +#define IShaderVkInclusiveMethods \ + IShaderInclusiveMethods; \ + IShaderVkMethods ShaderVk + #if DILIGENT_CPP_INTERFACE /// Exposes Vulkan-specific functionality of a shader object. diff --git a/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h b/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h index 532ffbcf..389a6ba5 100644 --- a/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h @@ -44,6 +44,10 @@ static const INTERFACE_ID IID_SwapChainVk = #define DILIGENT_INTERFACE_NAME ISwapChainVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define ISwapChainVkInclusiveMethods \ + ISwapChainInclusiveMethods; \ + ISwapChainVkMethods SwapChainVk + /// Exposes Vulkan-specific functionality of a swap chain. DILIGENT_BEGIN_INTERFACE(ISwapChainVk, ISwapChain) { @@ -56,14 +60,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -struct ISwapChainVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct ISwapChainMethods SwapChain; - struct ISwapChainVkMethods SwapChainVk; -}; - // clang-format off # define ISwapChainVk_GetVkSwapChain(This) CALL_IFACE_METHOD(SwapChainVk, GetVkSwapChain, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/TextureViewVk.h b/Graphics/GraphicsEngineVulkan/interface/TextureViewVk.h index c6ee2438..f37ae72b 100644 --- a/Graphics/GraphicsEngineVulkan/interface/TextureViewVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/TextureViewVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_TextureViewVk = #define DILIGENT_INTERFACE_NAME ITextureViewVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define ITextureViewVkInclusiveMethods \ + ITextureViewInclusiveMethods; \ + ITextureViewVkMethods TextureViewVk + // clang-format off /// Exposes Vulkan-specific functionality of a texture view object. @@ -55,16 +59,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct ITextureViewVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct ITextureViewMethods TextureView; - struct ITextureViewVkMethods TextureViewVk; -}; - // clang-format off # define ITextureViewVk_GetVulkanImageView(This) CALL_IFACE_METHOD(TextureViewVk, GetVulkanImageView, This) diff --git a/Graphics/GraphicsEngineVulkan/interface/TextureVk.h b/Graphics/GraphicsEngineVulkan/interface/TextureVk.h index 7dd96782..c1f99888 100644 --- a/Graphics/GraphicsEngineVulkan/interface/TextureVk.h +++ b/Graphics/GraphicsEngineVulkan/interface/TextureVk.h @@ -41,6 +41,10 @@ static const INTERFACE_ID IID_TextureVk = #define DILIGENT_INTERFACE_NAME ITextureVk #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" +#define ITextureVkInclusiveMethods \ + ITextureInclusiveMethods; \ + ITextureVkMethods TextureVk + // clang-format off /// Exposes Vulkan-specific functionality of a texture object. @@ -68,16 +72,6 @@ DILIGENT_END_INTERFACE #if DILIGENT_C_INTERFACE -// clang-format on - -struct ITextureVkVtbl -{ - struct IObjectMethods Object; - struct IDeviceObjectMethods DeviceObject; - struct ITextureMethods Texture; - struct ITextureVkMethods TextureVk; -}; - // clang-format off # define ITextureVk_GetVkImage(This) CALL_IFACE_METHOD(TextureVk, GetVkImage,This) -- cgit v1.2.3