diff options
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/location.h')
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/location.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/location.h b/src/shader_recompiler/frontend/maxwell/location.h index 66b51a19e..26d29eae2 100644 --- a/src/shader_recompiler/frontend/maxwell/location.h +++ b/src/shader_recompiler/frontend/maxwell/location.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | namespace Shader::Maxwell { | 15 | namespace Shader::Maxwell { |
| 16 | 16 | ||
| 17 | class Location { | 17 | class Location { |
| 18 | static constexpr u32 VIRTUAL_OFFSET{std::numeric_limits<u32>::max()}; | 18 | static constexpr u32 VIRTUAL_BIAS{4}; |
| 19 | 19 | ||
| 20 | public: | 20 | public: |
| 21 | constexpr Location() = default; | 21 | constexpr Location() = default; |
| @@ -27,12 +27,18 @@ public: | |||
| 27 | Align(); | 27 | Align(); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | constexpr Location Virtual() const noexcept { | ||
| 31 | Location virtual_location; | ||
| 32 | virtual_location.offset = offset - VIRTUAL_BIAS; | ||
| 33 | return virtual_location; | ||
| 34 | } | ||
| 35 | |||
| 30 | [[nodiscard]] constexpr u32 Offset() const noexcept { | 36 | [[nodiscard]] constexpr u32 Offset() const noexcept { |
| 31 | return offset; | 37 | return offset; |
| 32 | } | 38 | } |
| 33 | 39 | ||
| 34 | [[nodiscard]] constexpr bool IsVirtual() const { | 40 | [[nodiscard]] constexpr bool IsVirtual() const { |
| 35 | return offset == VIRTUAL_OFFSET; | 41 | return offset % 8 == VIRTUAL_BIAS; |
| 36 | } | 42 | } |
| 37 | 43 | ||
| 38 | constexpr auto operator<=>(const Location&) const noexcept = default; | 44 | constexpr auto operator<=>(const Location&) const noexcept = default; |
| @@ -89,7 +95,7 @@ private: | |||
| 89 | offset -= 8 + (offset % 32 == 8 ? 8 : 0); | 95 | offset -= 8 + (offset % 32 == 8 ? 8 : 0); |
| 90 | } | 96 | } |
| 91 | 97 | ||
| 92 | u32 offset{VIRTUAL_OFFSET}; | 98 | u32 offset{0xcccccccc}; |
| 93 | }; | 99 | }; |
| 94 | 100 | ||
| 95 | } // namespace Shader::Maxwell | 101 | } // namespace Shader::Maxwell |