Merge feb915321d
into 5dbba07e33
This commit is contained in:
commit
c2a7971fed
5 changed files with 59 additions and 17 deletions
|
@ -5,6 +5,7 @@ namespace Ryujinx.Graphics.GAL
|
|||
[Flags]
|
||||
public enum PolygonModeMask
|
||||
{
|
||||
None = 0,
|
||||
Point = 1 << 0,
|
||||
Line = 1 << 1,
|
||||
Fill = 1 << 2,
|
||||
|
|
|
@ -841,19 +841,35 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
/// </summary>
|
||||
private void UpdateDepthBiasState()
|
||||
{
|
||||
if (_state.State.DepthBiasFactor == 0 && _state.State.DepthBiasUnits == 0)
|
||||
{
|
||||
if (_pipeline.BiasEnable != PolygonModeMask.None)
|
||||
{
|
||||
_pipeline.BiasEnable = PolygonModeMask.None;
|
||||
|
||||
_context.Renderer.Pipeline.SetDepthBias(PolygonModeMask.None, 0, 0, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var depthBias = _state.State.DepthBiasState;
|
||||
|
||||
float factor = _state.State.DepthBiasFactor;
|
||||
float units = _state.State.DepthBiasUnits;
|
||||
float clamp = _state.State.DepthBiasClamp;
|
||||
|
||||
PolygonModeMask enables;
|
||||
PolygonModeMask enables = PolygonModeMask.None;
|
||||
|
||||
enables = (depthBias.PointEnable ? PolygonModeMask.Point : 0);
|
||||
enables |= (depthBias.LineEnable ? PolygonModeMask.Line : 0);
|
||||
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
|
||||
if (factor != 0 && units != 0)
|
||||
{
|
||||
enables = (depthBias.PointEnable ? PolygonModeMask.Point : 0);
|
||||
enables |= (depthBias.LineEnable ? PolygonModeMask.Line : 0);
|
||||
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
|
||||
}
|
||||
|
||||
_pipeline.BiasEnable = enables;
|
||||
|
||||
_context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp);
|
||||
}
|
||||
|
||||
|
|
|
@ -833,6 +833,15 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
||||
{
|
||||
if (enables == PolygonModeMask.None || (factor == 0 && units == 0))
|
||||
{
|
||||
GL.Disable(EnableCap.PolygonOffsetPoint);
|
||||
GL.Disable(EnableCap.PolygonOffsetLine);
|
||||
GL.Disable(EnableCap.PolygonOffsetFill);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((enables & PolygonModeMask.Point) != 0)
|
||||
{
|
||||
GL.Enable(EnableCap.PolygonOffsetPoint);
|
||||
|
@ -860,11 +869,6 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
GL.Disable(EnableCap.PolygonOffsetFill);
|
||||
}
|
||||
|
||||
if (enables == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HwCapabilities.SupportsPolygonOffsetClamp)
|
||||
{
|
||||
GL.PolygonOffsetClamp(factor, units, clamp);
|
||||
|
|
|
@ -792,10 +792,30 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
||||
{
|
||||
DynamicState.SetDepthBias(factor, units, clamp);
|
||||
if (factor == 0 && units == 0 && !_newState.DepthBiasEnable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_newState.DepthBiasEnable = enables != 0;
|
||||
SignalStateChange();
|
||||
bool depthBiasEnable = (enables != PolygonModeMask.None) && (factor != 0 && units != 0);
|
||||
bool changed = false;
|
||||
|
||||
if (_newState.DepthBiasEnable != depthBiasEnable)
|
||||
{
|
||||
_newState.DepthBiasEnable = depthBiasEnable;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (depthBiasEnable)
|
||||
{
|
||||
DynamicState.SetDepthBias(factor, units, clamp);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
SignalStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDepthClamp(bool clamp)
|
||||
|
|
|
@ -571,6 +571,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
|
||||
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
|
||||
|
||||
bool supportsFeedbackLoopDynamicState = gd.Capabilities.SupportsDynamicAttachmentFeedbackLoop;
|
||||
|
||||
DynamicState* dynamicStates = stackalloc DynamicState[MaxDynamicStatesCount];
|
||||
|
@ -579,11 +580,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
dynamicStates[0] = DynamicState.Viewport;
|
||||
dynamicStates[1] = DynamicState.Scissor;
|
||||
dynamicStates[2] = DynamicState.DepthBias;
|
||||
dynamicStates[3] = DynamicState.StencilCompareMask;
|
||||
dynamicStates[4] = DynamicState.StencilWriteMask;
|
||||
dynamicStates[5] = DynamicState.StencilReference;
|
||||
dynamicStates[6] = DynamicState.BlendConstants;
|
||||
dynamicStates[2] = DynamicState.StencilCompareMask;
|
||||
dynamicStates[3] = DynamicState.StencilWriteMask;
|
||||
dynamicStates[4] = DynamicState.StencilReference;
|
||||
dynamicStates[5] = DynamicState.BlendConstants;
|
||||
dynamicStates[6] = DynamicState.DepthBias;
|
||||
|
||||
if (supportsExtDynamicState)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue