Jump to content
  • Advertisement
Sign in to follow this  
IndakungWoo

How to get data from render-target when device is lost?

This topic is 2491 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

For resetting device after it was lost, all D3DPOOL_DEFAULT resources should be released. I want to restore some render-target textures after the device is reseted, so I'm trying to save their data to D3DPOOL_SYSTEMMEM texture when device is lost, but I cannot call IDirect3DDevice9::GetRenderTargetData successfully because the device was lost. The DX debug report says:

"Failing copy from video-memory surface to system-memory or managed surface because device is lost. UpdateSurface returns D3DERR_DEVICELOST"

Is there another way to restore the D3DPOOL_DEFAULT resources after a device losing?

Share this post


Link to post
Share on other sites
Advertisement
Once you lose the device, you lose all of your render targets. You would have to copy the data before you lose the device.

Share this post


Link to post
Share on other sites

Once you lose the device, you lose all of your render targets. You would have to copy the data before you lose the device.

Thank you. But how could the program predict the device's losing? Or just copy the data every frame? It seems not so efficient.


Why not just re-render what was originally rendered into your render targets?

Because those render targets are used for saving states of a GPU-based particle system. I think it'll be weird when all particles are disappeared or reseted at their initial position or other states after a device' losing.

Share this post


Link to post
Share on other sites

Thank you. But how could the program predict the device's losing? Or just copy the data every frame? It seems not so efficient.


I don't think you can in a reliable manner. You can detect a focus change, but I don't know if the device will already be considered "lost" at that point.

If you want, you can detect if your app is running on Vista or Win7 and create D3D9Ex interfaces. If you use those, you won't get a lost device scenario. Doesn't help you for at all for XP, obviously.

Share this post


Link to post
Share on other sites

[quote name='Indakung' timestamp='1329105128' post='4912460']
Thank you. But how could the program predict the device's losing? Or just copy the data every frame? It seems not so efficient.


I don't think you can in a reliable manner. You can detect a focus change, but I don't know if the device will already be considered "lost" at that point.

If you want, you can detect if your app is running on Vista or Win7 and create D3D9Ex interfaces. If you use those, you won't get a lost device scenario. Doesn't help you for at all for XP, obviously.
[/quote]
Thank you. As a matter of fact, losing device is not an usual thing, and I think most people would ignored the resetting of particles after that case, so I'd better ignore this problem too.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!