From b9ab44ed0e8706eed9d7fa6f3d6e70b0299ef42e Mon Sep 17 00:00:00 2001 From: Squall Leonhart Date: Fri, 11 Aug 2023 00:51:24 +1000 Subject: [PATCH 1/3] Fix an assert in the format lookup table fir Z16 Came across this while looking into Asterix and Obelix XXL glitching --- src/video_core/texture_cache/format_lookup_table.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 11ced6c38b..0105bbff47 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp @@ -138,7 +138,7 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red, return PixelFormat::E5B9G9R9_FLOAT; case Hash(TextureFormat::Z32, FLOAT): return PixelFormat::D32_FLOAT; - case Hash(TextureFormat::Z16, UNORM): + case Hash(TextureFormat::Z16, UNORM, UINT, UINT, UINT, LINEAR): return PixelFormat::D16_UNORM; case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR): return PixelFormat::S8_UINT_D24_UNORM; From e3dd78e414802791063b13ee744581e5ab7d440c Mon Sep 17 00:00:00 2001 From: Squall-Leonhart Date: Fri, 11 Aug 2023 08:36:36 +1000 Subject: [PATCH 2/3] Needed to make this an extra case so it didnt also start asserting in BOTW. Thanks Liam --- src/video_core/texture_cache/format_lookup_table.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 0105bbff47..56307d0309 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp @@ -138,6 +138,8 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red, return PixelFormat::E5B9G9R9_FLOAT; case Hash(TextureFormat::Z32, FLOAT): return PixelFormat::D32_FLOAT; + case Hash(TextureFormat::Z16, UNORM): + return PixelFormat::D16_UNORM; case Hash(TextureFormat::Z16, UNORM, UINT, UINT, UINT, LINEAR): return PixelFormat::D16_UNORM; case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR): From 5d7571114e2621eeda85d3c4784b9dd5df2f8853 Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Sat, 16 Sep 2023 20:48:45 +0100 Subject: [PATCH 3/3] Do not consider voice commands in time estimation, fix adpcm estimate --- .../command/command_processing_time_estimator.cpp | 4 ++-- src/audio_core/renderer/system.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/audio_core/renderer/command/command_processing_time_estimator.cpp b/src/audio_core/renderer/command/command_processing_time_estimator.cpp index a48a016b1b..0f7aff1b47 100644 --- a/src/audio_core/renderer/command/command_processing_time_estimator.cpp +++ b/src/audio_core/renderer/command/command_processing_time_estimator.cpp @@ -27,12 +27,12 @@ u32 CommandProcessingTimeEstimatorVersion1::Estimate( u32 CommandProcessingTimeEstimatorVersion1::Estimate( const AdpcmDataSourceVersion1Command& command) const { - return static_cast(command.pitch * 0.25f * 1.2f); + return static_cast(command.pitch * 0.46f * 1.2f); } u32 CommandProcessingTimeEstimatorVersion1::Estimate( const AdpcmDataSourceVersion2Command& command) const { - return static_cast(command.pitch * 0.25f * 1.2f); + return static_cast(command.pitch * 0.46f * 1.2f); } u32 CommandProcessingTimeEstimatorVersion1::Estimate( diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index d29754634e..31f92087ca 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -684,11 +684,11 @@ u64 System::GenerateCommand(std::span in_command_buffer, sink_context, splitter_context, perf_manager}; voice_context.SortInfo(); + command_generator.GenerateVoiceCommands(); const auto start_estimated_time{drop_voice_param * static_cast(command_buffer.estimated_process_time)}; - command_generator.GenerateVoiceCommands(); command_generator.GenerateSubMixCommands(); command_generator.GenerateFinalMixCommands(); command_generator.GenerateSinkCommands(); @@ -708,11 +708,13 @@ u64 System::GenerateCommand(std::span in_command_buffer, const auto end_estimated_time{drop_voice_param * static_cast(command_buffer.estimated_process_time)}; + + const auto dsp_time_limit{((time_limit_percent / 100.0f) * 2'880'000.0f) * + (static_cast(render_time_limit_percent) / 100.0f)}; + const auto estimated_time{start_estimated_time - end_estimated_time}; - const auto time_limit{static_cast( - estimated_time + (((time_limit_percent / 100.0f) * 2'880'000.0) * - (static_cast(render_time_limit_percent) / 100.0f)))}; + const auto time_limit{static_cast(std::max(dsp_time_limit + estimated_time, 0.0f))}; num_voices_dropped = DropVoices(command_buffer, static_cast(start_estimated_time), time_limit); }