Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-102451

RHI: Auto-detect D3D Feature Level

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 6.2.4
    • Qt RHI

    Description

      Even though it is documented that "the scene graph will choose the graphics API to use based on the platform" (https://doc.qt.io/qt-6/qquickwindow.html#setGraphicsApi), it would be nice if Qt on Windows can auto-detect the supported D3D feature levels and fall back to OpenGL if Shader Model 5.0 isn't available.

      With QSG_INFO=1 and QSG_RHI_DEBUG_LAYER=1, an old graphics card might produce this...

      [1756] qt.scenegraph.general: Using QRhi with backend D3D11
      [1756] Graphics API debug/validation layers: 1
      [1756] QRhi profiling and debug markers: 0
      [1756] Shader/pipeline cache collection: 0
      [1756] qt.scenegraph.general: threaded render loop
      [1756] qt.scenegraph.general: Using sg animation driver
      [1756] qt.scenegraph.general: Animation Driver: using vsync: 16.66 ms
      [1756] qt.scenegraph.general: Using sg animation driver
      [1756] qt.scenegraph.general: Animation Driver: using vsync: 16.66 ms
      [1756] qt.rhi.general: FLIP_* swapchain supported = true, ALLOW_TEARING supported = true
      [1756] qt.rhi.general: Default swap effect: FLIP_SEQUENTIAL
      [1756] qt.rhi.general: Adapter 0: 'NVIDIA GeForce GTS 250' (vendor 0x10DE device 0x615 flags 0x0)
      [1756] qt.rhi.general: using this adapter
      [1756] qt.rhi.general: Adapter 1: 'Microsoft Basic Render Driver' (vendor 0x1414 device 0x8C flags 0x2)
      [1756] qt.scenegraph.general: MSAA sample count for the swapchain is 1. Alpha channel requested = no.
      [1756] qt.scenegraph.general: rhi texture atlas dimensions: 512x512
      [1756] D3D11 ERROR: ID3D11Device::CreateVertexShader: Shader must be vs_4_0. Shader version provided: vs_5_0 [ STATE_CREATION ERROR #167: CREATEVERTEXSHADER_INVALIDSHADERTYPE]
      [1756] Failed to create vertex shader: Error 0x80070057: ???????? ????? ???????.
      [1756] Failed to build graphics pipeline state
      

      ...whereas the OpenGL backend can work. In other words, an app could run fine in Qt 5 (default: OpenGL) but fail in Qt 6 (default: D3D11)

       

      One mechanism for such detection is described at https://stackoverflow.com/questions/22223859/find-out-directx-version (call D3D11CreateDeviceAndSwapChain() with D3D_FEATURE_LEVEL_11_0 and see if it succeeds)

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              lagocs Laszlo Agocs
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes