From 4201cdab1886b5c39fe722a95e1b0ba462b63b71 Mon Sep 17 00:00:00 2001 From: Ben Fletcher Date: Thu, 16 Feb 2023 16:46:22 -0800 Subject: rhi: Metal tessellation shader input output interface blocks Add support for shader input output interface blocks in Metal tessellation pipelines. This feature is builtin to other rhi supported tessellation backends (OpenGL/Vulkan). Metal tessellation is implemented as compute pipelines for vert and tesc, and a render pipeline for tese and frag. The shader conversion from GLSL is handled by SPIRV-Cross, which has a particular way of doing things. Rhi must setup the vertex inputs for the tese - frag render pipeline to read from buffers written by the tesc compute pipeline, following SPIRV-Cross conventions. This includes ensuring correct memory alignment per MSL Specification. In order to enable input output interface blocks, reflection of struct members of QShaderDescription::InOutVariable is required. Reflection of QShaderDescription::BuiltinVariable array dimensions is also required to support variable size tese builtin input gl_ClipDistance. An acompanying patch to QtShaderTools is required. Change-Id: Id94e86caef211485afc187bb79fe3d0619d02cf0 Reviewed-by: Qt CI Bot Reviewed-by: Laszlo Agocs --- src/gui/rhi/qshaderdescription_p.h | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/gui/rhi/qshaderdescription_p.h') diff --git a/src/gui/rhi/qshaderdescription_p.h b/src/gui/rhi/qshaderdescription_p.h index 13e72ad134..990cb12003 100644 --- a/src/gui/rhi/qshaderdescription_p.h +++ b/src/gui/rhi/qshaderdescription_p.h @@ -117,7 +117,12 @@ public: ImageRect, ImageBuffer, - Struct + Struct, + + Half, + Half2, + Half3, + Half4 }; enum ImageFormat { @@ -181,6 +186,19 @@ public: // Optional data (like decorations) usually default to an otherwise invalid value (-1 or 0). This is intentional. + struct BlockVariable + { + QByteArray name; + VariableType type = Unknown; + int offset = 0; + int size = 0; + QList arrayDims; + int arrayStride = 0; + int matrixStride = 0; + bool matrixIsRowMajor = false; + QList structMembers; + }; + struct InOutVariable { QByteArray name; VariableType type = Unknown; @@ -191,17 +209,6 @@ public: ImageFlags imageFlags; QList arrayDims; bool perPatch = false; - }; - - struct BlockVariable { - QByteArray name; - VariableType type = Unknown; - int offset = 0; - int size = 0; - QList arrayDims; - int arrayStride = 0; - int matrixStride = 0; - bool matrixIsRowMajor = false; QList structMembers; }; @@ -276,6 +283,8 @@ public: struct BuiltinVariable { BuiltinType type; + VariableType varType; + QList arrayDims; }; QList inputBuiltinVariables() const; -- cgit v1.2.3