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);
619 Q_UNUSED(inhibitCompatibilityProfile);
625 format.setVersion(3, 3);
629 if (!inhibitCompatibilityProfile) {
630 format.setProfile(QSurfaceFormat::CompatibilityProfile);
636 format.setOptions(QSurfaceFormat::DeprecatedFunctions);
640 case QOpenGLContext::LibGLES:
641 format.setVersion(3, 0);
642 format.setProfile(QSurfaceFormat::NoProfile);
646 dbgOpenGL <<
"Version selected:" << openGLModuleType << format.version();
648 format.setDepthBufferSize(24);
649 format.setStencilBufferSize(8);
653 format.setRenderableType(info.first);
654 format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
655 format.setSwapInterval(0);
659 format.setSwapInterval(1);
662 format.setOption(QSurfaceFormat::DebugContext,
true);
668bool isOpenGLRendererBlacklisted(
const QString &rendererString,
669 const QString &driverVersionString,
672 bool isBlacklisted =
false;
674 Q_UNUSED(rendererString);
675 Q_UNUSED(driverVersionString);
676 Q_UNUSED(warningMessage);
683 if (rendererString.startsWith(
"Intel")) {
684 KLocalizedString knownBadIntelWarning = ki18n(
"The Intel graphics driver in use is known to have issues with OpenGL.");
685 KLocalizedString grossIntelWarning = ki18n(
686 "Intel graphics drivers tend to have issues with OpenGL so ANGLE will be used by default. "
687 "You may manually switch to OpenGL but it is not guaranteed to work properly."
689 QRegularExpression regex(
"\\b\\d{1,2}\\.\\d{1,2}\\.(\\d{1,3})\\.(\\d{4})\\b");
690 QRegularExpressionMatch match = regex.match(driverVersionString);
691 if (match.hasMatch()) {
692 const int thirdPart = match.captured(1).toInt();
693 const int fourthPart = match.captured(2).toInt();
695 if (thirdPart >= 100) {
696 driverBuild = thirdPart * 10000 + fourthPart;
698 driverBuild = fourthPart;
700 qDebug() <<
"Detected Intel driver build number as" << driverBuild;
701 if (driverBuild > 4636 && driverBuild < 4729) {
706 qDebug() <<
"Detected Intel driver build between 4636 and 4729, making ANGLE the preferred renderer";
707 isBlacklisted =
true;
708 *warningMessage << knownBadIntelWarning;
709 }
else if (driverBuild == 4358) {
712 qDebug() <<
"Detected Intel driver build 4358, making ANGLE the preferred renderer";
713 isBlacklisted =
true;
714 *warningMessage << knownBadIntelWarning;
719 qDebug() <<
"Detected Intel driver with unknown version format, making ANGLE the preferred renderer";
720 isBlacklisted =
true;
721 *warningMessage << grossIntelWarning;
725 return isBlacklisted;
728boost::optional<bool> orderPreference(
bool lhs,
bool rhs)
730 if (lhs == rhs)
return boost::none;
731 if (lhs && !rhs)
return true;
732 if (!lhs && rhs)
return false;
736#define ORDER_BY(lhs, rhs) if (auto res = orderPreference((lhs), (rhs))) { return *res; }
738class FormatPositionLess
753 isPreferredColorSpace(rhs.
format));
763 rhs.
rendererId() == m_preferredRendererByUser);
772 rhs.
rendererId() == m_preferredRendererByHDR);
782 rhs.
format.redBufferSize() == m_userPreferredBitDepth);
790 m_preferredColorSpace = preferredColorSpace;
794 m_preferredRendererByQt = preferredRendererByQt;
798 m_preferredRendererByUser = preferredRendererByUser;
802 m_preferredRendererByHDR = preferredRendererByHDR;
805 void setOpenGLBlacklisted(
bool openGLBlacklisted) {
806 m_openGLBlacklisted = openGLBlacklisted;
809 void setOpenGLESBlacklisted(
bool openGLESBlacklisted) {
810 m_openGLESBlacklisted = openGLESBlacklisted;
813 void setUserPreferredBitDepth(
int value) {
814 m_userPreferredBitDepth =
value;
817 bool isOpenGLBlacklisted()
const {
818 return m_openGLBlacklisted;
821 bool isOpenGLESBlacklisted()
const {
822 return m_openGLESBlacklisted;
826 return m_preferredColorSpace;
830 return m_preferredRendererByUser;
833 int userPreferredBitDepth()
const {
834 return m_userPreferredBitDepth;
838 bool isHDRFormat(
const QSurfaceFormat &f)
const {
864 bool doPreferHDR()
const {
873 bool isPreferredColorSpace(
const QSurfaceFormat & surfaceFormat)
const {
875 m_preferredColorSpace,
884 bool m_openGLBlacklisted =
false;
885 bool m_openGLESBlacklisted =
false;
886 int m_userPreferredBitDepth = 8;
889struct DetectionDebug :
public QDebug
891 DetectionDebug(QString *
string)
894 m_originalSize(string->
size())
896 ~DetectionDebug() {
dbgOpenGL << m_string->right(m_string->size() - m_originalSize); *
this << Qt::endl; }
903#define dbgDetection() DetectionDebug(&g_surfaceFormatDetectionLog)
912 using Info = boost::optional<KisOpenGLModeProber::Result>;
914 QHash<OpenGLRenderer, Info> renderersToTest;
924 auto makeDefaultSurfaceFormatPair = [] () -> std::pair<KisSurfaceColorSpaceWrapper, int> {
929 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
936#elif KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
937 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
943 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
949 bool shouldInhibitCompatibilityProfile =
false;
951 makeDefaultSurfaceFormatPair(),
953 shouldInhibitCompatibilityProfile);
966 dbgOpenGL <<
"Failed to probe default Qt's openGL format.. Trying DesktopGL with compatibility enabled...";
967 shouldInhibitCompatibilityProfile =
false;
969 makeDefaultSurfaceFormatPair(),
971 shouldInhibitCompatibilityProfile);
976 dbgOpenGL <<
"Failed again.. Trying DesktopGL with compatibility disabled...";
977 shouldInhibitCompatibilityProfile =
true;
979 makeDefaultSurfaceFormatPair(),
981 shouldInhibitCompatibilityProfile);
986 dbgOpenGL <<
"Failed again.. Trying OpenGLES...";
987 shouldInhibitCompatibilityProfile =
false;
989 makeDefaultSurfaceFormatPair(),
1001 makeDefaultSurfaceFormatPair(),
1003 shouldInhibitCompatibilityProfile);
1013 dbgOpenGL <<
"Failed to probe default openGL format! No openGL support will be available in Krita";
1017 const OpenGLRenderer defaultRenderer = getRendererFromProbeResult(*info);
1030 FormatPositionLess compareOp;
1031 compareOp.setPreferredRendererByQt(preferredAutoRenderer);
1034 compareOp.setPreferredColorSpace(
1039 Q_UNUSED(preferredRootSurfaceFormat);
1046 compareOp.setPreferredRendererByUser(preferredRenderer);
1047 compareOp.setOpenGLESBlacklisted(
false);
1049#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
1053 Q_UNUSED(preferredCanvasSurfaceBitMode)
1056 renderersToTest[defaultRenderer] = info;
1058 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1059 Info info = it.value();
1062 const RendererConfig config = generateSurfaceConfig(it.key(), makeDefaultSurfaceFormatPair(),
false, shouldInhibitCompatibilityProfile);
1068 dbgOpenGL <<
"Already probed:" << it.key();
1071 compareOp.setOpenGLBlacklisted(
1073 isOpenGLRendererBlacklisted(info->rendererString(),
1074 info->driverVersionString(),
1078 dbgOpenGL <<
"Result:" << info->rendererString() << info->driverVersionString()
1079 << info->isSupportedVersion();
1083 g_detectedRenderers << std::make_tuple(info->rendererString(),
1084 info->driverVersionString(),
1085 info->isSupportedVersion());
1088 if (info && info->isSupportedVersion()) {
1089 supportedRenderers |= it.key();
1097 compareOp.isOpenGLBlacklisted()) {
1103 compareOp.isOpenGLESBlacklisted()) {
1109 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1111 if (!it.value())
continue;
1113 Q_FOREACH (
const auto &formatPair, formatSymbolPairs) {
1114 preferredConfigs << generateSurfaceConfig(it.key(), formatPair, enableDebug, shouldInhibitCompatibilityProfile);
1118 std::stable_sort(preferredConfigs.begin(), preferredConfigs.end(), compareOp);
1120 dbgDetection() <<
"Supported renderers:" << supportedRenderers;
1135 if (info && info->isSupportedVersion()) {
1142 if (info->isUsingAngle() &&
1143 info->rendererString().contains(
"Direct3D9", Qt::CaseInsensitive)) {
1145 dbgDetection() <<
"Skipping Direct3D 9 Angle implementation, it shouldn't have happened.";
1154 resultConfig = config;
1160 const bool colorSpaceIsCorrect =
1164 const bool rendererIsCorrect =
1166 compareOp.preferredRendererByUser() == resultConfig.
rendererId();
1168 if (!rendererIsCorrect && colorSpaceIsCorrect) {
1169 warningMessages << ki18n(
"Preferred renderer doesn't support requested surface format. Another renderer has been selected.");
1170 }
else if (!colorSpaceIsCorrect) {
1171 warningMessages << ki18n(
"Preferred output format is not supported by available renderers");
1176 resultConfig.
format = QSurfaceFormat();
1180 overrideSupportedRenderers(supportedRenderers, preferredByQt);
1181 overrideOpenGLWarningString(warningMessages);
1183 return resultConfig;
1190 g_sanityDefaultFormatIsSet =
true;
1191 QSurfaceFormat::setDefaultFormat(config.
format);
1193 if (config.
format.renderableType() == QSurfaceFormat::OpenGLES) {
1194 QCoreApplication::setAttribute(Qt::AA_UseOpenGLES,
true);
1196 if (!qEnvironmentVariableIsSet(
"QT_ANGLE_PLATFORM")) {
1202 }
else if (config.
format.renderableType() == QSurfaceFormat::OpenGL) {
1203 QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL,
true);
1209 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