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 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());
336 Q_FOREACH (
const KLocalizedString &item, g_openglWarningStrings) {
337 strings << item.toString();
345 if (openGLCheckResult) {
346 return openGLCheckResult->driverVersionString();
356 return openGLCheckResult && openGLCheckResult->supportsLoD();
362 return openGLCheckResult && openGLCheckResult->hasOpenGL3();
368 return openGLCheckResult && openGLCheckResult->supportsVAO();
374 return openGLCheckResult && openGLCheckResult->isOpenGLES();
380 return openGLCheckResult && openGLCheckResult->supportsFenceSync();
386 return openGLCheckResult && openGLCheckResult->supportsBufferMapping();
392 return g_forceDisableTextureBuffers;
398 return !g_forceDisableTextureBuffers && userPreference;
404 return g_useBufferInvalidation &&
405 openGLCheckResult && openGLCheckResult->supportsBufferInvalidation();
411 return openGLCheckResult && openGLCheckResult->supportsFBO();
417 return openGLCheckResult ? openGLCheckResult->xcbGlProviderProtocol() : std::nullopt;
423 return g_needsFenceWorkaround;
433 g_isDebugSynchronous =
value;
438 g_glInvalidateBufferData(buffer);
444 return getRendererFromProbeResult(*openGLCheckResult);
449 return g_rendererPreferredByQt;
454 return g_supportedRenderers;
459 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
460 QSettings kritarc(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
466 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
467 QSettings kritarc(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
475 return QStringLiteral(
"none");
477 return QStringLiteral(
"software");
479 return QStringLiteral(
"desktop");
481 return QStringLiteral(
"angle");
483 return QStringLiteral(
"auto");
489 if (renderer ==
"desktop") {
491 }
else if (renderer ==
"angle") {
493 }
else if (renderer ==
"software") {
495 }
else if (renderer ==
"none") {
506 if (
format.renderableType() == QSurfaceFormat::OpenGLES &&
511 }
else if (
format.renderableType() == QSurfaceFormat::OpenGLES) {
515 }
else if (
format.renderableType() == QSurfaceFormat::OpenGL) {
517 }
else if (
format.renderableType() == QSurfaceFormat::DefaultRenderableType &&
529typedef std::pair<QSurfaceFormat::RenderableType, KisOpenGL::AngleRenderer> RendererInfo;
533 RendererInfo info = {QSurfaceFormat::DefaultRenderableType,
556QOpenGLContext::OpenGLModuleType determineOpenGLImplementation(
const RendererInfo &info)
558 switch (info.first) {
559 case QSurfaceFormat::OpenGLES:
560#if defined(Q_OS_WINDOWS)
562 switch (info.second) {
566 return QOpenGLContext::LibGLES;
571 return QOpenGLContext::LibGL;
575 return QOpenGLContext::LibGLES;
577 case QSurfaceFormat::DefaultRenderableType:
580 return QOpenGLContext::LibGL;
583#if defined(QT_OPENGL_ES_2)
584 return QOpenGLContext::LibGLES;
586 return QOpenGLContext::LibGL;
589 case QSurfaceFormat::OpenGL:
594 return QOpenGLContext::LibGL;
599 std::pair<KisSurfaceColorSpaceWrapper, int> rootSurfaceFormat,
601 bool inhibitCompatibilityProfile)
603 RendererInfo info = getRendererInfo(renderer);
609 dbgOpenGL <<
"Requesting configuration for" << info.first << info.second;
610 dbgOpenGL <<
"Requesting root surface format" << rootSurfaceFormat;
612 QSurfaceFormat &format = config.
format;
613 const auto openGLModuleType = determineOpenGLImplementation(info);
614 switch (openGLModuleType) {
615 case QOpenGLContext::LibGL:
616#if defined Q_OS_MACOS
617 format.setVersion(4, 1);
618 format.setProfile(QSurfaceFormat::CoreProfile);
624 format.setVersion(3, 3);
628 if (!inhibitCompatibilityProfile) {
629 format.setProfile(QSurfaceFormat::CompatibilityProfile);
635 format.setOptions(QSurfaceFormat::DeprecatedFunctions);
639 case QOpenGLContext::LibGLES:
640 format.setVersion(3, 0);
641 format.setProfile(QSurfaceFormat::NoProfile);
645 dbgOpenGL <<
"Version selected:" << openGLModuleType << format.version();
647 format.setDepthBufferSize(24);
648 format.setStencilBufferSize(8);
652 format.setRenderableType(info.first);
653 format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
654 format.setSwapInterval(0);
658 format.setSwapInterval(1);
661 format.setOption(QSurfaceFormat::DebugContext,
true);
667bool isOpenGLRendererBlacklisted(
const QString &rendererString,
668 const QString &driverVersionString,
671 bool isBlacklisted =
false;
673 Q_UNUSED(rendererString);
674 Q_UNUSED(driverVersionString);
675 Q_UNUSED(warningMessage);
682 if (rendererString.startsWith(
"Intel")) {
683 KLocalizedString knownBadIntelWarning = ki18n(
"The Intel graphics driver in use is known to have issues with OpenGL.");
684 KLocalizedString grossIntelWarning = ki18n(
685 "Intel graphics drivers tend to have issues with OpenGL so ANGLE will be used by default. "
686 "You may manually switch to OpenGL but it is not guaranteed to work properly."
688 QRegularExpression regex(
"\\b\\d{1,2}\\.\\d{1,2}\\.(\\d{1,3})\\.(\\d{4})\\b");
689 QRegularExpressionMatch match = regex.match(driverVersionString);
690 if (match.hasMatch()) {
691 const int thirdPart = match.captured(1).toInt();
692 const int fourthPart = match.captured(2).toInt();
694 if (thirdPart >= 100) {
695 driverBuild = thirdPart * 10000 + fourthPart;
697 driverBuild = fourthPart;
699 qDebug() <<
"Detected Intel driver build number as" << driverBuild;
700 if (driverBuild > 4636 && driverBuild < 4729) {
705 qDebug() <<
"Detected Intel driver build between 4636 and 4729, making ANGLE the preferred renderer";
706 isBlacklisted =
true;
707 *warningMessage << knownBadIntelWarning;
708 }
else if (driverBuild == 4358) {
711 qDebug() <<
"Detected Intel driver build 4358, making ANGLE the preferred renderer";
712 isBlacklisted =
true;
713 *warningMessage << knownBadIntelWarning;
718 qDebug() <<
"Detected Intel driver with unknown version format, making ANGLE the preferred renderer";
719 isBlacklisted =
true;
720 *warningMessage << grossIntelWarning;
724 return isBlacklisted;
727boost::optional<bool> orderPreference(
bool lhs,
bool rhs)
729 if (lhs == rhs)
return boost::none;
730 if (lhs && !rhs)
return true;
731 if (!lhs && rhs)
return false;
735#define ORDER_BY(lhs, rhs) if (auto res = orderPreference((lhs), (rhs))) { return *res; }
737class FormatPositionLess
752 isPreferredColorSpace(rhs.
format));
762 rhs.
rendererId() == m_preferredRendererByUser);
771 rhs.
rendererId() == m_preferredRendererByHDR);
781 rhs.
format.redBufferSize() == m_userPreferredBitDepth);
789 m_preferredColorSpace = preferredColorSpace;
793 m_preferredRendererByQt = preferredRendererByQt;
797 m_preferredRendererByUser = preferredRendererByUser;
801 m_preferredRendererByHDR = preferredRendererByHDR;
804 void setOpenGLBlacklisted(
bool openGLBlacklisted) {
805 m_openGLBlacklisted = openGLBlacklisted;
808 void setOpenGLESBlacklisted(
bool openGLESBlacklisted) {
809 m_openGLESBlacklisted = openGLESBlacklisted;
812 void setUserPreferredBitDepth(
int value) {
813 m_userPreferredBitDepth =
value;
816 bool isOpenGLBlacklisted()
const {
817 return m_openGLBlacklisted;
820 bool isOpenGLESBlacklisted()
const {
821 return m_openGLESBlacklisted;
825 return m_preferredColorSpace;
829 return m_preferredRendererByUser;
832 int userPreferredBitDepth()
const {
833 return m_userPreferredBitDepth;
837 bool isHDRFormat(
const QSurfaceFormat &f)
const {
863 bool doPreferHDR()
const {
872 bool isPreferredColorSpace(
const QSurfaceFormat & surfaceFormat)
const {
874 m_preferredColorSpace,
883 bool m_openGLBlacklisted =
false;
884 bool m_openGLESBlacklisted =
false;
885 int m_userPreferredBitDepth = 8;
888struct DetectionDebug :
public QDebug
890 DetectionDebug(QString *
string)
893 m_originalSize(string->
size())
895 ~DetectionDebug() {
dbgOpenGL << m_string->right(m_string->size() - m_originalSize); *
this << Qt::endl; }
902#define dbgDetection() DetectionDebug(&g_surfaceFormatDetectionLog)
911 using Info = boost::optional<KisOpenGLModeProber::Result>;
913 QHash<OpenGLRenderer, Info> renderersToTest;
923 auto makeDefaultSurfaceFormatPair = [] () -> std::pair<KisSurfaceColorSpaceWrapper, int> {
928 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
935#elif KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
936 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
942 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
948 bool shouldInhibitCompatibilityProfile =
false;
950 makeDefaultSurfaceFormatPair(),
952 shouldInhibitCompatibilityProfile);
965 dbgOpenGL <<
"Failed to probe default Qt's openGL format.. Trying DesktopGL with compatibility enabled...";
966 shouldInhibitCompatibilityProfile =
false;
968 makeDefaultSurfaceFormatPair(),
970 shouldInhibitCompatibilityProfile);
975 dbgOpenGL <<
"Failed again.. Trying DesktopGL with compatibility disabled...";
976 shouldInhibitCompatibilityProfile =
true;
978 makeDefaultSurfaceFormatPair(),
980 shouldInhibitCompatibilityProfile);
985 dbgOpenGL <<
"Failed again.. Trying OpenGLES...";
986 shouldInhibitCompatibilityProfile =
false;
988 makeDefaultSurfaceFormatPair(),
1000 makeDefaultSurfaceFormatPair(),
1002 shouldInhibitCompatibilityProfile);
1012 dbgOpenGL <<
"Failed to probe default openGL format! No openGL support will be available in Krita";
1016 const OpenGLRenderer defaultRenderer = getRendererFromProbeResult(*info);
1029 FormatPositionLess compareOp;
1030 compareOp.setPreferredRendererByQt(preferredAutoRenderer);
1033 compareOp.setPreferredColorSpace(
1038 Q_UNUSED(preferredRootSurfaceFormat);
1045 compareOp.setPreferredRendererByUser(preferredRenderer);
1046 compareOp.setOpenGLESBlacklisted(
false);
1048#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
1052 Q_UNUSED(preferredCanvasSurfaceBitMode)
1055 renderersToTest[defaultRenderer] = info;
1057 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1058 Info info = it.value();
1061 const RendererConfig config = generateSurfaceConfig(it.key(), makeDefaultSurfaceFormatPair(),
false, shouldInhibitCompatibilityProfile);
1067 dbgOpenGL <<
"Already probed:" << it.key();
1070 compareOp.setOpenGLBlacklisted(
1072 isOpenGLRendererBlacklisted(info->rendererString(),
1073 info->driverVersionString(),
1077 dbgOpenGL <<
"Result:" << info->rendererString() << info->driverVersionString()
1078 << info->isSupportedVersion();
1082 g_detectedRenderers << std::make_tuple(info->rendererString(),
1083 info->driverVersionString(),
1084 info->isSupportedVersion());
1087 if (info && info->isSupportedVersion()) {
1088 supportedRenderers |= it.key();
1096 compareOp.isOpenGLBlacklisted()) {
1102 compareOp.isOpenGLESBlacklisted()) {
1108 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1110 if (!it.value())
continue;
1112 Q_FOREACH (
const auto &formatPair, formatSymbolPairs) {
1113 preferredConfigs << generateSurfaceConfig(it.key(), formatPair, enableDebug, shouldInhibitCompatibilityProfile);
1117 std::stable_sort(preferredConfigs.begin(), preferredConfigs.end(), compareOp);
1119 dbgDetection() <<
"Supported renderers:" << supportedRenderers;
1134 if (info && info->isSupportedVersion()) {
1141 if (info->isUsingAngle() &&
1142 info->rendererString().contains(
"Direct3D9", Qt::CaseInsensitive)) {
1144 dbgDetection() <<
"Skipping Direct3D 9 Angle implementation, it shouldn't have happened.";
1153 resultConfig = config;
1159 const bool colorSpaceIsCorrect =
1163 const bool rendererIsCorrect =
1165 compareOp.preferredRendererByUser() == resultConfig.
rendererId();
1167 if (!rendererIsCorrect && colorSpaceIsCorrect) {
1168 warningMessages << ki18n(
"Preferred renderer doesn't support requested surface format. Another renderer has been selected.");
1169 }
else if (!colorSpaceIsCorrect) {
1170 warningMessages << ki18n(
"Preferred output format is not supported by available renderers");
1175 resultConfig.
format = QSurfaceFormat();
1179 overrideSupportedRenderers(supportedRenderers, preferredByQt);
1180 overrideOpenGLWarningString(warningMessages);
1182 return resultConfig;
1189 g_sanityDefaultFormatIsSet =
true;
1190 QSurfaceFormat::setDefaultFormat(config.
format);
1192 if (config.
format.renderableType() == QSurfaceFormat::OpenGLES) {
1193 QCoreApplication::setAttribute(Qt::AA_UseOpenGLES,
true);
1195 if (!qEnvironmentVariableIsSet(
"QT_ANGLE_PLATFORM")) {
1201 }
else if (config.
format.renderableType() == QSurfaceFormat::OpenGL) {
1202 QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL,
true);
1208 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