summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/shader_bytecode.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 7a6355ce2..d3d05a866 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -574,7 +574,7 @@ enum class ShuffleOperation : u64 {
574}; 574};
575 575
576union Instruction { 576union Instruction {
577 Instruction& operator=(const Instruction& instr) { 577 constexpr Instruction& operator=(const Instruction& instr) {
578 value = instr.value; 578 value = instr.value;
579 return *this; 579 return *this;
580 } 580 }
@@ -1760,22 +1760,22 @@ public:
1760 1760
1761 class Matcher { 1761 class Matcher {
1762 public: 1762 public:
1763 Matcher(const char* const name, u16 mask, u16 expected, OpCode::Id id, OpCode::Type type) 1763 constexpr Matcher(const char* const name, u16 mask, u16 expected, Id id, Type type)
1764 : name{name}, mask{mask}, expected{expected}, id{id}, type{type} {} 1764 : name{name}, mask{mask}, expected{expected}, id{id}, type{type} {}
1765 1765
1766 const char* GetName() const { 1766 constexpr const char* GetName() const {
1767 return name; 1767 return name;
1768 } 1768 }
1769 1769
1770 u16 GetMask() const { 1770 constexpr u16 GetMask() const {
1771 return mask; 1771 return mask;
1772 } 1772 }
1773 1773
1774 Id GetId() const { 1774 constexpr Id GetId() const {
1775 return id; 1775 return id;
1776 } 1776 }
1777 1777
1778 Type GetType() const { 1778 constexpr Type GetType() const {
1779 return type; 1779 return type;
1780 } 1780 }
1781 1781
@@ -1784,7 +1784,7 @@ public:
1784 * @param instruction The instruction to test 1784 * @param instruction The instruction to test
1785 * @returns true if the given instruction matches. 1785 * @returns true if the given instruction matches.
1786 */ 1786 */
1787 bool Matches(u16 instruction) const { 1787 constexpr bool Matches(u16 instruction) const {
1788 return (instruction & mask) == expected; 1788 return (instruction & mask) == expected;
1789 } 1789 }
1790 1790
@@ -1818,7 +1818,7 @@ private:
1818 * A '0' in a bitstring indicates that a zero must be present at that bit position. 1818 * A '0' in a bitstring indicates that a zero must be present at that bit position.
1819 * A '1' in a bitstring indicates that a one must be present at that bit position. 1819 * A '1' in a bitstring indicates that a one must be present at that bit position.
1820 */ 1820 */
1821 static auto GetMaskAndExpect(const char* const bitstring) { 1821 static constexpr auto GetMaskAndExpect(const char* const bitstring) {
1822 u16 mask = 0, expect = 0; 1822 u16 mask = 0, expect = 0;
1823 for (std::size_t i = 0; i < opcode_bitsize; i++) { 1823 for (std::size_t i = 0; i < opcode_bitsize; i++) {
1824 const std::size_t bit_position = opcode_bitsize - i - 1; 1824 const std::size_t bit_position = opcode_bitsize - i - 1;
@@ -1835,15 +1835,15 @@ private:
1835 break; 1835 break;
1836 } 1836 }
1837 } 1837 }
1838 return std::make_tuple(mask, expect); 1838 return std::make_pair(mask, expect);
1839 } 1839 }
1840 1840
1841 public: 1841 public:
1842 /// Creates a matcher that can match and parse instructions based on bitstring. 1842 /// Creates a matcher that can match and parse instructions based on bitstring.
1843 static auto GetMatcher(const char* const bitstring, OpCode::Id op, OpCode::Type type, 1843 static constexpr auto GetMatcher(const char* const bitstring, Id op, Type type,
1844 const char* const name) { 1844 const char* const name) {
1845 const auto mask_expect = GetMaskAndExpect(bitstring); 1845 const auto [mask, expected] = GetMaskAndExpect(bitstring);
1846 return Matcher(name, std::get<0>(mask_expect), std::get<1>(mask_expect), op, type); 1846 return Matcher(name, mask, expected, op, type);
1847 } 1847 }
1848 }; 1848 };
1849 1849