DirectX D3D11CreateDeviceAndSwapChain返回E_INVALIDARG [英] DirectX D3D11CreateDeviceAndSwapChain returning E_INVALIDARG

查看:945
本文介绍了DirectX D3D11CreateDeviceAndSwapChain返回E_INVALIDARG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下电话,无论我尝试什么, hresult 总是E_INVALIDARG:

I have the following call, and no matter what I try, hresult is always E_INVALIDARG:

LogMessage(L"Creating swap chain. Emulation: " + std::to_wstring(useSoftwareEmulation) + L", Debugging: " + std::to_wstring(enableRenderDebugging));
HRESULT hresult = D3D11CreateDeviceAndSwapChain(
    (useSoftwareEmulation ? NULL : currentAdapter), 
    (useSoftwareEmulation ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN), 
    NULL, 
    (enableRenderDebugging ? D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_DEBUGGABLE : 0),
    NULL,
    0,
    D3D11_SDK_VERSION,
    &swapChainDescriptor, 
    &swapChain,
    &graphicsCardInterface, 
    &runningFeatureLevel, 
    &graphicsCardContext
    );

根据上面的日志行, useSoftwareEmulation enableRenderDebugging 都是

According to the log line above, both useSoftwareEmulation and enableRenderDebugging are false.

所有其他变量的类型是例如:

The types of all the other variables are as such:

currentAdapter IDXGIAdapter * code>

currentAdapter is a IDXGIAdapter*

swapChainDescriptor 是一个 DXGI_SWAP_CHAIN_DESC

swapChain > IDXGISwapChain *

graphicsCardInterface c $ c> ID3D11Device *

runningFeatureLevel D3D_FEATURE_LEVEL

graphicsCardContext ID3D11DeviceContext *

推荐答案

错误警报:在我的swapChainDescriptor(即我的MSAA计数和质量值被交换)。

False alarm: I had an error in my swapChainDescriptor (namely, my MSAA count and quality values were swapped).

希望这可能会帮助未来的任何人。

Hope this might help anyone else in the future.

这篇关于DirectX D3D11CreateDeviceAndSwapChain返回E_INVALIDARG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆