diff --git a/OgreMain/include/OgreHardwarePixelBuffer.h b/OgreMain/include/OgreHardwarePixelBuffer.h index 8da5ecb0a42..0f43c5d4ff0 100644 --- a/OgreMain/include/OgreHardwarePixelBuffer.h +++ b/OgreMain/include/OgreHardwarePixelBuffer.h @@ -79,6 +79,8 @@ namespace Ogre { */ void _clearSliceRTT(size_t zoffset); friend class RenderTexture; + + String getNameForRenderTexture(const String& parentName) const; public: /// Should be called by HardwareBufferManager HardwarePixelBuffer(uint32 mWidth, uint32 mHeight, uint32 mDepth, diff --git a/OgreMain/src/OgreHardwarePixelBuffer.cpp b/OgreMain/src/OgreHardwarePixelBuffer.cpp index 51679f5807f..54e0ad1aebb 100644 --- a/OgreMain/src/OgreHardwarePixelBuffer.cpp +++ b/OgreMain/src/OgreHardwarePixelBuffer.cpp @@ -191,4 +191,10 @@ namespace Ogre mSliceTRT[zoffset] = NULL; } + + String HardwarePixelBuffer::getNameForRenderTexture(const String& parentName) const + { + // we need to add the pointer value, as the parent texture can have multiple slices or faces + return StringUtil::format("%s:buf%p", parentName.c_str(), this); + } } diff --git a/RenderSystems/Direct3D11/src/OgreD3D11HardwarePixelBuffer.cpp b/RenderSystems/Direct3D11/src/OgreD3D11HardwarePixelBuffer.cpp index d064e63501c..d08177fec7f 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11HardwarePixelBuffer.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11HardwarePixelBuffer.cpp @@ -75,9 +75,7 @@ namespace Ogre { mSliceTRT.reserve(mDepth); for(size_t zoffset=0; zoffsetgetName(); - + String name = getNameForRenderTexture(parentTexture->getName()); RenderTexture *trt = new D3D11RenderTexture(name, this, zoffset, mDevice); mSliceTRT.push_back(trt); Root::getSingleton().getRenderSystem()->attachRenderTarget(*trt); diff --git a/RenderSystems/Direct3D9/src/OgreD3D9HardwarePixelBuffer.cpp b/RenderSystems/Direct3D9/src/OgreD3D9HardwarePixelBuffer.cpp index 799329d4cfe..3f6d928e78f 100644 --- a/RenderSystems/Direct3D9/src/OgreD3D9HardwarePixelBuffer.cpp +++ b/RenderSystems/Direct3D9/src/OgreD3D9HardwarePixelBuffer.cpp @@ -985,8 +985,7 @@ void D3D9HardwarePixelBuffer::updateRenderTexture(bool writeGamma, uint fsaa, co { if (mSliceTRT.empty()) { - String name; - name = "rtt/" +Ogre::StringConverter::toString((size_t)this) + "/" + srcName; + String name = getNameForRenderTexture(srcName); mSliceTRT.push_back(OGRE_NEW D3D9RenderTexture(name, this, writeGamma, fsaa)); Root::getSingleton().getRenderSystem()->attachRenderTarget(*mSliceTRT[0]); diff --git a/RenderSystems/GL/src/OgreGLHardwarePixelBuffer.cpp b/RenderSystems/GL/src/OgreGLHardwarePixelBuffer.cpp index 32b9c665e8e..0e84e7763c6 100644 --- a/RenderSystems/GL/src/OgreGLHardwarePixelBuffer.cpp +++ b/RenderSystems/GL/src/OgreGLHardwarePixelBuffer.cpp @@ -143,8 +143,7 @@ GLTextureBuffer::GLTextureBuffer(GLRenderSystem* renderSystem, GLTexture* parent mSliceTRT.reserve(mDepth); for(uint32 zoffset=0; zoffsetgetName(); + String name = getNameForRenderTexture(parent->getName()); GLSurfaceDesc surface; surface.buffer = this; surface.zoffset = zoffset; diff --git a/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp b/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp index 773d1d09207..1c5d590f41f 100644 --- a/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp +++ b/RenderSystems/GL3Plus/src/OgreGL3PlusTextureBuffer.cpp @@ -85,8 +85,7 @@ namespace Ogre { mSliceTRT.reserve(mDepth); for(uint32 zoffset=0; zoffsetgetName(); + String name = getNameForRenderTexture(parent->getName()); GLSurfaceDesc surface; surface.buffer = this; surface.zoffset = zoffset; diff --git a/RenderSystems/GLES2/src/OgreGLES2HardwarePixelBuffer.cpp b/RenderSystems/GLES2/src/OgreGLES2HardwarePixelBuffer.cpp index 663dc69bfe9..2b1a1f556f6 100644 --- a/RenderSystems/GLES2/src/OgreGLES2HardwarePixelBuffer.cpp +++ b/RenderSystems/GLES2/src/OgreGLES2HardwarePixelBuffer.cpp @@ -143,8 +143,7 @@ namespace Ogre { mSliceTRT.reserve(mDepth); for(uint32 zoffset=0; zoffsetgetName(); + String name = getNameForRenderTexture(parent->getName()); GLSurfaceDesc surface; surface.buffer = this; surface.zoffset = zoffset; diff --git a/RenderSystems/Metal/src/OgreMetalHardwarePixelBuffer.mm b/RenderSystems/Metal/src/OgreMetalHardwarePixelBuffer.mm index 68719200a49..1060210ff63 100644 --- a/RenderSystems/Metal/src/OgreMetalHardwarePixelBuffer.mm +++ b/RenderSystems/Metal/src/OgreMetalHardwarePixelBuffer.mm @@ -268,8 +268,7 @@ of this software and associated documentation files (the "Software"), to deal mSliceTRT.reserve(mDepth); for(uint32 zoffset=0; zoffsetgetName(); + String name = getNameForRenderTexture(mParent->getName()); RenderTexture *trt = new VulkanRenderTexture(name, this, zoffset, mParent, mFace); mSliceTRT.push_back(trt);