From df67308c3b1236ff4c9445a17393f665e1ddd452 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 24 Nov 2018 15:45:15 -0800 Subject: Renamed/moved ITexture::UpdateData() to IDeviceContext::UpdateTexture() Renamed/moved IBuffer::CopyData() to IDeviceContext::CopyTexture() --- .../include/DeviceContextGLImpl.h | 14 +++++++++++ .../include/Texture1DArray_OGL.h | 2 +- .../GraphicsEngineOpenGL/include/Texture1D_OGL.h | 2 +- .../include/Texture2DArray_OGL.h | 2 +- .../GraphicsEngineOpenGL/include/Texture2D_OGL.h | 2 +- .../GraphicsEngineOpenGL/include/Texture3D_OGL.h | 2 +- .../GraphicsEngineOpenGL/include/TextureBaseGL.h | 24 +++++++++--------- .../include/TextureCubeArray_OGL.h | 2 +- .../GraphicsEngineOpenGL/include/TextureCube_OGL.h | 2 +- .../src/DeviceContextGLImpl.cpp | 25 +++++++++++++++++++ .../src/Texture1DArray_OGL.cpp | 7 +++--- .../GraphicsEngineOpenGL/src/Texture1D_OGL.cpp | 7 +++--- .../src/Texture2DArray_OGL.cpp | 7 +++--- .../GraphicsEngineOpenGL/src/Texture2D_OGL.cpp | 7 +++--- .../GraphicsEngineOpenGL/src/Texture3D_OGL.cpp | 7 +++--- .../GraphicsEngineOpenGL/src/TextureBaseGL.cpp | 29 ++++++++-------------- .../src/TextureCubeArray_OGL.cpp | 7 +++--- .../GraphicsEngineOpenGL/src/TextureCube_OGL.cpp | 7 +++--- 18 files changed, 90 insertions(+), 65 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h index c88e8410..5754eb69 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -82,6 +82,20 @@ public: virtual void CopyBuffer(IBuffer *pSrcBuffer, IBuffer *pDstBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size)override final; + virtual void UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData)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 FinishFrame()override final; virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)override final; diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h index b0fc149f..37844847 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture1DArray_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~Texture1DArray_OGL(); - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h index 7db891f6..7fed2d19 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture1D_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~Texture1D_OGL(); - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h index ff2ec974..82a9b1e6 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture2DArray_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~Texture2DArray_OGL(); - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h index af64a86a..c06e690b 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture2D_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~Texture2D_OGL(); - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h b/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h index 5e4ebcec..7b2e37fb 100644 --- a/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/Texture3D_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~Texture3D_OGL(); - virtual void UpdateData(IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData)override final; + virtual void UpdateData(class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData)override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h b/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h index 4f80aa05..63ad8e02 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureBaseGL.h @@ -64,8 +64,6 @@ public: virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override; - virtual void UpdateData( class GLContextState &CtxState, IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ); - //virtual void CopyData(CTexture *pSrcTexture, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size); virtual void Map(IDeviceContext* pContext, Uint32 MipLevel, @@ -84,20 +82,22 @@ public: virtual void AttachToFramebuffer(const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint) = 0; - virtual void CopyData(IDeviceContext *pContext, - ITexture *pSrcTexture, - Uint32 SrcMipLevel, - Uint32 SrcSlice, - const Box *pSrcBox, - Uint32 DstMipLevel, - Uint32 DstSlice, - Uint32 DstX, - Uint32 DstY, - Uint32 DstZ)override; + void CopyData(DeviceContextGLImpl *pDeviceCtxGL, + TextureBaseGL *pSrcTextureGL, + Uint32 SrcMipLevel, + Uint32 SrcSlice, + const Box *pSrcBox, + Uint32 DstMipLevel, + Uint32 DstSlice, + Uint32 DstX, + Uint32 DstY, + Uint32 DstZ); virtual GLuint GetGLTextureHandle()override final { return GetGLHandle(); } virtual void* GetNativeHandle()override final { return reinterpret_cast(static_cast(GetGLTextureHandle())); } + 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; void SetDefaultGLParameters(); diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h b/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h index e76ea064..cef100d1 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureCubeArray_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~TextureCubeArray_OGL(); - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h b/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h index a4536847..576b792f 100644 --- a/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h +++ b/Graphics/GraphicsEngineOpenGL/include/TextureCube_OGL.h @@ -48,7 +48,7 @@ public: bool bIsDeviceInternal = false); ~TextureCube_OGL(); - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( class GLContextState &CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; virtual void AttachToFramebuffer( const struct TextureViewDesc& ViewDesc, GLenum AttachmentPoint )override final; private: diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 57c684ff..83c5caa2 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -1028,6 +1028,31 @@ namespace Diligent pDstBufferGL->CopyData(m_ContextState, *pSrcBufferGL, SrcOffset, DstOffset, Size); } + void DeviceContextGLImpl::UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData) + { + TDeviceContextBase::UpdateTexture( pTexture, MipLevel, Slice, DstBox, SubresData ); + auto* pTexGL = ValidatedCast(pTexture); + 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) + { + 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); + } + void DeviceContextGLImpl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) { diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp index 57478e47..5d412bb5 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture1DArray_OGL.cpp @@ -72,7 +72,7 @@ Texture1DArray_OGL::Texture1DArray_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of Texture1DArray_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - Texture1DArray_OGL::UpdateData(pDeviceContext, Mip, Slice, DstBox, InitData.pSubResources[Slice*m_Desc.MipLevels + Mip]); + Texture1DArray_OGL::UpdateData(ContextState, Mip, Slice, DstBox, InitData.pSubResources[Slice*m_Desc.MipLevels + Mip]); } } } @@ -100,10 +100,9 @@ Texture1DArray_OGL::~Texture1DArray_OGL() { } -void Texture1DArray_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void Texture1DArray_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); ContextState.BindTexture( -1, m_BindTarget, m_GlTexture ); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp index f5ee0def..700cc7b8 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture1D_OGL.cpp @@ -70,7 +70,7 @@ Texture1D_OGL::Texture1D_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of Texture1D_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - Texture1D_OGL::UpdateData( pDeviceContext, Mip, 0, DstBox, InitData.pSubResources[Mip] ); + Texture1D_OGL::UpdateData( ContextState, Mip, 0, DstBox, InitData.pSubResources[Mip] ); } } else @@ -97,10 +97,9 @@ Texture1D_OGL::~Texture1D_OGL() { } -void Texture1D_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void Texture1D_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); ContextState.BindTexture( -1, m_BindTarget, m_GlTexture ); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp index e1cc57c1..606bf469 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp @@ -90,7 +90,7 @@ Texture2DArray_OGL::Texture2DArray_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of Texture2DArray_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - Texture2DArray_OGL::UpdateData(pDeviceContext, Mip, Slice, DstBox, InitData.pSubResources[Slice*m_Desc.MipLevels + Mip]); + Texture2DArray_OGL::UpdateData(ContextState, Mip, Slice, DstBox, InitData.pSubResources[Slice*m_Desc.MipLevels + Mip]); } } } @@ -121,10 +121,9 @@ Texture2DArray_OGL::~Texture2DArray_OGL() { } -void Texture2DArray_OGL::UpdateData(IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData) +void Texture2DArray_OGL::UpdateData(GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); ContextState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp index 631b44ca..87f673de 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp @@ -94,7 +94,7 @@ Texture2D_OGL::Texture2D_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of Texture2D_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - Texture2D_OGL::UpdateData( pDeviceContext, Mip, 0, DstBox, InitData.pSubResources[Mip] ); + Texture2D_OGL::UpdateData( ContextState, Mip, 0, DstBox, InitData.pSubResources[Mip] ); } } else @@ -123,10 +123,9 @@ Texture2D_OGL::~Texture2D_OGL() { } -void Texture2D_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void Texture2D_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); ContextState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp index 6fb7645a..b7e05e61 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture3D_OGL.cpp @@ -73,7 +73,7 @@ Texture3D_OGL::Texture3D_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of Texture3D_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - Texture3D_OGL::UpdateData( pDeviceContext, Mip, 0, DstBox, InitData.pSubResources[Mip] ); + Texture3D_OGL::UpdateData( ContextState, Mip, 0, DstBox, InitData.pSubResources[Mip] ); } } else @@ -101,10 +101,9 @@ Texture3D_OGL::~Texture3D_OGL() } -void Texture3D_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void Texture3D_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); ContextState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp index a0f0820b..5509aa2c 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp @@ -341,10 +341,8 @@ void TextureBaseGL::CreateViewInternal( const struct TextureViewDesc &OrigViewDe } -void TextureBaseGL::UpdateData( GLContextState &CtxState, IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void TextureBaseGL::UpdateData( GLContextState& CtxState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - TTextureBase::UpdateData(pContext, MipLevel, Slice, DstBox, SubresData); - // GL_TEXTURE_UPDATE_BARRIER_BIT: // Writes to a texture via glTex( Sub )Image*, glCopyTex( Sub )Image*, glClearTex*Image, // glCompressedTex( Sub )Image*, and reads via glTexImage() after the barrier will reflect @@ -364,19 +362,17 @@ void TextureBaseGL::UpdateData( GLContextState &CtxState, IDeviceContext *pCont //} // -void TextureBaseGL :: CopyData(IDeviceContext *pContext, - ITexture *pSrcTexture, - Uint32 SrcMipLevel, - Uint32 SrcSlice, - const Box *pSrcBox, - Uint32 DstMipLevel, - Uint32 DstSlice, - Uint32 DstX, - Uint32 DstY, - Uint32 DstZ) +void TextureBaseGL :: CopyData(DeviceContextGLImpl *pDeviceCtxGL, + TextureBaseGL *pSrcTextureGL, + Uint32 SrcMipLevel, + Uint32 SrcSlice, + const Box *pSrcBox, + Uint32 DstMipLevel, + Uint32 DstSlice, + Uint32 DstX, + Uint32 DstY, + Uint32 DstZ) { - auto *pDeviceCtxGL = ValidatedCast( pContext ); - auto *pSrcTextureGL = ValidatedCast( pSrcTexture ); const auto& SrcTexDesc = pSrcTextureGL->GetDesc(); Box SrcBox; @@ -396,9 +392,6 @@ void TextureBaseGL :: CopyData(IDeviceContext *pContext, pSrcBox = &SrcBox; } - TTextureBase::CopyData( pContext, pSrcTexture, SrcMipLevel, SrcSlice, pSrcBox, - DstMipLevel, DstSlice, DstX, DstY, DstZ ); - #if GL_ARB_copy_image if( glCopyImageSubData ) { diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp index eddea87a..03654063 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp @@ -79,7 +79,7 @@ TextureCubeArray_OGL::TextureCubeArray_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of TextureCubeArray_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - TextureCubeArray_OGL::UpdateData(pDeviceContext, Mip, Slice, DstBox, InitData.pSubResources[Slice*m_Desc.MipLevels + Mip]); + TextureCubeArray_OGL::UpdateData(ContextState, Mip, Slice, DstBox, InitData.pSubResources[Slice*m_Desc.MipLevels + Mip]); } } } @@ -107,10 +107,9 @@ TextureCubeArray_OGL::~TextureCubeArray_OGL() { } -void TextureCubeArray_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void TextureCubeArray_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); ContextState.BindTexture(-1, m_BindTarget, m_GlTexture); diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp index ce7fe1d5..528cafe0 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp @@ -77,7 +77,7 @@ TextureCube_OGL::TextureCube_OGL( IReferenceCounters *pRefCounters, // we will get into TextureBaseGL::UpdateData(), because instance of TextureCube_OGL // is not fully constructed yet. // To call the required function, we need to explicitly specify the class: - TextureCube_OGL::UpdateData( pDeviceContext, Mip, Face, DstBox, InitData.pSubResources[Face*m_Desc.MipLevels + Mip] ); + TextureCube_OGL::UpdateData( ContextState, Mip, Face, DstBox, InitData.pSubResources[Face*m_Desc.MipLevels + Mip] ); } } } @@ -117,10 +117,9 @@ static const GLenum CubeMapFaces[6] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z }; -void TextureCube_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void TextureCube_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) { - auto &ContextState = ValidatedCast(pContext)->GetContextState(); - TextureBaseGL::UpdateData(ContextState, pContext, MipLevel, Slice, DstBox, SubresData); + TextureBaseGL::UpdateData(ContextState, MipLevel, Slice, DstBox, SubresData); // Texture must be bound as GL_TEXTURE_CUBE_MAP, but glTexSubImage2D() // then takes one of GL_TEXTURE_CUBE_MAP_POSITIVE_X ... GL_TEXTURE_CUBE_MAP_NEGATIVE_Z -- cgit v1.2.3