Browse Source

Add toggle to force GPU to only use safe reads

pull/269/head
MaranBr 7 months ago
parent
commit
2e997c8124
  1. 2
      src/common/settings.h
  2. 27
      src/video_core/dma_pusher.cpp
  3. 5
      src/video_core/dma_pusher.h
  4. 7
      src/yuzu/configuration/shared_translation.cpp

2
src/common/settings.h

@ -466,7 +466,7 @@ struct Values {
true,
true};
#endif
SwitchableSetting<bool> force_safe_reads{linkage, false, "force_safe_reads", Category::RendererAdvanced};
SwitchableSetting<bool> async_presentation{linkage,
#ifdef ANDROID
true,

27
src/video_core/dma_pusher.cpp

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/cityhash.h"
@ -17,12 +17,6 @@ namespace Tegra {
constexpr u32 MacroRegistersStart = 0xE00;
constexpr u32 ComputeInline = 0x6D;
//start on PR#76 of Eden this is a unused variable in android (need to investigate)
// Dummy function that uses ComputeInline
constexpr void UseComputeInline() {
static_cast<void>(ComputeInline); // Suppress unused variable error
}
DmaPusher::DmaPusher(Core::System& system_, GPU& gpu_, MemoryManager& memory_manager_,
Control::ChannelState& channel_state_)
@ -102,22 +96,23 @@ bool DmaPusher::Step() {
&command_headers);
ProcessCommands(headers);
};
// Only use unsafe reads for non-compute macro operations
if (Settings::values.force_safe_reads.GetValue()) {
safe_process();
return true;
}
if (Settings::IsGPULevelHigh()) {
const bool is_compute = (subchannel_type[dma_state.subchannel] ==
Engines::EngineTypes::KeplerCompute);
if (dma_state.method >= MacroRegistersStart && !is_compute) {
if (dma_state.method >= MacroRegistersStart) {
unsafe_process();
return true;
}
if (subchannel_type[dma_state.subchannel] == Engines::EngineTypes::KeplerCompute &&
dma_state.method == ComputeInline) {
unsafe_process();
return true;
}
// Always use safe reads for compute operations
safe_process();
return true;
}
unsafe_process();
}
return true;

5
src/video_core/dma_pusher.h

@ -1,4 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

7
src/yuzu/configuration/shared_translation.cpp

@ -1,10 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 Torzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "yuzu/configuration/shared_translation.h"
@ -269,6 +266,8 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent)
INSERT(Settings, bg_blue, QString(), QString());
// Renderer (Advanced Graphics)
INSERT(Settings, force_safe_reads, tr("Force GPU to only use safe reads"),
tr("Prevents potential memory corruption issues that could lead to invalid dispatch parameters.\nThis can reduce performance in some cases."));
INSERT(Settings,
async_presentation,
tr("Enable asynchronous presentation (Vulkan only)"),

Loading…
Cancel
Save