Xenoprimate
Xenoprimate

Reputation: 7963

DirectX D3D11CreateDeviceAndSwapChain returning 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
    );

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

The types of all the other variables are as such:

currentAdapter is a IDXGIAdapter*

swapChainDescriptor is a DXGI_SWAP_CHAIN_DESC

swapChain is a IDXGISwapChain*

graphicsCardInterface is a ID3D11Device*

runningFeatureLevel is a D3D_FEATURE_LEVEL

graphicsCardContext is a ID3D11DeviceContext*

Upvotes: 4

Views: 3088

Answers (1)

Xenoprimate
Xenoprimate

Reputation: 7963

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.

Upvotes: 4

Related Questions