mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-16 17:27:38 +00:00
depends: qt: apply QShader reproducibility fixes
This commit is contained in:
parent
2777b7a76a
commit
e78e78677e
6 changed files with 172 additions and 215 deletions
|
@ -17,7 +17,6 @@ $(package)_patches += no-statx.patch
|
|||
$(package)_patches += no-xlib.patch
|
||||
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch
|
||||
$(package)_patches += rcc_hardcode_timestamp.patch
|
||||
$(package)_patches += remove-shaders.patch
|
||||
$(package)_patches += root_CMakeLists.txt
|
||||
$(package)_patches += Use-consistent-ordering-in-QShader.patch
|
||||
$(package)_patches += QShader_map.patch
|
||||
|
@ -188,9 +187,6 @@ define $(package)_preprocess_cmds
|
|||
patch -p1 -i $($(package)_patch_dir)/Use-consistent-ordering-in-QShader.patch && \
|
||||
patch -p1 -i $($(package)_patch_dir)/QShader_map.patch && \
|
||||
cd .. && \
|
||||
cd qtmultimedia && \
|
||||
patch -p1 -i $($(package)_patch_dir)/remove-shaders.patch && \
|
||||
cd .. && \
|
||||
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
|
||||
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
|
||||
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
|
||||
|
|
|
@ -25,10 +25,11 @@ $(package)_patches += no-xlib.patch
|
|||
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch
|
||||
$(package)_patches += qtmultimedia-fixes.patch
|
||||
$(package)_patches += rcc_hardcode_timestamp.patch
|
||||
$(package)_patches += remove-shaders.patch
|
||||
$(package)_patches += root_CMakeLists.txt
|
||||
$(package)_patches += windows_func_fix.patch
|
||||
$(package)_patches += WindowsToolchain.cmake
|
||||
$(package)_patches += Use-consistent-ordering-in-QShader.patch
|
||||
$(package)_patches += QShader_map.patch
|
||||
|
||||
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
|
||||
$(package)_qttranslations_sha256_hash=44dbc6f1d256d2048c96fa665c240e0075c2e67188c93986a39ede3556a16a12
|
||||
|
@ -267,6 +268,10 @@ define $(package)_preprocess_cmds
|
|||
mv $($(package)_patch_dir)/MacToolchain.cmake . && \
|
||||
mv $($(package)_patch_dir)/aarch64Toolchain.cmake . && \
|
||||
mv $($(package)_patch_dir)/gnueabihfToolchain.cmake . && \
|
||||
cd qtbase && \
|
||||
patch -p1 -i $($(package)_patch_dir)/Use-consistent-ordering-in-QShader.patch && \
|
||||
patch -p1 -i $($(package)_patch_dir)/QShader_map.patch && \
|
||||
cd .. && \
|
||||
cd qtmultimedia && \
|
||||
patch -p1 -i $($(package)_patch_dir)/qtmultimedia-fixes.patch && \
|
||||
cd .. && \
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
From 779b0701b82280a319a4b11d04742fbd1a245848 Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Wed, 21 Dec 2022 21:59:31 +0100
|
||||
Subject: [PATCH] Remove shaders
|
||||
|
||||
---
|
||||
src/multimedia/CMakeLists.txt | 59 ----------------------
|
||||
src/multimedia/video/qvideoframeformat.cpp | 5 --
|
||||
2 files changed, 64 deletions(-)
|
||||
|
||||
diff --git a/src/multimedia/CMakeLists.txt b/src/multimedia/CMakeLists.txt
|
||||
index 651c7ee76..b386e1501 100644
|
||||
--- a/src/multimedia/CMakeLists.txt
|
||||
+++ b/src/multimedia/CMakeLists.txt
|
||||
@@ -250,64 +250,5 @@ set(VIDEO_SHADERS
|
||||
"shaders/nv12_bt2020_hlg.frag"
|
||||
)
|
||||
|
||||
-qt_internal_add_shaders(Multimedia "shaders"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- FILES
|
||||
- ${VIDEO_VERTEX_SHADERS}
|
||||
- ${VIDEO_SHADERS}
|
||||
-)
|
||||
-
|
||||
string(REPLACE ".frag" "_linear.frag.qsb" LINEAR_VIDEO_SHADERS "${VIDEO_SHADERS}")
|
||||
|
||||
-qt_internal_add_shaders(Multimedia "shaders_linear"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- FILES
|
||||
- ${VIDEO_SHADERS}
|
||||
- OUTPUTS
|
||||
- ${LINEAR_VIDEO_SHADERS}
|
||||
- DEFINES
|
||||
- QMM_OUTPUTSURFACE_LINEAR
|
||||
-)
|
||||
-
|
||||
-qt_internal_add_shaders(Multimedia "shaders_gl_macos"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- GLSL
|
||||
- "120,150"
|
||||
- NOHLSL
|
||||
- NOMSL
|
||||
- FILES
|
||||
- "shaders/rectsampler.vert"
|
||||
- "shaders/rectsampler_bgra.frag"
|
||||
-)
|
||||
-
|
||||
-qt_internal_add_shaders(Multimedia "shaders_gl_macos_linear"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- GLSL
|
||||
- "120,150"
|
||||
- NOHLSL
|
||||
- NOMSL
|
||||
- FILES
|
||||
- "shaders/rectsampler_bgra.frag"
|
||||
- OUTPUTS
|
||||
- "shaders/rectsampler_bgra_linear.frag.qsb"
|
||||
-)
|
||||
diff --git a/src/multimedia/video/qvideoframeformat.cpp b/src/multimedia/video/qvideoframeformat.cpp
|
||||
index bc8fbe2e1..25bfdd5ff 100644
|
||||
--- a/src/multimedia/video/qvideoframeformat.cpp
|
||||
+++ b/src/multimedia/video/qvideoframeformat.cpp
|
||||
@@ -11,10 +11,6 @@
|
||||
#include <qvariant.h>
|
||||
#include <qmatrix4x4.h>
|
||||
|
||||
-static void initResource() {
|
||||
- Q_INIT_RESOURCE(shaders);
|
||||
-}
|
||||
-
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVideoFrameFormatPrivate : public QSharedData
|
||||
@@ -348,7 +344,6 @@ QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QVideoFrameFormatPrivate);
|
||||
QVideoFrameFormat::QVideoFrameFormat()
|
||||
: d(new QVideoFrameFormatPrivate)
|
||||
{
|
||||
- initResource();
|
||||
}
|
||||
|
||||
/*!
|
||||
--
|
||||
2.38.1
|
||||
|
21
contrib/depends/patches/qt/QShader_map.patch
Normal file
21
contrib/depends/patches/qt/QShader_map.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
diff --git a/src/gui/rhi/qshader_p.h b/src/gui/rhi/qshader_p.h
|
||||
index 690a7f44cd..8e5894c97f 100644
|
||||
--- a/src/gui/rhi/qshader_p.h
|
||||
+++ b/src/gui/rhi/qshader_p.h
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <QtGui/qtguiglobal.h>
|
||||
#include <QtCore/qhash.h>
|
||||
+#include <QtCore/qmap.h>
|
||||
#include <private/qshaderdescription_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -127,7 +128,7 @@ public:
|
||||
QByteArray serialized() const;
|
||||
static QShader fromSerialized(const QByteArray &data);
|
||||
|
||||
- using NativeResourceBindingMap = QHash<int, QPair<int, int> >; // binding -> native_binding[, native_binding]
|
||||
+ using NativeResourceBindingMap = QMap<int, QPair<int, int> >; // binding -> native_binding[, native_binding]
|
||||
NativeResourceBindingMap nativeResourceBindingMap(const QShaderKey &key) const;
|
||||
void setResourceBindingMap(const QShaderKey &key, const NativeResourceBindingMap &map);
|
||||
void removeResourceBindingMap(const QShaderKey &key);
|
|
@ -0,0 +1,145 @@
|
|||
From 9dced35b41882c42f4239a6380bd86dfda4cd7f5 Mon Sep 17 00:00:00 2001
|
||||
From: Laszlo Agocs <laszlo.agocs@qt.io>
|
||||
Date: Fri, 10 Jun 2022 12:09:11 +0200
|
||||
Subject: [PATCH] Use consistent ordering in QShader
|
||||
|
||||
Fixes: QTBUG-101923
|
||||
Change-Id: I62df3eba773350e47ed650acb00bc42b3ce6a899
|
||||
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
||||
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
|
||||
---
|
||||
src/gui/rhi/qshader.cpp | 38 ++++++++++++++++++++++
|
||||
src/gui/rhi/qshader_p.h | 2 ++
|
||||
src/gui/rhi/qshader_p_p.h | 9 ++---
|
||||
tests/auto/gui/rhi/qshader/tst_qshader.cpp | 11 +++++++
|
||||
4 files changed, 56 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp
|
||||
index 1992708ba4..cd4a9f3854 100644
|
||||
--- a/src/gui/rhi/qshader.cpp
|
||||
+++ b/src/gui/rhi/qshader.cpp
|
||||
@@ -563,6 +563,22 @@ size_t qHash(const QShaderVersion &s, size_t seed) noexcept
|
||||
}
|
||||
#endif
|
||||
|
||||
+/*!
|
||||
+ Establishes a sorting order between the two QShaderVersion \a lhs and \a rhs.
|
||||
+
|
||||
+ \relates QShaderVersion
|
||||
+ */
|
||||
+bool operator<(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
|
||||
+{
|
||||
+ if (lhs.version() < rhs.version())
|
||||
+ return true;
|
||||
+
|
||||
+ if (lhs.version() == rhs.version())
|
||||
+ return int(lhs.flags()) < int(rhs.flags());
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/*!
|
||||
\internal
|
||||
\fn bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs)
|
||||
@@ -584,6 +600,28 @@ bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
|
||||
&& lhs.sourceVariant() == rhs.sourceVariant();
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ Establishes a sorting order between the two keys \a lhs and \a rhs.
|
||||
+
|
||||
+ \relates QShaderKey
|
||||
+ */
|
||||
+bool operator<(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
|
||||
+{
|
||||
+ if (int(lhs.source()) < int(rhs.source()))
|
||||
+ return true;
|
||||
+
|
||||
+ if (int(lhs.source()) == int(rhs.source())) {
|
||||
+ if (lhs.sourceVersion() < rhs.sourceVersion())
|
||||
+ return true;
|
||||
+ if (lhs.sourceVersion() == rhs.sourceVersion()) {
|
||||
+ if (int(lhs.sourceVariant()) < int(rhs.sourceVariant()))
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/*!
|
||||
\internal
|
||||
\fn bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs)
|
||||
diff --git a/src/gui/rhi/qshader_p.h b/src/gui/rhi/qshader_p.h
|
||||
index 690a7f44cd..c6ef338bfa 100644
|
||||
--- a/src/gui/rhi/qshader_p.h
|
||||
+++ b/src/gui/rhi/qshader_p.h
|
||||
@@ -187,7 +187,9 @@ inline bool operator!=(const QShader &lhs, const QShader &rhs) noexcept
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept;
|
||||
+Q_GUI_EXPORT bool operator<(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept;
|
||||
Q_GUI_EXPORT bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept;
|
||||
+Q_GUI_EXPORT bool operator<(const QShaderKey &lhs, const QShaderKey &rhs) noexcept;
|
||||
Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept;
|
||||
|
||||
inline bool operator!=(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
|
||||
diff --git a/src/gui/rhi/qshader_p_p.h b/src/gui/rhi/qshader_p_p.h
|
||||
index c87f882bc5..e9d1e31aaf 100644
|
||||
--- a/src/gui/rhi/qshader_p_p.h
|
||||
+++ b/src/gui/rhi/qshader_p_p.h
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "qshader_p.h"
|
||||
#include <QtCore/QAtomicInt>
|
||||
-#include <QtCore/QHash>
|
||||
+#include <QtCore/QMap>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -54,9 +54,10 @@ struct Q_GUI_EXPORT QShaderPrivate
|
||||
int qsbVersion = QSB_VERSION;
|
||||
QShader::Stage stage = QShader::VertexStage;
|
||||
QShaderDescription desc;
|
||||
- QHash<QShaderKey, QShaderCode> shaders;
|
||||
- QHash<QShaderKey, QShader::NativeResourceBindingMap> bindings;
|
||||
- QHash<QShaderKey, QShader::SeparateToCombinedImageSamplerMappingList> combinedImageMap;
|
||||
+ // QMap not QHash because we need to be able to iterate based on sorted keys
|
||||
+ QMap<QShaderKey, QShaderCode> shaders;
|
||||
+ QMap<QShaderKey, QShader::NativeResourceBindingMap> bindings;
|
||||
+ QMap<QShaderKey, QShader::SeparateToCombinedImageSamplerMappingList> combinedImageMap;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
diff --git a/tests/auto/gui/rhi/qshader/tst_qshader.cpp b/tests/auto/gui/rhi/qshader/tst_qshader.cpp
|
||||
index cd883b34d9..40aa9d9a87 100644
|
||||
--- a/tests/auto/gui/rhi/qshader/tst_qshader.cpp
|
||||
+++ b/tests/auto/gui/rhi/qshader/tst_qshader.cpp
|
||||
@@ -18,6 +18,7 @@ private slots:
|
||||
void genVariants();
|
||||
void shaderDescImplicitSharing();
|
||||
void bakedShaderImplicitSharing();
|
||||
+ void sortedKeys();
|
||||
void mslResourceMapping();
|
||||
void serializeShaderDesc();
|
||||
void comparison();
|
||||
@@ -238,6 +239,16 @@ void tst_QShader::bakedShaderImplicitSharing()
|
||||
}
|
||||
}
|
||||
|
||||
+void tst_QShader::sortedKeys()
|
||||
+{
|
||||
+ QShader s = getShader(QLatin1String(":/data/texture_all_v4.frag.qsb"));
|
||||
+ QVERIFY(s.isValid());
|
||||
+ QList<QShaderKey> availableShaders = s.availableShaders();
|
||||
+ QCOMPARE(availableShaders.count(), 7);
|
||||
+ std::sort(availableShaders.begin(), availableShaders.end());
|
||||
+ QCOMPARE(availableShaders, s.availableShaders());
|
||||
+}
|
||||
+
|
||||
void tst_QShader::mslResourceMapping()
|
||||
{
|
||||
QShader s = getShader(QLatin1String(":/data/texture_all_v4.frag.qsb"));
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
From 779b0701b82280a319a4b11d04742fbd1a245848 Mon Sep 17 00:00:00 2001
|
||||
From: tobtoht <tob@featherwallet.org>
|
||||
Date: Wed, 21 Dec 2022 21:59:31 +0100
|
||||
Subject: [PATCH] Remove shaders
|
||||
|
||||
---
|
||||
src/multimedia/CMakeLists.txt | 59 ----------------------
|
||||
src/multimedia/video/qvideoframeformat.cpp | 5 --
|
||||
2 files changed, 64 deletions(-)
|
||||
|
||||
diff --git a/src/multimedia/CMakeLists.txt b/src/multimedia/CMakeLists.txt
|
||||
index 651c7ee76..b386e1501 100644
|
||||
--- a/src/multimedia/CMakeLists.txt
|
||||
+++ b/src/multimedia/CMakeLists.txt
|
||||
@@ -250,64 +250,5 @@ set(VIDEO_SHADERS
|
||||
"shaders/nv12_bt2020_hlg.frag"
|
||||
)
|
||||
|
||||
-qt_internal_add_shaders(Multimedia "shaders"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- FILES
|
||||
- ${VIDEO_VERTEX_SHADERS}
|
||||
- ${VIDEO_SHADERS}
|
||||
-)
|
||||
-
|
||||
string(REPLACE ".frag" "_linear.frag.qsb" LINEAR_VIDEO_SHADERS "${VIDEO_SHADERS}")
|
||||
|
||||
-qt_internal_add_shaders(Multimedia "shaders_linear"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- FILES
|
||||
- ${VIDEO_SHADERS}
|
||||
- OUTPUTS
|
||||
- ${LINEAR_VIDEO_SHADERS}
|
||||
- DEFINES
|
||||
- QMM_OUTPUTSURFACE_LINEAR
|
||||
-)
|
||||
-
|
||||
-qt_internal_add_shaders(Multimedia "shaders_gl_macos"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- GLSL
|
||||
- "120,150"
|
||||
- NOHLSL
|
||||
- NOMSL
|
||||
- FILES
|
||||
- "shaders/rectsampler.vert"
|
||||
- "shaders/rectsampler_bgra.frag"
|
||||
-)
|
||||
-
|
||||
-qt_internal_add_shaders(Multimedia "shaders_gl_macos_linear"
|
||||
- SILENT
|
||||
- BATCHABLE
|
||||
- PRECOMPILE
|
||||
- OPTIMIZED
|
||||
- PREFIX
|
||||
- "/qt-project.org/multimedia"
|
||||
- GLSL
|
||||
- "120,150"
|
||||
- NOHLSL
|
||||
- NOMSL
|
||||
- FILES
|
||||
- "shaders/rectsampler_bgra.frag"
|
||||
- OUTPUTS
|
||||
- "shaders/rectsampler_bgra_linear.frag.qsb"
|
||||
-)
|
||||
diff --git a/src/multimedia/video/qvideoframeformat.cpp b/src/multimedia/video/qvideoframeformat.cpp
|
||||
index bc8fbe2e1..25bfdd5ff 100644
|
||||
--- a/src/multimedia/video/qvideoframeformat.cpp
|
||||
+++ b/src/multimedia/video/qvideoframeformat.cpp
|
||||
@@ -11,10 +11,6 @@
|
||||
#include <qvariant.h>
|
||||
#include <qmatrix4x4.h>
|
||||
|
||||
-static void initResource() {
|
||||
- Q_INIT_RESOURCE(shaders);
|
||||
-}
|
||||
-
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QVideoFrameFormatPrivate : public QSharedData
|
||||
@@ -348,7 +344,6 @@ QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QVideoFrameFormatPrivate);
|
||||
QVideoFrameFormat::QVideoFrameFormat()
|
||||
: d(new QVideoFrameFormatPrivate)
|
||||
{
|
||||
- initResource();
|
||||
}
|
||||
|
||||
/*!
|
||||
--
|
||||
2.38.1
|
||||
|
Loading…
Reference in a new issue