Qt: disable TSX in the config.yml if not supported

This commit is contained in:
Megamouse 2020-05-18 15:02:44 +02:00
parent 1fffffad7a
commit 703841e251
3 changed files with 14 additions and 1 deletions

View file

@ -1,9 +1,15 @@
#include "stdafx.h"
#include "system_config.h"
#include "Utilities/StrUtil.h"
#include "Utilities/sysinfo.h"
cfg_root g_cfg;
bool cfg_root::node_core::has_rtm() const
{
return utils::has_rtm();
}
std::string cfg_root::node_vfs::get(const cfg::string& _cfg, const char* _def) const
{
auto [spath, sshared] = _cfg.get();

View file

@ -11,6 +11,11 @@ struct cfg_root : cfg::node
{
struct node_core : cfg::node
{
private:
/** We don't wanna include the sysinfo header here */
bool has_rtm() const;
public:
static constexpr bool thread_scheduler_enabled_def =
#ifdef _WIN32
true;
@ -42,7 +47,7 @@ struct cfg_root : cfg::node
cfg::_bool spu_verification{ this, "SPU Verification", true }; // Should be enabled
cfg::_bool spu_cache{ this, "SPU Cache", true };
cfg::_bool spu_prof{ this, "SPU Profiler", false };
cfg::_enum<tsx_usage> enable_TSX{ this, "Enable TSX", tsx_usage::enabled }; // Enable TSX. Forcing this on Haswell/Broadwell CPUs should be used carefully
cfg::_enum<tsx_usage> enable_TSX{ this, "Enable TSX", has_rtm() ? tsx_usage::enabled : tsx_usage::disabled }; // Enable TSX. Forcing this on Haswell/Broadwell CPUs should be used carefully
cfg::_bool spu_accurate_xfloat{ this, "Accurate xfloat", false };
cfg::_bool spu_approx_xfloat{ this, "Approximate xfloat", true };
cfg::_bool llvm_accurate_dfma{ this, "LLVM Accurate DFMA", true }; // Enable accurate double-precision FMA for CPUs which do not support it natively

View file

@ -231,6 +231,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
ui->enableTSX->setEnabled(false);
ui->enableTSX->addItem(tr("Not supported", "Enable TSX"));
SubscribeTooltip(ui->enableTSX, tr("Unfortunately your CPU model does not support this instruction set.", "Enable TSX"));
m_emu_settings->SetSetting(emu_settings_type::EnableTSX, fmt::format("%s", tsx_usage::disabled));
}
// PPU tool tips