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>
34#include <klocalizedstring.h>
46#include <config-hdr.h>
47#include <config-use-surface-color-management-api.h>
50# define GL_RENDERER 0x1F01
53#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
56#if !defined APIENTRYP && defined GL_APIENTRYP
57#define APIENTRYP GL_APIENTRYP
60typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
62typedef void (QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
68 qRegisterMetaType<KisOpenGL::XcbGLProviderProtocol>(
"KisOpenGL::XcbGLProviderProtocol");
69#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
70 QMetaType::registerEqualsComparator<KisOpenGL::XcbGLProviderProtocol>();
77 bool g_isDebugSynchronous =
false;
79 bool g_sanityDefaultFormatIsSet =
false;
81 boost::optional<KisOpenGLModeProber::Result> openGLCheckResult;
83 bool g_needsFenceWorkaround =
false;
85 QString g_surfaceFormatDetectionLog;
86 QString g_debugText(
"OpenGL Info\n **OpenGL not initialized**");
90 using DetectedRenderer = std::tuple<QString, QString, bool>;
92 KisOpenGL::OpenGLRenderers g_supportedRenderers;
95 bool g_useBufferInvalidation =
false;
96 PFNGLINVALIDATEBUFFERDATAPROC g_glInvalidateBufferData =
nullptr;
98 bool g_forceDisableTextureBuffers =
false;
100 void overrideSupportedRenderers(KisOpenGL::OpenGLRenderers supportedRenderers,
KisOpenGL::OpenGLRenderer preferredByQt) {
101 g_supportedRenderers = supportedRenderers;
102 g_rendererPreferredByQt = preferredByQt;
105 void appendOpenGLWarningString(KLocalizedString warning)
107 g_openglWarningStrings << warning;
112 g_openglWarningStrings = warnings;
115 void openglOnMessageLogged(
const QOpenGLDebugMessage& debugMessage) {
116 qDebug() <<
"OpenGL:" << debugMessage;
126 if (rendererString.contains(
"basic render driver") ||
127 rendererString.contains(
"software")) {
141 if (openGLCheckResult)
return;
146 config.
format = QSurfaceFormat::defaultFormat();
153 if (!qEnvironmentVariableIsSet(
"KRITA_UNLOCK_TEXTURE_BUFFERS") &&
154 openGLCheckResult->rendererString().toUpper().contains(
"ANGLE")) {
170 g_forceDisableTextureBuffers =
true;
171 appendOpenGLWarningString(
172 ki18n(
"Texture buffers are explicitly disabled on ANGLE renderer due "
173 "to performance issues."));
179 QDebug debugOut(&g_debugText);
180 debugOut <<
"OpenGL Info\n";
182 if (openGLCheckResult) {
183 debugOut <<
"\n Qt Platform Name: " << QGuiApplication::platformName();
184 if (openGLCheckResult->xcbGlProviderProtocol()) {
185 debugOut <<
"\n Qt XCB GL integration plugin: "
186 << (*openGLCheckResult->xcbGlProviderProtocol() ==
KisOpenGL::XCB_EGL ?
"xcb_egl" :
"xcb_glx");
188 debugOut <<
"\n Vendor: " << openGLCheckResult->vendorString();
189 debugOut <<
"\n Renderer: " << openGLCheckResult->rendererString();
190 debugOut <<
"\n Driver version: " << openGLCheckResult->driverVersionString();
191 debugOut <<
"\n Shading language: " << openGLCheckResult->shadingLanguageString();
192 debugOut <<
"\n Requested format: " << QSurfaceFormat::defaultFormat();
193 debugOut <<
"\n Current format: " << openGLCheckResult->format();
195 QDebugStateSaver saver(debugOut);
196 debugOut.nospace() <<
"\n GL version: " << openGLCheckResult->glMajorVersion() <<
"."
197 << openGLCheckResult->glMinorVersion();
199 debugOut <<
"\n Supports deprecated functions" << openGLCheckResult->supportsDeprecatedFunctions();
200 debugOut <<
"\n Is OpenGL ES:" << openGLCheckResult->isOpenGLES();
201 debugOut <<
"\n supportsBufferMapping:" << openGLCheckResult->supportsBufferMapping();
202 debugOut <<
"\n supportsBufferInvalidation:" << openGLCheckResult->supportsBufferInvalidation();
203 debugOut <<
"\n forceDisableTextureBuffers:" << g_forceDisableTextureBuffers;
204 debugOut <<
"\n Extensions:";
206 QDebugStateSaver saver(debugOut);
207 Q_FOREACH (
const QByteArray &i, openGLCheckResult->extensions()) {
208 debugOut.noquote() <<
"\n " << QString::fromLatin1(i);
213 debugOut <<
"\n\nQPA OpenGL Detection Info";
214 debugOut <<
"\n supportsDesktopGL:" << bool(g_supportedRenderers &
RendererDesktopGL);
216 debugOut <<
"\n supportsAngleD3D11:" << bool(g_supportedRenderers &
RendererOpenGLES);
217 debugOut <<
"\n isQtPreferAngle:" << bool(g_rendererPreferredByQt ==
RendererOpenGLES);
219 debugOut <<
"\n supportsOpenGLES:" << bool(g_supportedRenderers &
RendererOpenGLES);
220 debugOut <<
"\n isQtPreferOpenGLES:" << bool(g_rendererPreferredByQt ==
RendererOpenGLES);
222 debugOut <<
"\n Detected renderers:";
224 QDebugStateSaver saver(debugOut);
225 Q_FOREACH (
const DetectedRenderer &x, g_detectedRenderers) {
226 debugOut.noquote().nospace() <<
"\n " << (std::get<2>(x) ?
"(Supported)" :
"(Unsupported)") <<
" "
227 << std::get<0>(x) <<
" (" << std::get<1>(x) <<
") ";
237 dbgOpenGL.noquote().nospace() << g_debugText;
240 if (!openGLCheckResult) {
246 bool isOnX11 =
false;
253 g_useBufferInvalidation = cfg.
readEntry(
"useBufferInvalidation",
false);
257 g_needsFenceWorkaround =
true;
273 const qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio();
274 const QSize screenSize = QGuiApplication::primaryScreen()->size() * devicePixelRatio;
275 const int minCacheSize = 20 * 1024;
278 const int cacheSize = 2048 + 5 * 4 * screenSize.width() * screenSize.height() / 1024;
280 QPixmapCache::setCacheLimit(qMax(minCacheSize, cacheSize));
289 const bool isDebugEnabled = ctx->format().testOption(QSurfaceFormat::DebugContext);
291 dbgUI <<
"OpenGL: Opening new context";
292 if (isDebugEnabled) {
296 QOpenGLDebugLogger* openglLogger =
new QOpenGLDebugLogger(ctx);
297 if (openglLogger->initialize()) {
298 qDebug() <<
"QOpenGLDebugLogger is initialized. Check whether you get a message below.";
299 QObject::connect(openglLogger, &QOpenGLDebugLogger::messageLogged, &openglOnMessageLogged);
300 openglLogger->startLogging(g_isDebugSynchronous ? QOpenGLDebugLogger::SynchronousLogging : QOpenGLDebugLogger::AsynchronousLogging);
301 openglLogger->logMessage(QOpenGLDebugMessage::createApplicationMessage(QStringLiteral(
"QOpenGLDebugLogger is logging.")));
303 qDebug() <<
"QOpenGLDebugLogger cannot be initialized.";
309 QSurfaceFormat format = ctx->format();
310 QOpenGLFunctions *f = ctx->functions();
311 f->initializeOpenGLFunctions();
313 if (openGLCheckResult->supportsBufferInvalidation()) {
314 QOpenGLContext *ctx = QOpenGLContext::currentContext();
315 g_glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)ctx->getProcAddress(
"glInvalidateBufferData");
318 QFile log(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
"/krita-opengl.txt");
319 if (log.open(QFile::WriteOnly)) {
320 QString vendor((
const char*)f->glGetString(GL_VENDOR));
321 log.write(vendor.toLatin1());
323 log.write(openGLCheckResult->rendererString().toLatin1());
325 QString version((
const char*)f->glGetString(GL_VERSION));
326 log.write(version.toLatin1());
329 qWarning() <<
"Could not open" << log.fileName() <<
"for writing:" << log.errorString();
341 Q_FOREACH (
const KLocalizedString &item, g_openglWarningStrings) {
342 strings << item.toString();
350 if (openGLCheckResult) {
351 return openGLCheckResult->driverVersionString();
361 return openGLCheckResult && openGLCheckResult->supportsLoD();
367 return openGLCheckResult && openGLCheckResult->hasOpenGL3();
373 return openGLCheckResult && openGLCheckResult->supportsVAO();
379 return openGLCheckResult && openGLCheckResult->isOpenGLES();
385 return openGLCheckResult && openGLCheckResult->supportsFenceSync();
391 return openGLCheckResult && openGLCheckResult->supportsBufferMapping();
397 return g_forceDisableTextureBuffers;
403 return !g_forceDisableTextureBuffers && userPreference;
409 return g_useBufferInvalidation &&
410 openGLCheckResult && openGLCheckResult->supportsBufferInvalidation();
416 return openGLCheckResult && openGLCheckResult->supportsFBO();
422 return openGLCheckResult ? openGLCheckResult->xcbGlProviderProtocol() : std::nullopt;
428 return g_needsFenceWorkaround;
438 g_isDebugSynchronous =
value;
443 g_glInvalidateBufferData(buffer);
449 return getRendererFromProbeResult(*openGLCheckResult);
454 return g_rendererPreferredByQt;
459 return g_supportedRenderers;
464 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
465 QSettings kritarc(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
471 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
472 QSettings kritarc(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
480 return QStringLiteral(
"none");
482 return QStringLiteral(
"software");
484 return QStringLiteral(
"desktop");
486 return QStringLiteral(
"angle");
488 return QStringLiteral(
"auto");
494 if (renderer ==
"desktop") {
496 }
else if (renderer ==
"angle") {
498 }
else if (renderer ==
"software") {
500 }
else if (renderer ==
"none") {
511 if (
format.renderableType() == QSurfaceFormat::OpenGLES &&
516 }
else if (
format.renderableType() == QSurfaceFormat::OpenGLES) {
520 }
else if (
format.renderableType() == QSurfaceFormat::OpenGL) {
522 }
else if (
format.renderableType() == QSurfaceFormat::DefaultRenderableType &&
534typedef std::pair<QSurfaceFormat::RenderableType, KisOpenGL::AngleRenderer> RendererInfo;
538 RendererInfo info = {QSurfaceFormat::DefaultRenderableType,
561QOpenGLContext::OpenGLModuleType determineOpenGLImplementation(
const RendererInfo &info)
563 switch (info.first) {
564 case QSurfaceFormat::OpenGLES:
565#if defined(Q_OS_WINDOWS)
567 switch (info.second) {
571 return QOpenGLContext::LibGLES;
576 return QOpenGLContext::LibGL;
580 return QOpenGLContext::LibGLES;
582 case QSurfaceFormat::DefaultRenderableType:
585 return QOpenGLContext::LibGL;
588#if defined(QT_OPENGL_ES_2)
589 return QOpenGLContext::LibGLES;
591 return QOpenGLContext::LibGL;
594 case QSurfaceFormat::OpenGL:
599 return QOpenGLContext::LibGL;
604 std::pair<KisSurfaceColorSpaceWrapper, int> rootSurfaceFormat,
606 bool inhibitCompatibilityProfile)
608 RendererInfo info = getRendererInfo(renderer);
614 dbgOpenGL <<
"Requesting configuration for" << info.first << info.second;
615 dbgOpenGL <<
"Requesting root surface format" << rootSurfaceFormat;
617 QSurfaceFormat &format = config.
format;
618 const auto openGLModuleType = determineOpenGLImplementation(info);
619 switch (openGLModuleType) {
620 case QOpenGLContext::LibGL:
621#if defined Q_OS_MACOS
622 format.setVersion(4, 1);
623 format.setProfile(QSurfaceFormat::CoreProfile);
624 Q_UNUSED(inhibitCompatibilityProfile);
630 format.setVersion(3, 3);
634 if (!inhibitCompatibilityProfile) {
635 format.setProfile(QSurfaceFormat::CompatibilityProfile);
641 format.setOptions(QSurfaceFormat::DeprecatedFunctions);
645 case QOpenGLContext::LibGLES:
646 format.setVersion(3, 0);
647 format.setProfile(QSurfaceFormat::NoProfile);
651 dbgOpenGL <<
"Version selected:" << openGLModuleType << format.version();
653 format.setDepthBufferSize(24);
654 format.setStencilBufferSize(8);
658 format.setRenderableType(info.first);
659 format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
660 format.setSwapInterval(0);
664 format.setSwapInterval(1);
667 format.setOption(QSurfaceFormat::DebugContext,
true);
673bool isOpenGLRendererBlacklisted(
const QString &rendererString,
674 const QString &driverVersionString,
677 bool isBlacklisted =
false;
679 Q_UNUSED(rendererString);
680 Q_UNUSED(driverVersionString);
681 Q_UNUSED(warningMessage);
688 if (rendererString.startsWith(
"Intel")) {
689 KLocalizedString knownBadIntelWarning = ki18n(
"The Intel graphics driver in use is known to have issues with OpenGL.");
690 KLocalizedString grossIntelWarning = ki18n(
691 "Intel graphics drivers tend to have issues with OpenGL so ANGLE will be used by default. "
692 "You may manually switch to OpenGL but it is not guaranteed to work properly."
694 QRegularExpression regex(
"\\b\\d{1,2}\\.\\d{1,2}\\.(\\d{1,3})\\.(\\d{4})\\b");
695 QRegularExpressionMatch match = regex.match(driverVersionString);
696 if (match.hasMatch()) {
697 const int thirdPart = match.captured(1).toInt();
698 const int fourthPart = match.captured(2).toInt();
700 if (thirdPart >= 100) {
701 driverBuild = thirdPart * 10000 + fourthPart;
703 driverBuild = fourthPart;
705 qDebug() <<
"Detected Intel driver build number as" << driverBuild;
706 if (driverBuild > 4636 && driverBuild < 4729) {
711 qDebug() <<
"Detected Intel driver build between 4636 and 4729, making ANGLE the preferred renderer";
712 isBlacklisted =
true;
713 *warningMessage << knownBadIntelWarning;
714 }
else if (driverBuild == 4358) {
717 qDebug() <<
"Detected Intel driver build 4358, making ANGLE the preferred renderer";
718 isBlacklisted =
true;
719 *warningMessage << knownBadIntelWarning;
724 qDebug() <<
"Detected Intel driver with unknown version format, making ANGLE the preferred renderer";
725 isBlacklisted =
true;
726 *warningMessage << grossIntelWarning;
730 return isBlacklisted;
733boost::optional<bool> orderPreference(
bool lhs,
bool rhs)
735 if (lhs == rhs)
return boost::none;
736 if (lhs && !rhs)
return true;
737 if (!lhs && rhs)
return false;
741#define ORDER_BY(lhs, rhs) if (auto res = orderPreference((lhs), (rhs))) { return *res; }
743class FormatPositionLess
758 isPreferredColorSpace(rhs.
format));
768 rhs.
rendererId() == m_preferredRendererByUser);
777 rhs.
rendererId() == m_preferredRendererByHDR);
787 rhs.
format.redBufferSize() == m_userPreferredBitDepth);
795 m_preferredColorSpace = preferredColorSpace;
799 m_preferredRendererByQt = preferredRendererByQt;
803 m_preferredRendererByUser = preferredRendererByUser;
807 m_preferredRendererByHDR = preferredRendererByHDR;
810 void setOpenGLBlacklisted(
bool openGLBlacklisted) {
811 m_openGLBlacklisted = openGLBlacklisted;
814 void setOpenGLESBlacklisted(
bool openGLESBlacklisted) {
815 m_openGLESBlacklisted = openGLESBlacklisted;
818 void setUserPreferredBitDepth(
int value) {
819 m_userPreferredBitDepth =
value;
822 bool isOpenGLBlacklisted()
const {
823 return m_openGLBlacklisted;
826 bool isOpenGLESBlacklisted()
const {
827 return m_openGLESBlacklisted;
831 return m_preferredColorSpace;
835 return m_preferredRendererByUser;
838 int userPreferredBitDepth()
const {
839 return m_userPreferredBitDepth;
843 bool isHDRFormat(
const QSurfaceFormat &f)
const {
869 bool doPreferHDR()
const {
878 bool isPreferredColorSpace(
const QSurfaceFormat & surfaceFormat)
const {
880 m_preferredColorSpace,
889 bool m_openGLBlacklisted =
false;
890 bool m_openGLESBlacklisted =
false;
891 int m_userPreferredBitDepth = 8;
894struct DetectionDebug :
public QDebug
896 DetectionDebug(QString *
string)
899 m_originalSize(string->
size())
901 ~DetectionDebug() {
dbgOpenGL << m_string->right(m_string->size() - m_originalSize); *
this << Qt::endl; }
908#define dbgDetection() DetectionDebug(&g_surfaceFormatDetectionLog)
917 using Info = boost::optional<KisOpenGLModeProber::Result>;
919 QHash<OpenGLRenderer, Info> renderersToTest;
929 auto makeDefaultSurfaceFormatPair = [] () -> std::pair<KisSurfaceColorSpaceWrapper, int> {
934 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
941#elif KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
942 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
948 std::vector<std::pair<KisSurfaceColorSpaceWrapper, int>> formatSymbolPairs(
954 bool shouldInhibitCompatibilityProfile =
false;
956 makeDefaultSurfaceFormatPair(),
958 shouldInhibitCompatibilityProfile);
971 dbgOpenGL <<
"Failed to probe default Qt's openGL format.. Trying DesktopGL with compatibility enabled...";
972 shouldInhibitCompatibilityProfile =
false;
974 makeDefaultSurfaceFormatPair(),
976 shouldInhibitCompatibilityProfile);
981 dbgOpenGL <<
"Failed again.. Trying DesktopGL with compatibility disabled...";
982 shouldInhibitCompatibilityProfile =
true;
984 makeDefaultSurfaceFormatPair(),
986 shouldInhibitCompatibilityProfile);
991 dbgOpenGL <<
"Failed again.. Trying OpenGLES...";
992 shouldInhibitCompatibilityProfile =
false;
994 makeDefaultSurfaceFormatPair(),
1006 makeDefaultSurfaceFormatPair(),
1008 shouldInhibitCompatibilityProfile);
1018 dbgOpenGL <<
"Failed to probe default openGL format! No openGL support will be available in Krita";
1022 const OpenGLRenderer defaultRenderer = getRendererFromProbeResult(*info);
1035 FormatPositionLess compareOp;
1036 compareOp.setPreferredRendererByQt(preferredAutoRenderer);
1039 compareOp.setPreferredColorSpace(
1044 Q_UNUSED(preferredRootSurfaceFormat);
1051 compareOp.setPreferredRendererByUser(preferredRenderer);
1052 compareOp.setOpenGLESBlacklisted(
false);
1054#if KRITA_USE_SURFACE_COLOR_MANAGEMENT_API
1058 Q_UNUSED(preferredCanvasSurfaceBitMode)
1061 renderersToTest[defaultRenderer] = info;
1063 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1064 Info info = it.value();
1067 const RendererConfig config = generateSurfaceConfig(it.key(), makeDefaultSurfaceFormatPair(),
false, shouldInhibitCompatibilityProfile);
1073 dbgOpenGL <<
"Already probed:" << it.key();
1076 compareOp.setOpenGLBlacklisted(
1078 isOpenGLRendererBlacklisted(info->rendererString(),
1079 info->driverVersionString(),
1083 dbgOpenGL <<
"Result:" << info->rendererString() << info->driverVersionString()
1084 << info->isSupportedVersion();
1088 g_detectedRenderers << std::make_tuple(info->rendererString(),
1089 info->driverVersionString(),
1090 info->isSupportedVersion());
1093 if (info && info->isSupportedVersion()) {
1094 supportedRenderers |= it.key();
1102 compareOp.isOpenGLBlacklisted()) {
1108 compareOp.isOpenGLESBlacklisted()) {
1114 for (
auto it = renderersToTest.begin(); it != renderersToTest.end(); ++it) {
1116 if (!it.value())
continue;
1118 Q_FOREACH (
const auto &formatPair, formatSymbolPairs) {
1119 preferredConfigs << generateSurfaceConfig(it.key(), formatPair, enableDebug, shouldInhibitCompatibilityProfile);
1123 std::stable_sort(preferredConfigs.begin(), preferredConfigs.end(), compareOp);
1125 dbgDetection() <<
"Supported renderers:" << supportedRenderers;
1140 if (info && info->isSupportedVersion()) {
1147 if (info->isUsingAngle() &&
1148 info->rendererString().contains(
"Direct3D9", Qt::CaseInsensitive)) {
1150 dbgDetection() <<
"Skipping Direct3D 9 Angle implementation, it shouldn't have happened.";
1159 resultConfig = config;
1165 const bool colorSpaceIsCorrect =
1169 const bool rendererIsCorrect =
1171 compareOp.preferredRendererByUser() == resultConfig.
rendererId();
1173 if (!rendererIsCorrect && colorSpaceIsCorrect) {
1174 warningMessages << ki18n(
"Preferred renderer doesn't support requested surface format. Another renderer has been selected.");
1175 }
else if (!colorSpaceIsCorrect) {
1176 warningMessages << ki18n(
"Preferred output format is not supported by available renderers");
1181 resultConfig.
format = QSurfaceFormat();
1185 overrideSupportedRenderers(supportedRenderers, preferredByQt);
1186 overrideOpenGLWarningString(warningMessages);
1188 return resultConfig;
1195 g_sanityDefaultFormatIsSet =
true;
1196 QSurfaceFormat::setDefaultFormat(config.
format);
1198 if (config.
format.renderableType() == QSurfaceFormat::OpenGLES) {
1199 QCoreApplication::setAttribute(Qt::AA_UseOpenGLES,
true);
1201 if (!qEnvironmentVariableIsSet(
"QT_ANGLE_PLATFORM")) {
1207 }
else if (config.
format.renderableType() == QSurfaceFormat::OpenGL) {
1208 QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL,
true);
1214 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