diff --git a/Ryujinx.Graphics.GAL/IPipeline.cs b/Ryujinx.Graphics.GAL/IPipeline.cs index bb3a8dca..760ad2ed 100644 --- a/Ryujinx.Graphics.GAL/IPipeline.cs +++ b/Ryujinx.Graphics.GAL/IPipeline.cs @@ -52,6 +52,7 @@ namespace Ryujinx.Graphics.GAL void SetLogicOpState(bool enable, LogicalOp op); + void SetLineParameters(float width, bool smooth); void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin); void SetPrimitiveRestart(bool enable, int index); diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs index 39b3d13c..96741cd6 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs @@ -223,12 +223,17 @@ namespace Ryujinx.Graphics.Gpu.Engine UpdateTexturePoolState(state); } - // Input assembler state. + // Rasterizer state. if (state.QueryModified(MethodOffset.VertexAttribState)) { UpdateVertexAttribState(state); } + if (state.QueryModified(MethodOffset.LineWidthSmooth, MethodOffset.LineSmoothEnable)) + { + UpdateLineState(state); + } + if (state.QueryModified(MethodOffset.PointSize, MethodOffset.VertexProgramPointSize, MethodOffset.PointSpriteEnable, @@ -716,6 +721,18 @@ namespace Ryujinx.Graphics.Gpu.Engine _context.Renderer.Pipeline.SetVertexAttribs(vertexAttribs); } + /// + /// Updates host line width based on guest GPU state. + /// + /// Current GPU state + private void UpdateLineState(GpuState state) + { + float width = state.Get(MethodOffset.LineWidthSmooth); + bool smooth = state.Get(MethodOffset.LineSmoothEnable); + + _context.Renderer.Pipeline.SetLineParameters(width, smooth); + } + /// /// Updates host point size based on guest GPU state. /// diff --git a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs index 4504e6b1..1ddef95c 100644 --- a/Ryujinx.Graphics.Gpu/State/MethodOffset.cs +++ b/Ryujinx.Graphics.Gpu/State/MethodOffset.cs @@ -67,6 +67,8 @@ namespace Ryujinx.Graphics.Gpu.State BlendEnable = 0x4d8, StencilTestState = 0x4e0, YControl = 0x4eb, + LineWidthSmooth = 0x4ec, + LineWidthAliased = 0x4ed, FirstVertex = 0x50d, FirstInstance = 0x50e, ClipDistanceEnable = 0x544, @@ -77,6 +79,7 @@ namespace Ryujinx.Graphics.Gpu.State ConditionState = 0x554, SamplerPoolState = 0x557, DepthBiasFactor = 0x55b, + LineSmoothEnable = 0x55c, TexturePoolState = 0x55d, StencilBackTestState = 0x565, DepthBiasUnits = 0x56f, diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs index a651dc75..948a8b89 100644 --- a/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -746,6 +746,20 @@ namespace Ryujinx.Graphics.OpenGL } } + public void SetLineParameters(float width, bool smooth) + { + if (smooth) + { + GL.Enable(EnableCap.LineSmooth); + } + else + { + GL.Disable(EnableCap.LineSmooth); + } + + GL.LineWidth(width); + } + public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) { // GL_POINT_SPRITE was deprecated in core profile 3.2+ and causes GL_INVALID_ENUM when set.