diff options
Diffstat (limited to 'src/shader_recompiler/frontend')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.cpp | 14 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.h | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/shader_recompiler/frontend/ir/attribute.cpp b/src/shader_recompiler/frontend/ir/attribute.cpp index dc2bec06d..5b3694f65 100644 --- a/src/shader_recompiler/frontend/ir/attribute.cpp +++ b/src/shader_recompiler/frontend/ir/attribute.cpp | |||
| @@ -9,11 +9,21 @@ | |||
| 9 | 9 | ||
| 10 | namespace Shader::IR { | 10 | namespace Shader::IR { |
| 11 | 11 | ||
| 12 | u32 TxtCoordAttributeIndex(Attribute attribute) { | 12 | bool IsFixedFncTexture(Attribute attribute) { |
| 13 | return attribute >= Attribute::FixedFncTexture0S && attribute <= Attribute::FixedFncTexture9Q; | ||
| 14 | } | ||
| 15 | |||
| 16 | u32 FixedFncTextureAttributeIndex(Attribute attribute) { | ||
| 17 | if (!IsFixedFncTexture(attribute)) { | ||
| 18 | throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute); | ||
| 19 | } | ||
| 13 | return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::FixedFncTexture0S)) / 4u; | 20 | return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::FixedFncTexture0S)) / 4u; |
| 14 | } | 21 | } |
| 15 | 22 | ||
| 16 | u32 TxtCoordAttributeElement(Attribute attribute) { | 23 | u32 FixedFncTextureAttributeElement(Attribute attribute) { |
| 24 | if (!IsFixedFncTexture(attribute)) { | ||
| 25 | throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute); | ||
| 26 | } | ||
| 17 | return static_cast<u32>(attribute) % 4; | 27 | return static_cast<u32>(attribute) % 4; |
| 18 | } | 28 | } |
| 19 | 29 | ||
diff --git a/src/shader_recompiler/frontend/ir/attribute.h b/src/shader_recompiler/frontend/ir/attribute.h index 6957fb43b..3f07fd7ac 100644 --- a/src/shader_recompiler/frontend/ir/attribute.h +++ b/src/shader_recompiler/frontend/ir/attribute.h | |||
| @@ -222,12 +222,12 @@ 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_FIXEDFNCTEXTURE = 10; |
| 226 | constexpr size_t NUM_GENERICS = 32; | 226 | constexpr size_t NUM_GENERICS = 32; |
| 227 | 227 | ||
| 228 | [[nodiscard]] u32 TxtCoordAttributeIndex(Attribute attribute); | 228 | [[nodiscard]] u32 FixedFncTextureAttributeIndex(Attribute attribute); |
| 229 | 229 | ||
| 230 | [[nodiscard]] u32 TxtCoordAttributeElement(Attribute attribute); | 230 | [[nodiscard]] u32 FixedFncTextureAttributeElement(Attribute attribute); |
| 231 | 231 | ||
| 232 | [[nodiscard]] bool IsGeneric(Attribute attribute) noexcept; | 232 | [[nodiscard]] bool IsGeneric(Attribute attribute) noexcept; |
| 233 | 233 | ||