diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-12-02 23:36:10 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-12-02 23:36:10 +0000 |
| commit | da52d8bbc1ffcf82ed98e0198ecb2bc25530b2c0 (patch) | |
| tree | 3f2bd399de343b2c77ced0f167423476bd5f8835 /Graphics/GraphicsEngineOpenGL | |
| parent | Brought back MapType paramter to UnmapBuffer() function. The performance hit ... (diff) | |
| download | DiligentCore-da52d8bbc1ffcf82ed98e0198ecb2bc25530b2c0.tar.gz DiligentCore-da52d8bbc1ffcf82ed98e0198ecb2bc25530b2c0.zip | |
Added explicit state transition control to CopyBuffer() and CopyTexture() methods
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h | 21 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 33 |
2 files changed, 24 insertions, 30 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h index 325b5ab6..e667f0f8 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -74,7 +74,7 @@ public: virtual void ClearDepthStencil( ITextureView *pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil)override final; - virtual void ClearRenderTarget( ITextureView *pView, const float *RGBA, CLEAR_RENDER_TARGET_STATE_TRANSITION_MODE StateTransitionMode )override final; + virtual void ClearRenderTarget( ITextureView *pView, const float *RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; virtual void Flush()override final; @@ -84,7 +84,13 @@ public: const PVoid pData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)override final; - virtual void CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size)override final; + virtual void CopyBuffer(IBuffer* pSrcBuffer, + Uint32 SrcOffset, + RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, + IBuffer* pDstBuffer, + Uint32 DstOffset, + Uint32 Size, + RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode)override final; virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override final; @@ -98,16 +104,7 @@ public: RESOURCE_STATE_TRANSITION_MODE SrcBufferStateTransitionMode, RESOURCE_STATE_TRANSITION_MODE TextureStateTransitionMode)override final; - virtual void CopyTexture(ITexture* pSrcTexture, - Uint32 SrcMipLevel, - Uint32 SrcSlice, - const Box* pSrcBox, - ITexture* pDstTexture, - Uint32 DstMipLevel, - Uint32 DstSlice, - Uint32 DstX, - Uint32 DstY, - Uint32 DstZ)override final; + virtual void CopyTexture(const CopyTextureAttribs& CopyAttribs)override final; virtual void MapTextureSubresource( ITexture* pTexture, Uint32 MipLevel, diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 4f5b56b2..bdbfdce8 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -908,7 +908,7 @@ namespace Diligent m_ContextState.EnableScissorTest( ScissorTestEnabled ); } - void DeviceContextGLImpl::ClearRenderTarget( ITextureView *pView, const float *RGBA, CLEAR_RENDER_TARGET_STATE_TRANSITION_MODE StateTransitionMode ) + void DeviceContextGLImpl::ClearRenderTarget( ITextureView *pView, const float *RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode ) { // Unlike OpenGL, in D3D10+, the full extent of the resource view is always cleared. // Viewport and scissor settings are not applied. @@ -1023,9 +1023,15 @@ namespace Diligent pBufferGL->UpdateData(m_ContextState, Offset, Size, pData); } - void DeviceContextGLImpl::CopyBuffer(IBuffer *pSrcBuffer, Uint32 SrcOffset, IBuffer *pDstBuffer, Uint32 DstOffset, Uint32 Size) + void DeviceContextGLImpl::CopyBuffer(IBuffer* pSrcBuffer, + Uint32 SrcOffset, + RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, + IBuffer* pDstBuffer, + Uint32 DstOffset, + Uint32 Size, + RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) { - TDeviceContextBase::CopyBuffer(pSrcBuffer, SrcOffset, pDstBuffer, DstOffset, Size); + TDeviceContextBase::CopyBuffer(pSrcBuffer, SrcOffset, SrcBufferTransitionMode, pDstBuffer, DstOffset, Size, DstBufferTransitionMode); auto* pSrcBufferGL = ValidatedCast<BufferGLImpl>(pSrcBuffer); auto* pDstBufferGL = ValidatedCast<BufferGLImpl>(pDstBuffer); @@ -1059,22 +1065,13 @@ namespace Diligent pTexGL->UpdateData(m_ContextState, MipLevel, Slice, DstBox, SubresData); } - void DeviceContextGLImpl::CopyTexture(ITexture* pSrcTexture, - Uint32 SrcMipLevel, - Uint32 SrcSlice, - const Box* pSrcBox, - ITexture* pDstTexture, - Uint32 DstMipLevel, - Uint32 DstSlice, - Uint32 DstX, - Uint32 DstY, - Uint32 DstZ) + void DeviceContextGLImpl::CopyTexture(const CopyTextureAttribs& CopyAttribs) { - TDeviceContextBase::CopyTexture( pSrcTexture, SrcMipLevel, SrcSlice, pSrcBox, - pDstTexture, DstMipLevel, DstSlice, DstX, DstY, DstZ ); - auto* pSrcTexGL = ValidatedCast<TextureBaseGL>(pSrcTexture); - auto* pDstTexGL = ValidatedCast<TextureBaseGL>(pDstTexture); - pDstTexGL->CopyData(this, pSrcTexGL, SrcMipLevel, SrcSlice, pSrcBox, DstMipLevel, DstSlice, DstX, DstY, DstZ); + TDeviceContextBase::CopyTexture( CopyAttribs ); + auto* pSrcTexGL = ValidatedCast<TextureBaseGL>(CopyAttribs.pSrcTexture); + auto* pDstTexGL = ValidatedCast<TextureBaseGL>(CopyAttribs.pDstTexture); + pDstTexGL->CopyData(this, pSrcTexGL, CopyAttribs.SrcMipLevel, CopyAttribs.SrcSlice, CopyAttribs.pSrcBox, + CopyAttribs.DstMipLevel, CopyAttribs.DstSlice, CopyAttribs.DstX, CopyAttribs.DstY, CopyAttribs.DstZ); } void DeviceContextGLImpl::MapTextureSubresource( ITexture* pTexture, |
