diff options
author | gdkchan <gab.dark.100@gmail.com> | 2021-03-27 18:59:05 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 22:59:05 +0100 |
commit | a0b4799f1978ddb2cbd8d118380c29d9d15e158b (patch) | |
tree | 1e35b4bbe28ca3466f2d3f356f0aea55a7b8fb6d | |
parent | e60bae1a942a393a6b8dd3bcc6116dfb7e90cb8d (diff) |
Fix ZN flags set for shader instructions using RZ.CC dest (#2147)
* Fix ZN flags set for shader instructions using RZ.CC dest
* Shader cache version bump and nits
-rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 2 | ||||
-rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs | 19 | ||||
-rw-r--r-- | Ryujinx.Graphics.Shader/Translation/EmitterContext.cs | 2 |
3 files changed, 9 insertions, 14 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index d4ced7c8..293fe86b 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -35,7 +35,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// Version of the codegen (to be changed when codegen or guest format change). /// </summary> - private const ulong ShaderCodeGenVersion = 2088; + private const ulong ShaderCodeGenVersion = 2147; // Progress reporting helpers private volatile int _shaderCount; diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs index 37c17ecc..734d3aa7 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs @@ -276,12 +276,11 @@ namespace Ryujinx.Graphics.Shader.Instructions : context.IMaximumU32(srcA, srcB); Operand pred = GetPredicate39(context); + Operand res = context.ConditionalSelect(pred, resMin, resMax); - Operand dest = GetDest(context); - - context.Copy(dest, context.ConditionalSelect(pred, resMin, resMax)); + context.Copy(GetDest(context), res); - SetZnFlags(context, dest, op.SetCondCode); + SetZnFlags(context, res, op.SetCondCode); // TODO: X flags. } @@ -461,11 +460,9 @@ namespace Ryujinx.Graphics.Shader.Instructions EmitLopPredWrite(context, op, res, (ConditionalOperation)context.CurrOp.RawOpCode.Extract(44, 2)); - Operand dest = GetDest(context); - - context.Copy(dest, res); + context.Copy(GetDest(context), res); - SetZnFlags(context, dest, op.SetCondCode, op.Extended); + SetZnFlags(context, res, op.SetCondCode, op.Extended); } public static void Lop3(EmitterContext context) @@ -489,11 +486,9 @@ namespace Ryujinx.Graphics.Shader.Instructions EmitLopPredWrite(context, op, res, (ConditionalOperation)context.CurrOp.RawOpCode.Extract(36, 2)); } - Operand dest = GetDest(context); - - context.Copy(dest, res); + context.Copy(GetDest(context), res); - SetZnFlags(context, dest, op.SetCondCode, op.Extended); + SetZnFlags(context, res, op.SetCondCode, op.Extended); } public static void Popc(EmitterContext context) diff --git a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs index df6b0839..a4c21c1d 100644 --- a/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs +++ b/Ryujinx.Graphics.Shader/Translation/EmitterContext.cs @@ -91,7 +91,7 @@ namespace Ryujinx.Graphics.Shader.Translation public void PrepareForReturn() { - if (Config.Stage == ShaderStage.Fragment) + if (!IsNonMain && Config.Stage == ShaderStage.Fragment) { if (Config.OmapDepth) { |