3
我有以下的呼叫,不管我怎麼努力,hresult
總是E_INVALIDARG:的DirectX D3D11CreateDeviceAndSwapChain返回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
是假。
類型的所有其他變量是如此:
currentAdapter
是IDXGIAdapter*
swapChainDescriptor
是DXGI_SWAP_CHAIN_DESC
swapChain
是IDXGISwapChain*
graphicsCardInterface
是ID3D11Device*
runningFeatureLevel
是D3D_FEATURE_LEVEL
graphicsCardContext
是ID3D11DeviceContext*
將D3D11_CREATE_DEVICE_DEBUG傳遞給D3D11CreateDevice標誌以捕獲像這樣的錯誤。 – MooseBoys
@MooseBoys即使我傳遞了這些參數,輸出窗口中也沒有看到任何東西。奇怪。也許他們只會在設置設備+ swapchain後才顯示實際圖形調用的信息? – Xenoprimate
是的,因爲你正在使用CreateDeviceAndSwapChain調用,並且調用失敗。我瘦,如果你使用D3D11CreateDevice IDXGIFactory :: CreateSwapChain,你應該看到調試信息。 – MooseBoys