Initial tessellation shader support (#2534)

* Initial tessellation shader support

* Nits

* Re-arrange built-in table

* This is not needed anymore

* PR feedback
This commit is contained in:
gdkchan 2021-10-18 18:38:04 -03:00 committed by GitHub
parent 7603dbe3c8
commit d512ce122c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 775 additions and 148 deletions

View file

@ -40,19 +40,33 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Config.SetUsedFeature(FeatureFlags.IaIndexing);
}
else if (op.SrcB == RegisterConsts.RegisterZeroIndex)
else if (op.SrcB == RegisterConsts.RegisterZeroIndex || op.P)
{
Operand src = Attribute(op.Imm11 + index * 4);
int offset = op.Imm11 + index * 4;
context.FlagAttributeRead(src.Value);
context.FlagAttributeRead(offset);
if (op.O)
{
offset |= AttributeConsts.LoadOutputMask;
}
Operand src = op.P ? AttributePerPatch(offset) : Attribute(offset);
context.Copy(Register(rd), src);
}
else
{
Operand src = Const(op.Imm11 + index * 4);
int offset = op.Imm11 + index * 4;
context.FlagAttributeRead(src.Value);
context.FlagAttributeRead(offset);
if (op.O)
{
offset |= AttributeConsts.LoadOutputMask;
}
Operand src = Const(offset);
context.Copy(Register(rd), context.LoadAttribute(src, Const(0), primVertex));
}
@ -83,9 +97,13 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
Operand dest = Attribute(op.Imm11 + index * 4);
// TODO: Support indirect stores using Ra.
context.FlagAttributeWritten(dest.Value);
int offset = op.Imm11 + index * 4;
context.FlagAttributeWritten(offset);
Operand dest = op.P ? AttributePerPatch(offset) : Attribute(offset);
context.Copy(dest, Register(rd));
}