From 0943b5d65d1a5699fb2085f4d92c9112fb08871d Mon Sep 17 00:00:00 2001 From: Ben Fletcher Date: Tue, 6 Dec 2022 19:52:59 -0800 Subject: RHI: QShaderDescription storage buffer qualifiers / run time stride Add storage buffer memory qualifier and run time array stride information to QShaderDescription::StorageBlock. Memory qualifiers allow more informed selection of RHI resource buffer binding (bufferLoad / bufferStore / bufferLoadStore) function. Run time array stride (for last block member unsized array) allows packing of buffer data for transfer to / from GPU. Without this information, applications must infer or guess which packing rules (std430 / std140) are in use. Change-Id: I676d7e848afefd40d01cdd463c569b07022b683e Reviewed-by: Laszlo Agocs --- src/gui/rhi/qshaderdescription_p.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (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 df4e8fd873..7e5412a784 100644 --- a/src/gui/rhi/qshaderdescription_p.h +++ b/src/gui/rhi/qshaderdescription_p.h @@ -170,6 +170,15 @@ public: }; Q_DECLARE_FLAGS(ImageFlags, ImageFlag) + enum QualifierFlag { + QualifierReadOnly = 1 << 0, + QualifierWriteOnly = 1 << 1, + QualifierCoherent = 1 << 2, + QualifierVolatile = 1 << 3, + QualifierRestrict = 1 << 4, + }; + Q_DECLARE_FLAGS(QualifierFlags, QualifierFlag) + // Optional data (like decorations) usually default to an otherwise invalid value (-1 or 0). This is intentional. struct InOutVariable { @@ -218,6 +227,8 @@ public: int binding = -1; int descriptorSet = -1; QList members; + int runtimeArrayStride = 0; + QualifierFlags qualifierFlags; }; QList inputVariables() const; @@ -310,6 +321,7 @@ private: }; Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::ImageFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QShaderDescription::QualifierFlags) #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QShaderDescription &); -- cgit v1.2.3