mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-21 16:43:35 +00:00
Update topology with GpuAccessorState
This commit is contained in:
parent
ba8887b848
commit
6c09cfff4c
4 changed files with 13 additions and 30 deletions
|
@ -200,9 +200,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
/// Starts draw.
|
||||
/// This sets primitive type and instanced draw parameters.
|
||||
/// </summary>
|
||||
/// <param name="engine">3D engine where this method is being called</param>
|
||||
/// <param name="argument">Method call argument</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <param name="engine">3D engine where this method is being called</param>
|
||||
/// <param name="incrementInstance">Indicates if the current instance should be incremented</param>
|
||||
/// <param name="resetInstance">Indicates if the current instance should be set to zero</param>
|
||||
/// <param name="topology">Primitive topology</param>
|
||||
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;
|
||||
|
|
|
@ -192,15 +192,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
_updateTracker.SetAllDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets topology for the current pipeline.
|
||||
/// </summary>
|
||||
/// <param name="topology">New topology value</param>
|
||||
public void SetPipelineTopology(PrimitiveTopology topology)
|
||||
{
|
||||
_pipeline.Topology = topology;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates host state for any modified guest state, since the last time this function was called.
|
||||
/// </summary>
|
||||
|
|
|
@ -109,15 +109,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
_state.State.SetMmeShadowRamControl = (uint)control;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets topology for the current pipeline.
|
||||
/// </summary>
|
||||
/// <param name="topology">New topology value</param>
|
||||
public void SetPipelineTopology(PrimitiveTopology topology)
|
||||
{
|
||||
_stateUpdater.SetPipelineTopology(topology);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates current host state for all registers modified since the last call to this method.
|
||||
/// </summary>
|
||||
|
@ -352,7 +343,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
/// <param name="argument">Method call argument</param>
|
||||
private void DrawBegin(int argument)
|
||||
{
|
||||
_drawManager.DrawBegin(this, argument);
|
||||
_drawManager.DrawBegin(argument);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue