diff options
| author | 2021-12-18 14:15:34 +0800 | |
|---|---|---|
| committer | 2021-12-18 14:27:07 +0800 | |
| commit | 4908a07c20f98f4b7dd604d1fc6865b47bc5c182 (patch) | |
| tree | 952ce34bb33d48de6c318b49c584047df2e8fde3 /src/shader_recompiler/frontend | |
| parent | Remove spirv handle legacy related code (diff) | |
| download | yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.gz yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.tar.xz yuzu-4908a07c20f98f4b7dd604d1fc6865b47bc5c182.zip | |
Address format clang
Diffstat (limited to 'src/shader_recompiler/frontend')
| -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) { | |||
| 128 | }); | 128 | }); |
| 129 | } | 129 | } |
| 130 | } | 130 | } |
| 131 | |||
| 132 | bool IsLegacyAttribute(IR::Attribute attribute) { | ||
| 133 | return (attribute >= IR::Attribute::ColorFrontDiffuseR && | ||
| 134 | attribute <= IR::Attribute::ColorBackSpecularA) || | ||
| 135 | attribute == IR::Attribute::FogCoordinate || | ||
| 136 | (attribute >= IR::Attribute::FixedFncTexture0S && | ||
| 137 | attribute <= IR::Attribute::FixedFncTexture9Q); | ||
| 138 | } | ||
| 139 | |||
| 140 | std::map<IR::Attribute, IR::Attribute> GenerateLegacyToGenericMappings( | ||
| 141 | const VaryingState& state, std::queue<IR::Attribute> ununsed_generics) { | ||
| 142 | std::map<IR::Attribute, IR::Attribute> mapping; | ||
| 143 | for (size_t index = 0; index < 4; ++index) { | ||
| 144 | auto attr = IR::Attribute::ColorFrontDiffuseR + index * 4; | ||
| 145 | if (state.AnyComponent(attr)) { | ||
| 146 | for (size_t i = 0; i < 4; ++i) { | ||
| 147 | mapping.insert({attr + i, ununsed_generics.front() + i}); | ||
| 148 | } | ||
| 149 | ununsed_generics.pop(); | ||
| 150 | } | ||
| 151 | } | ||
| 152 | if (state[IR::Attribute::FogCoordinate]) { | ||
| 153 | mapping.insert({IR::Attribute::FogCoordinate, ununsed_generics.front()}); | ||
| 154 | ununsed_generics.pop(); | ||
| 155 | } | ||
| 156 | for (size_t index = 0; index < IR::NUM_FIXEDFNCTEXTURE; ++index) { | ||
| 157 | auto attr = IR::Attribute::FixedFncTexture0S + index * 4; | ||
| 158 | if (state.AnyComponent(attr)) { | ||
| 159 | for (size_t i = 0; i < 4; ++i) { | ||
| 160 | mapping.insert({attr + i, ununsed_generics.front() + i}); | ||
| 161 | } | ||
| 162 | ununsed_generics.pop(); | ||
| 163 | } | ||
| 164 | } | ||
| 165 | return mapping; | ||
| 166 | } | ||
| 131 | } // Anonymous namespace | 167 | } // Anonymous namespace |
| 132 | 168 | ||
| 133 | IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool, | 169 | 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 | |||
| 227 | return result; | 263 | return result; |
| 228 | } | 264 | } |
| 229 | 265 | ||
| 230 | bool IsLegacyAttribute(IR::Attribute attribute) { | ||
| 231 | return (attribute >= IR::Attribute::ColorFrontDiffuseR && | ||
| 232 | attribute <= IR::Attribute::ColorBackSpecularA) || | ||
| 233 | attribute == IR::Attribute::FogCoordinate || | ||
| 234 | (attribute >= IR::Attribute::FixedFncTexture0S && | ||
| 235 | attribute <= IR::Attribute::FixedFncTexture9Q); | ||
| 236 | } | ||
| 237 | |||
| 238 | std::map<IR::Attribute, IR::Attribute> GenerateLegacyToGenericMappings( | ||
| 239 | const VaryingState& state, std::queue<IR::Attribute> ununsed_generics) { | ||
| 240 | std::map<IR::Attribute, IR::Attribute> mapping; | ||
| 241 | for (size_t index = 0; index < 4; ++index) { | ||
| 242 | auto attr = IR::Attribute::ColorFrontDiffuseR + index * 4; | ||
| 243 | if (state.AnyComponent(attr)) { | ||
| 244 | for (size_t i = 0; i < 4; ++i) { | ||
| 245 | mapping.insert({attr + i, ununsed_generics.front() + i}); | ||
| 246 | } | ||
| 247 | ununsed_generics.pop(); | ||
| 248 | } | ||
| 249 | } | ||
| 250 | if (state[IR::Attribute::FogCoordinate]) { | ||
| 251 | mapping.insert({IR::Attribute::FogCoordinate, ununsed_generics.front()}); | ||
| 252 | ununsed_generics.pop(); | ||
| 253 | } | ||
| 254 | for (size_t index = 0; index < IR::NUM_FIXED_FNC_TEXTURES; ++index) { | ||
| 255 | auto attr = IR::Attribute::FixedFncTexture0S + index * 4; | ||
| 256 | if (state.AnyComponent(attr)) { | ||
| 257 | for (size_t i = 0; i < 4; ++i) { | ||
| 258 | mapping.insert({attr + i, ununsed_generics.front() + i}); | ||
| 259 | } | ||
| 260 | ununsed_generics.pop(); | ||
| 261 | } | ||
| 262 | } | ||
| 263 | return mapping; | ||
| 264 | } | ||
| 265 | |||
| 266 | void ConvertLegacyToGeneric(IR::Program& program, const Shader::RuntimeInfo& runtime_info) { | 266 | void ConvertLegacyToGeneric(IR::Program& program, const Shader::RuntimeInfo& runtime_info) { |
| 267 | auto& stores = program.info.stores; | 267 | auto& stores = program.info.stores; |
| 268 | if (stores.Legacy()) { | 268 | if (stores.Legacy()) { |