EnhancementsWidget: Handle gaps in AA mode list
Mesa (llvmpipe) only reports 4x MSAA, and doesn't report 2x (or 1x, but we implicitly add that). The old logic did not handle this correctly, causing selecting 4x to fail and fall back to None.
This also removes VideoUtils::GetAvailableAntialiasingModes, and thus VideoUtils entirely, as its only other function was removed in 1f74653501
.
This commit is contained in:
parent
b246a634d4
commit
ac48b2eea4
|
@ -534,7 +534,6 @@
|
|||
<ClInclude Include="UICommon\ResourcePack\ResourcePack.h" />
|
||||
<ClInclude Include="UICommon\UICommon.h" />
|
||||
<ClInclude Include="UICommon\USBUtils.h" />
|
||||
<ClInclude Include="UICommon\VideoUtils.h" />
|
||||
<ClInclude Include="UpdaterCommon\UI.h" />
|
||||
<ClInclude Include="UpdaterCommon\UpdaterCommon.h" />
|
||||
<ClInclude Include="VideoBackends\D3D\D3DBase.h" />
|
||||
|
@ -1160,7 +1159,6 @@
|
|||
<ClCompile Include="UICommon\ResourcePack\ResourcePack.cpp" />
|
||||
<ClCompile Include="UICommon\UICommon.cpp" />
|
||||
<ClCompile Include="UICommon\USBUtils.cpp" />
|
||||
<ClCompile Include="UICommon\VideoUtils.cpp" />
|
||||
<ClCompile Include="UpdaterCommon\UpdaterCommon.cpp" />
|
||||
<ClCompile Include="VideoBackends\D3D\D3DBase.cpp" />
|
||||
<ClCompile Include="VideoBackends\D3D\D3DBoundingBox.cpp" />
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
#include "UICommon/VideoUtils.h"
|
||||
|
||||
#include "VideoCommon/PostProcessing.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
@ -260,18 +258,38 @@ void EnhancementsWidget::LoadSettings()
|
|||
m_block_save = true;
|
||||
// Anti-Aliasing
|
||||
|
||||
const int aa_selection = Config::Get(Config::GFX_MSAA);
|
||||
const u32 aa_selection = Config::Get(Config::GFX_MSAA);
|
||||
const bool ssaa = Config::Get(Config::GFX_SSAA);
|
||||
const int aniso = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
|
||||
const TextureFilteringMode tex_filter_mode =
|
||||
Config::Get(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING);
|
||||
|
||||
m_aa_combo->clear();
|
||||
for (const auto& option : VideoUtils::GetAvailableAntialiasingModes(m_msaa_modes))
|
||||
m_aa_combo->addItem(option == "None" ? tr("None") : QString::fromStdString(option));
|
||||
|
||||
m_aa_combo->setCurrentText(
|
||||
QString::fromStdString(std::to_string(aa_selection) + "x " + (ssaa ? "SSAA" : "MSAA")));
|
||||
for (const u32 aa_mode : g_Config.backend_info.AAModes)
|
||||
{
|
||||
if (aa_mode == 1)
|
||||
m_aa_combo->addItem(tr("None"), 1);
|
||||
else
|
||||
m_aa_combo->addItem(tr("%1x MSAA").arg(aa_mode), static_cast<int>(aa_mode));
|
||||
|
||||
if (aa_mode == aa_selection && !ssaa)
|
||||
m_aa_combo->setCurrentIndex(m_aa_combo->count() - 1);
|
||||
}
|
||||
if (g_Config.backend_info.bSupportsSSAA)
|
||||
{
|
||||
for (const u32 aa_mode : g_Config.backend_info.AAModes)
|
||||
{
|
||||
if (aa_mode != 1) // don't show "None" twice
|
||||
{
|
||||
// Mark SSAA using negative values in the variant
|
||||
m_aa_combo->addItem(tr("%1x SSAA").arg(aa_mode), -static_cast<int>(aa_mode));
|
||||
if (aa_mode == aa_selection && ssaa)
|
||||
m_aa_combo->setCurrentIndex(m_aa_combo->count() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_aa_combo->setEnabled(m_aa_combo->count() > 1);
|
||||
|
||||
switch (tex_filter_mode)
|
||||
|
@ -310,22 +328,10 @@ void EnhancementsWidget::SaveSettings()
|
|||
if (m_block_save)
|
||||
return;
|
||||
|
||||
bool is_ssaa = m_aa_combo->currentText().endsWith(QStringLiteral("SSAA"));
|
||||
|
||||
int aa_value = m_aa_combo->currentIndex();
|
||||
|
||||
if (aa_value == 0)
|
||||
{
|
||||
aa_value = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aa_value > m_msaa_modes)
|
||||
aa_value -= m_msaa_modes;
|
||||
aa_value = std::pow(2, aa_value);
|
||||
}
|
||||
Config::SetBaseOrCurrent(Config::GFX_MSAA, static_cast<unsigned int>(aa_value));
|
||||
const u32 aa_value = static_cast<u32>(std::abs(m_aa_combo->currentData().toInt()));
|
||||
const bool is_ssaa = m_aa_combo->currentData().toInt() < 0;
|
||||
|
||||
Config::SetBaseOrCurrent(Config::GFX_MSAA, aa_value);
|
||||
Config::SetBaseOrCurrent(Config::GFX_SSAA, is_ssaa);
|
||||
|
||||
const int texture_filtering_selection = m_texture_filtering_combo->currentData().toInt();
|
||||
|
|
|
@ -23,8 +23,6 @@ add_library(uicommon
|
|||
UICommon.h
|
||||
USBUtils.cpp
|
||||
USBUtils.h
|
||||
VideoUtils.cpp
|
||||
VideoUtils.h
|
||||
)
|
||||
|
||||
target_link_libraries(uicommon
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "UICommon/VideoUtils.h"
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
namespace VideoUtils
|
||||
{
|
||||
std::vector<std::string> GetAvailableAntialiasingModes(int& msaa_modes)
|
||||
{
|
||||
std::vector<std::string> modes;
|
||||
const auto& aa_modes = g_Config.backend_info.AAModes;
|
||||
const bool supports_ssaa = g_Config.backend_info.bSupportsSSAA;
|
||||
msaa_modes = 0;
|
||||
|
||||
for (const auto mode : aa_modes)
|
||||
{
|
||||
if (mode == 1)
|
||||
{
|
||||
modes.push_back("None");
|
||||
ASSERT_MSG(VIDEO, !supports_ssaa || msaa_modes == 0, "SSAA setting won't work correctly");
|
||||
}
|
||||
else
|
||||
{
|
||||
modes.push_back(std::to_string(mode) + "x MSAA");
|
||||
msaa_modes++;
|
||||
}
|
||||
}
|
||||
|
||||
if (supports_ssaa)
|
||||
{
|
||||
for (const auto mode : aa_modes)
|
||||
{
|
||||
if (mode != 1)
|
||||
modes.push_back(std::to_string(mode) + "x SSAA");
|
||||
}
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
} // namespace VideoUtils
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace VideoUtils
|
||||
{
|
||||
std::vector<std::string> GetAvailableAntialiasingModes(int& m_msaa_modes);
|
||||
} // namespace VideoUtils
|
Loading…
Reference in New Issue