diff --git a/RenderSystems/NULL/include/OgreNULLTextureGpu.h b/RenderSystems/NULL/include/OgreNULLTextureGpu.h index 35a7f333d23..f80ac353c6e 100644 --- a/RenderSystems/NULL/include/OgreNULLTextureGpu.h +++ b/RenderSystems/NULL/include/OgreNULLTextureGpu.h @@ -86,6 +86,22 @@ namespace Ogre PixelFormatGpu getDesiredDepthBufferFormat() const override; }; + /// A RenderWindow-specific texture. Its only job over the base class is to + /// answer the "Window" custom attribute, which RenderSystem::getDepthBufferFor + /// relies on for every render-window-specific colour target. + class _OgreNULLExport NULLTextureGpuWindow final : public NULLTextureGpuRenderTarget + { + Window *mWindow; + + public: + NULLTextureGpuWindow( GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, + VaoManager *vaoManager, IdString name, uint32 textureFlags, + TextureTypes::TextureTypes initialType, TextureGpuManager *textureManager, + Window *window ); + + void getCustomAttribute( IdString name, void *pData ) override; + }; + /** @} */ /** @} */ } // namespace Ogre diff --git a/RenderSystems/NULL/include/OgreNULLTextureGpuManager.h b/RenderSystems/NULL/include/OgreNULLTextureGpuManager.h index b41e4c43ec1..f30290bd54b 100644 --- a/RenderSystems/NULL/include/OgreNULLTextureGpuManager.h +++ b/RenderSystems/NULL/include/OgreNULLTextureGpuManager.h @@ -64,7 +64,7 @@ namespace Ogre NULLTextureGpuManager( VaoManager *vaoManager, RenderSystem *renderSystem ); ~NULLTextureGpuManager() override; - TextureGpu *createTextureGpuWindow(); + TextureGpu *createTextureGpuWindow( Window *window ); }; /** @} */ diff --git a/RenderSystems/NULL/src/OgreNULLTextureGpu.cpp b/RenderSystems/NULL/src/OgreNULLTextureGpu.cpp index c41b0f9a49f..6bbc6dbfdb6 100644 --- a/RenderSystems/NULL/src/OgreNULLTextureGpu.cpp +++ b/RenderSystems/NULL/src/OgreNULLTextureGpu.cpp @@ -102,4 +102,23 @@ namespace Ogre { return mDesiredDepthBufferFormat; } + //----------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------- + NULLTextureGpuWindow::NULLTextureGpuWindow( GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, + VaoManager *vaoManager, IdString name, + uint32 textureFlags, + TextureTypes::TextureTypes initialType, + TextureGpuManager *textureManager, Window *window ) : + NULLTextureGpuRenderTarget( pageOutStrategy, vaoManager, name, textureFlags, initialType, + textureManager ), + mWindow( window ) + { + } + //----------------------------------------------------------------------------------- + void NULLTextureGpuWindow::getCustomAttribute( IdString name, void *pData ) + { + if( name == "Window" ) + *static_cast( pData ) = mWindow; + } } // namespace Ogre diff --git a/RenderSystems/NULL/src/OgreNULLTextureGpuManager.cpp b/RenderSystems/NULL/src/OgreNULLTextureGpuManager.cpp index 9a222c23a79..c0543dddd99 100644 --- a/RenderSystems/NULL/src/OgreNULLTextureGpuManager.cpp +++ b/RenderSystems/NULL/src/OgreNULLTextureGpuManager.cpp @@ -45,13 +45,13 @@ namespace Ogre //----------------------------------------------------------------------------------- NULLTextureGpuManager::~NULLTextureGpuManager() { destroyAll(); } //----------------------------------------------------------------------------------- - TextureGpu *NULLTextureGpuManager::createTextureGpuWindow() + TextureGpu *NULLTextureGpuManager::createTextureGpuWindow( Window *window ) { - return OGRE_NEW NULLTextureGpuRenderTarget( - GpuPageOutStrategy::Discard, mVaoManager, "RenderWindow", - TextureFlags::NotTexture | TextureFlags::RenderToTexture | - TextureFlags::RenderWindowSpecific | TextureFlags::DiscardableContent, - TextureTypes::Type2D, this ); + return OGRE_NEW NULLTextureGpuWindow( GpuPageOutStrategy::Discard, mVaoManager, "RenderWindow", + TextureFlags::NotTexture | TextureFlags::RenderToTexture | + TextureFlags::RenderWindowSpecific | + TextureFlags::DiscardableContent, + TextureTypes::Type2D, this, window ); } //----------------------------------------------------------------------------------- TextureGpu *NULLTextureGpuManager::createTextureImpl( diff --git a/RenderSystems/NULL/src/OgreNULLWindow.cpp b/RenderSystems/NULL/src/OgreNULLWindow.cpp index ae05f991f88..65f5e5f6f39 100644 --- a/RenderSystems/NULL/src/OgreNULLWindow.cpp +++ b/RenderSystems/NULL/src/OgreNULLWindow.cpp @@ -95,8 +95,8 @@ namespace Ogre NULLTextureGpuManager *textureManager = static_cast( textureGpuManager ); - mTexture = textureManager->createTextureGpuWindow(); - mDepthBuffer = textureManager->createTextureGpuWindow(); + mTexture = textureManager->createTextureGpuWindow( this ); + mDepthBuffer = textureManager->createTextureGpuWindow( this ); mStencilBuffer = mDepthBuffer; setFinalResolution( mRequestedWidth, mRequestedHeight );