diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-04-02 21:20:47 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-03 11:20:47 +1100 |
| commit | e93ca84b14cc325364f1ccc45a6e8622978e959d (patch) | |
| tree | 8e32b23e94e529ccf91b8e7d7613ce003d16e841 /Ryujinx.Graphics.Shader/Instructions | |
| parent | 2365ddfc363e76ac1ac9d2e32ef9b36b85463431 (diff) | |
Better IPA shader instruction implementation (#1082)
* Fix varying interpolation on fragment shader
* Some nits
* Alignment
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs index 1fddcc8c..7eb88883 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs @@ -96,17 +96,27 @@ namespace Ryujinx.Graphics.Shader.Instructions { OpCodeIpa op = (OpCodeIpa)context.CurrOp; - InterpolationQualifier iq = InterpolationQualifier.None; + Operand res = Attribute(op.AttributeOffset); - switch (op.Mode) + if (op.AttributeOffset >= AttributeConsts.UserAttributeBase && + op.AttributeOffset < AttributeConsts.UserAttributeEnd) { - case InterpolationMode.Constant: iq = InterpolationQualifier.Flat; break; - case InterpolationMode.Pass: iq = InterpolationQualifier.NoPerspective; break; + int index = (op.AttributeOffset - AttributeConsts.UserAttributeBase) >> 4; + + if (context.Config.ImapTypes[index].GetFirstUsedType() == PixelImap.Perspective) + { + res = context.FPMultiply(res, Attribute(AttributeConsts.PositionW)); + } } + + if (op.Mode == InterpolationMode.Default) + { + Operand srcB = GetSrcB(context); - Operand srcA = Attribute(op.AttributeOffset, iq); + res = context.FPMultiply(res, srcB); + } - Operand res = context.FPSaturate(srcA, op.Saturate); + res = context.FPSaturate(res, op.Saturate); context.Copy(GetDest(context), res); } |
