Restore method
I still have some questions about restore after reading about it in the sdk help.
1. What would happen if I called RestoreAllSurfaces() every time I get DDERR_SURFACELOST instead of calling Restore on the specific surface lost?
2. Should I keep a variable holding the name of my bitmaps so that I can easily reload my bitmaps?
3. Q2 assumes that the memory for the bitmaps is lost. Am I correct in that assumption?
1. it would restore (reclaim the memory) for the surfaces that were lost.. this is a nice utility function because then you do not have to call Restore on all surfaces..
2. that could be one way to do it.. everytime you get DDERR_SURFACELOST.. then just call RestoreAllSurfaces().. loop trough all your surfaces and reload their images.. if you store the filename together with each surface.. and put that into a linked list this should be really simple..
3. well.. that a surface is lost only means that some other process have been writing to the vidmen and therefore DirectX cannot guarantee, that memory still contains the stuff you loaded into it. so therefore you have to assume that the content is lost.. so you are right :-)
2. that could be one way to do it.. everytime you get DDERR_SURFACELOST.. then just call RestoreAllSurfaces().. loop trough all your surfaces and reload their images.. if you store the filename together with each surface.. and put that into a linked list this should be really simple..
3. well.. that a surface is lost only means that some other process have been writing to the vidmen and therefore DirectX cannot guarantee, that memory still contains the stuff you loaded into it. so therefore you have to assume that the content is lost.. so you are right :-)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement