diff options
| author | 2021-09-01 00:07:25 +0800 | |
|---|---|---|
| committer | 2021-09-01 00:07:25 +0800 | |
| commit | 73b11f390e3dabf42d22af78670c8aa6d8f52cee (patch) | |
| tree | 3af775771173d1e827d2e1a05ada642a43fba9a9 /src/shader_recompiler/frontend/ir | |
| parent | Merge pull request #6905 from Morph1984/nifm-misc (diff) | |
| download | yuzu-73b11f390e3dabf42d22af78670c8aa6d8f52cee.tar.gz yuzu-73b11f390e3dabf42d22af78670c8aa6d8f52cee.tar.xz yuzu-73b11f390e3dabf42d22af78670c8aa6d8f52cee.zip | |
Add colorfront and txtcoord support
Diffstat (limited to '')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.cpp | 8 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.h | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/attribute.cpp b/src/shader_recompiler/frontend/ir/attribute.cpp index 4d0b8b8e5..dc2bec06d 100644 --- a/src/shader_recompiler/frontend/ir/attribute.cpp +++ b/src/shader_recompiler/frontend/ir/attribute.cpp | |||
| @@ -9,6 +9,14 @@ | |||
| 9 | 9 | ||
| 10 | namespace Shader::IR { | 10 | namespace Shader::IR { |
| 11 | 11 | ||
| 12 | u32 TxtCoordAttributeIndex(Attribute attribute) { | ||
| 13 | return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::FixedFncTexture0S)) / 4u; | ||
| 14 | } | ||
| 15 | |||
| 16 | u32 TxtCoordAttributeElement(Attribute attribute) { | ||
| 17 | return static_cast<u32>(attribute) % 4; | ||
| 18 | } | ||
| 19 | |||
| 12 | bool IsGeneric(Attribute attribute) noexcept { | 20 | bool IsGeneric(Attribute attribute) noexcept { |
| 13 | return attribute >= Attribute::Generic0X && attribute <= Attribute::Generic31X; | 21 | return attribute >= Attribute::Generic0X && attribute <= Attribute::Generic31X; |
| 14 | } | 22 | } |
diff --git a/src/shader_recompiler/frontend/ir/attribute.h b/src/shader_recompiler/frontend/ir/attribute.h index ca1199494..6957fb43b 100644 --- a/src/shader_recompiler/frontend/ir/attribute.h +++ b/src/shader_recompiler/frontend/ir/attribute.h | |||
| @@ -222,8 +222,13 @@ enum class Attribute : u64 { | |||
| 222 | FrontFace = 255, | 222 | FrontFace = 255, |
| 223 | }; | 223 | }; |
| 224 | 224 | ||
| 225 | constexpr size_t NUM_TXT_COORD = 10; | ||
| 225 | constexpr size_t NUM_GENERICS = 32; | 226 | constexpr size_t NUM_GENERICS = 32; |
| 226 | 227 | ||
| 228 | [[nodiscard]] u32 TxtCoordAttributeIndex(Attribute attribute); | ||
| 229 | |||
| 230 | [[nodiscard]] u32 TxtCoordAttributeElement(Attribute attribute); | ||
| 231 | |||
| 227 | [[nodiscard]] bool IsGeneric(Attribute attribute) noexcept; | 232 | [[nodiscard]] bool IsGeneric(Attribute attribute) noexcept; |
| 228 | 233 | ||
| 229 | [[nodiscard]] u32 GenericAttributeIndex(Attribute attribute); | 234 | [[nodiscard]] u32 GenericAttributeIndex(Attribute attribute); |