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*
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With