mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 02:53:04 +00:00
Code review suggestions
This commit is contained in:
parent
a7a49cc8fe
commit
20101e2ea3
5 changed files with 18 additions and 15 deletions
|
@ -5,6 +5,7 @@ namespace Ryujinx.Graphics.GAL
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum PolygonModeMask
|
public enum PolygonModeMask
|
||||||
{
|
{
|
||||||
|
None = 0,
|
||||||
Point = 1 << 0,
|
Point = 1 << 0,
|
||||||
Line = 1 << 1,
|
Line = 1 << 1,
|
||||||
Fill = 1 << 2,
|
Fill = 1 << 2,
|
||||||
|
|
|
@ -841,16 +841,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateDepthBiasState()
|
private void UpdateDepthBiasState()
|
||||||
{
|
{
|
||||||
if (_pipeline.BiasEnable == 0 && (_state.State.DepthBiasFactor == 0 && _state.State.DepthBiasUnits == 0))
|
if (_state.State.DepthBiasFactor == 0 && _state.State.DepthBiasUnits == 0)
|
||||||
{
|
{
|
||||||
return;
|
if (_pipeline.BiasEnable != PolygonModeMask.None)
|
||||||
}
|
{
|
||||||
else if (_pipeline.BiasEnable != 0 &&
|
_pipeline.BiasEnable = PolygonModeMask.None;
|
||||||
(_state.State.DepthBiasFactor == 0 && _state.State.DepthBiasUnits == 0))
|
|
||||||
{
|
|
||||||
_pipeline.BiasEnable = 0;
|
|
||||||
|
|
||||||
_context.Renderer.Pipeline.SetDepthBias(0, 0, 0, 0);
|
_context.Renderer.Pipeline.SetDepthBias(PolygonModeMask.None, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -861,7 +859,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
float units = _state.State.DepthBiasUnits;
|
float units = _state.State.DepthBiasUnits;
|
||||||
float clamp = _state.State.DepthBiasClamp;
|
float clamp = _state.State.DepthBiasClamp;
|
||||||
|
|
||||||
PolygonModeMask enables = 0;
|
PolygonModeMask enables = PolygonModeMask.None;
|
||||||
|
|
||||||
if (factor != 0 && units != 0)
|
if (factor != 0 && units != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -833,7 +833,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
|
|
||||||
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
||||||
{
|
{
|
||||||
if (enables == 0 || (factor == 0 && units == 0))
|
if (enables == PolygonModeMask.None || (factor == 0 && units == 0))
|
||||||
{
|
{
|
||||||
GL.Disable(EnableCap.PolygonOffsetPoint);
|
GL.Disable(EnableCap.PolygonOffsetPoint);
|
||||||
GL.Disable(EnableCap.PolygonOffsetLine);
|
GL.Disable(EnableCap.PolygonOffsetLine);
|
||||||
|
|
|
@ -787,14 +787,14 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
||||||
{
|
{
|
||||||
bool depthBiasEnable = (enables != 0) && (factor != 0 && units != 0);
|
|
||||||
bool changed = false;
|
|
||||||
|
|
||||||
if (factor == 0 && units == 0 && !_newState.DepthBiasEnable)
|
if (factor == 0 && units == 0 && !_newState.DepthBiasEnable)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool depthBiasEnable = (enables != PolygonModeMask.None) && (factor != 0 && units != 0);
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
if (_newState.DepthBiasEnable != depthBiasEnable)
|
if (_newState.DepthBiasEnable != depthBiasEnable)
|
||||||
{
|
{
|
||||||
_newState.DepthBiasEnable = depthBiasEnable;
|
_newState.DepthBiasEnable = depthBiasEnable;
|
||||||
|
|
|
@ -564,7 +564,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
|
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
|
||||||
|
|
||||||
int dynamicStatesCount = supportsExtDynamicState ? 7 : 6;
|
int dynamicStatesCount = supportsExtDynamicState ? 7 : 6;
|
||||||
|
|
||||||
if (DepthBiasEnable)
|
if (DepthBiasEnable)
|
||||||
{
|
{
|
||||||
dynamicStatesCount++;
|
dynamicStatesCount++;
|
||||||
|
@ -579,14 +581,16 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
dynamicStates[4] = DynamicState.StencilReference;
|
dynamicStates[4] = DynamicState.StencilReference;
|
||||||
dynamicStates[5] = DynamicState.BlendConstants;
|
dynamicStates[5] = DynamicState.BlendConstants;
|
||||||
|
|
||||||
|
dynamicStatesCount = 6;
|
||||||
|
|
||||||
if (DepthBiasEnable)
|
if (DepthBiasEnable)
|
||||||
{
|
{
|
||||||
dynamicStates[6] = DynamicState.DepthBias;
|
dynamicStates[dynamicStatesCount++] = DynamicState.DepthBias;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsExtDynamicState)
|
if (supportsExtDynamicState)
|
||||||
{
|
{
|
||||||
dynamicStates[dynamicStatesCount - 1] = DynamicState.VertexInputBindingStrideExt;
|
dynamicStates[dynamicStatesCount++] = DynamicState.VertexInputBindingStrideExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo
|
var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo
|
||||||
|
|
Loading…
Reference in a new issue