diff options
author | Liam <byteslice@airmail.cc> | 2023-08-10 02:58:47 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-08-10 04:38:37 +0200 |
commit | 023b9b38cc9c6d31f1a01c29ac324c535308fa59 (patch) | |
tree | 3a7708c421d12e1840b772c18ce2f17e1dfbda97 /src/common/settings_enums.h | |
parent | Merge pull request #11216 from lat9nq/no-mesa-astc (diff) | |
download | yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.tar yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.tar.gz yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.tar.bz2 yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.tar.lz yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.tar.xz yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.tar.zst yuzu-023b9b38cc9c6d31f1a01c29ac324c535308fa59.zip |
Diffstat (limited to 'src/common/settings_enums.h')
-rw-r--r-- | src/common/settings_enums.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index a1a29ebf6..e7cb59ea5 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -12,8 +12,8 @@ namespace Settings { template <typename T> struct EnumMetadata { - static constexpr std::vector<std::pair<std::string, T>> Canonicalizations(); - static constexpr u32 Index(); + static std::vector<std::pair<std::string, T>> Canonicalizations(); + static u32 Index(); }; #define PAIR_45(N, X, ...) {#X, N::X} __VA_OPT__(, PAIR_46(N, __VA_ARGS__)) @@ -66,11 +66,11 @@ struct EnumMetadata { #define ENUM(NAME, ...) \ enum class NAME : u32 { __VA_ARGS__ }; \ template <> \ - constexpr std::vector<std::pair<std::string, NAME>> EnumMetadata<NAME>::Canonicalizations() { \ + inline std::vector<std::pair<std::string, NAME>> EnumMetadata<NAME>::Canonicalizations() { \ return {PAIR(NAME, __VA_ARGS__)}; \ } \ template <> \ - constexpr u32 EnumMetadata<NAME>::Index() { \ + inline u32 EnumMetadata<NAME>::Index() { \ return __COUNTER__; \ } @@ -85,7 +85,7 @@ enum class AudioEngine : u32 { }; template <> -constexpr std::vector<std::pair<std::string, AudioEngine>> +inline std::vector<std::pair<std::string, AudioEngine>> EnumMetadata<AudioEngine>::Canonicalizations() { return { {"auto", AudioEngine::Auto}, @@ -96,7 +96,7 @@ EnumMetadata<AudioEngine>::Canonicalizations() { } template <> -constexpr u32 EnumMetadata<AudioEngine>::Index() { +inline u32 EnumMetadata<AudioEngine>::Index() { // This is just a sufficiently large number that is more than the number of other enums declared // here return 100; @@ -147,7 +147,7 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); template <typename Type> -constexpr std::string CanonicalizeEnum(Type id) { +inline std::string CanonicalizeEnum(Type id) { const auto group = EnumMetadata<Type>::Canonicalizations(); for (auto& [name, value] : group) { if (value == id) { @@ -158,7 +158,7 @@ constexpr std::string CanonicalizeEnum(Type id) { } template <typename Type> -constexpr Type ToEnum(const std::string& canonicalization) { +inline Type ToEnum(const std::string& canonicalization) { const auto group = EnumMetadata<Type>::Canonicalizations(); for (auto& [name, value] : group) { if (name == canonicalization) { |