mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-27 14:16:04 +02:00
[buffer_cache] Add option to control GPU buffer readback (#4126)
Added an option to control the GPU buffer readback, as it causes issues if the hardware cannot keep up with the additional workload. Some games require this to render certain effects properly. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4126
This commit is contained in:
parent
0d6a2158f0
commit
b4b41ee62c
3 changed files with 19 additions and 8 deletions
|
|
@ -573,6 +573,13 @@ struct Values {
|
||||||
false,
|
false,
|
||||||
#endif
|
#endif
|
||||||
"rescale_hack", Category::RendererHacks};
|
"rescale_hack", Category::RendererHacks};
|
||||||
|
SwitchableSetting<bool> enable_gpu_buffer_readback{linkage,
|
||||||
|
false,
|
||||||
|
"enable_gpu_buffer_readback",
|
||||||
|
Category::RendererAdvanced,
|
||||||
|
Specialization::Default,
|
||||||
|
true,
|
||||||
|
true};
|
||||||
|
|
||||||
SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
|
SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
|
||||||
Category::RendererHacks};
|
Category::RendererHacks};
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,8 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent) {
|
||||||
INSERT(Settings, dma_accuracy, tr("DMA Accuracy:"),
|
INSERT(Settings, dma_accuracy, tr("DMA Accuracy:"),
|
||||||
tr("Controls the DMA precision accuracy. Safe precision fixes issues in some games but "
|
tr("Controls the DMA precision accuracy. Safe precision fixes issues in some games but "
|
||||||
"may degrade performance."));
|
"may degrade performance."));
|
||||||
|
INSERT(Settings, enable_gpu_buffer_readback, tr("Enable GPU buffer readback"),
|
||||||
|
tr("Preserves GPU-modified buffer data by reading it back before uploads.\nSome games require this to render certain effects properly.\nMay cause issues if the hardware cannot handle the additional workload."));
|
||||||
INSERT(Settings, use_asynchronous_shaders, tr("Enable asynchronous shader compilation"),
|
INSERT(Settings, use_asynchronous_shaders, tr("Enable asynchronous shader compilation"),
|
||||||
tr("May reduce shader stutter."));
|
tr("May reduce shader stutter."));
|
||||||
INSERT(Settings, fast_gpu_time, tr("Fast GPU Time"),
|
INSERT(Settings, fast_gpu_time, tr("Fast GPU Time"),
|
||||||
|
|
|
||||||
|
|
@ -1634,6 +1634,7 @@ bool BufferCache<P>::SynchronizeBuffer(Buffer& buffer, DAddr device_addr, u32 si
|
||||||
if (total_size_bytes == 0) {
|
if (total_size_bytes == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (Settings::values.enable_gpu_buffer_readback.GetValue()) {
|
||||||
u64 min_offset = (std::numeric_limits<u64>::max)();
|
u64 min_offset = (std::numeric_limits<u64>::max)();
|
||||||
u64 max_offset = 0;
|
u64 max_offset = 0;
|
||||||
for (const auto& copy : upload_copies) {
|
for (const auto& copy : upload_copies) {
|
||||||
|
|
@ -1643,6 +1644,7 @@ bool BufferCache<P>::SynchronizeBuffer(Buffer& buffer, DAddr device_addr, u32 si
|
||||||
const DAddr sync_addr = buffer.CpuAddr() + min_offset;
|
const DAddr sync_addr = buffer.CpuAddr() + min_offset;
|
||||||
const u64 sync_size = max_offset - min_offset;
|
const u64 sync_size = max_offset - min_offset;
|
||||||
DownloadBufferMemory(buffer, sync_addr, sync_size);
|
DownloadBufferMemory(buffer, sync_addr, sync_size);
|
||||||
|
}
|
||||||
const std::span<BufferCopy> copies_span(upload_copies.data(), upload_copies.size());
|
const std::span<BufferCopy> copies_span(upload_copies.data(), upload_copies.size());
|
||||||
UploadMemory(buffer, total_size_bytes, largest_copy, copies_span);
|
UploadMemory(buffer, total_size_bytes, largest_copy, copies_span);
|
||||||
any_buffer_uploaded = true;
|
any_buffer_uploaded = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue