From da52d8bbc1ffcf82ed98e0198ecb2bc25530b2c0 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 2 Dec 2018 15:36:10 -0800 Subject: Added explicit state transition control to CopyBuffer() and CopyTexture() methods --- .../include/DeviceContextGLImpl.h | 21 ++++++-------- .../src/DeviceContextGLImpl.cpp | 33 ++++++++++------------ 2 files changed, 24 insertions(+), 30 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') 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(pSrcBuffer); auto* pDstBufferGL = ValidatedCast(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(pSrcTexture); - auto* pDstTexGL = ValidatedCast(pDstTexture); - pDstTexGL->CopyData(this, pSrcTexGL, SrcMipLevel, SrcSlice, pSrcBox, DstMipLevel, DstSlice, DstX, DstY, DstZ); + TDeviceContextBase::CopyTexture( CopyAttribs ); + auto* pSrcTexGL = ValidatedCast(CopyAttribs.pSrcTexture); + auto* pDstTexGL = ValidatedCast(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, -- cgit v1.2.3