2020-04-19 23:04:05 +02:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
2020-03-27 20:36:02 +01:00
|
|
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
|
|
|
|
2020-01-24 23:04:16 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-03-26 15:33:19 +01:00
|
|
|
|
2020-03-25 18:59:37 +01:00
|
|
|
namespace skyline {
|
2020-01-24 23:04:16 +01:00
|
|
|
namespace constant {
|
2022-03-28 16:40:17 +02:00
|
|
|
constexpr u32 SupportedRevision{11}; //!< The audren revision our implementation supports
|
2020-08-21 15:28:47 +02:00
|
|
|
constexpr u32 Rev0Magic{util::MakeMagic<u32>("REV0")}; //!< The HOS 1.0 revision magic
|
|
|
|
constexpr u32 RevMagic{Rev0Magic + (SupportedRevision << 24)}; //!< The revision magic for our supported revision
|
2020-01-24 23:04:16 +01:00
|
|
|
|
|
|
|
namespace supportTags {
|
2020-08-21 15:28:47 +02:00
|
|
|
constexpr u32 Splitter{2}; //!< The revision splitter support was added
|
|
|
|
constexpr u32 SplitterBugFix{5}; //!< The revision the splitter buffer was made aligned
|
|
|
|
constexpr u32 PerformanceMetricsDataFormatV2{5}; //!< The revision a new performance metrics format is used
|
|
|
|
constexpr u32 VaradicCommandBufferSize{5}; //!< The revision support for varying command buffer sizes was added
|
|
|
|
constexpr u32 ElapsedFrameCount{5}; //!< The revision support for counting elapsed frames was added
|
2021-02-06 13:36:58 +01:00
|
|
|
}
|
2020-01-24 23:04:16 +01:00
|
|
|
}
|
|
|
|
|
2020-03-25 18:59:37 +01:00
|
|
|
namespace service::audio::IAudioRenderer {
|
2020-01-24 23:04:16 +01:00
|
|
|
/**
|
2020-03-25 18:59:37 +01:00
|
|
|
* @brief Extracts the audren version from a revision magic
|
|
|
|
* @param revision The revision magic
|
|
|
|
* @return The revision number from the magic
|
|
|
|
*/
|
|
|
|
inline u32 ExtractVersionFromRevision(u32 revision) {
|
|
|
|
return (revision - constant::Rev0Magic) >> 24;
|
2020-01-24 23:04:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-09-28 12:05:17 +02:00
|
|
|
* @brief The RevisionInfo class is used to query the supported features of various audren revisions
|
|
|
|
*/
|
2020-03-25 18:59:37 +01:00
|
|
|
class RevisionInfo {
|
|
|
|
private:
|
|
|
|
u32 userRevision; //!< The current audren revision of the guest
|
2020-01-24 23:04:16 +01:00
|
|
|
|
2020-03-25 18:59:37 +01:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief Extracts the audren revision from the magic and sets the behaviour revision to it
|
|
|
|
* @param revision The revision magic from guest
|
|
|
|
*/
|
2021-02-06 13:36:58 +01:00
|
|
|
void SetUserRevision(u32 revision) {
|
2020-03-25 18:59:37 +01:00
|
|
|
userRevision = ExtractVersionFromRevision(revision);
|
2020-01-24 23:04:16 +01:00
|
|
|
|
2020-03-25 18:59:37 +01:00
|
|
|
if (userRevision > constant::SupportedRevision)
|
|
|
|
throw exception("Unsupported audren revision: {}", userRevision);
|
|
|
|
}
|
2020-01-24 23:04:16 +01:00
|
|
|
|
2020-03-25 18:59:37 +01:00
|
|
|
/**
|
|
|
|
* @return Whether the splitter is supported
|
|
|
|
*/
|
2021-02-06 13:36:58 +01:00
|
|
|
bool SplitterSupported() {
|
2020-03-25 18:59:37 +01:00
|
|
|
return userRevision >= constant::supportTags::Splitter;
|
|
|
|
}
|
2020-01-24 23:04:16 +01:00
|
|
|
|
2020-03-25 18:59:37 +01:00
|
|
|
/**
|
|
|
|
* @return Whether the splitter is fixed
|
|
|
|
*/
|
2021-02-06 13:36:58 +01:00
|
|
|
bool SplitterBugFixed() {
|
2020-03-25 18:59:37 +01:00
|
|
|
return userRevision >= constant::supportTags::SplitterBugFix;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Whether the new performance metrics format is used
|
|
|
|
*/
|
2021-02-06 13:36:58 +01:00
|
|
|
bool UsesPerformanceMetricDataFormatV2() {
|
2020-03-25 18:59:37 +01:00
|
|
|
return userRevision >= constant::supportTags::PerformanceMetricsDataFormatV2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Whether varying command buffer sizes are supported
|
|
|
|
*/
|
2021-02-06 13:36:58 +01:00
|
|
|
bool VaradicCommandBufferSizeSupported() {
|
2020-03-25 18:59:37 +01:00
|
|
|
return userRevision >= constant::supportTags::VaradicCommandBufferSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Whether elapsed frame counting is supported
|
|
|
|
*/
|
2021-02-06 13:36:58 +01:00
|
|
|
bool ElapsedFrameCountSupported() {
|
2020-03-25 18:59:37 +01:00
|
|
|
return userRevision >= constant::supportTags::ElapsedFrameCount;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2020-01-24 23:04:16 +01:00
|
|
|
}
|