我有以下调用,无论我尝试什么,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*