Description
Direct OpenGL usage is to be removed in Qt 6.0 and is replaced by rendering via the Qt Rendering Hardware Interface and the associated graphics and compute shader management machinery provided by the Qt Shader Tools module.
See
https://bugreports.qt.io/browse/QTBUG-70287
https://intranet.qt.io/display/QTRD/Unleashing+the+Greyhound
Slides 31-53 in https://github.com/alpqr/talks/blob/master/NDC_TechTown_2019/qtgraphics_ndctt2019.pdf
With QRhi the shaders have to be migrated to Vulkan-style GLSL.
More information about this language variant is available at https://github.com/KhronosGroup/GLSL/blob/master/extensions/khr/GL_KHR_vulkan_glsl.txt
Note that many constructs described in the spec are not applicable or available for use in combination with QRhi.
- At minimum the porting involves using uniform buffers for everything (the concept of individual uniforms does not exist anymore), introducing location and binding qualifiers for vertex inputs and shader resources, and possibly a few syntactical changes.
- This also presents potentially significant changes to the rendering engine as well when it comes to shader resources (uniforms, samplers/textures).
- It is recommended to analyze and familiarize with the similar porting work done for the Qt Quick material system in Qt 5.14. The core concepts are the same, but the Quick 3D shaders are significantly more complex and may present more challanges.
- It has not yet been analyzed if the more complex pieces of GLSL snippets in the default and custom material library have potentially incompatible code in them.
- This task is to be implemented in a way that the old (direct OpenGL usage, GLSL) and new (QRhi, Vulkan-style GLSL) systems can co-exist side by side, and both are usable at runtime. Switching could happen via environment variables for example.
- Keep in mind that the shaders are to be processed by https://github.com/KhronosGroup/SPIRV-Cross While unlikely, it could happen that some shader code is mishandled or mistranslated by this tool, or miscompiled by https://github.com/KhronosGroup/glslang , the compiler we use for GLSL -> SPIR-V compilation. If this happens, we will need to investigate how to best handle this, on a case by case basis.
Attachments
Issue Links
- depends on
-
QTBUG-79219 Minimal proof of concept demo for Quick 3D on QRhi
- Closed
- relates to
-
QTBUG-78135 Quick3D: Shader managment rework to enable an efficient QRhi-based port
- Closed
-
QTBUG-78679 Port Qt Quick 3D onto the RHI
- Closed