diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-10-08 02:15:46 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-10-08 02:15:46 +0000 |
| commit | 1c8ae9282092034788d0ee427b1923e95d18a764 (patch) | |
| tree | e2bc76011fdc930caff5923372e86c828051f360 /Graphics/GraphicsEngineOpenGL | |
| parent | Fixed gcc/clang build issues (diff) | |
| download | DiligentCore-1c8ae9282092034788d0ee427b1923e95d18a764.tar.gz DiligentCore-1c8ae9282092034788d0ee427b1923e95d18a764.zip | |
Fixed another clang build issue + some code formatting
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
10 files changed, 69 insertions, 62 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h index 89e16017..96de1119 100644 --- a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h @@ -64,7 +64,7 @@ public: void UpdateData(DeviceContextGLImpl* pCtxGL, Uint32 Offset, Uint32 Size, const PVoid pData); void CopyData(GLContextState& CtxState, BufferGLImpl& SrcBufferGL, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size); - void Map(GLContextState& CtxState, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData ); + void Map(GLContextState& CtxState, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData ); void Unmap(); void BufferMemoryBarrier( Uint32 RequiredBarriers, class GLContextState &GLContextState ); diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h index 739e8e2f..6f1aea88 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -158,7 +158,7 @@ public: void BindProgramResources(Uint32& NewMemoryBarriers, IShaderResourceBinding* pResBinding); - GLContextState &GetContextState(){return m_ContextState;} + GLContextState& GetContextState(){return m_ContextState;} void CommitRenderTargets(); diff --git a/Graphics/GraphicsEngineOpenGL/include/FBOCache.h b/Graphics/GraphicsEngineOpenGL/include/FBOCache.h index f0736b21..ee5f416c 100644 --- a/Graphics/GraphicsEngineOpenGL/include/FBOCache.h +++ b/Graphics/GraphicsEngineOpenGL/include/FBOCache.h @@ -43,11 +43,11 @@ public: FBOCache& operator = (const FBOCache&) = delete; FBOCache& operator = ( FBOCache&&) = delete; - const GLObjectWrappers::GLFrameBufferObj& GetFBO( Uint32 NumRenderTargets, - ITextureView *ppRenderTargets[], - ITextureView *pDepthStencil, - class GLContextState &ContextState); - void OnReleaseTexture(ITexture *pTexture); + const GLObjectWrappers::GLFrameBufferObj& GetFBO(Uint32 NumRenderTargets, + ITextureView* ppRenderTargets[], + ITextureView* pDepthStencil, + class GLContextState& ContextState); + void OnReleaseTexture(ITexture* pTexture); private: // This structure is used as the key to find FBO diff --git a/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.h b/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.h index ac3cb8a7..f1a894f8 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.h @@ -33,8 +33,8 @@ class GLObjWrapper { public: GLObjWrapper(bool CreateObject, CreateReleaseHelperType CreateReleaseHelper = CreateReleaseHelperType()) : - m_uiHandle(0), - m_CreateReleaseHelper(CreateReleaseHelper) + m_uiHandle {0 }, + m_CreateReleaseHelper{CreateReleaseHelper} { if( CreateObject ) { @@ -51,10 +51,13 @@ public: Release(); } + GLObjWrapper (const GLObjWrapper&) = delete; + GLObjWrapper& operator = (const GLObjWrapper&) = delete; + GLObjWrapper(GLObjWrapper&& Wrapper) : - m_uiHandle(Wrapper.m_uiHandle), - m_CreateReleaseHelper( std::move( Wrapper.m_CreateReleaseHelper ) ), - m_UniqueId( std::move(Wrapper.m_UniqueId) ) + m_uiHandle {Wrapper.m_uiHandle }, + m_CreateReleaseHelper{std::move(Wrapper.m_CreateReleaseHelper)}, + m_UniqueId {std::move(Wrapper.m_UniqueId) } { Wrapper.m_uiHandle = 0; } @@ -62,10 +65,13 @@ public: GLObjWrapper& operator = (GLObjWrapper&& Wrapper) { Release(); - m_uiHandle = Wrapper.m_uiHandle; - Wrapper.m_uiHandle = 0; - m_CreateReleaseHelper = std::move( Wrapper.m_CreateReleaseHelper ); - m_UniqueId = std::move(Wrapper.m_UniqueId); + + m_uiHandle = Wrapper.m_uiHandle; + m_CreateReleaseHelper = std::move(Wrapper.m_CreateReleaseHelper); + m_UniqueId = std::move(Wrapper.m_UniqueId); + + Wrapper.m_uiHandle = 0; + return *this; } @@ -79,7 +85,7 @@ public: void Release() { - if( m_uiHandle ) + if (m_uiHandle) { m_CreateReleaseHelper.Release(m_uiHandle); m_uiHandle = 0; @@ -98,9 +104,6 @@ public: operator GLuint()const{return m_uiHandle;} private: - GLObjWrapper(const GLObjWrapper&); - GLObjWrapper& operator = (const GLObjWrapper&); - GLuint m_uiHandle; CreateReleaseHelperType m_CreateReleaseHelper; diff --git a/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.h b/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.h index 0cc95e7b..96c73fa6 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.h +++ b/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.h @@ -341,6 +341,8 @@ private: friend class ShaderVariableLocator; }; + + template<> inline Uint32 GLPipelineResourceLayout::GetNumResources<GLPipelineResourceLayout::UniformBuffBindInfo>()const { @@ -365,4 +367,30 @@ inline Uint32 GLPipelineResourceLayout::GetNumResources<GLPipelineResourceLayout return GetNumStorageBuffers(); } + + +template<> +inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::UniformBuffBindInfo>()const +{ + return m_UBOffset; +} + +template<> +inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::SamplerBindInfo>()const +{ + return m_SamplerOffset; +} + +template<> +inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::ImageBindInfo>()const +{ + return m_ImageOffset; +} + +template<> +inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::StorageBufferBindInfo>()const +{ + return m_StorageBufferOffset; +} + } diff --git a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h index 753b7616..a3c3e176 100644 --- a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.h @@ -50,7 +50,7 @@ public: virtual void Resize( Uint32 NewWidth, Uint32 NewHeight )override final; - virtual void SetFullscreenMode(const DisplayModeAttribs &DisplayMode)override final; + virtual void SetFullscreenMode(const DisplayModeAttribs& DisplayMode)override final; virtual void SetWindowedMode()override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h b/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h index 305f133b..81da6554 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h @@ -87,10 +87,10 @@ public: virtual GLuint GetGLTextureHandle()override final { return GetGLHandle(); } virtual void* GetNativeHandle()override final { return reinterpret_cast<void*>(static_cast<size_t>(GetGLTextureHandle())); } - virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) = 0; + virtual void UpdateData( class GLContextState& CtxState, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData ) = 0; protected: - virtual void CreateViewInternal( const struct TextureViewDesc &ViewDesc, class ITextureView **ppView, bool bIsDefaultView )override; + virtual void CreateViewInternal( const struct TextureViewDesc& ViewDesc, class ITextureView** ppView, bool bIsDefaultView )override; void SetDefaultGLParameters(); GLObjectWrappers::GLTextureObj m_GlTexture; diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h index c2841d04..36833e40 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureViewGLImpl.h @@ -40,12 +40,12 @@ class TextureViewGLImpl final : public TextureViewBase<ITextureViewGL, RenderDev public: using TTextureViewBase = TextureViewBase<ITextureViewGL, RenderDeviceGLImpl>; - TextureViewGLImpl(IReferenceCounters *pRefCounters, - RenderDeviceGLImpl *pDevice, + TextureViewGLImpl(IReferenceCounters* pRefCounters, + RenderDeviceGLImpl* pDevice, const struct TextureViewDesc& ViewDesc, - class TextureBaseGL *pTexture, - bool bCreateGLViewTex, - bool bIsDefaultView ); + class TextureBaseGL* pTexture, + bool bCreateGLViewTex, + bool bIsDefaultView ); ~TextureViewGLImpl(); virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface )override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/VAOCache.h b/Graphics/GraphicsEngineOpenGL/include/VAOCache.h index de251651..3b807029 100644 --- a/Graphics/GraphicsEngineOpenGL/include/VAOCache.h +++ b/Graphics/GraphicsEngineOpenGL/include/VAOCache.h @@ -48,24 +48,24 @@ public: - const GLObjectWrappers::GLVertexArrayObj& GetVAO( IPipelineState *pPSO, - IBuffer *pIndexBuffer, - VertexStreamInfo<class BufferGLImpl> VertexStreams[], - Uint32 NumVertexStreams, - class GLContextState &GLContextState); + const GLObjectWrappers::GLVertexArrayObj& GetVAO( IPipelineState* pPSO, + IBuffer* pIndexBuffer, + VertexStreamInfo<class BufferGLImpl> VertexStreams[], + Uint32 NumVertexStreams, + class GLContextState& GLContextState); const GLObjectWrappers::GLVertexArrayObj& GetEmptyVAO(); - void OnDestroyBuffer(IBuffer *pBuffer); - void OnDestroyPSO(IPipelineState *pPSO); + void OnDestroyBuffer(IBuffer* pBuffer); + void OnDestroyPSO(IPipelineState* pPSO); private: // This structure is used as the key to find VAO struct VAOCacheKey { VAOCacheKey(UniqueIdentifier pso_id, UniqueIdentifier ib_id) : - PSOUId (pso_id), - IndexBufferUId (ib_id), - NumUsedSlots (0) + PSOUId {pso_id}, + IndexBufferUId {ib_id }, + NumUsedSlots {0 } {} // Note that using pointers is unsafe as they may (and will) be reused: diff --git a/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp b/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp index 06fec118..4454fda5 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp @@ -31,30 +31,6 @@ namespace Diligent { -template<> -inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::UniformBuffBindInfo>()const -{ - return m_UBOffset; -} - -template<> -inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::SamplerBindInfo>()const -{ - return m_SamplerOffset; -} - -template<> -inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::ImageBindInfo>()const -{ - return m_ImageOffset; -} - -template<> -inline GLPipelineResourceLayout::OffsetType GLPipelineResourceLayout::GetResourceOffset<GLPipelineResourceLayout::StorageBufferBindInfo>()const -{ - return m_StorageBufferOffset; -} - size_t GLPipelineResourceLayout::GetRequiredMemorySize(GLProgramResources* ProgramResources, Uint32 NumPrograms, |
