deepin.dtk6declarative: fix build on qt 6.8

This commit is contained in:
rewine 2024-10-11 13:52:40 +08:00
parent 95b51be410
commit 50b7b688a5
2 changed files with 136 additions and 0 deletions

View File

@ -23,6 +23,7 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
./fix-pkgconfig-path.patch
./fix-pri-path.patch
./fix-build-on-qt-6.8.patch
];
nativeBuildInputs = [

View File

@ -0,0 +1,135 @@
diff --git a/qt6/src/CMakeLists.txt b/qt6/src/CMakeLists.txt
index 4314b72..a7ecaf1 100644
--- a/qt6/src/CMakeLists.txt
+++ b/qt6/src/CMakeLists.txt
@@ -25,6 +25,7 @@ dtk_extend_target(${PLUGIN_NAME} EnableCov ${ENABLE_COV})
qt_add_translations(${LIB_NAME}
TS_FILES ${TS_FILES}
QM_FILES_OUTPUT_VARIABLE QM_FILES
+ IMMEDIATE_CALL
)
set_target_properties(${LIB_NAME} PROPERTIES
diff --git a/src/private/dbackdropnode.cpp b/src/private/dbackdropnode.cpp
index 91c398a..1ed0ad8 100644
--- a/src/private/dbackdropnode.cpp
+++ b/src/private/dbackdropnode.cpp
@@ -320,8 +320,8 @@ public:
renderer->setDevicePixelRatio(base->devicePixelRatio());
renderer->setDeviceRect(base->deviceRect());
renderer->setViewportRect(base->viewportRect());
- renderer->setProjectionMatrix(base->projectionMatrix());
- renderer->setProjectionMatrixWithNativeNDC(base->projectionMatrixWithNativeNDC());
+ renderer->setProjectionMatrix(base->projectionMatrix(0));
+ renderer->setProjectionMatrixWithNativeNDC(base->projectionMatrixWithNativeNDC(0));
} else {
renderer->setDevicePixelRatio(1.0);
renderer->setDeviceRect(QRect(QPoint(0, 0), pixelSize));
@@ -336,8 +336,8 @@ public:
}
if (Q_UNLIKELY(!matrix.isIdentity())) {
- renderer->setProjectionMatrix(renderer->projectionMatrix() * matrix);
- renderer->setProjectionMatrixWithNativeNDC(renderer->projectionMatrixWithNativeNDC() * matrix);
+ renderer->setProjectionMatrix(renderer->projectionMatrix(0) * matrix);
+ renderer->setProjectionMatrixWithNativeNDC(renderer->projectionMatrixWithNativeNDC(0) * matrix);
}
renderer->setRootNode(rootNode);
diff --git a/src/private/dmaskeffectnode.cpp b/src/private/dmaskeffectnode.cpp
index c4db07d..da1e4ce 100644
--- a/src/private/dmaskeffectnode.cpp
+++ b/src/private/dmaskeffectnode.cpp
@@ -35,7 +35,7 @@ protected:
class OpaqueTextureMaterialShader : public QSGOpaqueTextureMaterialRhiShader
{
public:
- OpaqueTextureMaterialShader();
+ OpaqueTextureMaterialShader(int viewCount);
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
@@ -48,7 +48,7 @@ public:
class TextureMaterialShader : public OpaqueTextureMaterialShader
{
public:
- TextureMaterialShader();
+ TextureMaterialShader(int viewCount);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
@@ -61,7 +61,8 @@ protected:
#endif
};
-OpaqueTextureMaterialShader::OpaqueTextureMaterialShader()
+OpaqueTextureMaterialShader::OpaqueTextureMaterialShader(int viewCount)
+ : QSGOpaqueTextureMaterialRhiShader(viewCount)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if QT_CONFIG(opengl)
@@ -236,8 +237,8 @@ bool OpaqueTextureMaterialShader::updateGraphicsPipelineState(RenderState &state
}
#endif
-TextureMaterialShader::TextureMaterialShader()
- : OpaqueTextureMaterialShader()
+TextureMaterialShader::TextureMaterialShader(int viewCount)
+ : OpaqueTextureMaterialShader(viewCount)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // TODO qt6
#if QT_CONFIG(opengl)
@@ -529,7 +530,7 @@ QSGMaterialShader *TextureMaterial::createShader() const
QSGMaterialShader *TextureMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
{
Q_UNUSED(renderMode)
- return new TextureMaterialShader;
+ return new TextureMaterialShader(viewCount());
}
#endif
@@ -553,7 +554,7 @@ QSGMaterialShader *OpaqueTextureMaterial::createShader() const
QSGMaterialShader *OpaqueTextureMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
{
Q_UNUSED(renderMode)
- return new OpaqueTextureMaterialShader;
+ return new OpaqueTextureMaterialShader(viewCount());
}
#endif
diff --git a/src/private/drectanglenode.cpp b/src/private/drectanglenode.cpp
index efeeab6..b961588 100644
--- a/src/private/drectanglenode.cpp
+++ b/src/private/drectanglenode.cpp
@@ -72,7 +72,8 @@ void CornerColorShader::initialize()
m_idQtOpacity = program->uniformLocation("qt_Opacity");
}
#else
-CornerColorShader::CornerColorShader()
+CornerColorShader::CornerColorShader(int viewCount)
+ : QSGOpaqueTextureMaterialRhiShader(viewCount)
{
setShaderFileName(QSGMaterialShader::VertexStage, QStringLiteral(":/dtk/declarative/shaders_ng/cornerscolorshader.vert.qsb"));
setShaderFileName(QSGMaterialShader::FragmentStage, QStringLiteral(":/dtk/declarative/shaders_ng/cornerscolorshader.frag.qsb"));
@@ -128,7 +129,7 @@ QSGMaterialShader *CornerColorMaterial::createShader() const
QSGMaterialShader *CornerColorMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
{
Q_UNUSED(renderMode)
- return new CornerColorShader;
+ return new CornerColorShader(viewCount());
}
#endif
diff --git a/src/private/drectanglenode_p.h b/src/private/drectanglenode_p.h
index aee5a7c..7962154 100644
--- a/src/private/drectanglenode_p.h
+++ b/src/private/drectanglenode_p.h
@@ -37,7 +37,7 @@ private:
class CornerColorShader : public QSGOpaqueTextureMaterialRhiShader
{
public:
- CornerColorShader();
+ CornerColorShader(int viewCount);
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
};
#endif