summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-30 00:26:15 +0200
committerLioncash <mathew1800@gmail.com>2019-05-01 05:52:28 +0200
commit03746be097a28db429f05512275a4efe49bd0798 (patch)
tree584449f8f0853c64c0b955f8c3244a6b02c60a27 /src/core/hle/service
parentservice/audren_u: Clean up work buffer calculations (diff)
downloadyuzu-03746be097a28db429f05512275a4efe49bd0798.tar
yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.gz
yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.bz2
yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.lz
yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.xz
yuzu-03746be097a28db429f05512275a4efe49bd0798.tar.zst
yuzu-03746be097a28db429f05512275a4efe49bd0798.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/audio/audren_u.cpp18
-rw-r--r--src/core/hle/service/audio/audren_u.h1
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) {
};
// Calculates the part of the size related to performance statistics.
- const auto calculate_performance_size = [](const AudioCore::AudioRendererParameter& params) {
+ const auto calculate_perf_size = [this](const AudioCore::AudioRendererParameter& params) {
// Extra size value appended to the end of the calculation.
constexpr u64 appended = 128;
+ // Whether or not we assume the newer version of performance metrics data structures.
+ const bool is_v2 =
+ IsFeatureSupported(AudioFeatures::PerformanceMetricsVersion2, params.revision);
+
// Data structure sizes
constexpr u64 perf_statistics_size = 0x0C;
- constexpr u64 header_size = 0x18;
- constexpr u64 entry_size = 0x10;
- constexpr u64 detail_size = 0x10;
+ const u64 header_size = is_v2 ? 0x30 : 0x18;
+ const u64 entry_size = is_v2 ? 0x18 : 0x10;
+ const u64 detail_size = is_v2 ? 0x18 : 0x10;
constexpr u64 max_detail_entries = 100;
@@ -474,7 +478,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
size += calculate_effect_info_size(params);
size += calculate_sink_info_size(params);
size += calculate_voice_state_size(params);
- size += calculate_performance_size(params);
+ size += calculate_perf_size(params);
size += calculate_command_buffer_size();
// finally, 4KB page align the size, and we're done.
@@ -525,7 +529,9 @@ bool AudRenU::IsFeatureSupported(AudioFeatures feature, u32_le revision) const {
u32_be version_num = (revision - Common::MakeMagic('R', 'E', 'V', '0')); // Byte swap
switch (feature) {
case AudioFeatures::Splitter:
- return version_num >= 2u;
+ return version_num >= 2U;
+ case AudioFeatures::PerformanceMetricsVersion2:
+ return version_num >= 5U;
default:
return false;
}
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:
enum class AudioFeatures : u32 {
Splitter,
+ PerformanceMetricsVersion2,
};
bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const;