1

I'm trying to call "m_pDevice->CreatePipelineState" for a MeshShader pipeline. But failed in "m_pDevice->QueryInterface" for obtaining a ID3D12Device2 handle.

ID3D12Device2* pDevice2; HRESULT hr = m_pDevice->QueryInterface(IID_PPV_ARGS(&pDevice2)); pDevice2->CreatePipelineState(&desc, IID_PPV_ARGS(&pPipelineState));

HRESULT: E_NOINTERFACE No such interface supported.

I searched for a long time but still can't find out why. Does anyone have any ideas what this could be?

IDE: VS2017 Enterprise 15.9.51 OS: Windows 10 2009(19043.1706) Windows SDK: 10.0.19041.0 Graphics card: RTX 2060

have tried:

  1. configue "Windows SDK Version" in Debug-Properties to 10.0.19041.0
  2. reinstall IDE
  3. reinstall Windows SDK kits
  4. update graphics card driver up-to-date
  5. Check FeatureSupport "D3D12_FEATURE_D3D12_OPTIONS7" succeed.
Seize
  • 11
  • 2
  • What is `m_pDevice`? And do you run Windows 10 Creators Update version as requested per documentation https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nn-d3d12-id3d12device2 (https://en.wikipedia.org/wiki/Windows_10_version_history)? – Simon Mourier Jan 07 '23 at 07:27

1 Answers1

2

For DirectX 12, you can create the device at the level you want rather than using the QueryInterface method. This is probably an easier scenario to debug.

With a minimum requirement of Windows 10 (19043), you can use any of ID3D12Device - ID3D12Device8 in the creation:

ComPtr<ID3D12Device8> m_d3dDevice;

// ...

// Create the DX12 API device object.
hr = D3D12CreateDevice(
        adapter.Get(),
        D3D_FEATURE_LEVEL_11_0,
        IID_PPV_ARGS(&m_d3dDevice)
        );

At the time of this answer, all version of Windows 10 prior to Version 21H2 (Build 19044) are technically out of support for consumers. For shipping software, you can make Windows 10 (Version 1909, 18363) your minimum supported OS and use of the DirectX Agility SDK to be sure the above code will still succeed.

See this blog post.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81
  • I tried "ID3D12Device8", but still failed. For many reasons, I have to use "QueryInterface" way. Is there any potential environment reasons that caused "QueryInterface" fail? As far as I know, my windows version and sdk version support creating ID3D12Device2 or ID3D12Device8. – Seize Jan 08 '23 at 05:23
  • Have you enabled the debug device? Any output? Do you know you have a DX12 capable driver/video card? Were you able to create that ID3D12Device initially (you can't QI from DX11 to DX12 for example)? – Chuck Walbourn Jan 08 '23 at 07:16
  • I tried to enable debug device, but no output when step-over QueryInterface. And crashed on CreatePipelineState, because pDevice2 was not successfully inited. I can sure of creating ID3D12Device with feature level D3D_FEATURE_LEVEL_12_0 successfully. My card is RTX2060. – Seize Jan 08 '23 at 16:44
  • Try removing the "Graphics Tools" Windows optional feature and reinstalling it. – Chuck Walbourn Jan 08 '23 at 19:21
  • Sadly, it didn't work. Besides, I tried update windows10 to 19044.1706. It's really weird. – Seize Jan 09 '23 at 07:11
  • Created ID3D12Device with feature level D3D_FEATURE_LEVEL_12_1, QI still failed. Meanwhile, there's no problem if run the same code on another computer, which use RTX3080. – Seize Jan 09 '23 at 07:35
  • 1
    There may be some 'value add' software installed on the problem system that's failing to recognize the new revision. – Chuck Walbourn Jan 09 '23 at 18:28