4

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*

Xenoprimate
  • 7,691
  • 15
  • 58
  • 95

1 Answers1

4

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.

Xenoprimate
  • 7,691
  • 15
  • 58
  • 95
  • Pass D3D11_CREATE_DEVICE_DEBUG to D3D11CreateDevice flags to catch errors like this. – MooseBoys Oct 14 '13 at 20:04
  • 1
    @MooseBoys I see nothing on the output window even when I pass those parameters. Strange. Maybe they only show information for actual graphics calls once you've set up the device + swapchain? – Xenoprimate Oct 14 '13 at 21:53
  • 1
    Yes that makes sense since you're using the CreateDeviceAndSwapChain call and the call is failing. I thin if you use D3D11CreateDevice followed by IDXGIFactory::CreateSwapChain, you should see the debug info. – MooseBoys Oct 15 '13 at 00:30