Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Teric

LPDIRECT3DDEVICE9->Reset() doing strange things.

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

I am trying to allow the user to change screen resolutions at run-time, but I''m running into some problems. I''ve already done some searches on GameDev.net on this subject, and the search results did help me somewhat. But now when I reset the resolution once, it gives me a D3DERR_INVALIDCALL error, but it works just fine if I try to change resolutions again after the initial failure. In the inital call to LPDIRECT3DDEVICE9->Reset(), the return code is D3DERR_INVALIDCALL. The SDK docs say that such an error might be caused by invalid parameters. As the only parameter to the function is a set of D3DPRESENT_PARAMETERS, I did a debug dump of the structure (called PP) when the reset call failed. I also did a debug dump of the structure (called mD3DPresentParameters) from the initial setup of the D3D Device (See below).
//From when I initially set up the D3D Device

//D3DInit: Starting Presentation Parameters

mD3DPresentParameters.AutoDepthStencilFormat = 80
mD3DPresentParameters.BackBufferCount = 1
mD3DPresentParameters.BackBufferFormat = 23
mD3DPresentParameters.BackBufferHeight = 600
mD3DPresentParameters.BackBufferWidth = 800
mD3DPresentParameters.EnableAutoDepthStencil = 1
mD3DPresentParameters.Flags = 0
mD3DPresentParameters.FullScreen_RefreshRateInHz = 0
mD3DPresentParameters.hDeviceWindow = 17825850
mD3DPresentParameters.MultiSampleQuality = 0
mD3DPresentParameters.MultiSampleType = 0
mD3DPresentParameters.PresentationInterval = -2147483648
mD3DPresentParameters.SwapEffect = 1
mD3DPresentParameters.Windowed = 0

//Now, when I attempted to reset the device, I got an error

mD3DDevice->Reset(&PP) Failed!
Return Code: D3DERR_INVALIDCALL
TestCooperativeLevel: D3DERR_DEVICENOTRESET
PP.AutoDepthStencilFormat = 80
PP.BackBufferCount = 1
PP.BackBufferFormat = 23
PP.BackBufferHeight = 768
PP.BackBufferWidth = 1024
PP.EnableAutoDepthStencil = 1
PP.Flags = 0
PP.FullScreen_RefreshRateInHz = 0
PP.hDeviceWindow = 17825850
PP.MultiSampleQuality = 0
PP.MultiSampleType = 0
PP.PresentationInterval = -2147483648
PP.SwapEffect = 1
PP.Windowed = 0
I don''t see what I''m doing wrong here; the presentation parameters are exactly the same except for the height and width. I''ve even enumerated the device capabilities to make sure that is a valid resolution. Any suggestions? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
If you are using the debug runtimes and enable debug output, D3D will output all warnings, info, and errors to your IDE''s debug window. This is very useful, because it will tell you exactly why it failed and returned D3DERR_INVALIDCALL - check it out.

Share this post


Link to post
Share on other sites
Yes, I am using the DX9 debug runtime, but how do I enable full debug output in VC++ 7.0? I''ve tried looking all through the project settings, and I can''t figure out how to turn it on.

Share this post


Link to post
Share on other sites
It''s on the ''Direct3D'' tab of the ''DirectX'' applet in the Control Panel. If you already did this, simply start a debugging session. Just set a breakpoint in the Reset() call. Then, you can monitor all messages in the debug output window.

Share this post


Link to post
Share on other sites
You could also use dbmon.exe (in the DX9 sdk). Just run that right before you run your program. It will give you all the warning/error messages during the program.

Share this post


Link to post
Share on other sites
dbmon.exe is the remote debug monitor. I assume you meant D3DSpy.exe?

I don''t see the DirectX icon in my control panel. Is there a way I can make it come up?

Share this post


Link to post
Share on other sites
Ok well that''s frustrating. I tried using D3DSpy, and my program won''t even start now. When I run it under D3DSpy, it crashes to desktop during initialization.

Any other ideas?

Share this post


Link to post
Share on other sites
Another roadblock.

I downloaded the DirectX control panel applet, and I can bring it up now, but the debug output slider on the Direct3D tab is greyed out. Plus, the radio box to select retail/debug versions of directx is also greyed out. Anyone seen this before?

I''m just about at the end of my rope here, I have no idea how to figure out this bug.

Share this post


Link to post
Share on other sites
quote:
Original post by Teric
I downloaded the DirectX control panel applet, and I can bring it up now, but the debug output slider on the Direct3D tab is greyed out. Plus, the radio box to select retail/debug versions of directx is also greyed out. Anyone seen this before?



Yup, that''s a common one. Usually caused by using a newer runtime than the SDK. Steps to fix:

1)Uninstall the SDK
2)Reboot
3)Make sure there are no SDK bits still installed
4)Download and install the LATEST sdk (2003 Summer Update, at the moment)
5)Reboot

After this, you should be set.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Thanks for the info, Hyena. Just to be sure--what would those ''extra bits'' be? Directories? Leftover files? Registry Entries? I want to make sure I do this right.

Thanks!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!