Why is IDirect3D9::CheckDeviceMultiSampleType failing for me?

Started by
5 comments, last by Namethatnobodyelsetook 16 years, 10 months ago
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...
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.
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...)
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.
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!
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?
Those extra multisample types are only available as non-maskable types. If you query for non-maskable, it will tell you how many quality levels there are. For you, it's 4.

This topic is closed to new replies.

Advertisement