Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Feature request : D3D restore better way

Author
Message
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 20th May 2009 14:12 Edited at: 21st May 2009 02:15
Hi TGC

When D3D lost ( fullscreen to window and so on… ),GDK or DBpro will free all the resources ( image ,sprite ,object ,font …) automatically ,this way ,we need to re-create all the resources to make the program keep running ,that’s a lot of pain for programming.

Besides ,Deleting resources when D3D lost will cause some problems with addOn kit,such as "Enhanced animation" .You could not delete a animation controller after you have deleted the referenced object ,that will cause crash.But D3D lost will cause deleting a object before deleting a ani controller.

I found when D3D lost ,we just do not need to free anything, just stop to render .
when we get the event “D3D no target”(D3DERR_DEVICENOTRESET) ,that means the program back to work , we can use “OnLostDevice” ,then ,following “D3D reset” ,then ,reset all the resources ,this way ,we do not need to re-create anything, the program will keep running ,no crash.

I really hope TGC could improve the way deal with D3D lost if possible, so that ,we will not worry about D3D lost any more.

Thanks!!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th May 2009 20:08
@Lion Jin
Quote: "we can use “release” function to release all the resources"


Calling the release function will cause all the resources to be deleted: this is exactly what DBPro and DGDK does!

DirectX forces you to delete all video memory resources when the device is reset, so it is up to you to reload them.

What I usually do is set it to run in windowed fullscreen mode instead, because the device does not get lost when you switch windows, it looks the same, and the resolution of the moniter itself is not changed.

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 21st May 2009 00:58 Edited at: 21st May 2009 00:58
Well there is actually command called dbRestoreLostDevice(); sounds good doesn't it but it don't work

Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 21st May 2009 02:14
Quote: "
Calling the release function will cause all the resources to be deleted: this is exactly what DBPro and DGDK does!
"


Sorry ,not "Release", but "OnLostDevice" , it does not actually "delete" resource ,when D3D restore ,we just need to "OnLostDevice for resource","Reset for Device","OnResetDevice for resource".

Not only Fullscreen to window will cause D3D lost! In my notebook,if I press Ctrl+Alt+Delete ,D3D lost will be happen.
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 21st May 2009 02:21
Quote: "Well there is actually command called dbRestoreLostDevice(); sounds good doesn't it but it don't work "


If no source code ,we could not change that ,I think GDK or DBPro might release all the resources when D3D lost.

Login to post a reply

Server time is: 2024-11-25 10:45:33
Your offset time is: 2024-11-25 10:45:33