summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qshaderdescription_p.h
diff options
context:
space:
mode:
authorBen Fletcher <ben.fletcher@me.com>2023-02-16 16:46:22 -0800
committerBen Fletcher <ben.fletcher@me.com>2023-03-09 15:24:45 +0000
commit4201cdab1886b5c39fe722a95e1b0ba462b63b71 (patch)
tree242bec9a73e8bb0e09fbdc74c8f2fabd98b7eba1 /src/gui/rhi/qshaderdescription_p.h
parent17c9001a53a2377cc38bdf4b1982cab2dca94573 (diff)
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 <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qshaderdescription_p.h')
-rw-r--r--src/gui/rhi/qshaderdescription_p.h33
1 files changed, 21 insertions, 12 deletions
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<int> arrayDims;
+ int arrayStride = 0;
+ int matrixStride = 0;
+ bool matrixIsRowMajor = false;
+ QList<BlockVariable> structMembers;
+ };
+
struct InOutVariable {
QByteArray name;
VariableType type = Unknown;
@@ -191,17 +209,6 @@ public:
ImageFlags imageFlags;
QList<int> arrayDims;
bool perPatch = false;
- };
-
- struct BlockVariable {
- QByteArray name;
- VariableType type = Unknown;
- int offset = 0;
- int size = 0;
- QList<int> arrayDims;
- int arrayStride = 0;
- int matrixStride = 0;
- bool matrixIsRowMajor = false;
QList<BlockVariable> structMembers;
};
@@ -276,6 +283,8 @@ public:
struct BuiltinVariable {
BuiltinType type;
+ VariableType varType;
+ QList<int> arrayDims;
};
QList<BuiltinVariable> inputBuiltinVariables() const;