Commit 0b234404 authored by Alvin Wong's avatar Alvin Wong 🤔
Browse files

Merge branch 'alvin/T6696-opengl-angle'

This adds canvas rendering with Direct3D11 via ANGLE on Windows.

ANGLE is a library which translates OpenGL ES rendering functions to
other hardware rendering APIs, including Direct3D. It is supported by
the Windows build of Qt.

This aims to improve the compatibility of the OpenGL canvas with buggy
Windows Intel drivers by allowing the use of the Direct3D11 rendering
backend of ANGLE.

Krita can still be used with a Qt build without dynamic OpenGL support,
but it will only be able to use native desktop OpenGL. To enable ANGLE,
`ext_qt` will need to be rebuilt.

CCMAIL: kimageshop@kde.org
CCBUG: 360601
Maniphest Tasks: T5883, T6696, T6728
parents 91be0979 17e0d976
......@@ -53,6 +53,14 @@ set(GLOBAL_PROFILE ${GLOBAL_PROFILE} -DBUILD_TESTING=false)
if (MINGW)
option(QT_ENABLE_DEBUG_INFO "Build Qt with debug info included" OFF)
option(QT_ENABLE_DYNAMIC_OPENGL "Build Qt with dynamic ANGLE support '-opengl dynamic -angle' (needs env var 'WindowsSdkDir' set to path of Windows 10 SDK)" ON)
if (QT_ENABLE_DYNAMIC_OPENGL)
if (DEFINED ENV{WindowsSdkDir})
message(STATUS "WindowsSdkDir is set to '$ENV{WindowsSdkDir}'")
else (DEFINED ENV{WindowsSdkDir})
message(FATAL_ERROR "Environemnt variable 'WindowsSdkDir' not set! Please set it to path of Windows 10 SDK or disable QT_ENABLE_DYNAMIC_OPENGL")
endif (DEFINED ENV{WindowsSdkDir})
endif (QT_ENABLE_DYNAMIC_OPENGL)
endif (MINGW)
set(SECURITY_EXE_LINKER_FLAGS "")
......
......@@ -36,6 +36,8 @@ Note: on all operating systems the entire procedure is done in a terminal window
4. On Windows, you will also need Python 3.6.2 (technically any versions of 3.6 is fine, but it's not tested): https://www.python.org. Make sure to have that version of python.exe in your path. This version of Python will be used for two things: to configure Qt and to build the Python scripting module. Make sure the version you download is exactly python-3.6.2. Make sure that specific version of Python comes first in your path.
5. On Windows, if you want to compile Qt with ANGLE support, you will need to install Windows 10 SDK and have the environment variable `WindowsSdkDir` set to it (typically `C:\Program Files (x86)\Windows Kits\10`)
== Setup your environment ==
......@@ -90,6 +92,9 @@ Note that the cmake command needs to point to your BUILDROOT like /dev/d, not c:
`-DSUBMAKE_JOBS=<n>` to the cmake command where <n> is the number of jobs to
run (if your PC has 4 CPU cores, you might want to set it to 5).
- If you don't have Windows 10 SDK and don't want to build Qt with ANGLE, add
`-DQT_ENABLE_DYNAMIC_OPENGL=OFF` to the CMake command line args.
3. build the packages:
With a judicious application of DEPENDS statements, it's possible to build it all in one go, but in my experience that fails always, so it's better to build the dependencies independently.
......
......@@ -5,13 +5,13 @@ if (WIN32)
-skip qtlocation -skip qtsensors -skip qtserialport -skip qtwayland
-skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview
-skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools
-no-compile-examples -no-dbus -no-iconv -no-angle -no-qml-debug -no-ssl
-no-compile-examples -no-dbus -no-iconv -no-qml-debug -no-ssl
-no-openssl -no-libproxy -no-system-proxies -no-icu -no-mtdev
-skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtnetworkauth
-skip qtpurchasing -skip qtremoteobjects -skip qtscxml -skip qtserialbus
-skip qtspeech -skip qtvirtualkeyboard
#
-opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg
-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg
#
-opensource -confirm-license
#
......@@ -24,6 +24,11 @@ if (WIN32)
# Set the option to build Qt with debugging info enabled
list(APPEND _QT_conf -force-debug-info)
endif(QT_ENABLE_DEBUG_INFO)
if (QT_ENABLE_DYNAMIC_OPENGL)
list(APPEND _QT_conf -opengl dynamic -angle)
else (QT_ENABLE_DYNAMIC_OPENGL)
list(APPEND _QT_conf -opengl desktop -no-angle)
endif (QT_ENABLE_DYNAMIC_OPENGL)
ExternalProject_Add(
ext_qt
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
......@@ -34,6 +39,8 @@ if (WIN32)
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-Don-t-request-the-MIME-image-every-time-Windows-asks.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0002-Hack-always-return-we-support-DIBV5.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0003-Hack-for-fullscreen-workaround.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/qopengldebug-gles.patch
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/gerrit-189539-ANGLE-mingw-fix.patch
INSTALL_DIR ${EXTPREFIX_qt}
CONFIGURE_COMMAND <SOURCE_DIR>/configure.bat ${_QT_conf}
......
diff --git a/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp b/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
index 972c289412..cbb813b83f 100644
--- a/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
+++ b/qtbase/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
@@ -20,7 +20,7 @@ typedef struct D3D11_QUERY_DATA_SO_STATISTICS {
} D3D11_QUERY_DATA_SO_STATISTICS;
#endif // ANGLE_MINGW32_COMPAT
-#ifdef __MINGW32__
+#if defined __MINGW32__ && __GNUC__ < 6L
typedef struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT {
UINT64 Frequency;
BOOL Disjoint;
diff --git a/qtbase/src/angle/src/common/common.pri b/qtbase/src/angle/src/common/common.pri
index 7305362d86..c1f6e22a87 100644
--- a/qtbase/src/angle/src/common/common.pri
+++ b/qtbase/src/angle/src/common/common.pri
@@ -21,20 +21,6 @@ lib_replace.replace = \$\$\$\$[QT_INSTALL_LIBS]
lib_replace.CONFIG = path
QMAKE_PRL_INSTALL_REPLACE += lib_replace
-# DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK.
-winrt|msvc {
- FXC = fxc.exe
-} else {
- DX_DIR = $$(DXSDK_DIR)
- isEmpty(DX_DIR) {
- error("Cannot determine DirectX SDK location. Please set DXSDK_DIR environment variable.")
- }
-
- equals(QMAKE_TARGET.arch, x86_64) {
- FXC = \"$${DX_DIR}Utilities\\bin\\x64\\fxc.exe\"
- } else {
- FXC = \"$${DX_DIR}Utilities\\bin\\x86\\fxc.exe\"
- }
-}
+FXC = $$QMAKE_FXC_LOCATION
static: DEFINES *= LIBGLESV2_EXPORT_H_ ANGLE_EXPORT=
diff --git a/qtbase/src/gui/configure.json b/qtbase/src/gui/configure.json
index 2fb03a452a..a5f85e54ba 100644
--- a/qtbase/src/gui/configure.json
+++ b/qtbase/src/gui/configure.json
@@ -330,11 +330,14 @@
"label": "DirectX SDK",
"type": "directX",
"files": [
- "d3dcompiler.h",
- "d3d11.lib",
- "fxc.exe"
+ "d3dcompiler.h"
]
},
+ "fxc": {
+ "label": "DirectX Shader Compiler",
+ "type": "fxc",
+ "log": "value"
+ },
"egl-x11": {
"label": "EGL on X11",
"type": "compile",
@@ -440,10 +443,11 @@
"angle": {
"label": "ANGLE",
"autoDetect": "features.opengles2 || features.opengl-dynamic",
- "condition": "config.win32 && tests.directx",
+ "condition": "config.win32 && tests.directx && tests.fxc",
"output": [
"publicFeature",
- { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
+ { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" },
+ { "type": "varAssign", "name": "QMAKE_FXC_LOCATION", "value": "tests.fxc.value" }
]
},
"combined-angle-lib": {
diff --git a/qtbase/src/gui/configure.pri b/qtbase/src/gui/configure.pri
index aaffa835dc..c048129f55 100644
--- a/qtbase/src/gui/configure.pri
+++ b/qtbase/src/gui/configure.pri
@@ -15,22 +15,12 @@ defineTest(qtConfLibrary_freetype) {
return(true)
}
-# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
-# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
-# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
-# the Windows SDK. Checking for the header is not sufficient, since it
-# is also present in MinGW.
+# For MSVC everything DirectX related is included in Windows Kit >= 8,
+# so we do not do any magic in this case.
+# For MinGW we need the shader compiler (fxc.exe), which
+# are not part of MinGW. They can either be obtained from a DirectX SDK
+# (keep the old approach working) or Windows Kit (>= 8).
defineTest(qtConfTest_directX) {
- dxdir = $$getenv("DXSDK_DIR")
- !isEmpty(dxdir) {
- EXTRA_INCLUDEPATH += $$dxdir/include
- equals(QT_ARCH, x86_64): \
- EXTRA_LIBDIR += $$dxdir/lib/x64
- else: \
- EXTRA_LIBDIR += $$dxdir/lib/x86
- EXTRA_PATH += $$dxdir/Utilities/bin/x86
- }
-
$$qtConfEvaluate("features.sse2") {
ky = $$size($${1}.files._KEYS_)
$${1}.files._KEYS_ += $$ky
@@ -42,6 +32,50 @@ defineTest(qtConfTest_directX) {
return(false)
}
+defineTest(qtConfTest_fxc) {
+ !mingw {
+ fxc = $$qtConfFindInPath("fxc.exe")
+ } else {
+ dxdir = $$getenv("DXSDK_DIR")
+ winkitdir = $$getenv("WindowsSdkDir")
+ !isEmpty(dxdir) {
+ equals(QT_ARCH, x86_64): \
+ fxc = $$dxdir/Utilities/bin/x64/fxc.exe
+ else: \
+ fxc = $$dxdir/Utilities/bin/x86/fxc.exe
+ } else: !isEmpty(winkitdir) {
+ equals(QT_ARCH, x86_64): \
+ fxc = $$winkitdir/bin/x64/fxc.exe
+ else: \
+ fxc = $$winkitdir/bin/x86/fxc.exe
+
+ !exists($$fxc) {
+ binsubdirs = $$files($$winkitdir/bin/*)
+ for (dir, binsubdirs) {
+ equals(QT_ARCH, x86_64): \
+ finalBinDir = $$dir/x64
+ else: \
+ finalBinDir = $$dir/x86
+
+ fxc = $${finalBinDir}/fxc.exe
+ exists($$fxc) {
+ break()
+ }
+ }
+ }
+ }
+ }
+
+ !isEmpty(fxc):exists($$fxc) {
+ $${1}.value = $$fxc
+ export($${1}.value)
+ $${1}.cache += value
+ export($${1}.cache)
+ return(true)
+ }
+ return(false)
+}
+
defineTest(qtConfTest_xkbConfigRoot) {
qtConfTest_getPkgConfigVariable($${1}): return(true)
diff --git a/qtbase/src/gui/opengl/qopengldebug.cpp b/qtbase/src/gui/opengl/qopengldebug.cpp
index f6c3af37dd..70bf7530e1 100644
--- a/qtbase/src/gui/opengl/qopengldebug.cpp
+++ b/qtbase/src/gui/opengl/qopengldebug.cpp
@@ -1413,7 +1413,7 @@ bool QOpenGLDebugLogger::initialize()
#define GET_DEBUG_PROC_ADDRESS(procName) \
d->procName = reinterpret_cast< qt_ ## procName ## _t >( \
- d->context->getProcAddress(#procName) \
+ d->context->getProcAddress(d->context->isOpenGLES() ? (#procName "KHR") : (#procName)) \
);
GET_DEBUG_PROC_ADDRESS(glDebugMessageControl);
......@@ -34,6 +34,7 @@
#include <time.h>
#include <KisApplication.h>
#include <KisLoggingManager.h>
#include <KoConfig.h>
#include <KoResourcePaths.h>
......@@ -98,6 +99,7 @@ extern "C" int main(int argc, char **argv)
qputenv("QT_QPA_PLATFORM", "xcb");
#endif
KisLoggingManager::initialize();
// A per-user unique string, without /, because QLocalServer cannot use names with a / in it
QString key = "Krita3" + QDesktopServices::storageLocation(QDesktopServices::HomeLocation).replace("/", "_");
......@@ -132,8 +134,20 @@ extern "C" int main(int argc, char **argv)
if (enableOpenGLDebug && (qgetenv("KRITA_OPENGL_DEBUG") == "sync" || kritarc.value("OpenGLDebugSynchronous", false).toBool())) {
openGLDebugSynchronous = true;
}
KisOpenGL::setDefaultFormat(enableOpenGLDebug, openGLDebugSynchronous);
#ifdef Q_OS_WIN
QString preferredOpenGLRenderer = kritarc.value("OpenGLRenderer", "auto").toString();
// Force ANGLE to use Direct3D11. D3D9 doesn't support OpenGL ES 3 and WARP
// might get weird crashes atm.
qputenv("QT_ANGLE_PLATFORM", "d3d11");
// Probe QPA auto OpenGL detection
KisOpenGL::probeWindowsQpaOpenGL(argc, argv, preferredOpenGLRenderer);
#endif
}
KisOpenGL::setDefaultFormat(enableOpenGLDebug, openGLDebugSynchronous);
KLocalizedString::setApplicationDomain("krita");
......
......@@ -20,6 +20,7 @@ set(kritaglobal_LIB_SRCS
kis_signal_compressor_with_param.cpp
kis_acyclic_signal_connector.cpp
KisQPainterStateSaver.cpp
KisLoggingManager.cpp
)
add_library(kritaglobal SHARED ${kritaglobal_LIB_SRCS} )
......
/*
* Copyright (c) 2017 Alvin Wong <alvinhochun@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "KisLoggingManager.h"
#include <QSet>
#include <QLoggingCategory>
using ScopedLogCapturer = KisLoggingManager::ScopedLogCapturer;
namespace
{
QtMessageHandler oldMessageHandler;
QLoggingCategory::CategoryFilter oldCategoryFilter;
QSet<const ScopedLogCapturer *> capturerSet;
} // namespace
class KisLoggingManager::Private
{
friend class KisLoggingManager;
static void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
Q_FOREACH (const ScopedLogCapturer *const &capturer, capturerSet) {
if (capturer->m_category == context.category) {
capturer->m_callback(type, context, msg);
}
}
// TODO: Hide capture-only messages from default output
oldMessageHandler(type, context, msg);
}
static void myCategoryFilter(QLoggingCategory *category)
{
oldCategoryFilter(category);
// Enable categories to be captured
// TODO: Keep track of default filter stage to hide message from output
Q_FOREACH (const ScopedLogCapturer *const &capturer, capturerSet) {
if (capturer->m_category == category->categoryName()) {
category->setEnabled(QtDebugMsg, true);
category->setEnabled(QtInfoMsg, true);
category->setEnabled(QtWarningMsg, true);
category->setEnabled(QtCriticalMsg, true);
}
}
}
static void refreshCategoryFilter()
{
QLoggingCategory::installFilter(myCategoryFilter);
}
}; // class KisLoggingManager::Private
void KisLoggingManager::initialize()
{
// Install our QtMessageHandler for capturing logging messages
oldMessageHandler = qInstallMessageHandler(KisLoggingManager::Private::myMessageHandler);
// HACK: Gets the default CategoryFilter because the filter function may
// be called synchronously.
oldCategoryFilter = QLoggingCategory::installFilter(nullptr);
// Install our CategoryFilter for filtering
KisLoggingManager::Private::refreshCategoryFilter();
}
ScopedLogCapturer::ScopedLogCapturer(QByteArray category, ScopedLogCapturer::callback_t callback)
: m_category(category)
, m_callback(callback)
{
capturerSet.insert(this);
KisLoggingManager::Private::refreshCategoryFilter();
}
ScopedLogCapturer::~ScopedLogCapturer()
{
capturerSet.remove(this);
KisLoggingManager::Private::refreshCategoryFilter();
}
/*
* Copyright (c) 2017 Alvin Wong <alvinhochun@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISLOGGINGMANAGER_H
#define KISLOGGINGMANAGER_H
#include "kritaglobal_export.h"
#include <QtGlobal>
#include <QByteArray>
#include <functional>
#include <type_traits>
/**
* This static class is used to control the Qt logging infrastructure to suit
* our needs.
*
* This class assumes no other code calls qInstallMessageHandler and
* QLoggingCategory::installFilter.
*
* This class might or might not be thread-safe, please only use this class
* on the main GUI thread. There is no checking or synchronization in place.
*/
class KRITAGLOBAL_EXPORT KisLoggingManager
{
public:
/**
* Initialize KisLoggingManager globally..
* This function should be called as early as possible in main().
*/
static void initialize();
class ScopedLogCapturer;
private:
KisLoggingManager() = delete;
class Private;
}; // class KisLoggingManager
/**
* This class is used to capture logging output within a certain scope.
*
* This class might or might not be thread-safe, please only use this class
* on the main GUI thread. There is no checking or synchronization in place.
*/
class KRITAGLOBAL_EXPORT KisLoggingManager::ScopedLogCapturer
{
friend class KisLoggingManager;
using callback_t = std::function<std::remove_pointer<QtMessageHandler>::type>;
public:
ScopedLogCapturer(QByteArray category, callback_t callback);
~ScopedLogCapturer();
private:
QByteArray m_category;
callback_t m_callback;
ScopedLogCapturer(const ScopedLogCapturer &) = delete;
ScopedLogCapturer &operator=(const ScopedLogCapturer &) = delete;
}; // class KisLoggingManager::ScopedLogCapturer
#endif // KISLOGGINGMANAGER_H
......@@ -767,7 +767,44 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
{
KisConfig cfg;
const QString rendererOpenGLText = i18nc("canvas renderer", "OpenGL");
const QString rendererAngleText = i18nc("canvas renderer", "Direct3D 11 via ANGLE");
#ifdef Q_OS_WIN
cmbRenderer->clear();
QString qtPreferredRendererText;
if (KisOpenGL::getQtPreferredOpenGLRenderer() == KisOpenGL::RendererAngle) {
qtPreferredRendererText = rendererAngleText;
} else {
qtPreferredRendererText = rendererOpenGLText;
}
cmbRenderer->addItem(i18nc("canvas renderer", "Auto (%1)", qtPreferredRendererText), KisOpenGL::RendererAuto);
cmbRenderer->setCurrentIndex(0);
if (KisOpenGL::getSupportedOpenGLRenderers() & KisOpenGL::RendererDesktopGL) {
cmbRenderer->addItem(rendererOpenGLText, KisOpenGL::RendererDesktopGL);
if (KisOpenGL::getNextUserOpenGLRendererConfig() == KisOpenGL::RendererDesktopGL) {
cmbRenderer->setCurrentIndex(cmbRenderer->count() - 1);
}
}
if (KisOpenGL::getSupportedOpenGLRenderers() & KisOpenGL::RendererAngle) {
cmbRenderer->addItem(rendererAngleText, KisOpenGL::RendererAngle);
if (KisOpenGL::getNextUserOpenGLRendererConfig() == KisOpenGL::RendererAngle) {
cmbRenderer->setCurrentIndex(cmbRenderer->count() - 1);
}
}
#else
lblRenderer->setEnabled(false);
cmbRenderer->setEnabled(false);
cmbRenderer->clear();
cmbRenderer->addItem(rendererOpenGLText);
cmbRenderer->setCurrentIndex(0);
#endif
#ifdef Q_OS_WIN
if (!(KisOpenGL::getSupportedOpenGLRenderers() &
(KisOpenGL::RendererDesktopGL | KisOpenGL::RendererAngle))) {
#else
if (!KisOpenGL::hasOpenGL()) {
#endif
grpOpenGL->setEnabled(false);
grpOpenGL->setChecked(false);
chkUseTextureBuffer->setEnabled(false);
......@@ -831,7 +868,13 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
void DisplaySettingsTab::setDefault()
{
KisConfig cfg;
cmbRenderer->setCurrentIndex(0);
#ifdef Q_OS_WIN
if (!(KisOpenGL::getSupportedOpenGLRenderers() &
(KisOpenGL::RendererDesktopGL | KisOpenGL::RendererAngle))) {
#else
if (!KisOpenGL::hasOpenGL()) {
#endif
grpOpenGL->setEnabled(false);
grpOpenGL->setChecked(false);
chkUseTextureBuffer->setEnabled(false);
......@@ -1134,6 +1177,17 @@ bool KisDlgPreferences::editPreferences()
dialog->m_performanceSettings->save();
#ifdef Q_OS_WIN
{
KisOpenGL::OpenGLRenderer renderer = static_cast<KisOpenGL::OpenGLRenderer>(
dialog->m_displaySettings->cmbRenderer->itemData(
dialog->m_displaySettings->cmbRenderer->currentIndex()).toInt());
KisOpenGL::setNextUserOpenGLRendererConfig(renderer);
const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
kritarc.setValue("OpenGLRenderer", KisOpenGL::convertOpenGLRendererToConfig(renderer));
}
#endif
if (!cfg.useOpenGL() && dialog->m_displaySettings->grpOpenGL->isChecked())
cfg.setCanvasState("TRY_OPENGL");
cfg.setUseOpenGL(dialog->m_displaySettings->grpOpenGL->isChecked());
......
......@@ -175,13 +175,13 @@
</sizepolicy>
</property>
<property name="title">
<string>Open&amp;GL</string>
<string>Canvas &amp;Graphics Acceleration</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="cmbFilterMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -214,7 +214,7 @@
</item>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QCheckBox" name="chkDisableVsync">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Try to disable vsync for Krita. This makes painting more responsive. Uncheck only when experiencing crashes with some GPU/driver combinations.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
......@@ -227,7 +227,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QCheckBox" name="chkUseTextureBuffer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -243,7 +243,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
......@@ -256,6 +256,16 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblRenderer">
<property name="text">
<string>Renderer (needs restart):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cmbRenderer"/>
</item>
</layout>
</widget>
</item>
......
......@@ -614,12 +614,20 @@ bool KisConfig::useOpenGL(bool defaultValue) const
//dbgKrita << "use opengl" << m_cfg.readEntry("useOpenGL", true) << "success" << m_cfg.readEntry("canvasState", "OPENGL_SUCCESS");
QString cs = canvasState();
#ifdef Q_OS_WIN
return (m_cfg.readEntry("useOpenGLWindows", true) && (cs == "OPENGL_SUCCESS" || cs == "TRY_OPENGL"));
#else
return (m_cfg.readEntry("useOpenGL", true) && (cs == "OPENGL_SUCCESS" || cs == "TRY_OPENGL"));
#endif
}
void KisConfig::setUseOpenGL(bool useOpenGL) const
{
#ifdef Q_OS_WIN
m_cfg.writeEntry("useOpenGLWindows", useOpenGL);
#else
m_cfg.writeEntry("useOpenGL", useOpenGL);