Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Indakung   Members   -  Reputation: 101

Like
0Likes
Like

Posted 12 February 2012 - 08:54 AM

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?

Sponsor:

#2 MJP   Moderators   -  Reputation: 11569

Like
0Likes
Like

Posted 12 February 2012 - 01:30 PM

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

#3 mhagain   Crossbones+   -  Reputation: 8135

Like
0Likes
Like

Posted 12 February 2012 - 02:51 PM

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

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 Indakung   Members   -  Reputation: 101

Like
0Likes
Like

Posted 12 February 2012 - 09:52 PM

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.

#5 MJP   Moderators   -  Reputation: 11569

Like
1Likes
Like

Posted 13 February 2012 - 12:19 AM

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.

#6 Indakung   Members   -  Reputation: 101

Like
0Likes
Like

Posted 13 February 2012 - 11:12 PM


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.

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS