mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-03 06:24:18 +01:00
add: an option to turn fast math off
This commit is contained in:
parent
6ba6157bae
commit
ebcb62a785
@ -251,6 +251,7 @@ void InfoLog_PrintActiveSettings()
|
||||
if (ActiveSettings::GetGraphicsAPI() == GraphicAPI::kVulkan)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Async compile: {}", GetConfig().async_compile.GetValue() ? "true" : "false");
|
||||
cemuLog_log(LogType::Force, "Fast math: {}", GetConfig().fast_math.GetValue() ? "true" : "false");
|
||||
if(!GetConfig().vk_accurate_barriers.GetValue())
|
||||
cemuLog_log(LogType::Force, "Accurate barriers are disabled!");
|
||||
}
|
||||
|
@ -7,8 +7,7 @@
|
||||
|
||||
#include "Cemu/Logging/CemuLogging.h"
|
||||
#include "Common/precompiled.h"
|
||||
#include "HW/Latte/Core/FetchShader.h"
|
||||
#include "HW/Latte/ISA/RegDefines.h"
|
||||
#include "config/CemuConfig.h"
|
||||
|
||||
extern std::atomic_int g_compiled_shaders_total;
|
||||
extern std::atomic_int g_compiled_shaders_async;
|
||||
@ -16,8 +15,13 @@ extern std::atomic_int g_compiled_shaders_async;
|
||||
RendererShaderMtl::RendererShaderMtl(MetalRenderer* mtlRenderer, ShaderType type, uint64 baseHash, uint64 auxHash, bool isGameShader, bool isGfxPackShader, const std::string& mslCode)
|
||||
: RendererShader(type, baseHash, auxHash, isGameShader, isGfxPackShader), m_mtlr{mtlRenderer}
|
||||
{
|
||||
MTL::CompileOptions* options = MTL::CompileOptions::alloc()->init();
|
||||
if (GetConfig().fast_math)
|
||||
options->setFastMathEnabled(true);
|
||||
|
||||
NS::Error* error = nullptr;
|
||||
MTL::Library* library = m_mtlr->GetDevice()->newLibrary(ToNSString(mslCode), nullptr, &error);
|
||||
MTL::Library* library = m_mtlr->GetDevice()->newLibrary(ToNSString(mslCode), options, &error);
|
||||
options->release();
|
||||
if (error)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "failed to create library: {} -> {}", error->localizedDescription()->utf8String(), mslCode.c_str());
|
||||
|
@ -219,6 +219,7 @@ void CemuConfig::Load(XMLConfigParser& parser)
|
||||
downscale_filter = graphic.get("DownscaleFilter", kLinearFilter);
|
||||
fullscreen_scaling = graphic.get("FullscreenScaling", kKeepAspectRatio);
|
||||
async_compile = graphic.get("AsyncCompile", async_compile);
|
||||
fast_math = graphic.get("FastMath", fast_math);
|
||||
vk_accurate_barriers = graphic.get("vkAccurateBarriers", true); // this used to be "VulkanAccurateBarriers" but because we changed the default to true in 1.27.1 the option name had to be changed
|
||||
|
||||
auto overlay_node = graphic.get("Overlay");
|
||||
@ -475,6 +476,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
|
||||
graphic.set("DownscaleFilter", downscale_filter);
|
||||
graphic.set("FullscreenScaling", fullscreen_scaling);
|
||||
graphic.set("AsyncCompile", async_compile.GetValue());
|
||||
graphic.set("FastMath", fast_math.GetValue());
|
||||
graphic.set("vkAccurateBarriers", vk_accurate_barriers);
|
||||
|
||||
auto overlay_node = graphic.set("Overlay");
|
||||
|
@ -444,6 +444,7 @@ struct CemuConfig
|
||||
ConfigValue<bool> gx2drawdone_sync {true};
|
||||
ConfigValue<bool> render_upside_down{ false };
|
||||
ConfigValue<bool> async_compile{ true };
|
||||
ConfigValue<bool> fast_math{ true };
|
||||
|
||||
ConfigValue<bool> vk_accurate_barriers{ true };
|
||||
|
||||
|
@ -344,6 +344,10 @@ wxPanel* GeneralSettings2::AddGraphicsPage(wxNotebook* notebook)
|
||||
m_async_compile->SetToolTip(_("Enables async shader and pipeline compilation. Reduces stutter at the cost of objects not rendering for a short time.\nVulkan only"));
|
||||
graphic_misc_row->Add(m_async_compile, 0, wxALL, 5);
|
||||
|
||||
m_fast_math = new wxCheckBox(box, wxID_ANY, _("Fast math"));
|
||||
m_fast_math->SetToolTip(_("Enables fast math for all shaders. May cause minor inaccuracies in some games.\nMetal only"));
|
||||
graphic_misc_row->Add(m_fast_math, 0, wxALL, 5);
|
||||
|
||||
m_gx2drawdone_sync = new wxCheckBox(box, wxID_ANY, _("Full sync at GX2DrawDone()"));
|
||||
m_gx2drawdone_sync->SetToolTip(_("If synchronization is requested by the game, the emulated CPU will wait for the GPU to finish all operations.\nThis is more accurate behavior, but may cause lower performance"));
|
||||
graphic_misc_row->Add(m_gx2drawdone_sync, 0, wxALL, 5);
|
||||
@ -1038,6 +1042,7 @@ void GeneralSettings2::StoreConfig()
|
||||
config.vsync = m_vsync->GetSelection();
|
||||
config.gx2drawdone_sync = m_gx2drawdone_sync->IsChecked();
|
||||
config.async_compile = m_async_compile->IsChecked();
|
||||
config.fast_math = m_fast_math->IsChecked();
|
||||
|
||||
config.upscale_filter = m_upscale_filter->GetSelection();
|
||||
config.downscale_filter = m_downscale_filter->GetSelection();
|
||||
@ -1500,7 +1505,7 @@ void GeneralSettings2::HandleGraphicsApiSelection()
|
||||
selection = GetConfig().vsync;
|
||||
|
||||
m_vsync->Clear();
|
||||
if(m_graphic_api->GetSelection() == 0)
|
||||
if (m_graphic_api->GetSelection() == 0)
|
||||
{
|
||||
// OpenGL
|
||||
m_vsync->AppendString(_("Off"));
|
||||
@ -1515,12 +1520,14 @@ void GeneralSettings2::HandleGraphicsApiSelection()
|
||||
|
||||
m_gx2drawdone_sync->Enable();
|
||||
m_async_compile->Disable();
|
||||
m_fast_math->Disable();
|
||||
}
|
||||
else
|
||||
else if (m_graphic_api->GetSelection() == 1)
|
||||
{
|
||||
// Vulkan
|
||||
m_gx2drawdone_sync->Disable();
|
||||
m_async_compile->Enable();
|
||||
m_fast_math->Disable();
|
||||
|
||||
m_vsync->AppendString(_("Off"));
|
||||
m_vsync->AppendString(_("Double buffering"));
|
||||
@ -1553,6 +1560,24 @@ void GeneralSettings2::HandleGraphicsApiSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Metal
|
||||
m_gx2drawdone_sync->Disable();
|
||||
m_async_compile->Enable();
|
||||
m_fast_math->Enable();
|
||||
|
||||
// TODO: vsync options
|
||||
m_vsync->AppendString(_("Off"));
|
||||
m_vsync->AppendString(_("Double buffering"));
|
||||
m_vsync->AppendString(_("Triple buffering"));
|
||||
|
||||
m_vsync->Select(selection);
|
||||
|
||||
// TODO: add an option to select the graphic device
|
||||
m_graphic_device->Clear();
|
||||
m_graphic_device->Disable();
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSettings2::ApplyConfig()
|
||||
@ -1604,6 +1629,7 @@ void GeneralSettings2::ApplyConfig()
|
||||
m_graphic_api->SetSelection(config.graphic_api);
|
||||
m_vsync->SetSelection(config.vsync);
|
||||
m_async_compile->SetValue(config.async_compile);
|
||||
m_fast_math->SetValue(config.fast_math);
|
||||
m_gx2drawdone_sync->SetValue(config.gx2drawdone_sync);
|
||||
m_upscale_filter->SetSelection(config.upscale_filter);
|
||||
m_downscale_filter->SetSelection(config.downscale_filter);
|
||||
|
@ -52,7 +52,7 @@ private:
|
||||
// Graphics
|
||||
wxChoice* m_graphic_api, * m_graphic_device;
|
||||
wxChoice* m_vsync;
|
||||
wxCheckBox *m_async_compile, *m_gx2drawdone_sync;
|
||||
wxCheckBox *m_async_compile, *m_fast_math, *m_gx2drawdone_sync;
|
||||
wxRadioBox* m_upscale_filter, *m_downscale_filter, *m_fullscreen_scaling;
|
||||
wxChoice* m_overlay_position, *m_notification_position, *m_overlay_scale, *m_notification_scale;
|
||||
wxCheckBox* m_controller_profile_name, *m_controller_low_battery, *m_shader_compiling, *m_friends_data;
|
||||
@ -113,4 +113,3 @@ private:
|
||||
void HandleGraphicsApiSelection();
|
||||
void ApplyConfig();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user