From 43b4b34376cdea486906f8bb4058dda3be7e1bd8 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Thu, 12 May 2022 14:47:13 +0100 Subject: Implement Viewport Transform Disable (#3328) * Initial implementation (no specialization) * Use specialization * Fix render scale, increase code gen version * Revert accidental change * Address Feedback --- .../Instructions/InstEmitAttribute.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'Ryujinx.Graphics.Shader/Instructions') diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs index 1cdb3842..6ce2e537 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs @@ -206,7 +206,33 @@ namespace Ryujinx.Graphics.Shader.Instructions if (emit) { - context.EmitVertex(); + if (context.Config.LastInVertexPipeline) + { + context.PrepareForVertexReturn(out var tempXLocal, out var tempYLocal, out var tempZLocal); + + context.EmitVertex(); + + // Restore output position value before transformation. + + if (tempXLocal != null) + { + context.Copy(Attribute(AttributeConsts.PositionX), tempXLocal); + } + + if (tempYLocal != null) + { + context.Copy(Attribute(AttributeConsts.PositionY), tempYLocal); + } + + if (tempZLocal != null) + { + context.Copy(Attribute(AttributeConsts.PositionZ), tempZLocal); + } + } + else + { + context.EmitVertex(); + } } if (cut) -- cgit v1.2.3