Restoration in DX8 |
EACam | OK ok ok ok ok o k ok
I've tried everything:[}:)][}:)][}:)][}:)][:(!]
**I've looked at examples of working code and found barely any difference between theirs and mine.
**I've exausted the SDK
**I've spent hours of hopelessness trying random things that never did one diddle
Ok, when I check to see if the device is lost, I pause my main loop, when I get the D3DERR_DEVICENOTRESET error from the TestCooperativeLevel I try to reset the device. Well, it turns out that I can't reset the device for anything...ever. I've used for doing other things such as going from windowed to fullscreen on the same device (without completely reinitializing) and I got the same error.
Here's what happens. According to my Log file, the Reset operation returns the D3DERR_DEVICELOST error code. It then finishes the sub and returns that the device is not ready for rendering so my pause loop continues and check it again again until it's fixed. I know this because my log file says the sub finishes ok. But then I get a C++ error (you know, not a plain VB error) and, if I'm running in the IDE, EVERYTHING closes (that is, the IDE and the program). If I'm running a compiled version of the program, it simply gives me the error and closes.
I don't have a CLUE what's going on. I know my presentation parameters that I use for resetting the device are the same as when I initialized (I use the same variable for goodness sake, and I've checked it for changes).
THIS SHOULD BE WORKING!!!!
I've tried releasing memory (even tho everythings loaded in Pool_Managed anyway).
PLEASE HELP!!! I can't even begin to guess why this isn't working.
[?][?][?][?][?][?]
Thanks. |
Eric Coleman | Read Lucky's post, http://voodoovb.talosstudios.com/archives19.html
Does that help any? |
EACam | Sorry, that sounds like a different degree of a problem.
Mine is causing DX8 to give me an error and everything closes (crashes).
(It's also using DD7...) |
Eric Coleman | Ok, so its an "error." That really helps. I know eactly what the problem is. |
EACam | I described that "error" in detail in my first post [:)] |
Lachlan87 | I would recommend you try to re-create the error in a new project. All you should need to do is copy your intitialisation code, your code for handling device loss, and write a extremely simple game loop to use it all. You don't even have to display any graphics or anything. If you can't re-create the error by doing this, it would be a big step toward solving the problem. If the error still occurs, you will have a very small little bit of functioning source code you can e-mail me or anyone else interesting in helping you solve your problem. I can't tell you how many times I've managed to solve a bugger of a problem by reducing the amount of code I'm working with like that.
As it is right now, I have a hard time invisioning what your code looks like, or even what your errors look like. |
Spodi | I got it on DXRE, I can send you the code to do it in a few hours. |
EACam | Cool. Thanks! |
Spodi | For future reference, here is what I sent EACam:
[code]
'Check to see if the d3d device is not ready
If D3DDevice.TestCooperativeLevel <> D3D_OK Then
'Check to see if the device can be reset
If D3DDevice.TestCooperativeLevel = D3DERR_DEVICENOTRESET Then
'Clear the font from memory
MainFont.OnLostDevice
'Reset the device
D3DDevice.Reset D3DWindow
'Restore the font
MainFont.OnResetDevice
'Reset the textures and device settings
Engine_Init_Gfx
Else
'Exit the sub since the device is not ready to be used or reset
Exit Sub
End If
End If
'Make sure the screen is not minimized
If frmMain.WindowState = vbMinimized Then Exit Sub
[/code]
~D3DDevice is, well, the d3d device
~frmMain is whatever form you set the device to draw to
~MainFont is your D3DXFont(s) - make sure you list them all
~Engine_Init_Gfx is a sub that does the following:
1) Restore all device render states
2) Restore all textures |