Better IPA shader instruction implementation (#1082)
* Fix varying interpolation on fragment shader * Some nits * Alignment
This commit is contained in:
parent
2365ddfc36
commit
e93ca84b14
13 changed files with 97 additions and 89 deletions
|
@ -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);
|
||||
|
||||
res = context.FPMultiply(res, srcB);
|
||||
}
|
||||
|
||||
Operand srcA = Attribute(op.AttributeOffset, iq);
|
||||
|
||||
Operand res = context.FPSaturate(srcA, op.Saturate);
|
||||
res = context.FPSaturate(res, op.Saturate);
|
||||
|
||||
context.Copy(GetDest(context), res);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue