Commit 5b52e549 authored by Sharaf Zaman's avatar Sharaf Zaman Committed by Dmitry Kazakov
Browse files

Make the OpenGL workaround available for all platforms

BUG:401940
parent 8c914c4d
Pipeline #227600 canceled with stage
......@@ -1576,12 +1576,16 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
grpOpenGL->setEnabled(false);
grpOpenGL->setChecked(false);
chkUseTextureBuffer->setEnabled(false);
chkLargePixmapCache->setEnabled(false);
cmbFilterMode->setEnabled(false);
} else {
grpOpenGL->setEnabled(true);
grpOpenGL->setChecked(cfg.useOpenGL());
chkUseTextureBuffer->setEnabled(cfg.useOpenGL());
chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer());
chkLargePixmapCache->setEnabled(cfg.useOpenGL());
chkLargePixmapCache->setChecked(
cfg.readEntry("needsPixmapCacheWorkaround", KisOpenGL::needsPixmapCacheWorkaround()));
cmbFilterMode->setEnabled(cfg.useOpenGL());
cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode());
// Don't show the high quality filtering mode if it's not available
......@@ -1726,6 +1730,7 @@ void DisplaySettingsTab::setDefault()
grpOpenGL->setEnabled(false);
grpOpenGL->setChecked(false);
chkUseTextureBuffer->setEnabled(false);
chkLargePixmapCache->setEnabled(false);
cmbFilterMode->setEnabled(false);
}
else {
......@@ -1733,6 +1738,9 @@ void DisplaySettingsTab::setDefault()
grpOpenGL->setChecked(cfg.useOpenGL(true));
chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer(true));
chkUseTextureBuffer->setEnabled(true);
chkLargePixmapCache->setEnabled(true);
chkLargePixmapCache->setChecked(
cfg.readEntry("needsPixmapCacheWorkaround", KisOpenGL::needsPixmapCacheWorkaround()));
cmbFilterMode->setEnabled(true);
cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode(true));
}
......@@ -1775,6 +1783,7 @@ void DisplaySettingsTab::slotUseOpenGLToggled(bool isChecked)
{
chkUseTextureBuffer->setEnabled(isChecked);
cmbFilterMode->setEnabled(isChecked);
chkLargePixmapCache->setEnabled(isChecked);
}
void DisplaySettingsTab::slotPreferredSurfaceFormatChanged(int index)
......@@ -2257,6 +2266,7 @@ bool KisDlgPreferences::editPreferences()
cfg.setUseOpenGLTextureBuffer(m_displaySettings->chkUseTextureBuffer->isChecked());
cfg.setOpenGLFilteringMode(m_displaySettings->cmbFilterMode->currentIndex());
cfg.setRootSurfaceFormat(&kritarc, indexToFormat(m_displaySettings->cmbPreferedRootSurfaceFormat->currentIndex()));
cfg.writeEntry("needsPixmapCacheWorkaround", m_displaySettings->chkLargePixmapCache->isChecked());
cfg.setCheckSize(m_displaySettings->intCheckSize->value());
cfg.setScrollingCheckers(m_displaySettings->chkMoving->isChecked());
......
......@@ -10,8 +10,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>642</width>
<height>293</height>
<width>674</width>
<height>328</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -62,6 +62,22 @@
</property>
<layout class="QGridLayout">
<item row="4" column="1">
<widget class="QCheckBox" name="chkUseTextureBuffer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use Texture Buffering. This can be faster on some GPU/Driver combinations (like Intel) or broken on some others (like AMD/Radeon).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use texture buffer</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QGroupBox" name="grpOpenGLWarnings">
<property name="title">
<string/>
......@@ -99,46 +115,7 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Scaling Mode:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Current Renderer:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="cmbPreferredRenderer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -148,7 +125,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="cmbFilterMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -181,7 +158,23 @@
</item>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Scaling Mode:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblPreferredRenderer">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
......@@ -197,15 +190,38 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QLabel" name="lblCurrentRenderer">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="chkUseTextureBuffer">
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Current Renderer:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="chkLargePixmapCache">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -213,10 +229,10 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use Texture Buffering. This can be faster on some GPU/Driver combinations (like Intel) or broken on some others (like AMD/Radeon).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This should be enabled if you see any artifacts while using assistants.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use texture buffer</string>
<string>Use large pixmap cache</string>
</property>
</widget>
</item>
......
......@@ -248,10 +248,8 @@ void KisOpenGL::initialize()
* Qt5+openGL3 branch.
*/
if (openGLCheckResult->vendorString().toUpper().contains("NVIDIA")
|| KisOpenGL::hasOpenGLES()) {
g_needsPixmapCacheWorkaround = true;
g_needsPixmapCacheWorkaround = cfg.readEntry("needsPixmapCacheWorkaround", needsPixmapCacheWorkaround());
if (g_needsPixmapCacheWorkaround) {
const qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio();
const QSize screenSize = QGuiApplication::primaryScreen()->size() * devicePixelRatio;
const int minCacheSize = 20 * 1024;
......@@ -404,7 +402,7 @@ bool KisOpenGL::needsFenceWorkaround()
bool KisOpenGL::needsPixmapCacheWorkaround()
{
initialize();
return g_needsPixmapCacheWorkaround;
return openGLCheckResult->vendorString().toUpper().contains("NVIDIA") || KisOpenGL::hasOpenGLES();
}
void KisOpenGL::testingInitializeDefaultSurfaceFormat()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment