diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs index 07134485c..6dc5dca5b 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs @@ -200,9 +200,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// Starts draw. /// This sets primitive type and instanced draw parameters. /// - /// 3D engine where this method is being called /// Method call argument - public void DrawBegin(ThreedClass engine, int argument) + public void DrawBegin(int argument) { bool incrementInstance = (argument & (1 << 26)) != 0; bool resetInstance = (argument & (1 << 27)) == 0; @@ -210,12 +209,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed if (_state.State.PrimitiveTypeOverrideEnable) { PrimitiveTypeOverride typeOverride = _state.State.PrimitiveTypeOverride; - DrawBegin(engine, incrementInstance, resetInstance, typeOverride.Convert()); + DrawBegin(incrementInstance, resetInstance, typeOverride.Convert()); } else { PrimitiveType type = (PrimitiveType)(argument & 0xffff); - DrawBegin(engine, incrementInstance, resetInstance, type.Convert()); + DrawBegin(incrementInstance, resetInstance, type.Convert()); } } @@ -223,11 +222,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// Starts draw. /// This sets primitive type and instanced draw parameters. /// - /// 3D engine where this method is being called /// Indicates if the current instance should be incremented /// Indicates if the current instance should be set to zero /// Primitive topology - private void DrawBegin(ThreedClass engine, bool incrementInstance, bool resetInstance, PrimitiveTopology topology) + private void DrawBegin(bool incrementInstance, bool resetInstance, PrimitiveTopology topology) { if (incrementInstance) { @@ -242,7 +240,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed if (_drawState.Topology != topology || !_topologySet) { - engine.SetPipelineTopology(topology); _context.Renderer.Pipeline.SetPrimitiveTopology(topology); _drawState.Topology = topology; _topologySet = true; @@ -312,7 +309,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed { PrimitiveTypeOverride typeOverride = _state.State.PrimitiveTypeOverride; - DrawBegin(engine, instanced, !instanced, typeOverride.Convert()); + DrawBegin(instanced, !instanced, typeOverride.Convert()); int firstIndex = argument & 0xffff; int indexCount = (argument >> 16) & 0xfff; @@ -406,7 +403,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed { engine.Write(IndexBufferCountMethodOffset * 4, indexCount); - engine.SetPipelineTopology(topology); _context.Renderer.Pipeline.SetPrimitiveTopology(topology); _drawState.Topology = topology; _topologySet = true; diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index 33b34e6cb..2560f57c1 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -192,15 +192,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed _updateTracker.SetAllDirty(); } - /// - /// Sets topology for the current pipeline. - /// - /// New topology value - public void SetPipelineTopology(PrimitiveTopology topology) - { - _pipeline.Topology = topology; - } - /// /// Updates host state for any modified guest state, since the last time this function was called. /// diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs index 8416ae9bf..764ba2394 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs @@ -109,15 +109,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed _state.State.SetMmeShadowRamControl = (uint)control; } - /// - /// Sets topology for the current pipeline. - /// - /// New topology value - public void SetPipelineTopology(PrimitiveTopology topology) - { - _stateUpdater.SetPipelineTopology(topology); - } - /// /// Updates current host state for all registers modified since the last call to this method. /// @@ -352,7 +343,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// Method call argument private void DrawBegin(int argument) { - _drawManager.DrawBegin(this, argument); + _drawManager.DrawBegin(argument); } /// diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index c5c23caa1..28d10b03e 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -232,7 +232,11 @@ namespace Ryujinx.Graphics.Gpu.Shader return cpShader; } - private void UpdatePipelineInfo(ref ThreedClassState state, ref ProgramPipelineState pipeline, GpuChannel channel) + private void UpdatePipelineInfo( + ref ThreedClassState state, + ref ProgramPipelineState pipeline, + GpuChannelGraphicsState graphicsState, + GpuChannel channel) { channel.TextureManager.UpdateRenderTargets(); @@ -265,6 +269,7 @@ namespace Ryujinx.Graphics.Gpu.Shader pipeline.DepthStencilFormat = pipeline.DepthStencilEnable ? state.RtDepthStencilState.Format.Convert().Format : Format.D24UnormS8Uint; pipeline.VertexBufferCount = Constants.TotalVertexBuffers; + pipeline.Topology = graphicsState.Topology; } /// @@ -390,7 +395,7 @@ namespace Ryujinx.Graphics.Gpu.Shader } } - UpdatePipelineInfo(ref state, ref pipeline, channel); + UpdatePipelineInfo(ref state, ref pipeline, graphicsState, channel); int fragmentOutputMap = shaders[5]?.Info.FragmentOutputMap ?? -1; IProgram hostProgram = _context.Renderer.CreateProgram(shaderSources.ToArray(), new ShaderInfo(fragmentOutputMap, pipeline));