Original Post
I'm using SlimDX for my Direct3D9 app. I found something I don't quite understand the reasons why it happens this way and I was hoping someone could explain it to me.
Where currScreen is where I encapsulate the drawing and updating for what I want to show on the screen and spriteBatch is a pretty thin wrapper for SlimDX.Direct3D9.Sprite and device is an instance of SlimDX.Direct3D9.Device
So the second one draws correctly but when the device is reset it complains that all associated resources weren't released. But no other resources are being used but the dynamic texture and the sprite object which are definately being released beforehand. What's causing the problem?
In the first one which works and there are no complaints on reset. The object in the oldRenderTarget is the back buffer. BUT, I dispose of it. Shouldn't that cause a problem? It doesn't. Why not?
//The one that worksSurface oldRenderTarget = device.GetRenderTarget(0);device.SetRenderTarget(0, currScreen.RenderingSurface);device.Clear(ClearFlags.Target, currScreen.BackgroundColor, 1.0f, 0);device.BeginScene();spriteBatch.Begin();currScreen.Draw(spriteBatch);spriteBatch.End();device.EndScene();device.SetRenderTarget(0, oldRenderTarget);oldRenderTarget.Dispose();Where currScreen is where I encapsulate the drawing and updating for what I want to show on the screen and spriteBatch is a pretty thin wrapper for SlimDX.Direct3D9.Sprite and device is an instance of SlimDX.Direct3D9.Device
//The one that doesn't workdevice.SetRenderTarget(0, currScreen.RenderingSurface);device.Clear(ClearFlags.Target, currScreen.BackgroundColor, 1.0f, 0);device.BeginScene();spriteBatch.Begin();currScreen.Draw(spriteBatch);spriteBatch.End();device.EndScene();device.SetRenderTarget(0, device.GetBackBuffer(0, 0));So the second one draws correctly but when the device is reset it complains that all associated resources weren't released. But no other resources are being used but the dynamic texture and the sprite object which are definately being released beforehand. What's causing the problem?
In the first one which works and there are no complaints on reset. The object in the oldRenderTarget is the back buffer. BUT, I dispose of it. Shouldn't that cause a problem? It doesn't. Why not?