M. Laing
M. Laing

Reputation: 1617

C++ Directx 11 Multiple Video Cards

I am writing a program in C++ using directx 11 for my graphics. My laptop has a light weight intel graphics card that is used to extend my battery life and is supposed to only be used for "lightweight" graphics. I have another much more powerful video card installed also.

I am wondering how to specify which video card to use in directx? Is there a way when I am creating the device to specify which card to use within my code?

Thanks

Upvotes: 3

Views: 4154

Answers (2)

Erp
Erp

Reputation: 9

I had a similar issue. I haven't tried upgrading my graphics card drivers yet, but I will when I get my computer plugged back into the internet.

Here's what I found and how I "solved" (aka jury-rigged) my problem:

Symptoms:

  1. Similar to the poster above.
  2. I have only 1 NVDIA graphics card, which claims to support DirectX 11
  3. When I looked at it in DirectX Caps Viewer, it only supported DirectX 9.3 and lower.

Solution:

  1. Iterate backwards through the D3D_FEATURE_LEVEL, calling D3D11CreateDeviceAndSwapChain() each time.
  2. Once D3D11CreateDeviceAndSwapChain() works, you know you've found the maximum feature level supported by your selected graphics card.

There may be a prettier way to do this, but that's what my "problem" was. Obviously it would be better if my card supported the full DX11 system, but it's not a bad safeguard in case a user has similar issues. At least I can programmatically identify the issue.

Upvotes: 0

mrvux
mrvux

Reputation: 8953

If your card is some intel/nvidia combination, you have two options:

-First is set the nvidia card as prefered device (in nvidia control panel, manage 3d settings, Global/Program settings, change the preffered graphics processor.

Another way using code, is to enumerate adapters with DXGI, and try to get device with restricted feature level (CreateDevice will fail if not available, and most intel cards are 10.1)

http://msdn.microsoft.com/en-us/library/windows/desktop/bb174538(v=vs.85).aspx to enum adapters.

Then try to create device with D3D_FEATURE_LEVEL_11_0 only for each adapter, only the one supporting it will be created.

Upvotes: 2

Related Questions