aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-10-18 18:38:04 -0300
committerGitHub <noreply@github.com>2021-10-18 18:38:04 -0300
commitd512ce122cb1c9a7fe7cb40d3f85d642ee37f897 (patch)
treebd20273250bf8066fa4df4b67c0de2ab9eac8092 /Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs
parent7603dbe3c8b45c8563f320f17ce784151cb1f0a8 (diff)
Initial tessellation shader support (#2534)
* Initial tessellation shader support * Nits * Re-arrange built-in table * This is not needed anymore * PR feedback
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));
}