我有以下调用,无论我尝试什么,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
);
根据上面的日志行,两者useSoftwareEmulation和enableRenderDebugging都是false。
所有其他变量的类型如下:
currentAdapter是一个IDXGIAdapter*
swapChainDescriptor是一个DXGI_SWAP_CHAIN_DESC
swapChain是一个IDXGISwapChain*
graphicsCardInterface是一个ID3D11Device*
runningFeatureLevel是一个D3D_FEATURE_LEVEL
graphicsCardContext是一个ID3D11DeviceContext*