Sign in to follow this  
QuinnJohns

Question about DeviceCaps [SOLVED]

Recommended Posts

I recall seeing a sample on the internet, a while back, where you can extract all the possible resolutions capable by the video card, which utilized Get Device Caps, does anyknow how of any tutorial or code snippets, on how to accomplish something similar? In a sense, I'm just trying to see the depth on what is capable of GetDeviceCaps, via Direct3D ( C++ ). I'm in the midst of building a framework using my own UI, resource manager, and such, which I am going to add in-game functionality to manipulate the resolution. As a basic learning tool, for myself. So, with the GetDeviceCaps, does it produce an array, or some data structure, which contains all these values? such as bit depth, etc, or just give you the one its currently using? I'm just a bit lost, on the depth/capabilities. -added- The scope of what I'm trying to do is that when I get this information to populate - I will then load it into a combo box. I just need to get led into the direction to get that information. Hehe. -snip- Thanks for any information that can be provided. [Edited by - QuinnJohns on February 19, 2008 2:20:29 AM]

Share this post


Link to post
Share on other sites
GetDeviceCaps will return a lot of bit-packed booleans and a few numbers (maximum lights, maximum vertices per draw, maximum shader model, etc.), but not available display modes or surface types. It's a fixed sized structure (D3DCAPS9).

To get the available fullscreen display modes, you use GetAdapterModeCount for each display format you want to support, and then call EnumAdapterModes repeatedly with a mode number (from 0 to GetAdapterModeCount()-1) to get the resolutions that are supported. You can ignore where the docs claim X1R5G5B5 and R5G6B5 are treated identically, because they're not. You'll need to test for modes in both formats.

To create a backbuffer in the same format as the desktop, which use usually done for Windowed Mode apps, use GetAdapterMode to find the current display mode.

Once you've selected a resolution and mode, you use CheckDeviceFormat and CheckDepthStencilMatch to test which Z buffer modes can be used with that display. The docs for CheckDepthStencilMatch show how to use both together. Be forewarned that if you're making a device with alpha in the back buffer, you can't pass that format into these check calls as the AdapterFormat... they'll just fail. You must strip the format of alpha first (ie: if you backbuffer is A8R8G8B8 your adapter mode is X8R8G8B8). These calls are also used to test for support of Windowed Mode vs. Full screen modes.

Once you've found an adapter format, backbuffer format, and Z format to use, you can call CheckDeviceMultiSampleType to test which AA modes are valid. Note that the sample in the docs show calling CheckDeviceMultiSampleType for the the backbuffer AND Z buffer format before deciding an AA mode is available.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this