termux-packages/x11-packages/kirigami2/no_opengl.patch

191 lines
6.2 KiB
Diff
Raw Normal View History

Qt on Termux doesn't have OpenGL. This dirty patch comments out all OpenGL related code so
it can be compiled. However, this means the Kirigami 2 might not function completely or
correctly.
--- src/src/scenegraph/shadowedrectanglematerial.cpp 2021-05-19 13:40:06.865745704 +0100
+++ src.mod/src/scenegraph/shadowedrectanglematerial.cpp 2021-05-19 13:41:00.549263960 +0100
@@ -6,7 +6,9 @@
#include "shadowedrectanglematerial.h"
+#ifndef __ANDROID__
#include <QOpenGLContext>
+#endif
QSGMaterialType ShadowedRectangleMaterial::staticType;
@@ -43,6 +45,7 @@
ShadowedRectangleShader::ShadowedRectangleShader()
{
+#ifndef __ANDROID__
auto header = QOpenGLContext::currentContext()->isOpenGLES() ? QStringLiteral("header_es.glsl") : QStringLiteral("header_desktop.glsl");
auto shaderRoot = QStringLiteral(":/org/kde/kirigami/shaders/");
@@ -57,6 +60,7 @@
shaderRoot + QStringLiteral("sdf.glsl"),
shaderRoot + QStringLiteral("shadowedrectangle.frag")
});
+#endif
}
const char *const * ShadowedRectangleShader::attributeNames() const
@@ -68,6 +72,7 @@
void ShadowedRectangleShader::initialize()
{
QSGMaterialShader::initialize();
+#ifndef __ANDROID__
m_matrixLocation = program()->uniformLocation("matrix");
m_aspectLocation = program()->uniformLocation("aspect");
m_opacityLocation = program()->uniformLocation("opacity");
@@ -76,10 +81,12 @@
m_colorLocation = program()->uniformLocation("color");
m_shadowColorLocation = program()->uniformLocation("shadowColor");
m_offsetLocation = program()->uniformLocation("offset");
+#endif
}
void ShadowedRectangleShader::updateState(const QSGMaterialShader::RenderState& state, QSGMaterial* newMaterial, QSGMaterial* oldMaterial)
{
+#ifndef __ANDROID__
auto p = program();
if (state.isMatrixDirty()) {
@@ -99,4 +106,5 @@
p->setUniformValue(m_shadowColorLocation, material->shadowColor);
p->setUniformValue(m_offsetLocation, material->offset);
}
+#endif
}
--- src/src/scenegraph/shadowedrectanglematerial.h 2021-05-19 13:40:06.865745704 +0100
+++ src.mod/src/scenegraph/shadowedrectanglematerial.h 2021-05-19 13:33:30.284974868 +0100
@@ -9,6 +9,7 @@
#include <QSGMaterial>
#include <QSGMaterialShader>
#include <QColor>
+#include <QVector2D>
/**
* A material rendering a rectangle with a shadow.
--- src/src/scenegraph/shadowedborderrectanglematerial.cpp 2020-06-07 19:29:04.000000000 +0100
+++ src.mod/src/scenegraph/shadowedborderrectanglematerial.cpp 2021-05-19 13:47:43.418072767 +0100
@@ -6,7 +6,9 @@
#include "shadowedborderrectanglematerial.h"
+#ifndef __ANDROID__
#include <QOpenGLContext>
+#endif
QSGMaterialType ShadowedBorderRectangleMaterial::staticType;
@@ -42,6 +44,7 @@
ShadowedBorderRectangleShader::ShadowedBorderRectangleShader()
{
+#ifndef __ANDROID__
auto header = QOpenGLContext::currentContext()->isOpenGLES() ? QStringLiteral("header_es.glsl") : QStringLiteral("header_desktop.glsl");
auto shaderRoot = QStringLiteral(":/org/kde/kirigami/shaders/");
@@ -51,19 +54,23 @@
shaderRoot + QStringLiteral("sdf.glsl"),
shaderRoot + QStringLiteral("shadowedborderrectangle.frag")
});
+#endif
}
void ShadowedBorderRectangleShader::initialize()
{
ShadowedRectangleShader::initialize();
+#ifndef __ANDROID__
m_borderWidthLocation = program()->uniformLocation("borderWidth");
m_borderColorLocation = program()->uniformLocation("borderColor");
+#endif
}
void ShadowedBorderRectangleShader::updateState(const QSGMaterialShader::RenderState& state, QSGMaterial* newMaterial, QSGMaterial* oldMaterial)
{
ShadowedRectangleShader::updateState(state, newMaterial, oldMaterial);
+#ifndef __ANDROID__
auto p = program();
if (!oldMaterial || newMaterial->compare(oldMaterial) != 0 || state.isCachedMaterialDataDirty()) {
@@ -71,4 +78,5 @@
p->setUniformValue(m_borderWidthLocation, material->borderWidth);
p->setUniformValue(m_borderColorLocation, material->borderColor);
}
+#endif
}
--- src/src/scenegraph/shadowedtexturematerial.cpp 2020-06-07 19:29:04.000000000 +0100
+++ src.mod/src/scenegraph/shadowedtexturematerial.cpp 2021-05-19 13:50:42.636813685 +0100
@@ -6,7 +6,9 @@
#include "shadowedtexturematerial.h"
+#ifndef __ANDROID__
#include <QOpenGLContext>
+#endif
QSGMaterialType ShadowedTextureMaterial::staticType;
@@ -44,6 +46,7 @@
ShadowedTextureShader::ShadowedTextureShader()
{
+#ifndef __ANDROID__
auto header = QOpenGLContext::currentContext()->isOpenGLES() ? QStringLiteral("header_es.glsl") : QStringLiteral("header_desktop.glsl");
auto shaderRoot = QStringLiteral(":/org/kde/kirigami/shaders/");
@@ -58,12 +61,15 @@
shaderRoot + QStringLiteral("sdf.glsl"),
shaderRoot + QStringLiteral("shadowedtexture.frag")
});
+#endif
}
void ShadowedTextureShader::initialize()
{
ShadowedRectangleShader::initialize();
+#ifndef __ANDROID__
program()->setUniformValue("textureSource", 0);
+#endif
}
void ShadowedTextureShader::updateState(const QSGMaterialShader::RenderState& state, QSGMaterial* newMaterial, QSGMaterial* oldMaterial)
--- src/src/scenegraph/shadowedbordertexturematerial.cpp 2020-06-07 19:29:04.000000000 +0100
+++ src.mod/src/scenegraph/shadowedbordertexturematerial.cpp 2021-05-19 13:52:35.692051057 +0100
@@ -6,7 +6,9 @@
#include "shadowedbordertexturematerial.h"
+#ifndef __ANDROID__
#include <QOpenGLContext>
+#endif
QSGMaterialType ShadowedBorderTextureMaterial::staticType;
@@ -44,6 +46,7 @@
ShadowedBorderTextureShader::ShadowedBorderTextureShader()
{
+#ifndef __ANDROID__
auto header = QOpenGLContext::currentContext()->isOpenGLES() ? QStringLiteral("header_es.glsl") : QStringLiteral("header_desktop.glsl");
auto shaderRoot = QStringLiteral(":/org/kde/kirigami/shaders/");
@@ -58,12 +61,15 @@
shaderRoot + QStringLiteral("sdf.glsl"),
shaderRoot + QStringLiteral("shadowedbordertexture.frag")
});
+#endif
}
void ShadowedBorderTextureShader::initialize()
{
ShadowedBorderRectangleShader::initialize();
+#ifndef __ANDROID__
program()->setUniformValue("textureSource", 0);
+#endif
}
void ShadowedBorderTextureShader::updateState(const QSGMaterialShader::RenderState& state, QSGMaterial* newMaterial, QSGMaterial* oldMaterial)