From 960ece216b6e41e3fdbc480f10ec1ca5a1bfde67 Mon Sep 17 00:00:00 2001 From: Forrest Keller Date: Sun, 15 Mar 2026 04:43:29 -0500 Subject: [PATCH] Added setting to turn off streaming of sparse texture unswizzling --- .../app/src/main/res/values/arrays.xml | 4 ++++ .../app/src/main/res/values/strings.xml | 2 ++ src/common/settings_enums.h | 4 ++-- src/qt_common/config/shared_translation.cpp | 2 ++ src/video_core/texture_cache/texture_cache.h | 19 ++++++++++++++----- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml index f3a2a069e7..a1b78ac768 100644 --- a/src/android/app/src/main/res/values/arrays.xml +++ b/src/android/app/src/main/res/values/arrays.xml @@ -567,6 +567,7 @@ @string/gpu_swizzle_normal @string/gpu_swizzle_medium @string/gpu_swizzle_high + @string/gpu_swizzle_off @@ -575,6 +576,7 @@ 2 3 4 + 5 @@ -583,6 +585,7 @@ @string/gpu_swizzlechunk_normal @string/gpu_swizzlechunk_medium @string/gpu_swizzlechunk_high + @string/gpu_swizzlechunk_off @@ -591,6 +594,7 @@ 2 3 4 + 5 diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index a425ce36ef..87dd084e6c 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -986,6 +986,7 @@ Normal (16 MB) Medium (32 MB) High (64 MB) + Off Very Low (32) @@ -993,6 +994,7 @@ Normal (128) Medium (256) High (512) + Off Celsius diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index b14ed9bc67..e94bebc5b2 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -153,8 +153,8 @@ ENUM(AppletMode, HLE, LLE); ENUM(SpirvOptimizeMode, Never, OnLoad, Always); ENUM(GpuOverclock, Normal, Medium, High) ENUM(GpuUnswizzleSize, VerySmall, Small, Normal, Large, VeryLarge) -ENUM(GpuUnswizzle, VeryLow, Low, Normal, Medium, High) -ENUM(GpuUnswizzleChunk, VeryLow, Low, Normal, Medium, High) +ENUM(GpuUnswizzle, VeryLow, Low, Normal, Medium, High, Off) +ENUM(GpuUnswizzleChunk, VeryLow, Low, Normal, Medium, High, Off) ENUM(TemperatureUnits, Celsius, Fahrenheit) ENUM(ExtendedDynamicState, Disabled, EDS1, EDS2, EDS3); ENUM(GpuLogLevel, Off, Errors, Standard, Verbose, All) diff --git a/src/qt_common/config/shared_translation.cpp b/src/qt_common/config/shared_translation.cpp index 6778f37f7b..688dbe3bf4 100644 --- a/src/qt_common/config/shared_translation.cpp +++ b/src/qt_common/config/shared_translation.cpp @@ -665,6 +665,7 @@ std::unique_ptr ComboboxEnumeration(QObject* parent) { PAIR(GpuUnswizzle, Normal, tr("Normal (16 MB)")), PAIR(GpuUnswizzle, Medium, tr("Medium (32 MB)")), PAIR(GpuUnswizzle, High, tr("High (64 MB)")), + PAIR(GpuUnswizzle, Off, tr("Off")), }}); translations->insert({Settings::EnumMetadata::Index(), { @@ -673,6 +674,7 @@ std::unique_ptr ComboboxEnumeration(QObject* parent) { PAIR(GpuUnswizzleChunk, Normal, tr("Normal (128)")), PAIR(GpuUnswizzleChunk, Medium, tr("Medium (256)")), PAIR(GpuUnswizzleChunk, High, tr("High (512)")), + PAIR(GpuUnswizzleChunk, Off, tr("Off")), }}); translations->insert({Settings::EnumMetadata::Index(), diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 2cfdb94359..813b5239dc 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -95,6 +95,7 @@ TextureCache

::TextureCache(Runtime& runtime_, Tegra::MaxwellDeviceMemoryManag case Settings::GpuUnswizzle::Normal: swizzle_chunk_size = 16_MiB; break; case Settings::GpuUnswizzle::Medium: swizzle_chunk_size = 32_MiB; break; case Settings::GpuUnswizzle::High: swizzle_chunk_size = 64_MiB; break; + case Settings::GpuUnswizzle::Off: swizzle_chunk_size = 0; break; default: swizzle_chunk_size = 16_MiB; } @@ -104,6 +105,7 @@ TextureCache

::TextureCache(Runtime& runtime_, Tegra::MaxwellDeviceMemoryManag case Settings::GpuUnswizzleChunk::Normal: swizzle_slices_per_batch = 128; break; case Settings::GpuUnswizzleChunk::Medium: swizzle_slices_per_batch = 256; break; case Settings::GpuUnswizzleChunk::High: swizzle_slices_per_batch = 512; break; + case Settings::GpuUnswizzleChunk::Off: swizzle_slices_per_batch = 0; break; default: swizzle_slices_per_batch = 128; } } else { @@ -1401,10 +1403,10 @@ void TextureCache

::TickAsyncUnswizzle() { return; } - if(current_unswizzle_frame > 0) { + /*if(current_unswizzle_frame > 0) { current_unswizzle_frame--; return; - } + }*/ PendingUnswizzle& task = unswizzle_queue.front(); Image& image = slot_images[task.image_id]; @@ -1429,7 +1431,10 @@ void TextureCache

::TickAsyncUnswizzle() { if (task.current_offset < task.total_size) { const size_t remaining = task.total_size - task.current_offset; - size_t copy_amount = (std::min)(swizzle_chunk_size, remaining); + size_t copy_amount = 0; + if( swizzle_chunk_size == 0 ) + copy_amount = remaining; + else copy_amount = (std::min)(swizzle_chunk_size, remaining); if (remaining > swizzle_chunk_size) { copy_amount = (copy_amount / task.bytes_per_slice) * task.bytes_per_slice; @@ -1446,7 +1451,11 @@ void TextureCache

::TickAsyncUnswizzle() { const size_t bytes_ready = task.current_offset - task.last_submitted_offset; const u32 complete_slices = static_cast(bytes_ready / task.bytes_per_slice); - if (complete_slices >= swizzle_slices_per_batch || (is_final_batch && complete_slices > 0)) { + if( swizzle_slices_per_batch <= 0 ) { + runtime.AccelerateImageUpload(image, task.staging_buffer, FixSmallVectorADL(FullUploadSwizzles(task.info)), 0, image.info.size.depth); + task.last_submitted_offset += (static_cast(image.info.size.depth) * task.bytes_per_slice); + } + else if (complete_slices >= swizzle_slices_per_batch || (is_final_batch && complete_slices > 0)) { const u32 z_start = static_cast(task.last_submitted_offset / task.bytes_per_slice); const u32 slices_to_process = (std::min)(complete_slices, swizzle_slices_per_batch); const u32 z_count = (std::min)(slices_to_process, image.info.size.depth - z_start); @@ -1468,7 +1477,7 @@ void TextureCache

::TickAsyncUnswizzle() { unswizzle_queue.pop_front(); // Wait 4 frames to process the next entry - current_unswizzle_frame = 4u; + // current_unswizzle_frame = 4u; } }