qt_add_shaders: Expose tessellation options in CMake
When it comes to the docs, we won't mention these there yet.
In practice this allows to perform build-time processing of shaders
for a tessellation pipeline. The complications come from Metal, where:
- we need to tell the generator to generate the additional compute
shader variants for the vertex shaders that is going to be used in a
tessellation pipeline. This is accomplished by TESSELLATION. (maps to
qsb --msltess)
- the vertex count and mode needs to be upfront specified, even though
each of these are typically present in the .tesc or .tese but both of
them are needed by the _other_ (.tesc or .tese, respectively) when
generating Metal shaders since this will be baked in to the shader
code like in HLSL. Hence TESSELLATION_VERTEX_COUNT and
TESSELLATION_MODE.
Speaking of HLSL, that is not supported. A solution would be to have
hand-written hull and domain shaders and inject them. But this will
need splitting the qt_add_shaders since NOHLSL should not apply to the
vertex and fragment shaders then. Thus a real world example would look
like this:
qt6_add_shaders(project "shaders_tessellation_part1"
PREFIX
"/"
GLSL
"410,320es"
TESSELLATION
FILES
"tess.vert"
"tess.frag"
)
qt6_add_shaders(project "shaders_tessellation_part2"
PREFIX
"/"
NOHLSL
GLSL
"410,320es"
TESSELLATION
TESSELLATION_VERTEX_COUNT
3
TESSELLATION_MODE
"triangles"
FILES
"tess.tesc@hlsl,50,tess_hull.hlsl"
"tess.tese@hlsl,50,tess_domain.hlsl"
)
This is now exercised by the autotest, to ensure that at least
something (the expected number of shaders) gets generated.
Change-Id: Ia4bfe924ec38f6aeee0c47deb84c9fa3252cba04
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>