DirectX D3D11CreateDeviceAndSwapChain returning E_INVALIDARG

纵然是瞬间 提交于 2019-12-12 14:26:58

问题


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*


回答1:


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.



来源:https://stackoverflow.com/questions/19348787/directx-d3d11createdeviceandswapchain-returning-e-invalidarg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!