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

Cross-api rendering without touching shaders written for GL

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.15, 6.0, 6.6
    • Qt RHI
    • None
    • All

    Description

      Hello,

      I'm in the situation where my app has to load externally-provided vertex & fragment shaders (these: https://editor.isf.video/shaders?q=&category=&sort=&page=0) which are written with OpenGL coordinate system in mind.

      Most of the time these are only fragment shaders thus the solution provided by Qt right now is enough - I provide a basic vertex shader which uses QRhi::clipSpaceCorrMatrix() as mvp when rendering a triangle and all is fine.

      Problems appear when these shaders are a custom vertex & fragment pair: I can't ask my users to change the shaders - a lot of them only know how to go on the website, edit the shader settings to their liking with a gui and then import it into https://ossia.io ; so they get Y inversions when they render with other APIs than OpenGL (which is a huge win in some cases, e.g. rendering 8 * 1080p screen walls makes Qt RHI's GL implementation slow down to a crawl but works at 60fps from my laptop with Qt RHI Vulkan - yay).

      Thus during my investigations I found two things that can help in spirv-cross directly:

      --fixup-clipspace
      --flip-vert-y

      • these options affect the shader compilation step done by spirv-cross in order to make things compatible at the graphics API level without having to change the shaders themselves (or anything else in the pipeline - maybe the winding direction? c.f. "Implementation and impact" here : https://github.com/gpuweb/gpuweb/issues/416 ).

      Would it be possible for Qt to provide access to these features through e.g. Qt Shader Tools ? This would simplify workflows immensely.

      Attachments

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

        Activity

          People

            lagocs Laszlo Agocs
            jcelerier Jean-Michaƫl Celerier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes