DirectX D3D11CreateDeviceAndSwapChain返回E_INVALIDARG

时间:2013-10-13 18:36:48

标签: c++ directx directx-11

我有以下电话,无论我尝试什么,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*

1 个答案:

答案 0 :(得分:4)

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

希望这可能在将来帮助其他任何人。