2013-10-13 104 views
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 
    ); 

根據上面的日誌系列,兼具useSoftwareEmulationenableRenderDebugging

類型的所有其他變量是如此:

currentAdapterIDXGIAdapter*

swapChainDescriptorDXGI_SWAP_CHAIN_DESC

swapChainIDXGISwapChain*

graphicsCardInterfaceID3D11Device*

runningFeatureLevelD3D_FEATURE_LEVEL

graphicsCardContextID3D11DeviceContext*

回答

4

誤報:我在swapChainDescriptor(即我MSAA數量和質量值有錯誤被交換)。

希望這可以幫助其他人在未來。

+0

將D3D11_CREATE_DEVICE_DEBUG傳遞給D3D11CreateDevice標誌以捕獲像這樣的錯誤。 – MooseBoys

+1

@MooseBoys即使我傳遞了這些參數,輸出窗口中也沒有看到任何東西。奇怪。也許他們只會在設置設備+ swapchain後才顯示實際圖形調用的信息? – Xenoprimate

+1

是的,因爲你正在使用CreateDeviceAndSwapChain調用,並且調用失敗。我瘦,如果你使用D3D11CreateDevice IDXGIFactory :: CreateSwapChain,你應該看到調試信息。 – MooseBoys

相關問題