From a7bbaa489755c9847416c8c96f0eefb9e78a50a0 Mon Sep 17 00:00:00 2001 From: Feng Chen Date: Fri, 3 Sep 2021 23:52:20 +0800 Subject: Rename parameters --- src/shader_recompiler/frontend/ir/attribute.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/shader_recompiler/frontend/ir/attribute.cpp') 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 @@ namespace Shader::IR { -u32 TxtCoordAttributeIndex(Attribute attribute) { +bool IsFixedFncTexture(Attribute attribute) { + return attribute >= Attribute::FixedFncTexture0S && attribute <= Attribute::FixedFncTexture9Q; +} + +u32 FixedFncTextureAttributeIndex(Attribute attribute) { + if (!IsFixedFncTexture(attribute)) { + throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute); + } return (static_cast(attribute) - static_cast(Attribute::FixedFncTexture0S)) / 4u; } -u32 TxtCoordAttributeElement(Attribute attribute) { +u32 FixedFncTextureAttributeElement(Attribute attribute) { + if (!IsFixedFncTexture(attribute)) { + throw InvalidArgument("Attribute is not fixedfnctexture {}", attribute); + } return static_cast(attribute) % 4; } -- cgit v1.2.3