Jump to content
  • Advertisement
Sign in to follow this  
beebs1

Enumerating backbuffer formats

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

Hiya, I need to check if a video card supports various backbuffer formats, such as A8R8G8B8, X8R8G8B8, etc. I believe IDirect3D9::CheckDeviceType() is the correct method to use, but I'm not sure as to the difference between the DisplayFormat and BackBufferFormat parameters. I'd guess that DisplayFormat is the format of the frame buffer, and BackBufferFormat is obviously the back buffer - is this right? Also, are there any limitations on these when windowed mode is used? Also, does anyone know if I need to use both IDirect3D9::CheckDeviceFormat() and IDirect3D9::CheckDepthStencilMatch() to check if a given depth/stencil format is supported, or just one or the other? Many thanks for any help [smile]

Share this post


Link to post
Share on other sites
Advertisement
DisplayMode : This is the format used by the display, In full screen mode, this will be the same format as the backbuffer format.
BackBufferFormat : The format the back buffer will be in, the backbuffer is an offscreen surface.

You can use GetDeviceType() method, it should suite your needs.

I hope this helps.
take care.

Share this post


Link to post
Share on other sites
The display format is usually the backbuffer format, but not always. ;)

When you create an A8R8G8B8, or A1R5G5B5 backbuffer, the display format you pass must be X8R8G8B8 or X1R5G5B5, otherwise the calls will fail. As far as I can tell, there is no good reason for it not to automatically strip out the alpha for you, it just doesn't.

In the case of A2R10G10B10, you can still pass that format as a display format, even though it has alpha bits. Why? Because there is no X2R10G10B10 format.

Oh, and as Armadon says, this is for full screen. In windowed mode you can create a device with a 16 bit backbuffer when using a 32 bit desktop. You need to query the desktop mode (GetAdapterDisplayMode) for the display format when using windowed mode.

As for, whether you need both calls to test for a depth format... well, the SDK does, so I do too. I think one call will check if the card supports the mode and the other will check that it's available in a given setup. I'm not sure why a driver would return true for a specific setup, for a mode it doesn't support, but it's a couple extra lines of setup... why not be safe?

Share this post


Link to post
Share on other sites
Thanks, that's exactly what I needed to know.

Namethatnobodyelsetook ([smile]) does that mean that a card that supports X8R8G8B8 will support A8R8G8B8? I need the alpha bits, but it doesn't look like I can check that the format is supported.

Thanks again.

Share this post


Link to post
Share on other sites
You only need alpha in the backbuffer if you're going to use destination alpha, which is quite rare. Basically you write alpha in one pass, and in some later pass you use the alpha you wrote previously. You don't need it for standard blending.

You can test if a card supports dest alpha by checking caps.SrcBlendCaps or DestBlendCaps for D3DPBLENDCAPS_DESTALPHA or D3DPBLENDCAPS_INVDESTALPHA.

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!