yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

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.
This commit is contained in:
Lioncash 2019-04-29 18:26:15 -04:00
parent de93507a5a
commit 03746be097
2 changed files with 13 additions and 6 deletions

View File

@ -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;
}

View File

@ -28,6 +28,7 @@ private:
enum class AudioFeatures : u32 {
Splitter,
PerformanceMetricsVersion2,
};
bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const;