From 54501962f60b87d5ea0790302138c6db81cc2f23 Mon Sep 17 00:00:00 2001 From: jduncanator <1518948+jduncanator@users.noreply.github.com> Date: Fri, 6 Mar 2020 11:09:49 +1100 Subject: Fix branch with CC and predicate, and a case of SYNC propagation (#967) --- Ryujinx.Graphics.Shader/Instructions/InstEmitFlow.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Ryujinx.Graphics.Shader/Instructions') diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitFlow.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitFlow.cs index 0b96d751..4b058a84 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitFlow.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitFlow.cs @@ -145,10 +145,24 @@ namespace Ryujinx.Graphics.Shader.Instructions if (op is OpCodeBranch opBranch && opBranch.Condition != Condition.Always) { - pred = context.BitwiseAnd(pred, GetCondition(context, opBranch.Condition)); - } + Operand cond = GetCondition(context, opBranch.Condition); - if (op.Predicate.IsPT) + if (op.Predicate.IsPT) + { + pred = cond; + } + else if (op.InvertPredicate) + { + pred = context.BitwiseAnd(context.BitwiseNot(pred), cond); + } + else + { + pred = context.BitwiseAnd(pred, cond); + } + + context.BranchIfTrue(label, pred); + } + else if (op.Predicate.IsPT) { context.Branch(label); } -- cgit v1.2.3