C++ Directx 11 Multiple Video Cards

我们两清 提交于 2019-12-01 23:15:25

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/9509330/c-directx-11-multiple-video-cards

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!