2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #992 from bunnei/declr-pred

gl_shader_decompiler: Declare predicates on use.
This commit is contained in:
bunnei 2018-08-09 14:36:52 -04:00 committed by GitHub
commit 0bfe974281
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -657,16 +657,17 @@ private:
* @param instr Instruction to generate the if condition for. * @param instr Instruction to generate the if condition for.
* @returns string containing the predicate condition. * @returns string containing the predicate condition.
*/ */
std::string GetPredicateCondition(u64 index, bool negate) const { std::string GetPredicateCondition(u64 index, bool negate) {
using Tegra::Shader::Pred; using Tegra::Shader::Pred;
std::string variable; std::string variable;
// Index 7 is used as an 'Always True' condition. // Index 7 is used as an 'Always True' condition.
if (index == static_cast<u64>(Pred::UnusedIndex)) if (index == static_cast<u64>(Pred::UnusedIndex)) {
variable = "true"; variable = "true";
else } else {
variable = 'p' + std::to_string(index) + '_' + suffix; variable = 'p' + std::to_string(index) + '_' + suffix;
declr_predicates.insert(variable);
}
if (negate) { if (negate) {
return "!(" + variable + ')'; return "!(" + variable + ')';
} }