• Advertisement
Sign in to follow this  

[SlimDX] Resource Managment, Render to texture

This topic is 2831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! Here is my rendering script: 1. Save current render target surface and set render to floating point texture surface 2. Render scene 3. Perform post-processes 4. Copy result back form floating point RT to saved RT surface surface (StreachRectangle) (Optional) 5. Copy data from saved render target surface to Bitmap and save to file In a point 1. i change render target to floating point texture surface:
            // Change render targets
            m_destRt = device.GetRenderTarget(0);
            device.SetRenderTarget(0, m_colorRtSurface);

In case i render scene to screen m_destRt is back buffer of SwapChain and in case i render to Bitmap and save to file m_destRt is surface of render target texture. Then in a point 3. i copy data back:
                device.StretchRectangle(m_colorRtSurface, m_destRt, TextureFilter.None);
                device.SetRenderTarget(0, m_destRt);
                m_destRt = null;

All works good, but a got error when try to reset the device. Error says me that i did not release all Pool.Default resources. I modified point 3. a litte and my code look like next:
                device.StretchRectangle(m_colorRtSurface, m_destRt, TextureFilter.None);
                device.SetRenderTarget(0, m_destRt);
                m_destRt.Dispose();
                m_destRt = null;

Now device resets successful but i get error in a point 5. because i disposed RT texture surface. Seems there should be some fundamental knowledges of DirectX 9 Resource Managing which i don't know yet. Thanks in advice..

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement