Commit 5d1c04a3 authored by Martin Schultz's avatar Martin Schultz
Browse files

added settings in the options widget for OpenGL Profile and version

also added the actually reported values to the options widget to detect
driver issues. llvmpipe software rendering supports 3.3 core profiles
and openflipper can be run with llvmpipe
parent a2cc7ba5
......@@ -77,7 +77,29 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
// Files
connect(pbReloadShaders,SIGNAL(clicked()),this,SLOT(slotReloadShaders()));
// OpenGL versions
VersionComboBox->clear();
VersionComboBox->addItem("4.6",QVariant::fromValue(QPair<int, int>(4,6)));
VersionComboBox->addItem("4.5",QVariant::fromValue(QPair<int, int>(4,5)));
VersionComboBox->addItem("4.4",QVariant::fromValue(QPair<int, int>(4,4)));
VersionComboBox->addItem("4.3",QVariant::fromValue(QPair<int, int>(4,3)));
VersionComboBox->addItem("4.2",QVariant::fromValue(QPair<int, int>(4,2)));
VersionComboBox->addItem("4.1",QVariant::fromValue(QPair<int, int>(4,1)));
VersionComboBox->addItem("4.0",QVariant::fromValue(QPair<int, int>(4,0)));
VersionComboBox->addItem("3.3",QVariant::fromValue(QPair<int, int>(3,3)));
VersionComboBox->addItem("3.2",QVariant::fromValue(QPair<int, int>(3,2)));
VersionComboBox->addItem("3.1",QVariant::fromValue(QPair<int, int>(3,1)));
VersionComboBox->addItem("3.0",QVariant::fromValue(QPair<int, int>(3,0)));
VersionComboBox->addItem("2.1",QVariant::fromValue(QPair<int, int>(2,1)));
VersionComboBox->addItem("2.0",QVariant::fromValue(QPair<int, int>(2,0)));
VersionComboBox->addItem("1.5",QVariant::fromValue(QPair<int, int>(1,5)));
VersionComboBox->addItem("1.4",QVariant::fromValue(QPair<int, int>(1,4)));
VersionComboBox->addItem("1.3",QVariant::fromValue(QPair<int, int>(1,3)));
VersionComboBox->addItem("1.2",QVariant::fromValue(QPair<int, int>(1,2)));
VersionComboBox->addItem("1.1",QVariant::fromValue(QPair<int, int>(1,1)));
VersionComboBox->addItem("1.0",QVariant::fromValue(QPair<int, int>(1,0)));
// Viewer Settings
connect( restrictFPS, SIGNAL(toggled(bool)), FPS, SLOT(setEnabled(bool)) );
connect( viewerList, SIGNAL(currentRowChanged(int)), this, SLOT(updateViewerSettings(int)) );
......@@ -270,6 +292,37 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
//OpenGL
samples_spinBox->setValue(OpenFlipper::Options::samples());
QPalette warning = samplesWarning->palette();
samplesWarning->setText(QString::number(QOpenGLContext::currentContext()->format().samples()));
if(OpenFlipper::Options::samples() != QOpenGLContext::currentContext()->format().samples())
warning.setColor(samplesWarning->foregroundRole(),Qt::red);
else
warning.setColor(samplesWarning->foregroundRole(),Qt::black);
samplesWarning->setPalette(warning);
VersionComboBox->setCurrentIndex( VersionComboBox->findData(QVariant::fromValue(OpenFlipper::Options::glVersion())));
QPalette version = versionWarning->palette();
versionWarning->setText(QString("%1.%2").arg(QOpenGLContext::currentContext()->format().version().first)
.arg(QOpenGLContext::currentContext()->format().version().second));
if(OpenFlipper::Options::glVersion() != QOpenGLContext::currentContext()->format().version())
version.setColor(versionWarning->foregroundRole(),Qt::red);
else
version.setColor(versionWarning->foregroundRole(),Qt::black);
versionWarning->setPalette(version);
QPalette profile = profileWarning->palette();
profileComboBox->setCurrentIndex(OpenFlipper::Options::coreProfile()?0:1);
if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile)
profileWarning->setText("Core");
if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CompatibilityProfile)
profileWarning->setText("Compatibility");
if(QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::NoProfile)
profileWarning->setText("None");
if(OpenFlipper::Options::coreProfile() && QOpenGLContext::currentContext()->format().profile() != QSurfaceFormat::CoreProfile)
profile.setColor(profileWarning->foregroundRole(),Qt::red);
else
profile.setColor(profileWarning->foregroundRole(),Qt::black);
profileWarning->setPalette(profile);
//Files
logFile->setText( OpenFlipperSettings().value("Core/Log/logFile").toString() );
......@@ -585,6 +638,8 @@ void OptionsWidget::slotApply() {
//OpenGL settings
OpenFlipperSettings().setValue("Core/OpenGL/Samples",samples_spinBox->value());
OpenFlipper::Options::glVersion(VersionComboBox->currentData().value<QPair<int,int>>());
OpenFlipper::Options::coreProfile(profileComboBox->currentIndex() == 0);
//Paths settings
OpenFlipperSettings().setValue("Core/File/MaxRecent",maxRecentBox->value() ) ;
......
......@@ -36,8 +36,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>671</width>
<height>894</height>
<width>668</width>
<height>926</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -315,25 +315,392 @@
<rect>
<x>10</x>
<y>9</y>
<width>201</width>
<height>51</height>
<width>532</width>
<height>163</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_27">
<item>
<widget class="QLabel" name="label_22">
<property name="text">
<string>MSAA Samples:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="samples_spinBox"/>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="1">
<widget class="QSpinBox" name="samples_spinBox"/>
</item>
<item row="1" column="3">
<widget class="QLabel" name="versionWarning">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>OpenGL Profile: </string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>MSAA Samples:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="VersionComboBox">
<item>
<property name="text">
<string>4.6</string>
</property>
</item>
<item>
<property name="text">
<string>4.5</string>
</property>
</item>
<item>
<property name="text">
<string>4.4</string>
</property>
</item>
<item>
<property name="text">
<string>4.3</string>
</property>
</item>
<item>
<property name="text">
<string>4.2</string>
</property>
</item>
<item>
<property name="text">
<string>4.1</string>
</property>
</item>
<item>
<property name="text">
<string>4.0</string>
</property>
</item>
<item>
<property name="text">
<string>3.3</string>
</property>
</item>
<item>
<property name="text">
<string>3.2</string>
</property>
</item>
<item>
<property name="text">
<string>3.1</string>
</property>
</item>
<item>
<property name="text">
<string>3.0</string>
</property>
</item>
<item>
<property name="text">
<string>2.1</string>
</property>
</item>
<item>
<property name="text">
<string>2.0</string>
</property>
</item>
<item>
<property name="text">
<string>1.5</string>
</property>
</item>
<item>
<property name="text">
<string>1.4</string>
</property>
</item>
<item>
<property name="text">
<string>1.3</string>
</property>
</item>
<item>
<property name="text">
<string>1.2</string>
</property>
</item>
<item>
<property name="text">
<string>1.1</string>
</property>
</item>
<item>
<property name="text">
<string>1.0</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_30">
<property name="text">
<string>OpenGL Version:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="samplesWarning">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="profileWarning">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item row="2" column="4">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="profileComboBox">
<item>
<property name="text">
<string>Core</string>
</property>
</item>
<item>
<property name="text">
<string>Compatibility</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_33">
<property name="text">
<string>Reported value:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_34">
<property name="text">
<string>Reported value:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_35">
<property name="text">
<string>Reported value:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_23">
<property name="text">
<string>If the values mismatch after restarting OpenFlipper,
please check your driver and hardware capabilities.
Current software renderers should be capable of
providing at least 3.2 Core profiles</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
......
Markdown is supported
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