feat: add Low GPU Accuracy setting for maximum performance

Implements a new "Low" GPU accuracy level that prioritizes performance
over accuracy by aggressively cutting corners in GPU emulation.

Changes:
- Add GpuAccuracy::Low enum and setting infrastructure
- Implement IsGPULevelNormal() helper function
- Skip texture cache checks and query operations
- Use unsafe memory reads for DMA operations
- Disable fence delays and query precision
- Add UI support for desktop (Qt) and Android

Performance optimizations:
- Skips texture cache coherency checks (vk/gl_rasterizer.cpp)
- Non-blocking query synchronization (query_cache.h)
- Unsafe memory operations (dma_pusher.cpp)
- No macro parameter refresh (maxwell_3d.cpp)
- Immediate fence signaling (fence_manager.h)
- Non-precise Vulkan queries (vk_query_cache.cpp)

Ideal for lower-end hardware and users prioritizing FPS over accuracy.
Works on both desktop and Android platforms.

Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
Zephyron
2025-10-01 21:45:23 +10:00
parent 746f748973
commit 9090a24c2e
17 changed files with 57 additions and 19 deletions

View File

@@ -98,7 +98,8 @@ bool DmaPusher::Step() {
&command_headers);
ProcessCommands(headers);
};
if (Settings::IsGPULevelHigh()) {
if (Settings::IsGPULevelNormal()) {
// Normal/High/Extreme: Use safe reads for most operations
if (dma_state.method >= MacroRegistersStart) {
unsafe_process();
return true;
@@ -106,6 +107,10 @@ bool DmaPusher::Step() {
safe_process();
return true;
}
// Low accuracy: Use unsafe reads for maximum performance everywhere
unsafe_process();
return true;
// Note: The code below is unreachable for Low, but kept for reference
// Even in normal accuracy, use safe reads for KeplerCompute inline methods
if (subchannel_type[dma_state.subchannel] == Engines::EngineTypes::KeplerCompute &&
dma_state.method == ComputeInline) {

View File

@@ -221,7 +221,8 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool
}
void Maxwell3D::RefreshParametersImpl() {
if (!Settings::IsGPULevelHigh()) {
if (!Settings::IsGPULevelNormal()) {
// Skip parameter refresh for Low accuracy - ultimate performance
return;
}
size_t current_index = 0;

View File

@@ -72,7 +72,7 @@ public:
}
void SignalFence(std::function<void()>&& func) {
bool delay_fence = Settings::IsGPULevelHigh();
bool delay_fence = Settings::IsGPULevelNormal();
if constexpr (!can_async_check) {
TryReleasePendingFences<false>();
}

View File

@@ -257,7 +257,7 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type
};
u8* pointer = impl->device_memory.template GetPointer<u8>(cpu_addr);
u8* pointer_timestamp = impl->device_memory.template GetPointer<u8>(cpu_addr + 8);
bool is_synced = !Settings::IsGPULevelHigh() && is_fence;
bool is_synced = !Settings::IsGPULevelNormal() && is_fence;
std::function<void()> operation([this, is_synced, streamer, query_base = query, query_location,
pointer, pointer_timestamp] {
if (True(query_base->flags & QueryFlagBits::IsInvalidated)) {
@@ -287,7 +287,8 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type
if (is_fence) {
impl->rasterizer.SignalFence(std::move(operation));
} else {
if (!Settings::IsGPULevelHigh() && counter_type == QueryType::Payload) {
if (!Settings::IsGPULevelNormal() && counter_type == QueryType::Payload) {
// Low accuracy: Immediately write payload for ultimate performance
if (has_timestamp) {
u64 timestamp = impl->gpu.GetTicks();
u64 value = static_cast<u64>(payload);

View File

@@ -545,7 +545,8 @@ bool RasterizerOpenGL::MustFlushRegion(DAddr addr, u64 size, VideoCommon::CacheT
return true;
}
}
if (!Settings::IsGPULevelHigh()) {
if (!Settings::IsGPULevelNormal()) {
// Skip texture cache checks for Low accuracy - ultimate performance
return false;
}
if (True(which & VideoCommon::CacheType::TextureCache)) {
@@ -740,7 +741,8 @@ bool RasterizerOpenGL::AccelerateConditionalRendering() {
// Reimplement Host conditional rendering.
return false;
}
// Medium / Low Hack: stub any checks on queries written into the buffer cache.
// Normal / Low Hack: stub any checks on queries written into the buffer cache.
// Low accuracy: Always stub for maximum performance
const GPUVAddr condition_address{maxwell3d->regs.render_enable.Address()};
Maxwell::ReportSemaphore::Compare cmp;
if (gpu_memory->IsMemoryDirty(condition_address, sizeof(cmp),

View File

@@ -153,7 +153,7 @@ public:
ReserveHostQuery();
scheduler.Record([query_pool = current_query_pool,
query_index = current_bank_slot](vk::CommandBuffer cmdbuf) {
const bool use_precise = Settings::IsGPULevelHigh();
const bool use_precise = Settings::IsGPULevelNormal();
cmdbuf.BeginQuery(query_pool, static_cast<u32>(query_index),
use_precise ? VK_QUERY_CONTROL_PRECISE_BIT : 0);
});
@@ -1415,8 +1415,9 @@ bool QueryCacheRuntime::HostConditionalRenderingCompareValues(VideoCommon::Looku
return false;
}
const bool is_gpu_high = Settings::IsGPULevelHigh();
const bool is_gpu_high = Settings::IsGPULevelNormal();
if (!is_gpu_high && impl->device.GetDriverID() == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) {
// Low accuracy: stub conditional rendering on Intel for performance
return true;
}

View File

@@ -565,7 +565,8 @@ bool RasterizerVulkan::MustFlushRegion(DAddr addr, u64 size, VideoCommon::CacheT
return true;
}
}
if (!Settings::IsGPULevelHigh()) {
if (!Settings::IsGPULevelNormal()) {
// Skip texture cache checks for Low accuracy - ultimate performance
return false;
}
if (True(which & VideoCommon::CacheType::TextureCache)) {

View File

@@ -260,11 +260,14 @@ void Scheduler::AllocateNewContext() {
if (query_cache) {
#if ANDROID
if (Settings::IsGPULevelHigh()) {
// This is problematic on Android, disable on GPU Normal.
// This is problematic on Android, disable on GPU Normal and Low.
query_cache->NotifySegment(true);
}
#else
query_cache->NotifySegment(true);
if (Settings::IsGPULevelNormal()) {
// Skip query cache operations for Low accuracy
query_cache->NotifySegment(true);
}
#endif
}
}
@@ -278,13 +281,16 @@ void Scheduler::InvalidateState() {
void Scheduler::EndPendingOperations() {
#if ANDROID
if (Settings::IsGPULevelHigh()) {
// This is problematic on Android, disable on GPU Normal.
// This is problematic on Android, disable on GPU Normal and Low.
// query_cache->DisableStreams();
}
#else
// query_cache->DisableStreams();
#endif
query_cache->NotifySegment(false);
if (Settings::IsGPULevelNormal()) {
// Skip query cache operations for Low accuracy
query_cache->NotifySegment(false);
}
EndRenderPass();
}