diff options
| author | 2019-04-29 18:26:15 -0400 | |
|---|---|---|
| committer | 2019-04-30 23:52:28 -0400 | |
| commit | 03746be097a28db429f05512275a4efe49bd0798 (patch) | |
| tree | 584449f8f0853c64c0b955f8c3244a6b02c60a27 /src/core | |
| parent | service/audren_u: Clean up work buffer calculations (diff) | |
| download | yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.gz yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.xz yuzu-03746be097a28db429f05512275a4efe49bd0798.zip | |
service/audren_u: Handle version 2 of performance frame info in GetWorkBufferSize()
Introduced in REV5. This is trivial to add support for, now that
everything isn't a mess of random magic constant values.
All this is, is a change in data type sizes as far as this function
cares.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 18 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audren_u.h | 1 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 4c9e124cb..0f325fe07 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -426,15 +426,19 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { | |||
| 426 | }; | 426 | }; |
| 427 | 427 | ||
| 428 | // Calculates the part of the size related to performance statistics. | 428 | // Calculates the part of the size related to performance statistics. |
| 429 | const auto calculate_performance_size = [](const AudioCore::AudioRendererParameter& params) { | 429 | const auto calculate_perf_size = [this](const AudioCore::AudioRendererParameter& params) { |
| 430 | // Extra size value appended to the end of the calculation. | 430 | // Extra size value appended to the end of the calculation. |
| 431 | constexpr u64 appended = 128; | 431 | constexpr u64 appended = 128; |
| 432 | 432 | ||
| 433 | // Whether or not we assume the newer version of performance metrics data structures. | ||
| 434 | const bool is_v2 = | ||
| 435 | IsFeatureSupported(AudioFeatures::PerformanceMetricsVersion2, params.revision); | ||
| 436 | |||
| 433 | // Data structure sizes | 437 | // Data structure sizes |
| 434 | constexpr u64 perf_statistics_size = 0x0C; | 438 | constexpr u64 perf_statistics_size = 0x0C; |
| 435 | constexpr u64 header_size = 0x18; | 439 | const u64 header_size = is_v2 ? 0x30 : 0x18; |
| 436 | constexpr u64 entry_size = 0x10; | 440 | const u64 entry_size = is_v2 ? 0x18 : 0x10; |
| 437 | constexpr u64 detail_size = 0x10; | 441 | const u64 detail_size = is_v2 ? 0x18 : 0x10; |
| 438 | 442 | ||
| 439 | constexpr u64 max_detail_entries = 100; | 443 | constexpr u64 max_detail_entries = 100; |
| 440 | 444 | ||
| @@ -474,7 +478,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) { | |||
| 474 | size += calculate_effect_info_size(params); | 478 | size += calculate_effect_info_size(params); |
| 475 | size += calculate_sink_info_size(params); | 479 | size += calculate_sink_info_size(params); |
| 476 | size += calculate_voice_state_size(params); | 480 | size += calculate_voice_state_size(params); |
| 477 | size += calculate_performance_size(params); | 481 | size += calculate_perf_size(params); |
| 478 | size += calculate_command_buffer_size(); | 482 | size += calculate_command_buffer_size(); |
| 479 | 483 | ||
| 480 | // finally, 4KB page align the size, and we're done. | 484 | // finally, 4KB page align the size, and we're done. |
| @@ -525,7 +529,9 @@ bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const { | |||
| 525 | u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap | 529 | u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap |
| 526 | switch (feature) { | 530 | switch (feature) { |
| 527 | case AudioFeatures::Splitter: | 531 | case AudioFeatures::Splitter: |
| 528 | return version_num >= 2u; | 532 | return version_num >= 2U; |
| 533 | case AudioFeatures::PerformanceMetricsVersion2: | ||
| 534 | return version_num >= 5U; | ||
| 529 | default: | 535 | default: |
| 530 | return false; | 536 | return false; |
| 531 | } | 537 | } |
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index e55d25973..b8f71c37c 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h | |||
| @@ -28,6 +28,7 @@ private: | |||
| 28 | 28 | ||
| 29 | enum class AudioFeatures : u32 { | 29 | enum class AudioFeatures : u32 { |
| 30 | Splitter, | 30 | Splitter, |
| 31 | PerformanceMetricsVersion2, | ||
| 31 | }; | 32 | }; |
| 32 | 33 | ||
| 33 | bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; | 34 | bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; |