Jump to content
  • Advertisement
Sign in to follow this  
EternalNewbie

Get the current display mode using D3D10

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

Hi I'm moving to D3D10 from D3D9. I know in d3d9 you can use GetAdaptorDisplayMode. But can't figure out how to do it in D3D10, specifically how to get the display format. I know that I could use EnumDisplaySettings to get the current resolution and bits per pixel, but there is no way to safely convert this to a DXGI Format. So is there a proper function to do this? Or do I need to use some sort of hack? Thx Eternal Newbie

Share this post


Link to post
Share on other sites
Advertisement
That gives me list of possible display modes for a particular adaptor. But doesn't give me the current display mode. I could search the list for modes that match the details I get from EnumDisplaySettings, however that seems kinda roundabout way of doing things. Also to get the format you would have to store all potential formats for each bit depth and search through them.

Any alternatives??

Thx
Raj

Share this post


Link to post
Share on other sites
I didn't think that would work as you need to fill in DXGI_SWAP_CHAIN_DESC to create the swap chain in the first place. But if i create a swapchain without filling DXGI_SWAP_CHAIN_DESC or its BufferDesc, D3D10CreateDeviceAndSwapChain will use the current display format??
Is that right?

Raj

Share this post


Link to post
Share on other sites
i don't use D3D10CreateDeviceAndSwapChain() but
D3D10CreateDevice() and IDXGIFactory::CreateSwapChain()
which needs a DXGI_SWAP_CHAIN_DESC (cannot be null).

however, i tried D3D10CreateDeviceAndSwapChain() and it *only* works with a valid DXGI_SWAP_CHAIN_DESC here. does your code work without it?
if it works, how does the DXGI_SWAP_CHAIN_DESC look like? is it in current mode or in first enumed mode (smallest dimension), i am just interested..?

for an existing swap chain you can do like this to get the output and mode:

DXGI_SWAP_CHAIN_DESC scDesc;
DXGI_MODE_DESC closestModeDesc;
IDXGIOutput* output;
swapChain->GetDesc(&scDesc);
// we can further check which enumed mode matches best:
swapChain->GetContainingOutput(&output);
output->FindClosestMatchingMode(&scDesc.BufferDesc, &closestModeDesc, d3dDevice);


if you want to create the swap chain in a specific mode you can either enum the adapters->outputs->modes and use one of the modes as it is (or tweaked).
or you can use IDXGIOutput::FindClosestMatchingMode() instead.
but don't forget to check the enumed adapters for DX10 support:

bool canDX10 = SUCCEEDED(dxgiAdapter->CheckInterfaceSupport(__uuidof(ID3D10Device), NULL));









Share this post


Link to post
Share on other sites
Quote:
Original post by wavetable
however, i tried D3D10CreateDeviceAndSwapChain() and it *only* works with a valid DXGI_SWAP_CHAIN_DESC here. does your code work without it?
if it works, how does the DXGI_SWAP_CHAIN_DESC look like? is it in current mode or in first enumed mode (smallest dimension), i am just interested..?


Nah, thats what I thought your were suggesting. As I figured that creating a swapchain requires you to set the format. I was looking for way to get the format of the users current display mode.

Thx for trying anyway. any other suggestions? Or do i have to use brute force and guess work??

Raj

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!