From d512ce122cb1c9a7fe7cb40d3f85d642ee37f897 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 18 Oct 2021 18:38:04 -0300 Subject: Initial tessellation shader support (#2534) * Initial tessellation shader support * Nits * Re-arrange built-in table * This is not needed anymore * PR feedback --- .../Instructions/InstEmitAttribute.cs | 32 +++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs') 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)); } -- cgit v1.2.3