diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-28 06:14:20 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-28 06:14:20 +0000 |
| commit | 86441f5c9147efd2b5f3f296b9a4fde432a8c61d (patch) | |
| tree | 55d148068ecd5ded399fb94e1128f36c68de5bb6 /Graphics/GraphicsEngineOpenGL | |
| parent | Implemented C interface for D3D12 backend (diff) | |
| download | DiligentCore-86441f5c9147efd2b5f3f296b9a4fde432a8c61d.tar.gz DiligentCore-86441f5c9147efd2b5f3f296b9a4fde432a8c61d.zip | |
Implemented C Interface for OpenGL backend
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
16 files changed, 491 insertions, 139 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp index c6218595..7703a019 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.hpp @@ -40,9 +40,6 @@ namespace Diligent { -class RenderDeviceGLImpl; -class ISwapChainGL; - struct DeviceContextGLImplTraits { using BufferType = BufferGLImpl; diff --git a/Graphics/GraphicsEngineOpenGL/interface/BaseInterfacesGL.h b/Graphics/GraphicsEngineOpenGL/interface/BaseInterfacesGL.h index 4d10231f..4167479c 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/BaseInterfacesGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/BaseInterfacesGL.h @@ -32,33 +32,39 @@ #if PLATFORM_ANDROID # include "RenderDeviceGLES.h" - namespace Diligent - { - using IGLDeviceBaseInterface = IRenderDeviceGLES; - } + DILIGENT_BEGIN_NAMESPACE(Diligent) + + typedef IRenderDeviceGLES IGLDeviceBaseInterface; + + DILIGENT_END_NAMESPACE #elif PLATFORM_WIN32 || PLATFORM_LINUX || PLATFORM_MACOS # include "RenderDeviceGL.h" - namespace Diligent - { - using IGLDeviceBaseInterface = IRenderDeviceGL; - } + DILIGENT_BEGIN_NAMESPACE(Diligent) + + typedef IRenderDeviceGL IGLDeviceBaseInterface; + + DILIGENT_END_NAMESPACE #elif PLATFORM_IOS # include "RenderDeviceGL.h" - namespace Diligent - { - using IGLDeviceBaseInterface = IRenderDeviceGL; - } + DILIGENT_BEGIN_NAMESPACE(Diligent) + + typedef IRenderDeviceGL IGLDeviceBaseInterface; + + DILIGENT_END_NAMESPACE + #else # error Unsupported platform + #endif #include "DeviceContextGL.h" -namespace Diligent -{ - using IGLDeviceContextBaseInterface = IDeviceContextGL; -} +DILIGENT_BEGIN_NAMESPACE(Diligent) + + typedef IDeviceContextGL IGLDeviceContextBaseInterface; + +DILIGENT_END_NAMESPACE diff --git a/Graphics/GraphicsEngineOpenGL/interface/BufferGL.h b/Graphics/GraphicsEngineOpenGL/interface/BufferGL.h index 8a32eec2..de79bde9 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/BufferGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/BufferGL.h @@ -32,19 +32,41 @@ #include "../../GraphicsEngine/interface/Buffer.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) + +#define DILIGENT_INTERFACE_NAME IBufferGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" // {08DF7319-F425-4EC7-8D2B-1B3FC0BDDBB4} -static constexpr INTERFACE_ID IID_BufferGL = +static const INTERFACE_ID IID_BufferGL = {0x8df7319, 0xf425, 0x4ec7, {0x8d, 0x2b, 0x1b, 0x3f, 0xc0, 0xbd, 0xdb, 0xb4}}; /// Exposes OpenGL-specific functionality of a buffer object. -class IBufferGL : public IBuffer +DILIGENT_INTERFACE(IBufferGL, IBuffer) { -public: /// Returns OpenGL buffer handle - virtual GLuint GetGLBufferHandle() = 0; + VIRTUAL GLuint METHOD(GetGLBufferHandle)(THIS) PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IBufferGLVtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IBufferMethods Buffer; + struct IBufferGLMethods BufferGL; +}; + +typedef struct IBufferGL +{ + struct IBufferGLVtbl* pVtbl; +} IBufferGL; + +# define IBufferGL_GetGLBufferHandle(This) (This)->pVtbl->BufferGL.GetGLBufferHandle((IBufferGL*)(This)) + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/BufferViewGL.h b/Graphics/GraphicsEngineOpenGL/interface/BufferViewGL.h index d7ac0789..60e0e4c6 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/BufferViewGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/BufferViewGL.h @@ -32,18 +32,39 @@ #include "../../GraphicsEngine/interface/BufferView.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {927A865B-3CEB-4743-9A22-2A1397A73E6D} -static constexpr INTERFACE_ID IID_BufferViewGL = +static const INTERFACE_ID IID_BufferViewGL = {0x927a865b, 0x3ceb, 0x4743, {0x9a, 0x22, 0x2a, 0x13, 0x97, 0xa7, 0x3e, 0x6d}}; +#define DILIGENT_INTERFACE_NAME IBufferViewGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes OpenGL-specific functionality of a buffer view object. -class IBufferViewGL : public IBufferView +DILIGENT_INTERFACE(IBufferViewGL, IBufferView){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IBufferViewGLVtbl { -public: - //const GLObjectWrappers::GLTextureObj& GetTexBufferHandle(){ return m_GLTexBuffer; } + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IBufferViewMethods BufferView; + //struct IBufferViewGLMethods BufferViewGL; }; -} // namespace Diligent +typedef struct IBufferViewGL +{ + struct IBufferViewGLVtbl* pVtbl; +} IBufferViewGL; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/DeviceContextGL.h b/Graphics/GraphicsEngineOpenGL/interface/DeviceContextGL.h index 26c80f1b..dc002ca2 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/DeviceContextGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/DeviceContextGL.h @@ -32,19 +32,22 @@ #include "../../GraphicsEngine/interface/DeviceContext.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) -class ISwapChainGL; +struct ISwapChainGL; // {3464FDF1-C548-4935-96C3-B454C9DF6F6A} -static constexpr INTERFACE_ID IID_DeviceContextGL = +static const INTERFACE_ID IID_DeviceContextGL = {0x3464fdf1, 0xc548, 0x4935, {0x96, 0xc3, 0xb4, 0x54, 0xc9, 0xdf, 0x6f, 0x6a}}; +#define DILIGENT_INTERFACE_NAME IDeviceContextGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Exposes OpenGL-specific functionality of a device context. -class IDeviceContextGL : public IDeviceContext +DILIGENT_INTERFACE(IDeviceContextGL, IDeviceContext) { -public: /// Attaches to the active GL context in the thread. /// If an application uses multiple GL contexts, this method must be called before any @@ -52,11 +55,40 @@ public: /// is passed over from the main application /// /// \return false if there is no active GL context, and true otherwise - virtual bool UpdateCurrentGLContext() = 0; + VIRTUAL bool METHOD(UpdateCurrentGLContext)(THIS) PURE; /// Sets the swap in the device context. The swap chain is used by the device context /// to obtain the default FBO handle. - virtual void SetSwapChain(ISwapChainGL* pSwapChain) = 0; + VIRTUAL void METHOD(SetSwapChain)(THIS_ + struct ISwapChainGL* pSwapChain) PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct IDeviceContextGLVtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IDeviceContextMethods DeviceContext; + struct IDeviceContextGLMethods DeviceContextGL; +}; + +typedef struct IDeviceContextGL +{ + struct IDeviceContextGLVtbl* pVtbl; +} IDeviceContextGL; + +// clang-format off + +# define IDeviceContextGL_UpdateCurrentGLContext(This) (This)->pVtbl->DeviceContextGL.UpdateCurrentGLContext((IDeviceContextGL*)(This)) +# define IDeviceContextGL_SetSwapChain(This, ...) (This)->pVtbl->DeviceContextGL.SetSwapChain((IDeviceContextGL*)(This), __VA_ARGS__) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h b/Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h index 86172e70..bc6e67e6 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/EngineFactoryOpenGL.h @@ -30,8 +30,6 @@ /// \file /// Declaration of functions that create OpenGL-based engine implementation -#include <sstream> - #include "../../GraphicsEngine/interface/EngineFactory.h" #include "../../GraphicsEngine/interface/RenderDevice.h" #include "../../GraphicsEngine/interface/DeviceContext.h" @@ -54,46 +52,79 @@ # define EXPLICITLY_LOAD_ENGINE_GL_DLL 1 #endif -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {9BAAC767-02CC-4FFA-9E4B-E1340F572C49} static const INTERFACE_ID IID_EngineFactoryOpenGL = {0x9baac767, 0x2cc, 0x4ffa, {0x9e, 0x4b, 0xe1, 0x34, 0xf, 0x57, 0x2c, 0x49}}; -class IEngineFactoryOpenGL : public IEngineFactory +#define DILIGENT_INTERFACE_NAME IEngineFactoryOpenGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + +DILIGENT_INTERFACE(IEngineFactoryOpenGL, IEngineFactory) { -public: - virtual void CreateDeviceAndSwapChainGL(const EngineGLCreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppImmediateContext, - const SwapChainDesc& SCDesc, - ISwapChain** ppSwapChain) = 0; - virtual void CreateHLSL2GLSLConverter(IHLSL2GLSLConverter** ppConverter) = 0; - - virtual void AttachToActiveGLContext(const EngineGLCreateInfo& EngineCI, - IRenderDevice** ppDevice, - IDeviceContext** ppImmediateContext) = 0; + VIRTUAL void METHOD(CreateDeviceAndSwapChainGL)(THIS_ + const EngineGLCreateInfo REF EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppImmediateContext, + const SwapChainDesc REF SCDesc, + ISwapChain** ppSwapChain) PURE; + + VIRTUAL void METHOD(CreateHLSL2GLSLConverter)(THIS_ + IHLSL2GLSLConverter** ppConverter) PURE; + + VIRTUAL void METHOD(AttachToActiveGLContext)(THIS_ + const EngineGLCreateInfo REF EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppImmediateContext) PURE; }; +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct IEngineFactoryOpenGLVtbl +{ + struct IObjectMethods Object; + struct IEngineFactoryMethods EngineFactory; + struct IEngineFactoryOpenGLMethods EngineFactoryOpenGL; +}; + +typedef struct IEngineFactoryOpenGL +{ + struct IEngineFactoryOpenGLVtbl* pVtbl; +} IEngineFactoryOpenGL; + +// clang-format off + +# define IEngineFactoryOpenGL_CreateDeviceAndSwapChainGL(This, ...) (This)->pVtbl->EngineFactoryOpenGL.CreateDeviceAndSwapChainGL((IEngineFactoryOpenGL*)(This), __VA_ARGS__) +# define IEngineFactoryOpenGL_CreateHLSL2GLSLConverter(This, ...) (This)->pVtbl->EngineFactoryOpenGL.CreateHLSL2GLSLConverter ((IEngineFactoryOpenGL*)(This), __VA_ARGS__) +# define IEngineFactoryOpenGL_AttachToActiveGLContext(This, ...) (This)->pVtbl->EngineFactoryOpenGL.AttachToActiveGLContext ((IEngineFactoryOpenGL*)(This), __VA_ARGS__) + +// clang-format on + +#endif + #if EXPLICITLY_LOAD_ENGINE_GL_DLL -using GetEngineFactoryOpenGLType = IEngineFactoryOpenGL* (*)(); +typedef struct IEngineFactoryOpenGL* (*GetEngineFactoryOpenGLType)(); -static bool LoadGraphicsEngineOpenGL(GetEngineFactoryOpenGLType& GetFactoryFunc) +inline GetEngineFactoryOpenGLType LoadGraphicsEngineOpenGL() { - auto ProcAddress = LoadEngineDll("GraphicsEngineOpenGL", "GetEngineFactoryOpenGL"); - GetFactoryFunc = reinterpret_cast<GetEngineFactoryOpenGLType>(ProcAddress); - return GetFactoryFunc != nullptr; + return (GetEngineFactoryOpenGLType)LoadEngineDll("GraphicsEngineGL", "GetEngineFactoryOpenGL"); } #else // Do not forget to call System.loadLibrary("GraphicsEngineOpenGL") in Java on Android! API_QUALIFIER -IEngineFactoryOpenGL* GetEngineFactoryOpenGL(); +struct IEngineFactoryOpenGL* DILIGENT_GLOBAL_FUNCTION(GetEngineFactoryOpenGL)(); #endif -} // namespace Diligent +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/FenceGL.h b/Graphics/GraphicsEngineOpenGL/interface/FenceGL.h index 61f5c73a..c5a3faca 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/FenceGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/FenceGL.h @@ -32,20 +32,39 @@ #include "../../GraphicsEngine/interface/Fence.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {8FEACBDA-89D6-4509-88E6-D55DD06220C5} -static constexpr INTERFACE_ID IID_FenceGL = +static const INTERFACE_ID IID_FenceGL = {0x8feacbda, 0x89d6, 0x4509, {0x88, 0xe6, 0xd5, 0x5d, 0xd0, 0x62, 0x20, 0xc5}}; +#define DILIGENT_INTERFACE_NAME IFenceGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE /// Exposes OpenGL-specific functionality of a fence object. -class IFenceGL : public IFence +DILIGENT_INTERFACE(IFenceGL, IFence){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IFenceGLVtbl { -public: - /// Returns OpenGL sync object - //virtual IGLFence* GetGLFence() = 0; + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IFenceMethods Fence; + //struct IFenceGLMethods FenceGL; }; -} // namespace Diligent +typedef struct IFenceGL +{ + struct IFenceGLVtbl* pVtbl; +} IFenceGL; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/PipelineStateGL.h b/Graphics/GraphicsEngineOpenGL/interface/PipelineStateGL.h index b9042a15..de47144f 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/PipelineStateGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/PipelineStateGL.h @@ -32,17 +32,38 @@ #include "../../GraphicsEngine/interface/PipelineState.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {80666BE3-318A-4403-AEE1-6E61A5B7A0F9} -static constexpr INTERFACE_ID IID_PipelineStateGL = +static const INTERFACE_ID IID_PipelineStateGL = {0x80666be3, 0x318a, 0x4403, {0xae, 0xe1, 0x6e, 0x61, 0xa5, 0xb7, 0xa0, 0xf9}}; +#define DILIGENT_INTERFACE_NAME IPipelineStateGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE /// Exposes OpenGL-specific functionality of a pipeline state object. -class IPipelineStateGL : public IPipelineState +DILIGENT_INTERFACE(IPipelineStateGL, IPipelineState){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IPipelineStateGLVtbl { + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IPipelineStateMethods PipelineState; + //struct IPipelineStateGLMethods PipelineStateGL; }; -} // namespace Diligent +typedef struct IPipelineStateGL +{ + struct IPipelineStateGLVtbl* pVtbl; +} IPipelineStateGL; + +#endif +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/QueryGL.h b/Graphics/GraphicsEngineOpenGL/interface/QueryGL.h index dc11eb86..2d03d989 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/QueryGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/QueryGL.h @@ -32,19 +32,42 @@ #include "../../GraphicsEngine/interface/Query.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {D8A02AB7-0720-417D-AA9B-20A2C05A3EE0} -static constexpr INTERFACE_ID IID_QueryGL = +static const INTERFACE_ID IID_QueryGL = {0xd8a02ab7, 0x720, 0x417d, {0xaa, 0x9b, 0x20, 0xa2, 0xc0, 0x5a, 0x3e, 0xe0}}; +#define DILIGENT_INTERFACE_NAME IQueryGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes OpenGL-specific functionality of a Query object. -class IQueryGL : public IQuery +DILIGENT_INTERFACE(IQueryGL, IQuery) { /// Returns OpenGL handle of an internal query object. - virtual GLuint GetGlQueryHandle() const = 0; + VIRTUAL GLuint METHOD(GetGlQueryHandle)(THIS) CONST PURE; }; -} // namespace Diligent +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IQueryGLVtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IQueryMethods Query; + struct IQueryGLMethods QueryGL; +}; + +typedef struct IQueryGL +{ + struct IQueryGLVtbl* pVtbl; +} IQueryGL; + +# define IQueryGL_GetGlQueryHandle(This) (This)->pVtbl->QueryGL.GetGlQueryHandle((IQueryGL*)(This)) + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h b/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h index 10a9e50e..b697897d 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/RenderDeviceGL.h @@ -33,17 +33,20 @@ #include "../../GraphicsEngine/interface/RenderDevice.h" /// Namespace for the OpenGL implementation of the graphics engine -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {B4B395B9-AC99-4E8A-B7E1-9DCA0D485618} -static constexpr INTERFACE_ID IID_RenderDeviceGL = +static const INTERFACE_ID IID_RenderDeviceGL = {0xb4b395b9, 0xac99, 0x4e8a, {0xb7, 0xe1, 0x9d, 0xca, 0xd, 0x48, 0x56, 0x18}}; +#define DILIGENT_INTERFACE_NAME IRenderDeviceGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +// clang-format off + /// Exposes OpenGL-specific functionality of a render device. -class IRenderDeviceGL : public IRenderDevice +DILIGENT_INTERFACE(IRenderDeviceGL, IRenderDevice) { -public: /// Creates a texture from OpenGL handle /// \param [in] GLHandle - OpenGL texture handle @@ -57,10 +60,11 @@ public: /// one reference. /// \note Diligent engine texture object does not take ownership of the GL resource, /// and the application must not destroy it while it is in use by the engine. - virtual void CreateTextureFromGLHandle(Uint32 GLHandle, - const TextureDesc& TexDesc, - RESOURCE_STATE InitialState, - ITexture** ppTexture) = 0; + VIRTUAL void METHOD(CreateTextureFromGLHandle)(THIS_ + Uint32 GLHandle, + const TextureDesc REF TexDesc, + RESOURCE_STATE InitialState, + ITexture** ppTexture) PURE; /// Creates a buffer from OpenGL handle @@ -75,10 +79,11 @@ public: /// one reference. /// \note Diligent engine buffer object does not take ownership of the GL resource, /// and the application must not destroy it while it is in use by the engine. - virtual void CreateBufferFromGLHandle(Uint32 GLHandle, - const BufferDesc& BuffDesc, - RESOURCE_STATE InitialState, - IBuffer** ppBuffer) = 0; + VIRTUAL void METHOD(CreateBufferFromGLHandle)(THIS_ + Uint32 GLHandle, + const BufferDesc REF BuffDesc, + RESOURCE_STATE InitialState, + IBuffer** ppBuffer) PURE; /// Creates a dummy texture with null handle. @@ -94,9 +99,39 @@ public: /// The function calls AddRef(), so that the new object will contain /// one reference. /// \note Only RESOURCE_DIM_TEX_2D dummy textures are supported. - virtual void CreateDummyTexture(const TextureDesc& TexDesc, - RESOURCE_STATE InitialState, - ITexture** ppTexture) = 0; + VIRTUAL void METHOD(CreateDummyTexture)(THIS_ + const TextureDesc REF TexDesc, + RESOURCE_STATE InitialState, + ITexture** ppTexture) PURE; +}; + + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +// clang-format on + +struct IRenderDeviceGLVtbl +{ + struct IObjectMethods Object; + struct IRenderDeviceMethods RenderDevice; + struct IRenderDeviceGLMethods RenderDeviceGL; }; -} // namespace Diligent +typedef struct IRenderDeviceGL +{ + struct IRenderDeviceGLVtbl* pVtbl; +} IRenderDeviceGL; + +// clang-format off + +# define IRenderDeviceGL_CreateTextureFromGLHandle(This, ...)(This)->pVtbl->RenderDeviceGL.CreateTextureFromGLHandle ((IRenderDeviceGL*)(This), __VA_ARGS__) +# define IRenderDeviceGL_CreateBufferFromGLHandle(This, ...) (This)->pVtbl->RenderDeviceGL.CreateBufferFromGLHandle((IRenderDeviceGL*)(This), __VA_ARGS__) +# define IRenderDeviceGL_CreateDummyTexture(This, ...) (This)->pVtbl->RenderDeviceGL.CreateDummyTexture((IRenderDeviceGL*)(This), __VA_ARGS__) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/SamplerGL.h b/Graphics/GraphicsEngineOpenGL/interface/SamplerGL.h index 9aa1693b..ac7625d7 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/SamplerGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/SamplerGL.h @@ -32,18 +32,39 @@ #include "../../GraphicsEngine/interface/Sampler.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {3E9EB89E-E955-447A-9D13-92C10541F727} -static constexpr INTERFACE_ID IID_SamplerGL = +static const INTERFACE_ID IID_SamplerGL = {0x3e9eb89e, 0xe955, 0x447a, {0x9d, 0x13, 0x92, 0xc1, 0x5, 0x41, 0xf7, 0x27}}; +#define DILIGENT_INTERFACE_NAME ISamplerGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes OpenGL-specific functionality of a sampler object. -class ISamplerGL : public ISampler +DILIGENT_INTERFACE(ISamplerGL, ISampler){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ISamplerGLVtbl { -public: - //const GLObjectWrappers::GLSamplerObj& GetHandle(){ return m_GlSampler; } + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + //struct ISamplerMethods Sampler; + //struct ISamplerGLMethods SamplerGL; }; -} // namespace Diligent +typedef struct ISamplerGL +{ + struct ISamplerGLVtbl* pVtbl; +} ISamplerGL; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/ShaderGL.h b/Graphics/GraphicsEngineOpenGL/interface/ShaderGL.h index 61212e36..2a92c31b 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/ShaderGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/ShaderGL.h @@ -32,16 +32,39 @@ #include "../../GraphicsEngine/interface/Shader.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {2FF3C191-285B-4E6C-BD0B-D084DDEA6FCC} -static constexpr INTERFACE_ID IID_ShaderGL = +static const INTERFACE_ID IID_ShaderGL = {0x2ff3c191, 0x285b, 0x4e6c, {0xbd, 0xb, 0xd0, 0x84, 0xdd, 0xea, 0x6f, 0xcc}}; +#define DILIGENT_INTERFACE_NAME IShaderGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes OpenGL-specific functionality of a shader object. -class IShaderGL : public IShader +DILIGENT_INTERFACE(IShaderGL, IShader){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IShaderGLVtbl { + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IShaderMethods Shader; + //struct IShaderGLMethods ShaderGL; }; -} // namespace Diligent +typedef struct IShaderGL +{ + struct IShaderGLVtbl* pVtbl; +} IShaderGL; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/ShaderResourceBindingGL.h b/Graphics/GraphicsEngineOpenGL/interface/ShaderResourceBindingGL.h index 463b3e66..03c32ff4 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/ShaderResourceBindingGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/ShaderResourceBindingGL.h @@ -32,16 +32,40 @@ #include "../../GraphicsEngine/interface/ShaderResourceBinding.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {41DB0329-B6D2-4470-9A58-D44CF4695FC6} -static constexpr INTERFACE_ID IID_ShaderResourceBindingGL = +static const INTERFACE_ID IID_ShaderResourceBindingGL = {0x41db0329, 0xb6d2, 0x4470, {0x9a, 0x58, 0xd4, 0x4c, 0xf4, 0x69, 0x5f, 0xc6}}; +#define DILIGENT_INTERFACE_NAME IShaderResourceBindingGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes OpenGL-specific functionality of a shader resource binding object. -class IShaderResourceBindingGL : public IShaderResourceBinding +DILIGENT_INTERFACE(IShaderResourceBindingGL, IShaderResourceBinding){}; + +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct IShaderResourceBindingGLVtbl { + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct IShaderMethods Shader; + //struct IShaderResourceBindingGLMethods ShaderResourceBindingGL; }; -} // namespace Diligent +typedef struct IShaderResourceBindingGL +{ + struct IShaderResourceBindingGLVtbl* pVtbl; +} IShaderResourceBindingGL; + +#endif + + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/SwapChainGL.h b/Graphics/GraphicsEngineOpenGL/interface/SwapChainGL.h index 74c7249d..e942da14 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/SwapChainGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/SwapChainGL.h @@ -32,19 +32,45 @@ #include "../../GraphicsEngine/interface/SwapChain.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {F457BD7C-E725-4D3E-8607-A1F9BAE329EB} -static constexpr INTERFACE_ID IID_SwapChainGL = +static const INTERFACE_ID IID_SwapChainGL = {0xf457bd7c, 0xe725, 0x4d3e, {0x86, 0x7, 0xa1, 0xf9, 0xba, 0xe3, 0x29, 0xeb}}; +#define DILIGENT_INTERFACE_NAME ISwapChainGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes OpenGL-specific functionality of a swap chain. -class ISwapChainGL : public ISwapChain +DILIGENT_INTERFACE(ISwapChainGL, ISwapChain) { -public: /// Returns the default framebuffer handle - virtual GLuint GetDefaultFBO() const = 0; + VIRTUAL GLuint METHOD(GetDefaultFBO)(THIS) CONST PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ISwapChainGLVtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ISwapChainMethods SwapChain; + struct ISwapChainGLMethods SwapChainGL; }; -} // namespace Diligent +typedef struct ISwapChainGL +{ + struct ISwapChainGLVtbl* pVtbl; +} ISwapChainGL; + +// clang-format off + +# define ISwapChainGL_GetDefaultFBO(This) (This)->pVtbl->SwapChainGL.GetDefaultFBO((ISwapChainGL*)(This)) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/TextureGL.h b/Graphics/GraphicsEngineOpenGL/interface/TextureGL.h index b73a50b0..6d4d2137 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/TextureGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/TextureGL.h @@ -32,22 +32,49 @@ #include "../../GraphicsEngine/interface/Texture.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {D7BC9FF0-28F0-4636-9732-710C204D1D63} -static constexpr INTERFACE_ID IID_TextureGL = +static const INTERFACE_ID IID_TextureGL = {0xd7bc9ff0, 0x28f0, 0x4636, {0x97, 0x32, 0x71, 0xc, 0x20, 0x4d, 0x1d, 0x63}}; +#define DILIGENT_INTERFACE_NAME ITextureGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + /// Exposes OpenGL-specific functionality of a texture object. -class ITextureGL : public ITexture +DILIGENT_INTERFACE(ITextureGL, ITexture) { -public: /// Returns OpenGL texture handle - virtual GLuint GetGLTextureHandle() = 0; + VIRTUAL GLuint METHOD(GetGLTextureHandle)(THIS) PURE; /// Returns bind target of the native OpenGL texture - virtual GLenum GetBindTarget() const = 0; + VIRTUAL GLenum METHOD(GetBindTarget)(THIS) CONST PURE; +}; + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ITextureGLVtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ITextureMethods Texture; + struct ITextureGLMethods TextureGL; }; -} // namespace Diligent +typedef struct ITextureGL +{ + struct ITextureGLVtbl* pVtbl; +} ITextureGL; + +// clang-format off + +# define ITextureGL_GetGLTextureHandle(This) (This)->pVtbl->TextureGL.GetGLTextureHandle((ITextureGL*)(This)) +# define ITextureGL_GetBindTarget(This) (This)->pVtbl->TextureGL.GetBindTarget ((ITextureGL*)(This)) + +// clang-format on + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngineOpenGL/interface/TextureViewGL.h b/Graphics/GraphicsEngineOpenGL/interface/TextureViewGL.h index e85c5e80..b69c1d3e 100644 --- a/Graphics/GraphicsEngineOpenGL/interface/TextureViewGL.h +++ b/Graphics/GraphicsEngineOpenGL/interface/TextureViewGL.h @@ -32,19 +32,43 @@ #include "../../GraphicsEngine/interface/TextureView.h" -namespace Diligent -{ +DILIGENT_BEGIN_NAMESPACE(Diligent) // {15F93272-6135-414F-AB10-53FF9A5004AD} -static constexpr INTERFACE_ID IID_TextureViewGL = +static const INTERFACE_ID IID_TextureViewGL = {0x15f93272, 0x6135, 0x414f, {0xab, 0x10, 0x53, 0xff, 0x9a, 0x50, 0x4, 0xad}}; +#define DILIGENT_INTERFACE_NAME ITextureViewGL +#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h" + +#if DILIGENT_CPP_INTERFACE + /// Exposes OpenGL-specific functionality of a texture view object. -class ITextureViewGL : public ITextureView +DILIGENT_INTERFACE(ITextureViewGL, ITextureView) // { -public: //const GLObjectWrappers::GLTextureObj& GetHandle(); //GLenum GetBindTarget(); }; -} // namespace Diligent +#endif + +#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h" + +#if DILIGENT_C_INTERFACE + +struct ITextureViewGLVtbl +{ + struct IObjectMethods Object; + struct IDeviceObjectMethods DeviceObject; + struct ITextureViewMethods TextureView; + //struct ITextureViewGLMethods TextureViewGL; +}; + +typedef struct ITextureViewGL +{ + struct ITextureViewGLVtbl* pVtbl; +} ITextureViewGL; + +#endif + +DILIGENT_END_NAMESPACE // namespace Diligent |
