diff options
author | vonchenplus <vonchenplus@gmail.com> | 2021-12-18 07:15:34 +0100 |
---|---|---|
committer | vonchenplus <vonchenplus@gmail.com> | 2021-12-18 07:27:07 +0100 |
commit | 4908a07c20f98f4b7dd604d1fc6865b47bc5c182 (patch) | |
tree | 952ce34bb33d48de6c318b49c584047df2e8fde3 /src/shader_recompiler/frontend/maxwell | |
parent | Remove spirv handle legacy related code (diff) | |
download | yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.gz yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.bz2 yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.lz yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.xz yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.zst yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
-rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate_program.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate_program.cpp b/src/shader_recompiler/frontend/maxwell/translate_program.cpp index 40c9307db..248ad3ced 100644 --- a/src/shader_recompiler/frontend/maxwell/translate_program.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate_program.cpp @@ -128,6 +128,42 @@ void AddNVNStorageBuffers(IR::Program& program) { }); } } + +bool IsLegacyAttribute(IR::Attribute attribute) { + return (attribute >= IR::Attribute::ColorFrontDiffuseR && + attribute <= IR::Attribute::ColorBackSpecularA) || + attribute == IR::Attribute::FogCoordinate || + (attribute >= IR::Attribute::FixedFncTexture0S && + attribute <= IR::Attribute::FixedFncTexture9Q); +} + +std::map<IR::Attribute, IR::Attribute> GenerateLegacyToGenericMappings( + const VaryingState& state, std::queue<IR::Attribute> ununsed_generics) { + std::map<IR::Attribute, IR::Attribute> mapping; + for (size_t index = 0; index < 4; ++index) { + auto attr = IR::Attribute::ColorFrontDiffuseR + index * 4; + if (state.AnyComponent(attr)) { + for (size_t i = 0; i < 4; ++i) { + mapping.insert({attr + i, ununsed_generics.front() + i}); + } + ununsed_generics.pop(); + } + } + if (state[IR::Attribute::FogCoordinate]) { + mapping.insert({IR::Attribute::FogCoordinate, ununsed_generics.front()}); + ununsed_generics.pop(); + } + for (size_t index = 0; index < IR::NUM_FIXEDFNCTEXTURE; ++index) { + auto attr = IR::Attribute::FixedFncTexture0S + index * 4; + if (state.AnyComponent(attr)) { + for (size_t i = 0; i < 4; ++i) { + mapping.insert({attr + i, ununsed_generics.front() + i}); + } + ununsed_generics.pop(); + } + } + return mapping; +} } // Anonymous namespace IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool, @@ -227,42 +263,6 @@ IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b return result; } -bool IsLegacyAttribute(IR::Attribute attribute) { - return (attribute >= IR::Attribute::ColorFrontDiffuseR && - attribute <= IR::Attribute::ColorBackSpecularA) || - attribute == IR::Attribute::FogCoordinate || - (attribute >= IR::Attribute::FixedFncTexture0S && - attribute <= IR::Attribute::FixedFncTexture9Q); -} - -std::map<IR::Attribute, IR::Attribute> GenerateLegacyToGenericMappings( - const VaryingState& state, std::queue<IR::Attribute> ununsed_generics) { - std::map<IR::Attribute, IR::Attribute> mapping; - for (size_t index = 0; index < 4; ++index) { - auto attr = IR::Attribute::ColorFrontDiffuseR + index * 4; - if (state.AnyComponent(attr)) { - for (size_t i = 0; i < 4; ++i) { - mapping.insert({attr + i, ununsed_generics.front() + i}); - } - ununsed_generics.pop(); - } - } - if (state[IR::Attribute::FogCoordinate]) { - mapping.insert({IR::Attribute::FogCoordinate, ununsed_generics.front()}); - ununsed_generics.pop(); - } - for (size_t index = 0; index < IR::NUM_FIXED_FNC_TEXTURES; ++index) { - auto attr = IR::Attribute::FixedFncTexture0S + index * 4; - if (state.AnyComponent(attr)) { - for (size_t i = 0; i < 4; ++i) { - mapping.insert({attr + i, ununsed_generics.front() + i}); - } - ununsed_generics.pop(); - } - } - return mapping; -} - void ConvertLegacyToGeneric(IR::Program& program, const Shader::RuntimeInfo& runtime_info) { auto& stores = program.info.stores; if (stores.Legacy()) { |