Fix ~3500 analyser issues

See merge request ryubing/ryujinx!44
This commit is contained in:
MrKev 2025-05-30 17:08:34 -05:00 committed by LotP
parent 417df486b1
commit 361d0c5632
622 changed files with 3080 additions and 2652 deletions

View file

@ -85,8 +85,8 @@ namespace Ryujinx.Graphics.Gpu.Engine
{
_state.WriteWithRedundancyCheck(offset, value, out changed);
}
else if (shadowRamControl == SetMmeShadowRamControlMode.MethodTrack ||
shadowRamControl == SetMmeShadowRamControlMode.MethodTrackWithFilter)
else if (shadowRamControl is SetMmeShadowRamControlMode.MethodTrack or
SetMmeShadowRamControlMode.MethodTrackWithFilter)
{
_shadowState.Write(offset, value);
_state.WriteWithRedundancyCheck(offset, value, out changed);

View file

@ -290,6 +290,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
_ilGen.Emit(OpCodes.Shl);
break;
}
break;
case AluOperation.ReadImmediate:

View file

@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
{
public static bool IsTrack(this SetMmeShadowRamControlMode mode)
{
return mode == SetMmeShadowRamControlMode.MethodTrack || mode == SetMmeShadowRamControlMode.MethodTrackWithFilter;
return mode is SetMmeShadowRamControlMode.MethodTrack or SetMmeShadowRamControlMode.MethodTrackWithFilter;
}
public static bool IsPassthrough(this SetMmeShadowRamControlMode mode)

View file

@ -285,6 +285,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
{
data[index] = index;
}
break;
case PrimitiveTopology.LineLoop:
data[^1] = 0;
@ -294,6 +295,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[index] = index >> 1;
data[index + 1] = (index >> 1) + 1;
}
break;
case PrimitiveTopology.LineStrip:
for (int index = 0; index < ((data.Length - 1) & ~1); index += 2)
@ -301,6 +303,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[index] = index >> 1;
data[index + 1] = (index >> 1) + 1;
}
break;
case PrimitiveTopology.TriangleStrip:
int tsTrianglesCount = data.Length / 3;
@ -330,6 +333,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[baseIndex + 2] = tsOutIndex++;
}
}
break;
case PrimitiveTopology.TriangleFan:
case PrimitiveTopology.Polygon:
@ -342,6 +346,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[index + 1] = tfOutIndex;
data[index + 2] = ++tfOutIndex;
}
break;
case PrimitiveTopology.Quads:
int qQuadsCount = data.Length / 6;
@ -358,6 +363,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[index + 4] = qIndex + 2;
data[index + 5] = qIndex + 3;
}
break;
case PrimitiveTopology.QuadStrip:
int qsQuadsCount = data.Length / 6;
@ -384,6 +390,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[index + 4] = qIndex + 2;
data[index + 5] = qIndex + 3;
}
break;
case PrimitiveTopology.LineStripAdjacency:
for (int index = 0; index < ((data.Length - 3) & ~3); index += 4)
@ -395,6 +402,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[index + 2] = lIndex + 2;
data[index + 3] = lIndex + 3;
}
break;
case PrimitiveTopology.TriangleStripAdjacency:
int tsaTrianglesCount = data.Length / 6;
@ -433,6 +441,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
data[baseIndex + 5] = tsaOutIndex++;
}
}
break;
}

View file

@ -170,8 +170,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
int vbStride = vertexBuffer.UnpackStride();
ulong vbSize = GetVertexBufferSize(address, endAddress.Pack(), vbStride, _indexed, instanced, _firstVertex, _count);
ulong oldVbSize = vbSize;
ulong attributeOffset = (ulong)vertexAttrib.UnpackOffset();
int componentSize = format.GetScalarSize();
@ -477,7 +475,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
private readonly ulong GetVertexBufferSize(ulong vbAddress, ulong vbEndAddress, int vbStride, bool indexed, bool instanced, int firstVertex, int vertexCount)
{
IndexType indexType = _state.State.IndexBufferState.Type;
bool indexTypeSmall = indexType == IndexType.UByte || indexType == IndexType.UShort;
bool indexTypeSmall = indexType is IndexType.UByte or IndexType.UShort;
ulong vbSize = vbEndAddress - vbAddress + 1;
ulong size;

View file

@ -5,7 +5,6 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <summary>
/// Indirect draw type, which can be indexed or non-indexed, with or without a draw count.
/// </summary>
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
enum IndirectDrawType
{
/// <summary>

View file

@ -253,9 +253,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
value |= AttributeType.Packed;
if (type == VertexAttribType.Snorm ||
type == VertexAttribType.Sint ||
type == VertexAttribType.Sscaled)
if (type is VertexAttribType.Snorm or
VertexAttribType.Sint or
VertexAttribType.Sscaled)
{
value |= AttributeType.PackedRgb10A2Signed;
}

View file

@ -1104,7 +1104,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
private void UpdateVertexBufferState()
{
IndexType indexType = _state.State.IndexBufferState.Type;
bool indexTypeSmall = indexType == IndexType.UByte || indexType == IndexType.UShort;
bool indexTypeSmall = indexType is IndexType.UByte or IndexType.UShort;
_drawState.IsAnyVbInstanced = false;