aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2024-04-15 12:36:14 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2024-04-16 23:00:15 +0000
commit2e1400f8b4296e74c65e6c4c56be6aa20b0733b5 (patch)
tree008904907220f697ac9fbd397f021e8eb12ab2b7
parent213770f72d5c94771d3cb9b892be5f902fc6876b (diff)
Correct fragment stage related in QSGMaterial multiview docs
Do not suggest relying on gl_ViewIndex is possible in fragment shaders. It is possible in many cases, but not always, and doing so will not be portable, in particular, there are problems with OpenGL (ES) and the related SPIRV-Cross-based translation into GLSL ES. Change-Id: I1393429469e478b520ae87f4f9133600e52e3295 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index 99c70a6c38..49508c1c35 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -372,11 +372,15 @@ int QSGMaterial::compare(const QSGMaterial *other) const
\endcode
\note The fragment shader should be treated the same way the vertex shader
- is, even when the fragment shader code has no dependency on the view count.
- This is because mixing different shader versions within the same graphics
- pipeline can be problematic, depending on the underlying graphics API. With
- D3D12 for example, mixing HLSL shaders for shader model 5.0 and 6.1 would
- generate an error.
+ is, even though the fragment shader code cannot have any dependency on the
+ view count (\c{gl_ViewIndex}), for maximum portability. There are two
+ reasons for including fragment shaders too in the multiview set. One is that
+ mixing different shader versions within the same graphics pipeline can be
+ problematic, depending on the underlying graphics API: with D3D12 for
+ example, mixing HLSL shaders for shader model 5.0 and 6.1 would generate an
+ error. The other is that having \c QSHADER_VIEW_COUNT defined in fragment
+ shaders can be very useful, for example when sharing a uniform buffer layout
+ between the vertex and fragment stages.
\note For OpenGL the minimum GLSL version for vertex shaders relying on
\c{gl_ViewIndex} is \c 330. Lower versions may be accepted at build time,