Question about DeviceCaps [SOLVED]

Started by
1 comment, last by QuinnJohns 16 years, 2 months ago
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]
[size="2"][size="1"][size="2"]- Quinn
[size="2"][size="1"][size="2"]Software Developer, Mintrus
Advertisement
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.
Thanks for the information, I actually found a link, to a thread that related to the exact topic.

Device Enumeration

Thanks again.
[size="2"][size="1"][size="2"]- Quinn
[size="2"][size="1"][size="2"]Software Developer, Mintrus

This topic is closed to new replies.

Advertisement