mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-26 10:33:05 +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]
|
||||
public enum PolygonModeMask
|
||||
{
|
||||
None = 0,
|
||||
Point = 1 << 0,
|
||||
Line = 1 << 1,
|
||||
Fill = 1 << 2,
|
||||
|
|
|
@ -841,16 +841,14 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
/// </summary>
|
||||
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;
|
||||
}
|
||||
else if (_pipeline.BiasEnable != 0 &&
|
||||
(_state.State.DepthBiasFactor == 0 && _state.State.DepthBiasUnits == 0))
|
||||
{
|
||||
_pipeline.BiasEnable = 0;
|
||||
if (_pipeline.BiasEnable != PolygonModeMask.None)
|
||||
{
|
||||
_pipeline.BiasEnable = PolygonModeMask.None;
|
||||
|
||||
_context.Renderer.Pipeline.SetDepthBias(0, 0, 0, 0);
|
||||
_context.Renderer.Pipeline.SetDepthBias(PolygonModeMask.None, 0, 0, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -861,7 +859,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
float units = _state.State.DepthBiasUnits;
|
||||
float clamp = _state.State.DepthBiasClamp;
|
||||
|
||||
PolygonModeMask enables = 0;
|
||||
PolygonModeMask enables = PolygonModeMask.None;
|
||||
|
||||
if (factor != 0 && units != 0)
|
||||
{
|
||||
|
|
|
@ -833,7 +833,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
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.PolygonOffsetLine);
|
||||
|
|
|
@ -787,14 +787,14 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool depthBiasEnable = (enables != PolygonModeMask.None) && (factor != 0 && units != 0);
|
||||
bool changed = false;
|
||||
|
||||
if (_newState.DepthBiasEnable != depthBiasEnable)
|
||||
{
|
||||
_newState.DepthBiasEnable = depthBiasEnable;
|
||||
|
|
|
@ -564,7 +564,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
|
||||
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
|
||||
|
||||
int dynamicStatesCount = supportsExtDynamicState ? 7 : 6;
|
||||
|
||||
if (DepthBiasEnable)
|
||||
{
|
||||
dynamicStatesCount++;
|
||||
|
@ -579,14 +581,16 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
dynamicStates[4] = DynamicState.StencilReference;
|
||||
dynamicStates[5] = DynamicState.BlendConstants;
|
||||
|
||||
dynamicStatesCount = 6;
|
||||
|
||||
if (DepthBiasEnable)
|
||||
{
|
||||
dynamicStates[6] = DynamicState.DepthBias;
|
||||
dynamicStates[dynamicStatesCount++] = DynamicState.DepthBias;
|
||||
}
|
||||
|
||||
if (supportsExtDynamicState)
|
||||
{
|
||||
dynamicStates[dynamicStatesCount - 1] = DynamicState.VertexInputBindingStrideExt;
|
||||
dynamicStates[dynamicStatesCount++] = DynamicState.VertexInputBindingStrideExt;
|
||||
}
|
||||
|
||||
var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo
|
||||
|
|
Loading…
Reference in a new issue