Jump to content
  • Advertisement
Sign in to follow this  
sofakng

Why is IDirect3D9::CheckDeviceMultiSampleType failing for me?

This topic is 4178 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'm using a DirectX v9.0 wrapper for Delphi and I'm trying to enable antialiasing but it's not working. I've narrowed down the problem to this call:
Direct3D9.CheckDeviceMultiSampleType(0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, True, D3DMULTISAMPLE_2_SAMPLES, nil);
Does anything look wrong with that? My video card (a cheap laptop nVidia-based card) supports 2x, 2xQ, 4x, and 4xS. I've forceably enabled them in the driver configuration and it works fine, but for some reason I can't enable it via DirectX. What am I doing wrong? Thanks...

Share this post


Link to post
Share on other sites
Advertisement
In what way does it fail? Does it crash, or does the call fail? What is the return value? Are you using the debug runtimes? If so, what do they say about it? They should give you some error string in the debug window (Not sure how this works for Delphi) telling you what's wrong.

Share this post


Link to post
Share on other sites
Well, it seems as though the code is returning a strange number (-2000518 or something). Shouldn't it be returning a -1, 0, or 1?

HResult is just an 32-bit signed integer, right?

There are no debug messages printed anywhere. Is there a special DirectX message viewer or something? (I thought I remembered seeing one somewhere...)

Share this post


Link to post
Share on other sites
Quote:
Original post by sofakng
Well, it seems as though the code is returning a strange number (-2000518 or something). Shouldn't it be returning a -1, 0, or 1?

HResult is just an 32-bit signed integer, right?

There are no debug messages printed anywhere. Is there a special DirectX message viewer or something? (I thought I remembered seeing one somewhere...)
A HRESULT is a 32-bit hexadecimal number, always with the high bit set for failure codes (So it'll appear as a negative number when displayed as a 32-bit signed int). It includes a status (success / failure), a faculty (E.g. D3D, DirectSound, Security, some other area) and an error code (E.g. "Unsupported", "failed", "invalid parameter" and so on) all packed together.

I don't know of any viewers for delphi, but if you can get a .exe you can use any debug output viewer you can find on Google.

Share this post


Link to post
Share on other sites
Ahhhhh... that explains it.

The DirectX SDK came with an error lookup utility (dxerr.exe) and here is what my HRESULT translate to:

HRESULT: 0x8876086a (2289436778)
Name: D3DERR_NOTAVAILABLE
Description: Not available
Severity code: Failed
Facility Code: FACILITY_D3D (2166)
Error Code: 0x086a (2154)

So, I have two questions:

1) Why am I getting this error when I can forceably set antialiasing in the driver?

2) What D3D multisampling mode does 2x, 2xQ, 4x, and 4xS translate to? D3DMULTISAMPLE_2 for 2x? ...and D3DMULTISAMPLE_4 for 4x? If so, how do I use 2xQ or 4xS?

Thanks for the help!

Share this post


Link to post
Share on other sites
1) Get a debug output viewer and run your app through it with the debug DirectX runtimes. That'll give you output like:
"D3D (ERROR): Multisample is not supported. CheckDeviceMultiSampleType fails."
Or some other error.

2) No idea, is there any information in the driver settings?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!