gpt4 book ai didi

c++ - DirectX D3D11CreateDeviceAndSwapChain 返回 E_INVALIDARG

转载 作者:太空狗 更新时间:2023-10-29 21:01:10 27 4
gpt4 key购买 nike

我有以下调用,无论我尝试什么,hresult 总是 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
);

根据上面的日志行,useSoftwareEmulationenableRenderDebugging 都是 false

所有其他变量的类型如下:

currentAdapter 是一个 IDXGIAdapter*

swapChainDescriptor 是一个 DXGI_SWAP_CHAIN_DESC

swapChain 是一个 IDXGISwapChain*

graphicsCardInterface 是一个 ID3D11Device*

runningFeatureLevel 是一个 D3D_FEATURE_LEVEL

graphicsCardContext 是一个 ID3D11DeviceContext*

最佳答案

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

希望这对以后的其他人有所帮助。

关于c++ - DirectX D3D11CreateDeviceAndSwapChain 返回 E_INVALIDARG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19348787/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com