diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-11-25 20:08:42 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-11-25 20:08:42 +0000 |
| commit | 3494f0538a108730f9bb25d79416136d2b329af4 (patch) | |
| tree | c0e82cd48d811954f1cd722f113f8042561b6caf /Graphics/GraphicsEngineOpenGL | |
| parent | Moved ITextureView::GenerateMips() to IDeviceContext::GenerateMips() (diff) | |
| download | DiligentCore-3494f0538a108730f9bb25d79416136d2b329af4.tar.gz DiligentCore-3494f0538a108730f9bb25d79416136d2b329af4.zip | |
Renamed/moved IBuffer::Map() to IDeviceContext::MapBuffer()
Renamed/moved IBuffer::Unmap() to IDeviceContext::UnmapBuffer()
Closed https://github.com/DiligentGraphics/DiligentCore/issues/30 (Removed map type, map flag parameters from IBuffer::Unmap function)
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
4 files changed, 23 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h index 9609eadc..6dd5fd04 100644 --- a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h @@ -62,8 +62,8 @@ public: void UpdateData(GLContextState& CtxState, Uint32 Offset, Uint32 Size, const PVoid pData); void CopyData(GLContextState& CtxState, BufferGLImpl& SrcBufferGL, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size); - virtual void Map( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData )override; - virtual void Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags )override; + 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 788327d6..96d7840d 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -82,6 +82,10 @@ public: virtual void CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size)override final; + virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData)override final; + + virtual void UnmapBuffer(IBuffer* pBuffer)override final; + virtual void UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData)override final; virtual void CopyTexture(ITexture* pSrcTexture, diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp index 20de77fb..21333984 100644 --- a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp @@ -227,17 +227,15 @@ void BufferGLImpl :: CopyData(GLContextState& CtxState, BufferGLImpl& SrcBufferG glBindBuffer(GL_COPY_WRITE_BUFFER, 0); } -void BufferGLImpl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData) +void BufferGLImpl :: Map(GLContextState& CtxState, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData) { - TBufferBase::Map( pContext, MapType, MapFlags, pMappedData ); VERIFY( m_uiMapTarget == 0, "Buffer is already mapped"); - auto *pDeviceContextGL = ValidatedCast<DeviceContextGLImpl>(pContext); BufferMemoryBarrier( GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT,// Access by the client to persistent mapped regions of buffer // objects will reflect data written by shaders prior to the barrier. // Note that this may cause additional synchronization operations. - pDeviceContextGL->GetContextState()); + CtxState); m_uiMapTarget = ( MapType == MAP_READ ) ? GL_COPY_READ_BUFFER : GL_COPY_WRITE_BUFFER; glBindBuffer(m_uiMapTarget, m_GlBuffer); @@ -310,10 +308,8 @@ void BufferGLImpl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapF glBindBuffer(m_uiMapTarget, 0); } -void BufferGLImpl::Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags ) +void BufferGLImpl::Unmap() { - TBufferBase::Unmap(pContext, MapType, MapFlags); - glBindBuffer(m_uiMapTarget, m_GlBuffer); auto Result = glUnmapBuffer(m_uiMapTarget); // glUnmapBuffer() returns TRUE unless data values in the buffer's data store have diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 8da30532..1687316d 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -1028,6 +1028,20 @@ namespace Diligent pDstBufferGL->CopyData(m_ContextState, *pSrcBufferGL, SrcOffset, DstOffset, Size); } + void DeviceContextGLImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData) + { + TDeviceContextBase::MapBuffer(pBuffer, MapType, MapFlags, pMappedData); + auto* pBufferGL = ValidatedCast<BufferGLImpl>(pBuffer); + pBufferGL->Map(m_ContextState, MapType, MapFlags, pMappedData); + } + + void DeviceContextGLImpl::UnmapBuffer(IBuffer* pBuffer) + { + TDeviceContextBase::UnmapBuffer(pBuffer); + auto* pBufferGL = ValidatedCast<BufferGLImpl>(pBuffer); + pBufferGL->Unmap(); + } + void DeviceContextGLImpl::UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData) { TDeviceContextBase::UpdateTexture( pTexture, MipLevel, Slice, DstBox, SubresData ); |
