Operating System:: Windows 10
Render System:: Direct3D11
Hello!
I have an assert crash when exiting my application when using Direct3D11 with a cubemap texture (with RTT), but I think it might be a bug.
Everything works on OpenGL, Direct3D9 and Direct3D11 with the cubemap texture, but it only crashes on exit when using Direct3D11.
Normal render target textures (with only one face) works properly, it is only the 6 face render target texture of cubemaps that crashes.
I create the cubemap texture like this:
Code: Select all
TexturePtr cubemapTexture = TextureManager::getSingleton().createManual("testCubemapTexture",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_CUBE_MAP,
512,
512,
0, PF_R8G8B8, TU_RENDERTARGET);
Code: Select all
RenderTexture *trt = new D3D11RenderTexture(name, this, zoffset, mDevice);
mSliceTRT.push_back(trt);
Root::getSingleton().getRenderSystem()->attachRenderTarget(*trt);
The thing in here is that "attachRenderTarget" only adds the RenderTexture if it has a unique name, which is true for the first time it comes into that, but for all 5 other faces nothing happens in that function because the RenderTarget name is not unique.
Is this a bug? Should it not also add "mFace" to the name in D3D11HardwarePixelBuffer::D3D11HardwarePixelBuffer?
After this is done, the texture can be rendered and everything in the application works with the cubemap.
But, when exiting the application and removing the texture, it comes into D3D11Texture::freeInternalResourcesImpl, which calls "mSurfaceList.clear()".
mSurfaceList has 6 objects in it, which is correct, and when clearing it the code jumps automatically 6 times to D3D11HardwarePixelBuffer::~D3D11HardwarePixelBuffer:
Code: Select all
if(!mSliceTRT.empty())
{
// Delete all render targets that are not yet deleted via _clearSliceRTT
for(size_t zoffset=0; zoffset<mDepth; ++zoffset)
{
if(mSliceTRT[zoffset])
Root::getSingleton().getRenderSystem()->destroyRenderTarget(mSliceTRT[zoffset]->getName());
}
}
This only destroys the first render target of the 6 created.
Later it comes to D3D11DeviceResourceManager::~D3D11DeviceResourceManager, which uses "assert(mResources.empty())" and crashes because there are still 5 objects in it (the last 5 of the 6 render targets to be exact).
Anyone know what is happening here?
Am I doing something wrong?
Is this a bug?
Thanks in advance!
Cheers,
Robin