Unverified Commit 60358547 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

deepin.dtk: fix build on qt 6.8 (#347842)

parents 7d4ba773 50b7b688
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  pkg-config,
  doxygen,
@@ -26,6 +27,11 @@ stdenv.mkDerivation (finalAttrs: {
  patches = [
    ./fix-pkgconfig-path.patch
    ./fix-pri-path.patch
    (fetchpatch {
      name = "fix-build-on-qt-6.8.patch";
      url = "https://gitlab.archlinux.org/archlinux/packaging/packages/dtk6core/-/raw/d2e991f96b2940e8533b7e944bab5a7dd6aa0fb7/qt-6.8.patch";
      hash = "sha256-HZxUrtUmVwnNUwcBoU7ewb+McsRkALQglPBbJU8HTkk=";
    })
  ];

  postPatch = ''
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ stdenv.mkDerivation (finalAttrs: {
  patches = [
    ./fix-pkgconfig-path.patch
    ./fix-pri-path.patch
    ./fix-build-on-qt-6.8.patch
  ];

  nativeBuildInputs = [
+135 −0
Original line number Diff line number Diff line
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
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  pkg-config,
  doxygen,
@@ -24,6 +25,11 @@ stdenv.mkDerivation (finalAttrs: {
  patches = [
    ./fix-pkgconfig-path.patch
    ./fix-pri-path.patch
    (fetchpatch {
      name = "fix-build-on-qt-6.8.patch";
      url = "https://gitlab.archlinux.org/archlinux/packaging/packages/dtk6gui/-/raw/b6b8521fd69c28dbca5f6e8d1d8258c904b6caf1/qt-6.8.patch";
      hash = "sha256-Fu5vwvKJGMW94JYoIPvDCeXs8WrAskQlVRX/3FYQFGY=";
    })
  ];

  postPatch = ''
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  pkg-config,
  doxygen,
@@ -25,6 +26,11 @@ stdenv.mkDerivation (finalAttrs: {
  patches = [
    ./fix-pkgconfig-path.patch
    ./fix-pri-path.patch
    (fetchpatch {
      name = "fix-build-on-qt-6.8.patch";
      url = "https://gitlab.archlinux.org/archlinux/packaging/packages/dtk6widget/-/raw/c4ac094715daa4ec319dc4d55bbca9d818845f82/qt-6.8.patch";
      hash = "sha256-XEgtAV0mF1+C26wCaukjuv4WNbP4ISGgXt/eav7h9ko=";
    })
  ];

  postPatch = ''