diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-10-08 02:37:23 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-10-08 02:37:23 +0000 |
| commit | 2c135690209a7da2c44d8867057d0cc23fd30edf (patch) | |
| tree | 8bbbf578ece34470a9afe5ea0d14f7cf8d4c7d22 /Graphics/GraphicsEngineOpenGL | |
| parent | Fixed another clang build issue + some code formatting (diff) | |
| download | DiligentCore-2c135690209a7da2c44d8867057d0cc23fd30edf.tar.gz DiligentCore-2c135690209a7da2c44d8867057d0cc23fd30edf.zip | |
OpenGL backend: cosmetic code changes
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
23 files changed, 234 insertions, 100 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp index 50e462e8..f0123b11 100644 --- a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp @@ -74,11 +74,18 @@ BufferGLImpl::BufferGLImpl(IReferenceCounters* pRefCounters, const BufferDesc& BuffDesc, const BufferData* pBuffData /*= nullptr*/, bool bIsDeviceInternal) : - TBufferBase( pRefCounters, BuffViewObjMemAllocator, pDeviceGL, BuffDesc, bIsDeviceInternal), - m_GlBuffer(true), // Create buffer immediately - m_uiMapTarget(0), - m_GLUsageHint(UsageToGLUsage(BuffDesc.Usage)), - m_bUseMapWriteDiscardBugWA(GetUseMapWriteDiscardBugWA(pDeviceGL)) + TBufferBase + { + pRefCounters, + BuffViewObjMemAllocator, + pDeviceGL, + BuffDesc, + bIsDeviceInternal + }, + m_GlBuffer {true }, // Create buffer immediately + m_uiMapTarget {0 }, + m_GLUsageHint {UsageToGLUsage(BuffDesc.Usage) }, + m_bUseMapWriteDiscardBugWA{GetUseMapWriteDiscardBugWA(pDeviceGL)} { if( BuffDesc.Usage == USAGE_STATIC && (pBuffData == nullptr || pBuffData->pData == nullptr) ) LOG_ERROR_AND_THROW("Static buffer must be initialized with data at creation time"); @@ -183,12 +190,19 @@ BufferGLImpl::BufferGLImpl(IReferenceCounters* pRefCounters, const BufferDesc& BuffDesc, GLuint GLHandle, bool bIsDeviceInternal) : - TBufferBase( pRefCounters, BuffViewObjMemAllocator, pDeviceGL, GetBufferDescFromGLHandle(pCtxGL, BuffDesc, GLHandle), bIsDeviceInternal), + TBufferBase + { + pRefCounters, + BuffViewObjMemAllocator, + pDeviceGL, + GetBufferDescFromGLHandle(pCtxGL, BuffDesc, GLHandle), + bIsDeviceInternal + }, // Attach to external buffer handle - m_GlBuffer(true, GLObjectWrappers::GLBufferObjCreateReleaseHelper(GLHandle)), - m_uiMapTarget(0), - m_GLUsageHint(UsageToGLUsage(BuffDesc.Usage)), - m_bUseMapWriteDiscardBugWA(GetUseMapWriteDiscardBugWA(pDeviceGL)) + m_GlBuffer {true, GLObjectWrappers::GLBufferObjCreateReleaseHelper(GLHandle)}, + m_uiMapTarget {0 }, + m_GLUsageHint {UsageToGLUsage(BuffDesc.Usage) }, + m_bUseMapWriteDiscardBugWA{GetUseMapWriteDiscardBugWA(pDeviceGL)} { } @@ -197,7 +211,7 @@ BufferGLImpl::~BufferGLImpl() static_cast<RenderDeviceGLImpl*>( GetDevice() )->OnDestroyBuffer(this); } -IMPLEMENT_QUERY_INTERFACE( BufferGLImpl, IID_BufferGL, TBufferBase ) +IMPLEMENT_QUERY_INTERFACE(BufferGLImpl, IID_BufferGL, TBufferBase) void BufferGLImpl :: UpdateData(DeviceContextGLImpl* pCtxGL, Uint32 Offset, Uint32 Size, const PVoid pData) { @@ -367,7 +381,7 @@ void BufferGLImpl::BufferMemoryBarrier( Uint32 RequiredBarriers, GLContextState #endif } -void BufferGLImpl::CreateViewInternal( const BufferViewDesc &OrigViewDesc, class IBufferView **ppView, bool bIsDefaultView ) +void BufferGLImpl::CreateViewInternal(const BufferViewDesc& OrigViewDesc, class IBufferView** ppView, bool bIsDefaultView) { VERIFY( ppView != nullptr, "Buffer view pointer address is null" ); if( !ppView )return; diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp index 55e12c9e..1d0444a2 100644 --- a/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp @@ -37,8 +37,15 @@ namespace Diligent const BufferViewDesc& ViewDesc, BufferGLImpl* pBuffer, bool bIsDefaultView) : - TBuffViewBase(pRefCounters, pDevice, ViewDesc, pBuffer, bIsDefaultView ), - m_GLTexBuffer(false) + TBuffViewBase + { + pRefCounters, + pDevice, + ViewDesc, + pBuffer, + bIsDefaultView + }, + m_GLTexBuffer{false} { const auto& BuffDesc = pBuffer->GetDesc(); if ((ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE || ViewDesc.ViewType == BUFFER_VIEW_UNORDERED_ACCESS) && diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index dfb2acb3..e1d2640a 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -51,10 +51,15 @@ using namespace std; namespace Diligent { DeviceContextGLImpl::DeviceContextGLImpl(IReferenceCounters* pRefCounters, class RenderDeviceGLImpl* pDeviceGL, bool bIsDeferred) : - TDeviceContextBase (pRefCounters, pDeviceGL, bIsDeferred), - m_ContextState (pDeviceGL), - m_CommitedResourcesTentativeBarriers (0), - m_DefaultFBO (false) + TDeviceContextBase + { + pRefCounters, + pDeviceGL, + bIsDeferred + }, + m_ContextState {pDeviceGL}, + m_CommitedResourcesTentativeBarriers {0 }, + m_DefaultFBO {false } { m_BoundWritableTextures.reserve( 16 ); m_BoundWritableBuffers.reserve( 16 ); diff --git a/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp index e8c819af..c207bef4 100644 --- a/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/FenceGLImpl.cpp @@ -32,7 +32,12 @@ namespace Diligent FenceGLImpl :: FenceGLImpl(IReferenceCounters* pRefCounters, RenderDeviceGLImpl* pDevice, const FenceDesc& Desc) : - TFenceBase(pRefCounters, pDevice, Desc) + TFenceBase + { + pRefCounters, + pDevice, + Desc + } { } diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp index e7886e8d..d28175d6 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp @@ -36,9 +36,9 @@ using namespace Diligent; namespace Diligent { - GLContextState::GLContextState( RenderDeviceGLImpl *pDeviceGL ) + GLContextState::GLContextState(RenderDeviceGLImpl* pDeviceGL) { - const DeviceCaps &DeviceCaps = pDeviceGL->GetDeviceCaps(); + const DeviceCaps& DeviceCaps = pDeviceGL->GetDeviceCaps(); m_Caps.bFillModeSelectionSupported = DeviceCaps.bWireframeFillSupported; { diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp index d651446f..af4305c7 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp @@ -90,8 +90,8 @@ namespace Diligent } GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCaps, const SwapChainDesc* pSCDesc) : - m_Context(0), - m_WindowHandleToDeviceContext(0) + m_Context {0}, + m_WindowHandleToDeviceContext{0} { Int32 MajorVersion = 0, MinorVersion = 0; if(InitAttribs.pNativeWndHandle != nullptr) diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp index aa67f70c..351cdffd 100644 --- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp @@ -36,9 +36,15 @@ PipelineStateGLImpl::PipelineStateGLImpl(IReferenceCounters* pRefCounters, RenderDeviceGLImpl* pDeviceGL, const PipelineStateDesc& PipelineDesc, bool bIsDeviceInternal) : - TPipelineStateBase(pRefCounters, pDeviceGL, PipelineDesc, bIsDeviceInternal), - m_ResourceLayout (*this), - m_StaticResourceLayout(*this) + TPipelineStateBase + { + pRefCounters, + pDeviceGL, + PipelineDesc, + bIsDeviceInternal + }, + m_ResourceLayout {*this}, + m_StaticResourceLayout{*this} { if (!m_Desc.IsComputePipeline && m_pPS == nullptr) { diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp index 0df97e66..8ec263c2 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp @@ -72,7 +72,7 @@ RenderDeviceGLImpl :: RenderDeviceGLImpl(IReferenceCounters* pRefCounters } }, // Device caps must be filled in before the constructor of Pipeline Cache is called! - m_GLContext(InitAttribs, m_DeviceCaps, pSCDesc) + m_GLContext{InitAttribs, m_DeviceCaps, pSCDesc} { GLint NumExtensions = 0; glGetIntegerv( GL_NUM_EXTENSIONS,& NumExtensions ); diff --git a/Graphics/GraphicsEngineOpenGL/src/SamplerGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SamplerGLImpl.cpp index d13b78b1..1b18fe6e 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SamplerGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/SamplerGLImpl.cpp @@ -30,8 +30,14 @@ namespace Diligent { SamplerGLImpl::SamplerGLImpl(IReferenceCounters *pRefCounters, class RenderDeviceGLImpl *pDeviceGL, const SamplerDesc& SamplerDesc, bool bIsDeviceInternal) : - TSamplerBase( pRefCounters, pDeviceGL, SamplerDesc, bIsDeviceInternal ), - m_GlSampler(true) + TSamplerBase + { + pRefCounters, + pDeviceGL, + SamplerDesc, + bIsDeviceInternal + }, + m_GlSampler{true} { const auto& SamCaps = pDeviceGL->GetDeviceCaps().SamCaps; diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp index 26413796..d952f330 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp @@ -38,8 +38,14 @@ ShaderGLImpl::ShaderGLImpl(IReferenceCounters* pRefCounters, RenderDeviceGLImpl* pDeviceGL, const ShaderCreateInfo& CreationAttribs, bool bIsDeviceInternal) : - TShaderBase( pRefCounters, pDeviceGL, CreationAttribs.Desc, bIsDeviceInternal ), - m_GLShaderObj(true, GLObjectWrappers::GLShaderObjCreateReleaseHelper( GetGLShaderType( m_Desc.ShaderType ) )) + TShaderBase + { + pRefCounters, + pDeviceGL, + CreationAttribs.Desc, + bIsDeviceInternal + }, + m_GLShaderObj{true, GLObjectWrappers::GLShaderObjCreateReleaseHelper{GetGLShaderType(m_Desc.ShaderType)}} { auto GLSLSource = BuildGLSLSourceString(CreationAttribs, pDeviceGL->GetDeviceCaps(), TargetGLSLCompiler::driver); diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp index bcc2482a..fb023a90 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp @@ -34,8 +34,12 @@ ShaderResourceBindingGLImpl::ShaderResourceBindingGLImpl(IReferenceCounters* PipelineStateGLImpl* pPSO, GLProgramResources* ProgramResources, Uint32 NumPrograms) : - TBase (pRefCounters, pPSO), - m_ResourceLayout(*this) + TBase + { + pRefCounters, + pPSO + }, + m_ResourceLayout{*this} { pPSO->InitializeSRBResourceCache(m_ResourceCache); diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp index fa87b149..d5ad07b9 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp @@ -33,7 +33,13 @@ SwapChainGLImpl::SwapChainGLImpl(IReferenceCounters* pRefCounters, const SwapChainDesc& SCDesc, RenderDeviceGLImpl* pRenderDeviceGL, DeviceContextGLImpl* pImmediateContextGL) : - TSwapChainBase( pRefCounters, pRenderDeviceGL, pImmediateContextGL, SCDesc) + TSwapChainBase + { + pRefCounters, + pRenderDeviceGL, + pImmediateContextGL, + SCDesc + } { #if PLATFORM_WIN32 HWND hWnd = reinterpret_cast<HWND>(InitAttribs.pNativeWndHandle); diff --git a/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp b/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp index 3a82b31e..429cfe83 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TexRegionRender.cpp @@ -56,7 +56,7 @@ namespace Diligent "} \n" }; - TexRegionRender::TexRegionRender( class RenderDeviceGLImpl *pDeviceGL ) + TexRegionRender::TexRegionRender(class RenderDeviceGLImpl* pDeviceGL) { ShaderCreateInfo ShaderAttrs; ShaderAttrs.Desc.Name = "TexRegionRender : Vertex shader"; diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp index ccb3cb20..a92f32a7 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp @@ -39,8 +39,16 @@ Texture1DArray_OGL::Texture1DArray_OGL(IReferenceCounters* pRefCounters, const TextureDesc& TexDesc, const TextureData* pInitData /*= nullptr*/, bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, - GL_TEXTURE_1D_ARRAY, pInitData, bIsDeviceInternal) + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + GL_TEXTURE_1D_ARRAY, + pInitData, + bIsDeviceInternal + } { GLState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp index 92fb1c02..97d60345 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp @@ -32,14 +32,23 @@ namespace Diligent { -Texture1D_OGL::Texture1D_OGL( IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - RenderDeviceGLImpl* pDeviceGL, - GLContextState& GLState, - const TextureDesc& TexDesc, - const TextureData* pInitData /*= nullptr*/, - bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, GL_TEXTURE_1D, pInitData, bIsDeviceInternal) +Texture1D_OGL::Texture1D_OGL(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceGLImpl* pDeviceGL, + GLContextState& GLState, + const TextureDesc& TexDesc, + const TextureData* pInitData /*= nullptr*/, + bool bIsDeviceInternal /*= false*/) : + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + GL_TEXTURE_1D, + pInitData, + bIsDeviceInternal + } { GLState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp index 1ce9da56..a1a64000 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp @@ -33,14 +33,23 @@ namespace Diligent { -Texture2DArray_OGL::Texture2DArray_OGL( IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - RenderDeviceGLImpl* pDeviceGL, - GLContextState& GLState, - const TextureDesc& TexDesc, - const TextureData* pInitData /*= nullptr*/, - bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, TexDesc.SampleCount > 1 ? GL_TEXTURE_2D_MULTISAMPLE_ARRAY : GL_TEXTURE_2D_ARRAY, pInitData, bIsDeviceInternal) +Texture2DArray_OGL::Texture2DArray_OGL(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceGLImpl* pDeviceGL, + GLContextState& GLState, + const TextureDesc& TexDesc, + const TextureData* pInitData /*= nullptr*/, + bool bIsDeviceInternal /*= false*/) : + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + TexDesc.SampleCount > 1 ? GL_TEXTURE_2D_MULTISAMPLE_ARRAY : GL_TEXTURE_2D_ARRAY, + pInitData, + bIsDeviceInternal + } { GLState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp index c781a943..a5d902a2 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp @@ -40,7 +40,16 @@ Texture2D_OGL::Texture2D_OGL( IReferenceCounters* pRefCounters, const TextureDesc& TexDesc, const TextureData* pInitData /*= nullptr*/, bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, TexDesc.SampleCount > 1 ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, pInitData, bIsDeviceInternal) + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + TexDesc.SampleCount > 1 ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, + pInitData, + bIsDeviceInternal + } { GLState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp index ba766342..46b79d6f 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp @@ -33,15 +33,23 @@ namespace Diligent { -Texture3D_OGL::Texture3D_OGL( IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - RenderDeviceGLImpl* pDeviceGL, - GLContextState& GLState, - const TextureDesc& TexDesc, - const TextureData* pInitData /*= TextureData()*/, - bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, - GL_TEXTURE_3D, pInitData, bIsDeviceInternal) +Texture3D_OGL::Texture3D_OGL(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceGLImpl* pDeviceGL, + GLContextState& GLState, + const TextureDesc& TexDesc, + const TextureData* pInitData /*= TextureData()*/, + bool bIsDeviceInternal /*= false*/) : + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + GL_TEXTURE_3D, + pInitData, + bIsDeviceInternal + } { GLState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp index 7786a9d4..6ca11e69 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp @@ -42,10 +42,17 @@ TextureBaseGL::TextureBaseGL(IReferenceCounters* pRefCounters, GLenum BindTarget, const TextureData* pInitData /*= nullptr*/, bool bIsDeviceInternal /*= false*/) : - TTextureBase( pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, bIsDeviceInternal ), - m_GlTexture(true), // Create Texture immediately - m_BindTarget(BindTarget), - m_GLTexFormat( TexFormatToGLInternalTexFormat(m_Desc.Format, m_Desc.BindFlags) ) + TTextureBase + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + bIsDeviceInternal + }, + m_GlTexture {true }, // Create Texture immediately + m_BindTarget {BindTarget }, + m_GLTexFormat {TexFormatToGLInternalTexFormat(m_Desc.Format, m_Desc.BindFlags)} //m_uiMapTarget(0) { VERIFY( m_GLTexFormat != 0, "Unsupported texture format" ); diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp index 76544f2f..0a16f4e6 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp @@ -33,14 +33,23 @@ namespace Diligent { -TextureCubeArray_OGL::TextureCubeArray_OGL( IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - RenderDeviceGLImpl* pDeviceGL, - GLContextState& GLState, - const TextureDesc& TexDesc, - const TextureData* pInitData /*= nullptr*/, - bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, GL_TEXTURE_CUBE_MAP_ARRAY, pInitData, bIsDeviceInternal) +TextureCubeArray_OGL::TextureCubeArray_OGL(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceGLImpl* pDeviceGL, + GLContextState& GLState, + const TextureDesc& TexDesc, + const TextureData* pInitData /*= nullptr*/, + bool bIsDeviceInternal /*= false*/) : + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + GL_TEXTURE_CUBE_MAP_ARRAY, + pInitData, + bIsDeviceInternal + } { VERIFY(m_Desc.SampleCount == 1, "Multisampled texture cube arrays are not supported"); diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp index ac0e089b..ec09b6bf 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp @@ -33,14 +33,23 @@ namespace Diligent { -TextureCube_OGL::TextureCube_OGL( IReferenceCounters* pRefCounters, - FixedBlockMemoryAllocator& TexViewObjAllocator, - class RenderDeviceGLImpl* pDeviceGL, - GLContextState& GLState, - const TextureDesc& TexDesc, - const TextureData* pInitData /*= nullptr*/, - bool bIsDeviceInternal /*= false*/) : - TextureBaseGL(pRefCounters, TexViewObjAllocator, pDeviceGL, TexDesc, GL_TEXTURE_CUBE_MAP, pInitData, bIsDeviceInternal) +TextureCube_OGL::TextureCube_OGL(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceGLImpl* pDeviceGL, + GLContextState& GLState, + const TextureDesc& TexDesc, + const TextureData* pInitData /*= nullptr*/, + bool bIsDeviceInternal /*= false*/) : + TextureBaseGL + { + pRefCounters, + TexViewObjAllocator, + pDeviceGL, + TexDesc, + GL_TEXTURE_CUBE_MAP, + pInitData, + bIsDeviceInternal + } { VERIFY(m_Desc.SampleCount == 1, "Multisampled cubemap textures are not supported"); diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureViewGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureViewGLImpl.cpp index cc55cd7e..b3f8880a 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureViewGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureViewGLImpl.cpp @@ -30,15 +30,22 @@ namespace Diligent { - TextureViewGLImpl::TextureViewGLImpl( IReferenceCounters *pRefCounters, - RenderDeviceGLImpl *pDevice, - const TextureViewDesc& ViewDesc, - TextureBaseGL* pTexture, - bool bCreateGLViewTex, - bool bIsDefaultView ) : - TTextureViewBase(pRefCounters, pDevice, ViewDesc, pTexture, bIsDefaultView), - m_ViewTexGLHandle( bCreateGLViewTex ), - m_ViewTexBindTarget(0) + TextureViewGLImpl::TextureViewGLImpl(IReferenceCounters *pRefCounters, + RenderDeviceGLImpl *pDevice, + const TextureViewDesc& ViewDesc, + TextureBaseGL* pTexture, + bool bCreateGLViewTex, + bool bIsDefaultView) : + TTextureViewBase + { + pRefCounters, + pDevice, + ViewDesc, + pTexture, + bIsDefaultView + }, + m_ViewTexGLHandle {bCreateGLViewTex}, + m_ViewTexBindTarget {0 } { } diff --git a/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp b/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp index dcb700ac..1fa06748 100644 --- a/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/VAOCache.cpp @@ -35,7 +35,7 @@ namespace Diligent { VAOCache::VAOCache() : - m_EmptyVAO(true) + m_EmptyVAO{true} { m_Cache.max_load_factor(0.5f); m_PSOToKey.max_load_factor(0.5f); @@ -49,7 +49,7 @@ VAOCache::~VAOCache() VERIFY(m_BuffToKey.empty(), "BuffToKey hash is not empty"); } -void VAOCache::OnDestroyBuffer(IBuffer *pBuffer) +void VAOCache::OnDestroyBuffer(IBuffer* pBuffer) { ThreadingTools::LockHelper CacheLock(m_CacheLockFlag); auto EqualRange = m_BuffToKey.equal_range(pBuffer); @@ -71,14 +71,14 @@ void VAOCache::OnDestroyPSO(IPipelineState *pPSO) m_PSOToKey.erase(EqualRange.first, EqualRange.second); } -const GLObjectWrappers::GLVertexArrayObj& VAOCache::GetVAO( IPipelineState* pPSO, - IBuffer* pIndexBuffer, - VertexStreamInfo<BufferGLImpl> VertexStreams[], - Uint32 NumVertexStreams, - GLContextState& GLContextState ) +const GLObjectWrappers::GLVertexArrayObj& VAOCache::GetVAO(IPipelineState* pPSO, + IBuffer* pIndexBuffer, + VertexStreamInfo<BufferGLImpl> VertexStreams[], + Uint32 NumVertexStreams, + GLContextState& GLContextState) { // Lock the cache - ThreadingTools::LockHelper CacheLock(m_CacheLockFlag); + ThreadingTools::LockHelper CacheLock{m_CacheLockFlag}; BufferGLImpl* VertexBuffers[MaxBufferSlots]; for (Uint32 s = 0; s < NumVertexStreams; ++s) |
