aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs32
1 files changed, 25 insertions, 7 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
index e865caf2..f82b835c 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
@@ -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(offset);
- context.FlagAttributeRead(src.Value);
+ 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.
+
+ int offset = op.Imm11 + index * 4;
+
+ context.FlagAttributeWritten(offset);
- context.FlagAttributeWritten(dest.Value);
+ Operand dest = op.P ? AttributePerPatch(offset) : Attribute(offset);
context.Copy(dest, Register(rd));
}