mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-24 02:29:20 +01:00
Add flag to disable seperable shaders for osx Intel GPUs. Default is false
This commit is contained in:
parent
79a0cbbba8
commit
1e54f27cde
@ -110,13 +110,12 @@ void Config::ReadValues() {
|
||||
// Renderer
|
||||
Settings::values.use_gles = sdl2_config->GetBoolean("Renderer", "use_gles", false);
|
||||
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
|
||||
Settings::values.use_hw_shader = sdl2_config->GetBoolean("Renderer", "use_hw_shader", true);
|
||||
#ifdef __APPLE__
|
||||
// Hardware shader is broken on macos thanks to poor drivers.
|
||||
// We still want to provide this option for test/development purposes, but disable it by
|
||||
// default.
|
||||
Settings::values.use_hw_shader = sdl2_config->GetBoolean("Renderer", "use_hw_shader", false);
|
||||
#else
|
||||
Settings::values.use_hw_shader = sdl2_config->GetBoolean("Renderer", "use_hw_shader", true);
|
||||
Settings::values.seperable_shader = sdl2_config->GetBoolean("Renderer", "seperable_shader", false);
|
||||
#endif
|
||||
Settings::values.shaders_accurate_mul =
|
||||
sdl2_config->GetBoolean("Renderer", "shaders_accurate_mul", false);
|
||||
|
@ -110,6 +110,10 @@ use_hw_renderer =
|
||||
# 0: Software, 1 (default): Hardware
|
||||
use_hw_shader =
|
||||
|
||||
# Whether to use seperable shaders to emulate 3DS shaders (macOS only)
|
||||
# 0: Off (Default), 1 : On
|
||||
seperable_shader =
|
||||
|
||||
# Whether to use accurate multiplication in hardware shaders
|
||||
# 0: Off (Default. Faster, but causes issues in some games) 1: On (Slower, but correct)
|
||||
shaders_accurate_mul =
|
||||
|
@ -431,13 +431,12 @@ void Config::ReadRendererValues() {
|
||||
|
||||
Settings::values.use_hw_renderer =
|
||||
ReadSetting(QStringLiteral("use_hw_renderer"), true).toBool();
|
||||
Settings::values.use_hw_shader = ReadSetting(QStringLiteral("use_hw_shader"), true).toBool();
|
||||
#ifdef __APPLE__
|
||||
// Hardware shader is broken on macos thanks to poor drivers.
|
||||
// We still want to provide this option for test/development purposes, but disable it by
|
||||
// default.
|
||||
Settings::values.use_hw_shader = ReadSetting(QStringLiteral("use_hw_shader"), false).toBool();
|
||||
#else
|
||||
Settings::values.use_hw_shader = ReadSetting(QStringLiteral("use_hw_shader"), true).toBool();
|
||||
Settings::values.seperable_shader = ReadSetting(QStringLiteral("seperable_shader"), false).toBool();
|
||||
#endif
|
||||
Settings::values.shaders_accurate_mul =
|
||||
ReadSetting(QStringLiteral("shaders_accurate_mul"), false).toBool();
|
||||
@ -916,13 +915,11 @@ void Config::SaveRendererValues() {
|
||||
qt_config->beginGroup(QStringLiteral("Renderer"));
|
||||
|
||||
WriteSetting(QStringLiteral("use_hw_renderer"), Settings::values.use_hw_renderer, true);
|
||||
WriteSetting(QStringLiteral("use_hw_shader"), Settings::values.use_hw_shader, true);
|
||||
#ifdef __APPLE__
|
||||
// Hardware shader is broken on macos thanks to poor drivers.
|
||||
// We still want to provide this option for test/development purposes, but disable it by
|
||||
// default.
|
||||
WriteSetting(QStringLiteral("use_hw_shader"), Settings::values.use_hw_shader, false);
|
||||
#else
|
||||
WriteSetting(QStringLiteral("use_hw_shader"), Settings::values.use_hw_shader, true);
|
||||
// TODO: enable this for none Intel GPUs
|
||||
WriteSetting(QStringLiteral("use_seperable_shader"), Settings::values.seperable_shader, false);
|
||||
#endif
|
||||
WriteSetting(QStringLiteral("shaders_accurate_mul"), Settings::values.shaders_accurate_mul,
|
||||
false);
|
||||
|
@ -29,15 +29,23 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||
connect(ui->toggle_hw_shader, &QCheckBox::toggled, ui->hw_shader_group, &QWidget::setEnabled);
|
||||
#ifdef __APPLE__
|
||||
connect(ui->toggle_hw_shader, &QCheckBox::stateChanged, this, [this](int state) {
|
||||
if (state == Qt::Checked) {
|
||||
ui->toggle_seperable_shader->setEnabled(true);
|
||||
}
|
||||
});
|
||||
connect(ui->toggle_seperable_shader, &QCheckBox::stateChanged, this, [this](int state) {
|
||||
if (state == Qt::Checked) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Hardware Shader Warning"),
|
||||
tr("Hardware Shader support is broken on macOS, and will cause graphical issues "
|
||||
tr("Seperable Shader support is broken on macOS with Intel GPUs, and will cause graphical issues "
|
||||
"like showing a black screen.<br><br>The option is only there for "
|
||||
"test/development purposes. If you experience graphical issues with Hardware "
|
||||
"Shader, please turn it off."));
|
||||
}
|
||||
});
|
||||
#else
|
||||
// TODO(B3N30): Hide this for macs with none Intel GPUs, too.
|
||||
ui->toggle_seperable_shader->visible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -46,6 +54,7 @@ ConfigureGraphics::~ConfigureGraphics() = default;
|
||||
void ConfigureGraphics::SetConfiguration() {
|
||||
ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
|
||||
ui->toggle_hw_shader->setChecked(Settings::values.use_hw_shader);
|
||||
ui->toggle_seperable_shader->setChecked(Settings::values.seperable_shader);
|
||||
ui->toggle_accurate_mul->setChecked(Settings::values.shaders_accurate_mul);
|
||||
ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit);
|
||||
ui->toggle_vsync_new->setChecked(Settings::values.use_vsync_new);
|
||||
@ -54,6 +63,7 @@ void ConfigureGraphics::SetConfiguration() {
|
||||
void ConfigureGraphics::ApplyConfiguration() {
|
||||
Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
|
||||
Settings::values.use_hw_shader = ui->toggle_hw_shader->isChecked();
|
||||
Settings::values.seperable_shader = ui->toggle_seperable_shader->isChecked();
|
||||
Settings::values.shaders_accurate_mul = ui->toggle_accurate_mul->isChecked();
|
||||
Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
|
||||
Settings::values.use_vsync_new = ui->toggle_vsync_new->isChecked();
|
||||
|
@ -76,6 +76,13 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="toggle_seperable_shader">
|
||||
<property name="text">
|
||||
<string>Seperable Shader (Intel GPUs only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="toggle_accurate_mul">
|
||||
<property name="toolTip">
|
||||
|
@ -27,6 +27,7 @@ void Apply() {
|
||||
VideoCore::g_hw_renderer_enabled = values.use_hw_renderer;
|
||||
VideoCore::g_shader_jit_enabled = values.use_shader_jit;
|
||||
VideoCore::g_hw_shader_enabled = values.use_hw_shader;
|
||||
VideoCore::g_seperable_shader_enabled = values.seperable_shader;
|
||||
VideoCore::g_hw_shader_accurate_mul = values.shaders_accurate_mul;
|
||||
VideoCore::g_use_disk_shader_cache = values.use_disk_shader_cache;
|
||||
|
||||
@ -78,6 +79,7 @@ void LogSettings() {
|
||||
LogSetting("Renderer_UseGLES", Settings::values.use_gles);
|
||||
LogSetting("Renderer_UseHwRenderer", Settings::values.use_hw_renderer);
|
||||
LogSetting("Renderer_UseHwShader", Settings::values.use_hw_shader);
|
||||
LogSetting("Renderer_SeperableShader", Settings::values.seperable_shader);
|
||||
LogSetting("Renderer_ShadersAccurateMul", Settings::values.shaders_accurate_mul);
|
||||
LogSetting("Renderer_UseShaderJit", Settings::values.use_shader_jit);
|
||||
LogSetting("Renderer_UseResolutionFactor", Settings::values.resolution_factor);
|
||||
|
@ -142,6 +142,7 @@ struct Values {
|
||||
bool use_gles;
|
||||
bool use_hw_renderer;
|
||||
bool use_hw_shader;
|
||||
bool seperable_shader;
|
||||
bool use_disk_shader_cache;
|
||||
bool shaders_accurate_mul;
|
||||
bool use_shader_jit;
|
||||
|
@ -43,6 +43,10 @@ static bool IsVendorAmd() {
|
||||
std::string gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))};
|
||||
return gpu_vendor == "ATI Technologies Inc." || gpu_vendor == "Advanced Micro Devices, Inc.";
|
||||
}
|
||||
static bool IsVendorIntel() {
|
||||
std::string gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))};
|
||||
return gpu_vendor == "Intel Inc.";
|
||||
}
|
||||
|
||||
RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& window)
|
||||
: is_amd(IsVendorAmd()), shader_dirty(true),
|
||||
@ -161,8 +165,19 @@ RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& window)
|
||||
state.Apply();
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer.GetHandle());
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (IsVendorIntel()) {
|
||||
shader_program_manager = std::make_unique<ShaderProgramManager>(
|
||||
VideoCore::g_seperable_shader_enabled ? GLAD_GL_ARB_separate_shader_objects : false,
|
||||
is_amd);
|
||||
} else {
|
||||
shader_program_manager =
|
||||
std::make_unique<ShaderProgramManager>(GLAD_GL_ARB_separate_shader_objects, is_amd);
|
||||
}
|
||||
#else
|
||||
shader_program_manager =
|
||||
std::make_unique<ShaderProgramManager>(GLAD_GL_ARB_separate_shader_objects, is_amd);
|
||||
#endif
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
|
@ -23,6 +23,7 @@ std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
||||
std::atomic<bool> g_hw_renderer_enabled;
|
||||
std::atomic<bool> g_shader_jit_enabled;
|
||||
std::atomic<bool> g_hw_shader_enabled;
|
||||
std::atomic<bool> g_seperable_shader_enabled;
|
||||
std::atomic<bool> g_hw_shader_accurate_mul;
|
||||
std::atomic<bool> g_use_disk_shader_cache;
|
||||
std::atomic<bool> g_renderer_bg_color_update_requested;
|
||||
|
@ -31,6 +31,7 @@ extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
||||
extern std::atomic<bool> g_hw_renderer_enabled;
|
||||
extern std::atomic<bool> g_shader_jit_enabled;
|
||||
extern std::atomic<bool> g_hw_shader_enabled;
|
||||
extern std::atomic<bool> g_seperable_shader_enabled;
|
||||
extern std::atomic<bool> g_hw_shader_accurate_mul;
|
||||
extern std::atomic<bool> g_use_disk_shader_cache;
|
||||
extern std::atomic<bool> g_renderer_bg_color_update_requested;
|
||||
|
Loading…
Reference in New Issue
Block a user