简体   繁体   English

C ++ Directx 11多个视频卡

[英]C++ Directx 11 Multiple Video Cards

I am writing a program in C++ using directx 11 for my graphics. 我正在使用directx 11为我的图形编写一个C ++程序。 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? 我想知道如何指定在directx中使用哪个视频卡? Is there a way when I am creating the device to specify which card to use within my code? 有没有办法在我创建设备时指定在我的代码中使用哪张卡?

Thanks 谢谢

If your card is some intel/nvidia combination, you have two options: 如果您的卡是某种intel / nvidia组合,您有两种选择:

-First is set the nvidia card as prefered device (in nvidia control panel, manage 3d settings, Global/Program settings, change the preffered graphics processor. - 首先将nvidia卡设置为首选设备(在nvidia控制面板中,管理3d设置,全局/程序设置,更改优先图形处理器。

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) 使用代码的另一种方法是使用DXGI枚举适配器,并尝试获取具有受限功能级别的设备(如果不可用,CreateDevice将失败,并且大多数英特尔卡都是10.1)

http://msdn.microsoft.com/en-us/library/windows/desktop/bb174538(v=vs.85).aspx to enum adapters. http://msdn.microsoft.com/en-us/library/windows/desktop/bb174538(v=vs.85).aspx到枚举适配器。

Then try to create device with D3D_FEATURE_LEVEL_11_0 only for each adapter, only the one supporting it will be created. 然后尝试仅为每个适配器创建具有D3D_FEATURE_LEVEL_11_0的设备,仅创建支持它的设备。

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 我只有1张NVDIA显卡,声称支持DirectX 11
  3. When I looked at it in DirectX Caps Viewer, it only supported DirectX 9.3 and lower. 当我在DirectX Caps Viewer中查看它时,它只支持DirectX 9.3及更低版本。

Solution: 解:

  1. Iterate backwards through the D3D_FEATURE_LEVEL, calling D3D11CreateDeviceAndSwapChain() each time. 通过D3D_FEATURE_LEVEL向后迭代,每次调用D3D11CreateDeviceAndSwapChain()。
  2. Once D3D11CreateDeviceAndSwapChain() works, you know you've found the maximum feature level supported by your selected graphics card. 一旦D3D11CreateDeviceAndSwapChain()工作,您就知道您已找到所选图形卡支持的最大功能级别。

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. 显然,如果我的卡支持完整的DX11系统会更好,但是如果用户遇到类似问题,这并不是一个糟糕的保护措施。 At least I can programmatically identify the issue. 至少我可以通过编程方式识别问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM