Skip to content

Commit

Permalink
Add enums for zcull precision control
Browse files Browse the repository at this point in the history
  • Loading branch information
kd-11 committed Sep 6, 2021
1 parent ea949a5 commit b3f002f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions rpcs3/Emu/system_config_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,11 @@ enum class perf_graph_detail_level
show_one_percent_avg,
show_all
};

enum class zcull_precision_level
{
precise,
approximate,
relaxed,
undefined
};
22 changes: 14 additions & 8 deletions rpcs3/rpcs3qt/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,30 +1040,36 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
SubscribeTooltip(ui->gb_vulkansched, tooltips.settings.vulkan_async_scheduler);

// Custom control that simplifies operation of two independent variables. Can probably be done better but this works.
ui->zcullPrecisionMode->addItems({tr("Precise (Default)"), tr("Approximate (Fast)"), tr("Relaxed (Fastest)")});
ui->zcullPrecisionMode->addItem(tr("Precise (Default)"), static_cast<int>(zcull_precision_level::precise));
ui->zcullPrecisionMode->addItem(tr("Approximate (Fast)"), static_cast<int>(zcull_precision_level::approximate));
ui->zcullPrecisionMode->addItem(tr("Relaxed (Fastest)"), static_cast<int>(zcull_precision_level::relaxed));

if (m_emu_settings->GetSetting(emu_settings_type::RelaxedZCULL) == "true")
{
ui->zcullPrecisionMode->setCurrentIndex(2);
ui->zcullPrecisionMode->setCurrentIndex(
ui->zcullPrecisionMode->findData(static_cast<int>(zcull_precision_level::relaxed)));
}
else if (m_emu_settings->GetSetting(emu_settings_type::PreciseZCULL) == "true")
{
ui->zcullPrecisionMode->setCurrentIndex(0);
ui->zcullPrecisionMode->setCurrentIndex(
ui->zcullPrecisionMode->findData(static_cast<int>(zcull_precision_level::precise)));
}
else
{
ui->zcullPrecisionMode->setCurrentIndex(1);
ui->zcullPrecisionMode->setCurrentIndex(
ui->zcullPrecisionMode->findData(static_cast<int>(zcull_precision_level::approximate)));
}
connect(ui->zcullPrecisionMode, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index)
{
bool relaxed = false, precise = false;

switch (index)
switch (static_cast<zcull_precision_level>(ui->zcullPrecisionMode->itemData(index).toInt()))
{
case 0:
case zcull_precision_level::precise:
precise = true; break;
case 1:
case zcull_precision_level::approximate:
break;
case 2:
case zcull_precision_level::relaxed:
relaxed = true; break;
default:
fmt::throw_exception("Unexpected selection");
Expand Down

0 comments on commit b3f002f

Please sign in to comment.