Revert some changes that were out of scope/intent of commit

This commit is contained in:
sunshineinabox 2024-07-20 19:07:19 -07:00
parent 10506afc23
commit a7a49cc8fe
9 changed files with 35 additions and 79 deletions

View File

@ -47,8 +47,7 @@ namespace Ryujinx.Graphics.GAL
void SetBlendState(AdvancedBlendDescriptor blend);
void SetBlendState(int index, BlendDescriptor blend);
void SetDepthBias(float factor, float units, float clamp);
void SetDepthBiasEnable(PolygonModeMask enables);
void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp);
void SetDepthClamp(bool clamp);
void SetDepthMode(DepthMode mode);
void SetDepthTest(DepthTestDescriptor depthTest);

View File

@ -116,7 +116,6 @@ namespace Ryujinx.Graphics.GAL.Multithreading
Register<SetBlendStateAdvancedCommand>(CommandType.SetBlendStateAdvanced);
Register<SetBlendStateCommand>(CommandType.SetBlendState);
Register<SetDepthBiasCommand>(CommandType.SetDepthBias);
Register<SetDepthBiasEnableCommand>(CommandType.SetDepthBiasEnable);
Register<SetDepthClampCommand>(CommandType.SetDepthClamp);
Register<SetDepthModeCommand>(CommandType.SetDepthMode);
Register<SetDepthTestCommand>(CommandType.SetDepthTest);

View File

@ -76,7 +76,6 @@ namespace Ryujinx.Graphics.GAL.Multithreading
SetBlendStateAdvanced,
SetBlendState,
SetDepthBias,
SetDepthBiasEnable,
SetDepthClamp,
SetDepthMode,
SetDepthTest,

View File

@ -3,12 +3,14 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
struct SetDepthBiasCommand : IGALCommand, IGALCommand<SetDepthBiasCommand>
{
public readonly CommandType CommandType => CommandType.SetDepthBias;
private PolygonModeMask _enables;
private float _factor;
private float _units;
private float _clamp;
public void Set(float factor, float units, float clamp)
public void Set(PolygonModeMask enables, float factor, float units, float clamp)
{
_enables = enables;
_factor = factor;
_units = units;
_clamp = clamp;
@ -16,7 +18,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
public static void Run(ref SetDepthBiasCommand command, ThreadedRenderer threaded, IRenderer renderer)
{
renderer.Pipeline.SetDepthBias(command._factor, command._units, command._clamp);
renderer.Pipeline.SetDepthBias(command._enables, command._factor, command._units, command._clamp);
}
}
}

View File

@ -1,19 +0,0 @@
namespace Ryujinx.Graphics.GAL.Multithreading.Commands
{
struct SetDepthBiasEnableCommand : IGALCommand, IGALCommand<SetDepthBiasEnableCommand>
{
public readonly CommandType CommandType => CommandType.SetDepthBias;
private PolygonModeMask _enables;
public void Set(PolygonModeMask enables)
{
_enables = enables;
}
public static void Run(ref SetDepthBiasEnableCommand command, ThreadedRenderer threaded, IRenderer renderer)
{
renderer.Pipeline.SetDepthBiasEnable(command._enables);
}
}
}

View File

@ -141,15 +141,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading
_renderer.QueueCommand();
}
public void SetDepthBias(float factor, float units, float clamp)
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
{
_renderer.New<SetDepthBiasCommand>().Set(factor, units, clamp);
_renderer.QueueCommand();
}
public void SetDepthBiasEnable(PolygonModeMask enables)
{
_renderer.New<SetDepthBiasEnableCommand>().Set(enables);
_renderer.New<SetDepthBiasCommand>().Set(enables, factor, units, clamp);
_renderer.QueueCommand();
}

View File

@ -850,7 +850,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
_pipeline.BiasEnable = 0;
_context.Renderer.Pipeline.SetDepthBiasEnable(0);
_context.Renderer.Pipeline.SetDepthBias(0, 0, 0, 0);
return;
}
@ -872,12 +872,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_pipeline.BiasEnable = enables;
_context.Renderer.Pipeline.SetDepthBiasEnable(enables);
if (enables > 0)
{
_context.Renderer.Pipeline.SetDepthBias(factor, units / 2f, clamp);
}
_context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp);
}
/// <summary>

View File

@ -831,9 +831,9 @@ namespace Ryujinx.Graphics.OpenGL
GL.Enable(IndexedEnableCap.Blend, index);
}
public void SetDepthBias(float factor, float units, float clamp)
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
{
if (factor == 0 && units == 0)
if (enables == 0 || (factor == 0 && units == 0))
{
GL.Disable(EnableCap.PolygonOffsetPoint);
GL.Disable(EnableCap.PolygonOffsetLine);
@ -842,23 +842,6 @@ namespace Ryujinx.Graphics.OpenGL
return;
}
if (HwCapabilities.SupportsPolygonOffsetClamp)
{
GL.PolygonOffsetClamp(factor, units, clamp);
}
else
{
GL.PolygonOffset(factor, units);
}
}
public void SetDepthBiasEnable(PolygonModeMask enables)
{
if (enables == 0)
{
return;
}
if ((enables & PolygonModeMask.Point) != 0)
{
GL.Enable(EnableCap.PolygonOffsetPoint);
@ -885,6 +868,15 @@ namespace Ryujinx.Graphics.OpenGL
{
GL.Disable(EnableCap.PolygonOffsetFill);
}
if (HwCapabilities.SupportsPolygonOffsetClamp)
{
GL.PolygonOffsetClamp(factor, units, clamp);
}
else
{
GL.PolygonOffset(factor, units);
}
}
public void SetDepthClamp(bool clamp)

View File

@ -785,37 +785,32 @@ namespace Ryujinx.Graphics.Vulkan
SignalStateChange();
}
public void SetDepthBias(float factor, float units, float clamp)
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
{
if (factor == 0 && units == 0 && _newState.DepthBiasEnable)
{
_newState.DepthBiasEnable = false;
bool depthBiasEnable = (enables != 0) && (factor != 0 && units != 0);
bool changed = false;
SignalStateChange();
return;
}
else if (factor == 0 && units == 0 && !_newState.DepthBiasEnable)
if (factor == 0 && units == 0 && !_newState.DepthBiasEnable)
{
return;
}
DynamicState.SetDepthBias(factor, units, clamp);
SignalStateChange();
}
public void SetDepthBiasEnable(PolygonModeMask enables)
{
bool depthBiasEnable = enables != 0;
if (_newState.DepthBiasEnable != depthBiasEnable)
{
_newState.DepthBiasEnable = depthBiasEnable;
SignalStateChange();
changed = true;
}
if (depthBiasEnable)
{
DynamicState.SetDepthBias(factor, units, clamp);
changed = true;
}
if (changed)
{
SignalStateChange();
}
}
public void SetDepthClamp(bool clamp)