aboutsummaryrefslogtreecommitdiffstats
path: root/community/krita/pure-opengles-compat.patch
blob: 202489fe28cec16b10de6ab90a6c15c8727d0861 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
diff -urN krita-4.2.9.orig/libs/ui/opengl/kis_opengl_canvas2.cpp krita-4.2.9/libs/ui/opengl/kis_opengl_canvas2.cpp
--- krita-4.2.9.orig/libs/ui/opengl/kis_opengl_canvas2.cpp	2020-05-22 02:19:15.233324983 -0600
+++ krita-4.2.9/libs/ui/opengl/kis_opengl_canvas2.cpp	2020-05-22 02:20:49.730356628 -0600
@@ -46,10 +46,6 @@
 #include "KisOpenGLModeProber.h"
 #include <KoColorModelStandardIds.h>
 
-#ifndef Q_OS_MACOS
-#include <QOpenGLFunctions_2_1>
-#endif
-
 #define NEAR_VAL -1000.0
 #define FAR_VAL 1000.0
 
@@ -104,10 +100,6 @@
     QVector3D vertices[6];
     QVector2D texCoords[6];
 
-#ifndef Q_OS_MACOS
-    QOpenGLFunctions_2_1 *glFn201;
-#endif
-
     qreal pixelGridDrawingThreshold;
     bool pixelGridEnabled;
     QColor gridColor;
@@ -271,16 +263,6 @@
 {
     KisOpenGL::initializeContext(context());
     initializeOpenGLFunctions();
-#ifndef Q_OS_MACOS
-    if (!KisOpenGL::hasOpenGLES()) {
-        d->glFn201 = context()->versionFunctions<QOpenGLFunctions_2_1>();
-        if (!d->glFn201) {
-            warnUI << "Cannot obtain QOpenGLFunctions_2_1, glLogicOp cannot be used";
-        }
-    } else {
-        d->glFn201 = nullptr;
-    }
-#endif
 
     KisConfig cfg(true);
     d->openGLImageTextures->setProofingConfig(canvas()->proofingConfiguration());
@@ -442,21 +424,8 @@
     modelMatrix = projectionMatrix * modelMatrix;
     d->solidColorShader->setUniformValue(d->solidColorShader->location(Uniform::ModelViewProjection), modelMatrix);
 
-    if (!KisOpenGL::hasOpenGLES()) {
-        glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
-
-        glEnable(GL_COLOR_LOGIC_OP);
-#ifndef Q_OS_MACOS
-        if (d->glFn201) {
-            d->glFn201->glLogicOp(GL_XOR);
-        }
-#else
-        glLogicOp(GL_XOR);
-#endif
-    } else {
-        glEnable(GL_BLEND);
-        glBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ZERO, GL_ONE, GL_ONE);
-    }
+    glEnable(GL_BLEND);
+    glBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ZERO, GL_ONE, GL_ONE);
 
     d->solidColorShader->setUniformValue(
                 d->solidColorShader->location(Uniform::FragmentColor),
@@ -497,11 +466,7 @@
         d->outlineVAO.release();
     }
 
-    if (!KisOpenGL::hasOpenGLES()) {
-        glDisable(GL_COLOR_LOGIC_OP);
-    } else {
-        glDisable(GL_BLEND);
-    }
+    glDisable(GL_BLEND);
 
     d->solidColorShader->release();
 }
diff -urN krita-4.2.9.orig/libs/ui/opengl/kis_opengl_image_textures.cpp krita-4.2.9/libs/ui/opengl/kis_opengl_image_textures.cpp
--- krita-4.2.9.orig/libs/ui/opengl/kis_opengl_image_textures.cpp	2020-05-22 02:19:15.233324983 -0600
+++ krita-4.2.9/libs/ui/opengl/kis_opengl_image_textures.cpp	2020-05-22 02:36:06.923918655 -0600
@@ -473,36 +473,16 @@
 namespace {
 void initializeRGBA16FTextures(QOpenGLContext *ctx, KisGLTexturesInfo &texturesInfo, KoID &destinationColorDepthId)
 {
-    if (KisOpenGL::hasOpenGLES() || KisOpenGL::hasOpenGL3()) {
-        texturesInfo.internalFormat = GL_RGBA16F;
-        dbgUI << "Using half (GLES or GL3)";
-    } else if (ctx->hasExtension("GL_ARB_texture_float")) {
-        texturesInfo.internalFormat = GL_RGBA16F_ARB;
-        dbgUI << "Using ARB half";
-    }
-    else if (ctx->hasExtension("GL_ATI_texture_float")) {
-        texturesInfo.internalFormat = GL_RGBA_FLOAT16_ATI;
-        dbgUI << "Using ATI half";
-    }
+    texturesInfo.internalFormat = GL_RGBA16F;
+    dbgUI << "Using half (GLES or GL3)";
 
     bool haveBuiltInOpenExr = false;
 #ifdef HAVE_OPENEXR
     haveBuiltInOpenExr = true;
 #endif
 
-    if (haveBuiltInOpenExr && (KisOpenGL::hasOpenGLES() || KisOpenGL::hasOpenGL3())) {
-        texturesInfo.type = GL_HALF_FLOAT;
-        destinationColorDepthId = Float16BitsColorDepthID;
-        dbgUI << "Pixel type half (GLES or GL3)";
-    } else if (haveBuiltInOpenExr && ctx->hasExtension("GL_ARB_half_float_pixel")) {
-        texturesInfo.type = GL_HALF_FLOAT_ARB;
-        destinationColorDepthId = Float16BitsColorDepthID;
-        dbgUI << "Pixel type half";
-    } else {
-        texturesInfo.type = GL_FLOAT;
-        destinationColorDepthId = Float32BitsColorDepthID;
-        dbgUI << "Pixel type float";
-    }
+    texturesInfo.type = GL_HALF_FLOAT;
+    destinationColorDepthId = Float16BitsColorDepthID;
     texturesInfo.format = GL_RGBA;
 }
 }
@@ -543,16 +523,8 @@
             initializeRGBA16FTextures(ctx, m_texturesInfo, destinationColorDepthId);
         }
         else if (colorDepthId == Float32BitsColorDepthID) {
-            if (KisOpenGL::hasOpenGLES() || KisOpenGL::hasOpenGL3()) {
-                m_texturesInfo.internalFormat = GL_RGBA32F;
-                dbgUI << "Using float (GLES or GL3)";
-            } else if (ctx->hasExtension("GL_ARB_texture_float")) {
-                m_texturesInfo.internalFormat = GL_RGBA32F_ARB;
-                dbgUI << "Using ARB float";
-            } else if (ctx->hasExtension("GL_ATI_texture_float")) {
-                m_texturesInfo.internalFormat = GL_RGBA_FLOAT32_ATI;
-                dbgUI << "Using ATI float";
-            }
+            m_texturesInfo.internalFormat = GL_RGBA32F;
+            dbgUI << "Using float (GLES or GL3)";
 
             m_texturesInfo.type = GL_FLOAT;
             m_texturesInfo.format = GL_RGBA;