10#include <boost/optional.hpp>
14#include <QOpenGLContext>
15#include <QOpenGLDebugLogger>
16#include <QOpenGLFunctions>
18#include <QApplication>
20#include <QPixmapCache>
25#include <QStandardPaths>
28#include <QRegularExpression>
32#include <klocalizedstring.h>
44#include <config-hdr.h>
45#include <config-use-surface-color-management-api.h>
48# define GL_RENDERER 0x1F01
51#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
54#if !defined APIENTRYP && defined GL_APIENTRYP
55#define APIENTRYP GL_APIENTRYP
58typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
60typedef void (QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
66 qRegisterMetaType<KisOpenGL::XcbGLProviderProtocol>(
"KisOpenGL::XcbGLProviderProtocol");
67#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
68 QMetaType::registerEqualsComparator<KisOpenGL::XcbGLProviderProtocol>();
75 bool g_isDebugSynchronous =
false;
77 bool g_sanityDefaultFormatIsSet =
false;
79 boost::optional<KisOpenGLModeProber::Result> openGLCheckResult;
81 bool g_needsFenceWorkaround =
false;
83 QString g_surfaceFormatDetectionLog;
84 QString g_debugText(
"OpenGL Info\n **OpenGL not initialized**");
88 using DetectedRenderer = std::tuple<QString, QString, bool>;
90 KisOpenGL::OpenGLRenderers g_supportedRenderers;
93 bool g_useBufferInvalidation =
false;
94 PFNGLINVALIDATEBUFFERDATAPROC g_glInvalidateBufferData =
nullptr;
96 bool g_forceDisableTextureBuffers =
false;
99 g_supportedRenderers = supportedRenderers;
100 g_rendererPreferredByQt = preferredByQt;
103 void appendOpenGLWarningString(KLocalizedString warning)
105 g_openglWarningStrings << warning;
110 g_openglWarningStrings = warnings;
113 void openglOnMessageLogged(
const QOpenGLDebugMessage& debugMessage) {
114 qDebug() <<
"OpenGL:" << debugMessage;
124 if (rendererString.contains(
"basic render driver") ||
125 rendererString.contains(
"software")) {
139 if (openGLCheckResult)
return;
144 config.
format = QSurfaceFormat::defaultFormat();
151 if (!qEnvironmentVariableIsSet(
"KRITA_UNLOCK_TEXTURE_BUFFERS") &&
152 openGLCheckResult->rendererString().toUpper().contains(
"ANGLE")) {
168 g_forceDisableTextureBuffers =
true;
169 appendOpenGLWarningString(
170 ki18n(
"Texture buffers are explicitly disabled on ANGLE renderer due "
171 "to performance issues."));
177 QDebug debugOut(&g_debugText);
178 debugOut <<
"OpenGL Info\n";
180 if (openGLCheckResult) {
181 debugOut <<
"\n Qt Platform Name: " << QGuiApplication::platformName();
182 if (openGLCheckResult->xcbGlProviderProtocol()) {
183 debugOut <<
"\n Qt XCB GL integration plugin: "
184 << (*openGLCheckResult->xcbGlProviderProtocol() ==
KisOpenGL::XCB_EGL ?
"xcb_egl" :
"xcb_glx");
186 debugOut <<
"\n Vendor: " << openGLCheckResult->vendorString();
187 debugOut <<
"\n Renderer: " << openGLCheckResult->rendererString();
188 debugOut <<
"\n Driver version: " << openGLCheckResult->driverVersionString();
189 debugOut <<
"\n Shading language: " << openGLCheckResult->shadingLanguageString();
190 debugOut <<
"\n Requested format: " << QSurfaceFormat::defaultFormat();
191 debugOut <<
"\n Current format: " << openGLCheckResult->format();
193 QDebugStateSaver saver(debugOut);
194 debugOut.nospace() <<
"\n GL version: " << openGLCheckResult->glMajorVersion() <<
"."
195 << openGLCheckResult->glMinorVersion();
197 debugOut <<
"\n Supports deprecated functions" << openGLCheckResult->supportsDeprecatedFunctions();
198 debugOut <<
"\n Is OpenGL ES:" << openGLCheckResult->isOpenGLES();
199 debugOut <<
"\n supportsBufferMapping:" << openGLCheckResult->supportsBufferMapping();
200 debugOut <<
"\n supportsBufferInvalidation:" << openGLCheckResult->supportsBufferInvalidation();
201 debugOut <<
"\n forceDisableTextureBuffers:" << g_forceDisableTextureBuffers;
202 debugOut <<
"\n Extensions:";
204 QDebugStateSaver saver(debugOut);
205 Q_FOREACH (
const QByteArray &i, openGLCheckResult->extensions()) {
206 debugOut.noquote() <<
"\n " << QString::fromLatin1(i);
211 debugOut <<
"\n\nQPA OpenGL Detection Info";
212 debugOut <<
"\n supportsDesktopGL:" << bool(g_supportedRenderers &
RendererDesktopGL);
214 debugOut <<
"\n supportsAngleD3D11:" << bool(g_supportedRenderers &
RendererOpenGLES);
215 debugOut <<
"\n isQtPreferAngle:" << bool(g_rendererPreferredByQt ==
RendererOpenGLES);
217 debugOut <<
"\n supportsOpenGLES:" << bool(g_supportedRenderers &
RendererOpenGLES);
218 debugOut <<
"\n isQtPreferOpenGLES:" << bool(g_rendererPreferredByQt ==
RendererOpenGLES);
220 debugOut <<
"\n Detected renderers:";
222 QDebugStateSaver saver(debugOut);
223 Q_FOREACH (
const DetectedRenderer &x, g_detectedRenderers) {
224 debugOut.noquote().nospace() <<
"\n " << (std::get<2>(x) ?
"(Supported)" :
"(Unsupported)") <<
" "
225 << std::get<0>(x) <<
" (" << std::get<1>(x) <<
") ";
235 dbgOpenGL.noquote().nospace() << g_debugText;
238 if (!openGLCheckResult) {
244 bool isOnX11 =
false;
251 g_useBufferInvalidation = cfg.
readEntry(
"useBufferInvalidation",
false);
255 g_needsFenceWorkaround =
true;
271 const qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio();
272 const QSize screenSize = QGuiApplication::primaryScreen()->size() * devicePixelRatio;
273 const int minCacheSize = 20 * 1024;
276 const int cacheSize = 2048 + 5 * 4 * screenSize.width() * screenSize.height() / 1024;
278 QPixmapCache::setCacheLimit(qMax(minCacheSize, cacheSize));
287 const bool isDebugEnabled = ctx->format().testOption(QSurfaceFormat::DebugContext);
289 dbgUI <<
"OpenGL: Opening new context";
290 if (isDebugEnabled) {
294 QOpenGLDebugLogger* openglLogger =
new QOpenGLDebugLogger(ctx);
295 if (openglLogger->initialize()) {
296 qDebug() <<
"QOpenGLDebugLogger is initialized. Check whether you get a message below.";
297 QObject::connect(openglLogger, &QOpenGLDebugLogger::messageLogged, &openglOnMessageLogged);
298 openglLogger->startLogging(g_isDebugSynchronous ? QOpenGLDebugLogger::SynchronousLogging : QOpenGLDebugLogger::AsynchronousLogging);
299 openglLogger->logMessage(QOpenGLDebugMessage::createApplicationMessage(QStringLiteral(
"QOpenGLDebugLogger is logging.")));
301 qDebug() <<
"QOpenGLDebugLogger cannot be initialized.";
307 QSurfaceFormat format = ctx->format();
308 QOpenGLFunctions *f = ctx->functions();
309 f->initializeOpenGLFunctions();
311 if (openGLCheckResult->supportsBufferInvalidation()) {
312 QOpenGLContext *ctx = QOpenGLContext::currentContext();
313 g_glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)ctx->getProcAddress(
"glInvalidateBufferData");
316 QFile log(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
"/krita-opengl.txt");
317 if (log.open(QFile::WriteOnly)) {
318 QString vendor((
const char*)f->glGetString(GL_VENDOR));
319 log.write(vendor.toLatin1());
321 log.write(openGLCheckResult->rendererString().toLatin1());
323 QString version((
const char*)f->glGetString(GL_VERSION));
324 log.write(version.toLatin1());
327 qWarning() <<
"Could not open" << log.fileName() <<
"for writing:" << log.errorString();
339 Q_FOREACH (
const KLocalizedString &item, g_openglWarningStrings) {
340 strings << item.toString();
348 if (openGLCheckResult) {
349 return openGLCheckResult->driverVersionString();
359 return openGLCheckResult && openGLCheckResult->supportsLoD();
365 return openGLCheckResult && openGLCheckResult->hasOpenGL3();
371 return openGLCheckResult && openGLCheckResult->supportsVAO();
377 return openGLCheckResult && openGLCheckResult->isOpenGLES();
383 return openGLCheckResult && openGLCheckResult->supportsFenceSync();
389 return openGLCheckResult && openGLCheckResult->supportsBufferMapping();
395 return g_forceDisableTextureBuffers;
401 return !g_forceDisableTextureBuffers && userPreference;
407 return g_useBufferInvalidation &&
408 openGLCheckResult && openGLCheckResult->supportsBufferInvalidation();
414 return openGLCheckResult && openGLCheckResult->supportsFBO();
420 return openGLCheckResult ? openGLCheckResult->xcbGlProviderProtocol() : std::nullopt;
426 return g_needsFenceWorkaround;
436 g_isDebugSynchronous =
value;
441 g_glInvalidateBufferData(buffer);
447 return getRendererFromProbeResult(*openGLCheckResult);
452 return g_rendererPreferredByQt;
457 return g_supportedRenderers;
462 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
463 QSettings kritarc(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
469 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
470 QSettings kritarc(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
478 return QStringLiteral(
"none");
480 return QStringLiteral(
"software");
482 return QStringLiteral(
"desktop");
484 return QStringLiteral(
"angle");
486 return QStringLiteral(
"auto");
492 if (renderer ==
"desktop") {
494 }
else if (renderer ==
"angle") {
496 }
else if (renderer ==
"software") {
498 }
else if (renderer ==
"none") {
509 if (
format.renderableType() == QSurfaceFormat::OpenGLES &&
514 }
else if (
format.renderableType() == QSurfaceFormat::OpenGLES) {
518 }
else if (
format.renderableType() == QSurfaceFormat::OpenGL) {
520 }
else if (
format.renderableType() == QSurfaceFormat::DefaultRenderableType &&
532typedef std::pair<QSurfaceFormat::RenderableType, KisOpenGL::AngleRenderer> RendererInfo;
536 RendererInfo info = {QSurfaceFormat::DefaultRenderableType,
559QOpenGLContext::OpenGLModuleType determineOpenGLImplementation(
const RendererInfo &info)
561 switch (info.first) {
562 case QSurfaceFormat::OpenGLES:
563#if defined(Q_OS_WINDOWS)
565 switch (info.second) {
569 return QOpenGLContext::LibGLES;
574 return QOpenGLContext::LibGL;
578 return QOpenGLContext::LibGLES;
580 case QSurfaceFormat::DefaultRenderableType:
583 return QOpenGLContext::LibGL;
586#if defined(QT_OPENGL_ES_2)
587 return QOpenGLContext::LibGLES;
589 return QOpenGLContext::LibGL;
592 case QSurfaceFormat::OpenGL:
597 return QOpenGLContext::LibGL;
602 std::pair<KisSurfaceColorSpaceWrapper, int> rootSurfaceFormat,
604 bool inhibitCompatibilityProfile)
606 RendererInfo info = getRendererInfo(renderer);
612 dbgOpenGL <<
"Requesting configuration for" << info.first << info.second;
613 dbgOpenGL <<
"Requesting root surface format" << rootSurfaceFormat;
615 QSurfaceFormat &format = config.
format;
616 const auto openGLModuleType = determineOpenGLImplementation(info);
617 switch (openGLModuleType) {
618 case QOpenGLContext::LibGL:
619#if defined Q_OS_MACOS
620 format.setVersion(4, 1);
621 format.setProfile(QSurfaceFormat::CoreProfile);
622 Q_UNUSED(inhibitCompatibilityProfile);
628 format.setVersion(3, 3);
632 if (!inhibitCompatibilityProfile) {
633 format.setProfile(QSurfaceFormat::CompatibilityProfile);
639 format.setOptions(QSurfaceFormat::DeprecatedFunctions);
643 case QOpenGLContext::LibGLES:
644 format.setVersion(3, 0);
645 format.setProfile(QSurfaceFormat::NoProfile);
649 dbgOpenGL <<
"Version selected:" << openGLModuleType << format.version();
651 format.setDepthBufferSize(24);
652 format.setStencilBufferSize(8);
656 format.setRenderableType(info.first);
657 format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
658 format.setSwapInterval(0);
662 format.setSwapInterval(1);
665 format.setOption(QSurfaceFormat::DebugContext,
true);
671bool isOpenGLRendererBlacklisted(
const QString &rendererString,
672 const QString &driverVersionString,
675 bool isBlacklisted =
false;
677 Q_UNUSED(rendererString);
678 Q_UNUSED(driverVersionString);
679 Q_UNUSED(warningMessage);
686 if (rendererString.startsWith(
"Intel")) {
687 KLocalizedString knownBadIntelWarning = ki18n(
"The Intel graphics driver in use is known to have issues with OpenGL.");
688 KLocalizedString grossIntelWarning = ki18n(
689 "Intel graphics drivers tend to have issues with OpenGL so ANGLE will be used by default. "
690 "You may manually switch to OpenGL but it is not guaranteed to work properly."
692 QRegularExpression regex(
"\\b\\d{1,2}\\.\\d{1,2}\\.(\\d{1,3})\\.(\\d{4})\\b");
693 QRegularExpressionMatch match = regex.match(driverVersionString);
694 if (match.hasMatch()) {
695 const int thirdPart = match.captured(1).toInt();
696 const int fourthPart = match.captured(2).toInt();
698 if (thirdPart >= 100) {
699 driverBuild = thirdPart * 10000 + fourthPart;
701 driverBuild = fourthPart;
703 qDebug() <<
"Detected Intel driver build number as" << driverBuild;
704 if (driverBuild > 4636 && driverBuild < 4729) {
709 qDebug() <<
"Detected Intel driver build between 4636 and 4729, making ANGLE the preferred renderer";
710 isBlacklisted =
true;
711 *warningMessage << knownBadIntelWarning;
712 }
else if (driverBuild == 4358) {
715 qDebug() <<
"Detected Intel driver build 4358, making ANGLE the preferred renderer";
716 isBlacklisted =
true;
717 *warningMessage << knownBadIntelWarning;
722 qDebug() <<
"Detected Intel driver with unknown version format, making ANGLE the preferred renderer";
723 isBlacklisted =
true;
724 *warningMessage << grossIntelWarning;
728 return isBlacklisted;
731boost::optional<bool> orderPreference(
bool lhs,
bool rhs)
733 if (lhs == rhs)
return boost::none;
734 if (lhs && !rhs)
return true;
735 if (!lhs && rhs)
return false;
739#define ORDER_BY(lhs, rhs) if (auto res = orderPreference((lhs), (rhs))) { return *res; }
741class FormatPositionLess
756 isPreferredColorSpace(rhs.
format));
766 rhs.
rendererId() == m_preferredRendererByUser);
775 rhs.
rendererId() == m_preferredRendererByHDR);
785 rhs.
format.redBufferSize() == m_userPreferredBitDepth);
793 m_preferredColorSpace = preferredColorSpace;
797 m_preferredRendererByQt = preferredRendererByQt;
801 m_preferredRendererByUser = preferredRendererByUser;
805 m_preferredRendererByHDR = preferredRendererByHDR;
808 void setOpenGLBlacklisted(
bool openGLBlacklisted) {
809 m_openGLBlacklisted = openGLBlacklisted;
812 void setOpenGLESBlacklisted(
bool openGLESBlacklisted) {
813 m_openGLESBlacklisted = openGLESBlacklisted;
816 void setUserPreferredBitDepth(
int value) {
817 m_userPreferredBitDepth =
value;
820 bool isOpenGLBlacklisted()
const {
821 return m_openGLBlacklisted;
824 bool isOpenGLESBlacklisted()
const {
825 return m_openGLESBlacklisted;
829 return m_preferredColorSpace;
833 return m_preferredRendererByUser;
836 int userPreferredBitDepth()
const {
837 return m_userPreferredBitDepth;
841 bool isHDRFormat(
const QSurfaceFormat &f)
const {
867 bool doPreferHDR()
const {
876 bool isPreferredColorSpace(
const QSurfaceFormat & surfaceFormat)
const {
878 m_preferredColorSpace,
887 bool m_openGLBlacklisted =
false;
888 bool m_openGLESBlacklisted =
false;
889 int m_userPreferredBitDepth = 8;
892struct DetectionDebug :
public QDebug
894 DetectionDebug(QString *
string)
897 m_originalSize(string->
size())
899 ~DetectionDebug() {
dbgOpenGL << m_string->right(m_string->size() - m_originalSize); *
this << Qt::endl; }
906#define dbgDetection() DetectionDebug(&g_surfaceFormatDetectionLog)
915 using Info = boost::optional<KisOpenGLModeProber::Result>;
917 QHash<OpenGLRenderer, Info> renderersToTest;
927 auto makeDefaultSurfaceFormatPair = [] () -> std::pair<KisSurfaceColorSpaceWrapper, int> {
932 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
939#elif KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
940 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
946 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
952 bool shouldInhibitCompatibilityProfile =
false;
954 makeDefaultSurfaceFormatPair(),
956 shouldInhibitCompatibilityProfile);
969 dbgOpenGL <<
"Failed to probe default Qt's openGL format.. Trying DesktopGL with compatibility enabled...";
970 shouldInhibitCompatibilityProfile =
false;
972 makeDefaultSurfaceFormatPair(),
974 shouldInhibitCompatibilityProfile);
979 dbgOpenGL <<
"Failed again.. Trying DesktopGL with compatibility disabled...";
980 shouldInhibitCompatibilityProfile =
true;
982 makeDefaultSurfaceFormatPair(),
984 shouldInhibitCompatibilityProfile);
989 dbgOpenGL <<
"Failed again.. Trying OpenGLES...";
990 shouldInhibitCompatibilityProfile =
false;
992 makeDefaultSurfaceFormatPair(),
1004 makeDefaultSurfaceFormatPair(),
1006 shouldInhibitCompatibilityProfile);
1016 dbgOpenGL <<
"Failed to probe default openGL format! No openGL support will be available in Krita";
1020 const OpenGLRenderer defaultRenderer = getRendererFromProbeResult(*info);
1033 FormatPositionLess compareOp;
1034 compareOp.setPreferredRendererByQt(preferredAutoRenderer);
1037 compareOp.setPreferredColorSpace(
1042 Q_UNUSED(preferredRootSurfaceFormat);
1049 compareOp.setPreferredRendererByUser(preferredRenderer);
1050 compareOp.setOpenGLESBlacklisted(
false);
1052#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
1056 Q_UNUSED(preferredCanvasSurfaceBitMode)
1059 renderersToTest[defaultRenderer] = info;
1061 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1062 Info info = it.value();
1065 const RendererConfig config = generateSurfaceConfig(it.key(), makeDefaultSurfaceFormatPair(),
false, shouldInhibitCompatibilityProfile);
1071 dbgOpenGL <<
"Already probed:" << it.key();
1074 compareOp.setOpenGLBlacklisted(
1076 isOpenGLRendererBlacklisted(info->rendererString(),
1077 info->driverVersionString(),
1081 dbgOpenGL <<
"Result:" << info->rendererString() << info->driverVersionString()
1082 << info->isSupportedVersion();
1086 g_detectedRenderers << std::make_tuple(info->rendererString(),
1087 info->driverVersionString(),
1088 info->isSupportedVersion());
1091 if (info && info->isSupportedVersion()) {
1092 supportedRenderers |= it.key();
1100 compareOp.isOpenGLBlacklisted()) {
1106 compareOp.isOpenGLESBlacklisted()) {
1112 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1114 if (!it.value())
continue;
1116 Q_FOREACH (
const auto &formatPair, formatSymbolPairs) {
1117 preferredConfigs << generateSurfaceConfig(it.key(), formatPair, enableDebug, shouldInhibitCompatibilityProfile);
1121 std::stable_sort(preferredConfigs.begin(), preferredConfigs.end(), compareOp);
1123 dbgDetection() <<
"Supported renderers:" << supportedRenderers;
1138 if (info && info->isSupportedVersion()) {
1145 if (info->isUsingAngle() &&
1146 info->rendererString().contains(
"Direct3D9", Qt::CaseInsensitive)) {
1148 dbgDetection() <<
"Skipping Direct3D 9 Angle implementation, it shouldn't have happened.";
1157 resultConfig = config;
1163 const bool colorSpaceIsCorrect =
1167 const bool rendererIsCorrect =
1169 compareOp.preferredRendererByUser() == resultConfig.
rendererId();
1171 if (!rendererIsCorrect && colorSpaceIsCorrect) {
1172 warningMessages << ki18n(
"Preferred renderer doesn't support requested surface format. Another renderer has been selected.");
1173 }
else if (!colorSpaceIsCorrect) {
1174 warningMessages << ki18n(
"Preferred output format is not supported by available renderers");
1179 resultConfig.
format = QSurfaceFormat();
1183 overrideSupportedRenderers(supportedRenderers, preferredByQt);
1184 overrideOpenGLWarningString(warningMessages);
1186 return resultConfig;
1193 g_sanityDefaultFormatIsSet =
true;
1194 QSurfaceFormat::setDefaultFormat(config.
format);
1196 if (config.
format.renderableType() == QSurfaceFormat::OpenGLES) {
1197 QCoreApplication::setAttribute(Qt::AA_UseOpenGLES,
true);
1199 if (!qEnvironmentVariableIsSet(
"QT_ANGLE_PLATFORM")) {
1205 }
else if (config.
format.renderableType() == QSurfaceFormat::OpenGL) {
1206 QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL,
true);
1212 return openGLCheckResult->isSupportedVersion();
float value(const T *src, size_t ch)
@ ASSISTANTS_DRAW_MODE_LARGE_PIXMAP_CACHE
bool forceOpenGLFenceWorkaround(bool defaultValue=false) const
T readEntry(const QString &name, const T &defaultValue=T())
CanvasSurfaceBitDepthMode
AssistantsDrawMode assistantsDrawMode(bool defaultValue=false) const
QString rendererString() const
static KisOpenGLModeProber * instance()
boost::optional< Result > probeFormat(const KisOpenGL::RendererConfig &rendererConfig, bool adjustGlobalState=true)
static void initSurfaceFormatFromConfig(std::pair< KisSurfaceColorSpaceWrapper, int > rootSurfaceFormat, QSurfaceFormat *format)
static QString angleRendererToString(KisOpenGL::AngleRenderer renderer)
static bool fuzzyCompareColorSpaces(const KisSurfaceColorSpaceWrapper &lhs, const KisSurfaceColorSpaceWrapper &rhs)
static bool useFBOForToolOutlineRendering()
supportsRenderToFBO
static OpenGLRenderer getCurrentOpenGLRenderer()
static bool hasOpenGLES()
static RendererConfig selectSurfaceConfig(KisOpenGL::OpenGLRenderer preferredRenderer, KisConfig::RootSurfaceFormat preferredRootSurfaceFormat, KisConfig::CanvasSurfaceBitDepthMode preferredCanvasSurfaceBitMode, bool enableDebug)
static bool shouldUseTextureBuffers(bool userPreference)
static bool needsFenceWorkaround()
static void testingInitializeDefaultSurfaceFormat()
static OpenGLRenderers getSupportedOpenGLRenderers()
static bool useTextureBufferInvalidation()
static QStringList getOpenGLWarnings()
static void initialize()
Request OpenGL version 3.2.
static void glInvalidateBufferData(uint buffer)
static bool hasOpenGL()
Check for OpenGL.
static bool supportsLoD()
static QString currentDriver()
static void initializeContext(QOpenGLContext *ctx)
Initialize shared OpenGL context.
static OpenGLRenderer getUserPreferredOpenGLRendererConfig()
static OpenGLRenderer getQtPreferredOpenGLRenderer()
static OpenGLRenderer convertConfigToOpenGLRenderer(QString renderer)
static bool supportsFenceSync()
supportsFilter
static bool supportsBufferMapping()
static bool forceDisableTextureBuffers()
static void setDebugSynchronous(bool value)
static QString convertOpenGLRendererToConfig(OpenGLRenderer renderer)
static void setDefaultSurfaceConfig(const RendererConfig &config)
static bool supportsVAO()
static const QString & getDebugText()
static std::optional< XcbGLProviderProtocol > xcbGlProviderProtocol()
static void setUserPreferredOpenGLRendererConfig(OpenGLRenderer renderer)
static constexpr KisSurfaceColorSpaceWrapper makeSCRGBColorSpace()
static KisSurfaceColorSpaceWrapper fromQtColorSpace(const QColorSpace &colorSpace)
static constexpr KisSurfaceColorSpaceWrapper makeBt2020PQColorSpace()
static void writeSysInfo(const QString &message)
Writes to the system information file and Krita log.
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
typedef void(QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC)(GLuint buffer)
KIS_DECLARE_STATIC_INITIALIZER
#define ORDER_BY(lhs, rhs)
int size(const Forest< T > &forest)
AngleRenderer angleRenderer
OpenGLRenderer rendererId() const