Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.15, 6.0, 6.6
-
None
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.