1
\$\begingroup\$
    IDXGIAdapter* higher_performance_adapter;
    dx_result = dxgi_factory->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,
                                                         __uuidof(IDXGIAdapter),
                                                         (void**)&higher_performance_adapter);
    if(SUCCEEDED(dx_result))
    {
      UINT output_index = 0;
      IDXGIOutput* output;
      while(higher_performance_adapter->EnumOutputs(output_index, &output) != DXGI_ERROR_NOT_FOUND)
      {
        DXGI_OUTPUT_DESC output_description = {0};
        output->GetDesc(&output_description);

        ++output_index;
      }

      ID3D12Device* device;
      dx_result = D3D12CreateDevice(higher_performance_adapter,
                                    D3D_FEATURE_LEVEL_12_1,
                                    __uuidof(ID3D12Device),
                                    (void**)&device);
      if(SUCCEEDED(dx_result))
      {

          ...

I'm trying to create a D3D12 device selecting the GPU with the higher performance because passing null to the adapter parameter at D3D12CreateDevice gets the first adapater from EnumAdapters, which is the Intel integrated GPU. But, when I got a IDXGIAdapter object of my dedicated GPU, the EnumOutputs function failed, as well as the D3D12CreateDevice. Why is that? Why these functions fails when using the dedicated GPU, which in my case is a NVIDIA, ?

The returned dx_result is "0x887a0004 : The specified device interface or feature level is not supported on this system. "

That don't makes sense, since my system supports DirectX12.

\$\endgroup\$
0
\$\begingroup\$

Ok, I found the issue. I just opened my task manager to see information about my NVIDIA GPU. On DirectX verison it saids 12 (FL 11.0) which I realized that FL stands for Feature Level, which is exactly the seconds parameter for D3D12CreateDevice. I Just changed D3D_FEATURE_LEVEL_12_1 to D3D_FEATURE_LEVEL_11_0 and it works.

Now, I don't get it why the EnumOutputs failed. I mean, no outputs were found, event with the index 0.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ See Anatomy of Direct3D 12 Create Device for some general advice on Direct3D 12 device creation. Keep in mind that you can in fact have a system where only some of the drivers/devices supports DX12 while others only support DX11. D3D_FEATURE_LEVEL_11_0 is also the best choice for broad hardware support for DX12. \$\endgroup\$ – Chuck Walbourn Jul 12 at 19:13
  • 1
    \$\begingroup\$ In "hybrid graphics" systems (see AMD / NVIDIA versions), the output is not 'owned' by all devices. The integrated part usually owns the physical output to the device, while the discrete part does not. Similarly if a WARP device is created, it has no 'outputs'. You should also look at this thread. \$\endgroup\$ – Chuck Walbourn Jul 12 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.