misc: chore: Use explicit types & fix object creation

This commit is contained in:
KeatonTheBot
2026-05-30 16:26:50 -05:00
parent 9d3fecf334
commit 76a123b81d
454 changed files with 3042 additions and 2961 deletions
@@ -221,7 +221,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
sb.AppendLine($"private static Dictionary<Hash128, AdvancedBlendEntry> _entries = new()");
sb.AppendLine("{");
foreach (var entry in Table)
foreach (AdvancedBlendUcode entry in Table)
{
Hash128 hash = XXHash128.ComputeHash(MemoryMarshal.Cast<uint, byte>(entry.Code));
@@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
descriptor = default;
if (!AdvancedBlendPreGenTable.Entries.TryGetValue(hash, out var entry))
if (!AdvancedBlendPreGenTable.Entries.TryGetValue(hash, out AdvancedBlendEntry entry))
{
return false;
}
@@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
{
if (disposing)
{
foreach (var texture in _cache.Values)
foreach (ITexture texture in _cache.Values)
{
texture.Release();
}
@@ -620,7 +620,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
DestroyIfNotNull(ref _geometryIndexDataBuffer.Handle);
DestroyIfNotNull(ref _sequentialIndexBuffer);
foreach (var indexBuffer in _topologyRemapBuffers.Values)
foreach (IndexBuffer indexBuffer in _topologyRemapBuffers.Values)
{
_context.Renderer.DeleteBuffer(indexBuffer.Handle);
}
@@ -132,7 +132,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
for (int index = 0; index < Constants.TotalVertexAttribs; index++)
{
var vertexAttrib = vertexAttribStateSpan[index];
VertexAttribState vertexAttrib = vertexAttribStateSpan[index];
if (!FormatTable.TryGetSingleComponentAttribFormat(vertexAttrib.UnpackFormat(), out Format format, out int componentsCount))
{
@@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
int bufferIndex = vertexAttrib.UnpackBufferIndex();
GpuVa endAddress = vertexBufferEndAddressSpan[bufferIndex];
var vertexBuffer = vertexBufferStateSpan[bufferIndex];
VertexBufferState vertexBuffer = vertexBufferStateSpan[bufferIndex];
bool instanced = vertexBufferInstancedSpan[bufferIndex];
ulong address = vertexBuffer.Address.Pack();
@@ -373,7 +373,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
/// <param name="size">Size of the buffer in bytes</param>
private readonly void SetBufferTexture(ResourceReservations reservations, int index, Format format, ulong address, ulong size)
{
var memoryManager = _channel.MemoryManager;
MemoryManager memoryManager = _channel.MemoryManager;
BufferRange range = memoryManager.Physical.BufferCache.GetBufferRange(memoryManager.GetPhysicalRegions(address, size), BufferStage.VertexBuffer);
@@ -414,7 +414,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
indexOffset <<= shift;
size <<= shift;
var memoryManager = _channel.MemoryManager;
MemoryManager memoryManager = _channel.MemoryManager;
ulong misalign = address & ((ulong)_context.Capabilities.TextureBufferOffsetAlignment - 1);
BufferRange range = memoryManager.Physical.BufferCache.GetBufferRange(
@@ -1,3 +1,4 @@
using Ryujinx.Graphics.Gpu.Memory;
using System;
using System.Runtime.InteropServices;
@@ -92,7 +93,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (enable)
{
var uniformBuffer = _state.State.UniformBufferState;
UniformBufferState uniformBuffer = _state.State.UniformBufferState;
ulong address = uniformBuffer.Address.Pack();
@@ -111,7 +112,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
if (_ubFollowUpAddress != 0)
{
var memoryManager = _channel.MemoryManager;
MemoryManager memoryManager = _channel.MemoryManager;
Span<byte> data = MemoryMarshal.Cast<int, byte>(_ubData.AsSpan(0, (int)(_ubByteCount / 4)));
@@ -131,7 +132,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="argument">New uniform buffer data word</param>
public void Update(int argument)
{
var uniformBuffer = _state.State.UniformBufferState;
UniformBufferState uniformBuffer = _state.State.UniformBufferState;
ulong address = uniformBuffer.Address.Pack() + (uint)uniformBuffer.Offset;
@@ -157,7 +158,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="data">Data to be written to the uniform buffer</param>
public void Update(ReadOnlySpan<int> data)
{
var uniformBuffer = _state.State.UniformBufferState;
UniformBufferState uniformBuffer = _state.State.UniformBufferState;
ulong address = uniformBuffer.Address.Pack() + (uint)uniformBuffer.Offset;
@@ -471,7 +471,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int textureId = _state.State.DrawTextureTextureId;
int samplerId = _state.State.DrawTextureSamplerId;
(var texture, var sampler) = _channel.TextureManager.GetGraphicsTextureAndSampler(textureId, samplerId);
(Image.Texture texture, Sampler sampler) = _channel.TextureManager.GetGraphicsTextureAndSampler(textureId, samplerId);
srcX0 *= texture.ScaleFactor;
srcY0 *= texture.ScaleFactor;
@@ -684,8 +684,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (hasCount)
{
var indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
var parameterBuffer = memory.BufferCache.GetBufferRange(parameterBufferRange, BufferStage.Indirect);
BufferRange indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
BufferRange parameterBuffer = memory.BufferCache.GetBufferRange(parameterBufferRange, BufferStage.Indirect);
if (indexed)
{
@@ -698,7 +698,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
else
{
var indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
BufferRange indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
if (indexed)
{
@@ -820,7 +820,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
// If there is a mismatch on the host clip region and the one explicitly defined by the guest
// on the screen scissor state, then we need to force only one texture to be bound to avoid
// host clipping.
var screenScissorState = _state.State.ScreenScissorState;
ScreenScissorState screenScissorState = _state.State.ScreenScissorState;
Span<ScissorState> scissorStateSpan = _state.State.ScissorState.AsSpan();
@@ -835,7 +835,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (fullClear && clearAffectedByScissor && scissorStateSpan[0].Enable)
{
ref var scissorState = ref scissorStateSpan[0];
ref ScissorState scissorState = ref scissorStateSpan[0];
fullClear = scissorState.X1 == screenScissorState.X &&
scissorState.Y1 == screenScissorState.Y &&
@@ -893,7 +893,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (clearAffectedByScissor && scissorStateSpan[0].Enable)
{
ref var scissorState = ref scissorStateSpan[0];
ref ScissorState scissorState = ref scissorStateSpan[0];
scissorX = Math.Max(scissorX, scissorState.X1);
scissorY = Math.Max(scissorY, scissorState.Y1);
@@ -922,7 +922,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (componentMask != 0)
{
var clearColor = _state.State.ClearColors;
ClearColors clearColor = _state.State.ClearColors;
ColorF color = new(clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha);
@@ -289,7 +289,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
int rtIndex = rtControl.UnpackPermutationIndex(index);
var colorState = state[rtIndex];
RtColorState colorState = state[rtIndex];
if (index < count && StateUpdater.IsRtEnabled(colorState))
{
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -57,13 +58,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_registerToGroupMapping = new byte[BlockSize];
_callbacks = new Action[entries.Length];
var fieldToDelegate = new Dictionary<string, int>();
Dictionary<string, int> fieldToDelegate = new();
for (int entryIndex = 0; entryIndex < entries.Length; entryIndex++)
{
var entry = entries[entryIndex];
StateUpdateCallbackEntry entry = entries[entryIndex];
foreach (var fieldName in entry.FieldNames)
foreach (string fieldName in entry.FieldNames)
{
fieldToDelegate.Add(fieldName, entryIndex);
}
@@ -71,15 +72,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_callbacks[entryIndex] = entry.Callback;
}
var fields = typeof(TState).GetFields();
FieldInfo[] fields = typeof(TState).GetFields();
int offset = 0;
for (int fieldIndex = 0; fieldIndex < fields.Length; fieldIndex++)
{
var field = fields[fieldIndex];
FieldInfo field = fields[fieldIndex];
var currentFieldOffset = (int)Marshal.OffsetOf<TState>(field.Name);
var nextFieldOffset = fieldIndex + 1 == fields.Length ? Unsafe.SizeOf<TState>() : (int)Marshal.OffsetOf<TState>(fields[fieldIndex + 1].Name);
int currentFieldOffset = (int)Marshal.OffsetOf<TState>(field.Name);
int nextFieldOffset = fieldIndex + 1 == fields.Length ? Unsafe.SizeOf<TState>() : (int)Marshal.OffsetOf<TState>(fields[fieldIndex + 1].Name);
int sizeOfField = nextFieldOffset - currentFieldOffset;
@@ -3,6 +3,7 @@ using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Engine.Threed.Blender;
using Ryujinx.Graphics.Gpu.Engine.Types;
using Ryujinx.Graphics.Gpu.Image;
using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Gpu.Shader;
using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Texture;
@@ -464,8 +465,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="singleUse">If this is not -1, it indicates that only the given indexed target will be used.</param>
public void UpdateRenderTargetState(RenderTargetUpdateFlags updateFlags, int singleUse = -1)
{
var memoryManager = _channel.MemoryManager;
var rtControl = _state.State.RtControl;
MemoryManager memoryManager = _channel.MemoryManager;
RtControl rtControl = _state.State.RtControl;
bool useControl = (updateFlags & RenderTargetUpdateFlags.UseControl) == RenderTargetUpdateFlags.UseControl;
bool layered = (updateFlags & RenderTargetUpdateFlags.Layered) == RenderTargetUpdateFlags.Layered;
@@ -474,12 +475,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
var msaaMode = _state.State.RtMsaaMode;
TextureMsaaMode msaaMode = _state.State.RtMsaaMode;
int samplesInX = msaaMode.SamplesInX();
int samplesInY = msaaMode.SamplesInY();
var scissor = _state.State.ScreenScissorState;
ScreenScissorState scissor = _state.State.ScreenScissorState;
Size sizeHint = new((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
int clipRegionWidth = int.MaxValue;
@@ -494,7 +495,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
int rtIndex = useControl ? rtControl.UnpackPermutationIndex(index) : index;
var colorState = rtColorStateSpan[rtIndex];
RtColorState colorState = rtColorStateSpan[rtIndex];
if (index >= count || !IsRtEnabled(colorState) || (singleColor && index != singleUse))
{
@@ -544,8 +545,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (dsEnable && (updateFlags & RenderTargetUpdateFlags.UpdateDepthStencil) == RenderTargetUpdateFlags.UpdateDepthStencil)
{
var dsState = _state.State.RtDepthStencilState;
var dsSize = _state.State.RtDepthStencilSize;
RtDepthStencilState dsState = _state.State.RtDepthStencilState;
Size3D dsSize = _state.State.RtDepthStencilSize;
depthStencil = memoryManager.Physical.TextureCache.FindOrCreateTexture(
memoryManager,
@@ -647,7 +648,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if ((_state.State.YControl & YControl.NegateY) != 0)
{
ref var screenScissor = ref _state.State.ScreenScissorState;
ref ScreenScissorState screenScissor = ref _state.State.ScreenScissorState;
y = screenScissor.Height - height - y;
if (y < 0)
@@ -725,8 +726,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateViewportTransform()
{
var yControl = _state.State.YControl;
var face = _state.State.FaceState;
YControl yControl = _state.State.YControl;
FaceState face = _state.State.FaceState;
bool disableTransform = _state.State.ViewportTransformEnable == 0;
bool yNegate = (yControl & YControl.NegateY) != 0;
@@ -742,17 +743,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
if (disableTransform)
{
ref var scissor = ref _state.State.ScreenScissorState;
ref ScreenScissorState scissor = ref _state.State.ScreenScissorState;
float rScale = _channel.TextureManager.RenderTargetScale;
var scissorRect = new Rectangle<float>(0, 0, (scissor.X + scissor.Width) * rScale, (scissor.Y + scissor.Height) * rScale);
Rectangle<float> scissorRect = new(0, 0, (scissor.X + scissor.Width) * rScale, (scissor.Y + scissor.Height) * rScale);
viewports[index] = new Viewport(scissorRect, ViewportSwizzle.PositiveX, ViewportSwizzle.PositiveY, ViewportSwizzle.PositiveZ, ViewportSwizzle.PositiveW, 0, 1);
continue;
}
ref var transform = ref viewportTransformSpan[index];
ref var extents = ref viewportExtentsSpan[index];
ref ViewportTransform transform = ref viewportTransformSpan[index];
ref ViewportExtents extents = ref viewportExtentsSpan[index];
float scaleX = MathF.Abs(transform.ScaleX);
float scaleY = transform.ScaleY;
@@ -847,7 +848,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateDepthBiasState()
{
var depthBias = _state.State.DepthBiasState;
DepthBiasState depthBias = _state.State.DepthBiasState;
float factor = _state.State.DepthBiasFactor;
float units = _state.State.DepthBiasUnits;
@@ -868,9 +869,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateStencilTestState()
{
var backMasks = _state.State.StencilBackMasks;
var test = _state.State.StencilTestState;
var backTest = _state.State.StencilBackTestState;
StencilBackMasks backMasks = _state.State.StencilBackMasks;
StencilTestState test = _state.State.StencilTestState;
StencilBackTestState backTest = _state.State.StencilBackTestState;
CompareOp backFunc;
StencilOp backSFail;
@@ -940,10 +941,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateSamplerPoolState()
{
var texturePool = _state.State.TexturePoolState;
var samplerPool = _state.State.SamplerPoolState;
PoolState texturePool = _state.State.TexturePoolState;
PoolState samplerPool = _state.State.SamplerPoolState;
var samplerIndex = _state.State.SamplerIndex;
SamplerIndex samplerIndex = _state.State.SamplerIndex;
int maximumId = samplerIndex == SamplerIndex.ViaHeaderIndex
? texturePool.MaximumId
@@ -957,7 +958,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateTexturePoolState()
{
var texturePool = _state.State.TexturePoolState;
PoolState texturePool = _state.State.TexturePoolState;
_channel.TextureManager.SetGraphicsTexturePool(texturePool.Address.Pack(), texturePool.MaximumId);
_channel.TextureManager.SetGraphicsTextureBufferIndex((int)_state.State.TextureBufferIndex);
@@ -978,7 +979,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalVertexAttribs; index++)
{
var vertexAttrib = vertexAttribStateSpan[index];
VertexAttribState vertexAttrib = vertexAttribStateSpan[index];
int bufferIndex = vertexAttrib.UnpackBufferIndex();
@@ -1072,7 +1073,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateIndexBufferState()
{
var indexBufferNullable = _state?.State.IndexBufferState;
IndexBufferState? indexBufferNullable = _state?.State.IndexBufferState;
if (!indexBufferNullable.HasValue)
{
@@ -1128,7 +1129,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalVertexBuffers; index++)
{
var vertexBuffer = vertexBufferStateSpan[index];
VertexBufferState vertexBuffer = vertexBufferStateSpan[index];
if (!vertexBuffer.UnpackEnable())
{
@@ -1212,8 +1213,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateFaceState()
{
var yControl = _state.State.YControl;
var face = _state.State.FaceState;
YControl yControl = _state.State.YControl;
FaceState face = _state.State.FaceState;
_pipeline.CullEnable = face.CullEnable;
_pipeline.CullMode = face.CullFace;
@@ -1254,7 +1255,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalRenderTargets; index++)
{
var colorMask = rtColorMaskSpan[rtColorMaskShared ? 0 : index];
RtColorMask colorMask = rtColorMaskSpan[rtColorMaskShared ? 0 : index];
uint componentMask;
@@ -1277,7 +1278,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
if (_state.State.BlendUcodeEnable != BlendUcodeEnable.Disabled)
{
if (_context.Capabilities.SupportsBlendEquationAdvanced && _blendManager.TryGetAdvancedBlend(out var blendDescriptor))
if (_context.Capabilities.SupportsBlendEquationAdvanced && _blendManager.TryGetAdvancedBlend(out AdvancedBlendDescriptor blendDescriptor))
{
// Try to HLE it using advanced blend on the host if we can.
_context.Renderer.Pipeline.SetBlendState(blendDescriptor);
@@ -1303,9 +1304,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalRenderTargets; index++)
{
bool enable = blendEnableSpan[index];
var blend = blendStateSpan[index];
BlendState blend = blendStateSpan[index];
var descriptor = new BlendDescriptor(
BlendDescriptor descriptor = new(
enable,
blendConstant,
blend.ColorOp,
@@ -1331,9 +1332,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
else
{
bool enable = _state.State.BlendEnable[0];
var blend = _state.State.BlendStateCommon;
BlendStateCommon blend = _state.State.BlendStateCommon;
var descriptor = new BlendDescriptor(
BlendDescriptor descriptor = new(
enable,
blendConstant,
blend.ColorOp,
@@ -1436,7 +1437,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateShaderState()
{
var shaderCache = _channel.MemoryManager.Physical.ShaderCache;
ShaderCache shaderCache = _channel.MemoryManager.Physical.ShaderCache;
_vtgWritesRtLayer = false;
@@ -1448,7 +1449,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < 6; index++)
{
var shader = shaderStateSpan[index];
ShaderState shader = shaderStateSpan[index];
if (!shader.UnpackEnable() && index != 1)
{
continue;
@@ -1553,7 +1554,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateSupportBufferViewportSize()
{
ref var transform = ref _state.State.ViewportTransform[0];
ref ViewportTransform transform = ref _state.State.ViewportTransform[0];
float scaleX = MathF.Abs(transform.ScaleX);
float scaleY = transform.ScaleY;
@@ -1592,8 +1593,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <returns>Current depth mode</returns>
private DepthMode GetDepthMode()
{
ref var transform = ref _state.State.ViewportTransform[0];
ref var extents = ref _state.State.ViewportExtents[0];
ref ViewportTransform transform = ref _state.State.ViewportTransform[0];
ref ViewportExtents extents = ref _state.State.ViewportExtents[0];
DepthMode depthMode;
@@ -81,8 +81,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_i2mClass = new InlineToMemoryClass(context, channel, initializeState: false);
var spec = new SpecializationStateUpdater(context);
var drawState = new DrawState();
SpecializationStateUpdater spec = new(context);
DrawState drawState = new();
_drawManager = new DrawManager(context, channel, _state, drawState, spec);
_blendManager = new AdvancedBlendManager(_state);
@@ -252,8 +252,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
else
{
var lhsVec = Unsafe.As<Span<T>, ReadOnlySpan<Vector128<uint>>>(ref lhs);
var rhsVec = Unsafe.As<Span<T>, ReadOnlySpan<Vector128<uint>>>(ref rhs);
ReadOnlySpan<Vector128<uint>> lhsVec = Unsafe.As<Span<T>, ReadOnlySpan<Vector128<uint>>>(ref lhs);
ReadOnlySpan<Vector128<uint>> rhsVec = Unsafe.As<Span<T>, ReadOnlySpan<Vector128<uint>>>(ref rhs);
return Vector128.EqualsAll(lhsVec[0], rhsVec[0]) &&
Vector128.EqualsAll(lhsVec[1], rhsVec[1]);
@@ -266,8 +266,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="masks">Blend enable</param>
public void UpdateBlendEnable(Span<Boolean32> enable)
{
var shadow = ShadowMode;
var state = _state.State.BlendEnable.AsSpan();
SetMmeShadowRamControlMode shadow = ShadowMode;
Span<Boolean32> state = _state.State.BlendEnable.AsSpan();
if (shadow.IsReplay())
{
@@ -293,8 +293,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="masks">Color masks</param>
public void UpdateColorMasks(Span<RtColorMask> masks)
{
var shadow = ShadowMode;
var state = _state.State.RtColorMask.AsSpan();
SetMmeShadowRamControlMode shadow = ShadowMode;
Span<RtColorMask> state = _state.State.RtColorMask.AsSpan();
if (shadow.IsReplay())
{
@@ -322,12 +322,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="type">Type of the binding</param>
public void UpdateIndexBuffer(uint addrHigh, uint addrLow, IndexType type)
{
var shadow = ShadowMode;
ref var state = ref _state.State.IndexBufferState;
SetMmeShadowRamControlMode shadow = ShadowMode;
ref IndexBufferState state = ref _state.State.IndexBufferState;
if (shadow.IsReplay())
{
ref var shadowState = ref _state.ShadowState.IndexBufferState;
ref IndexBufferState shadowState = ref _state.ShadowState.IndexBufferState;
addrHigh = shadowState.Address.High;
addrLow = shadowState.Address.Low;
type = shadowState.Type;
@@ -344,7 +344,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (shadow.IsTrack())
{
ref var shadowState = ref _state.ShadowState.IndexBufferState;
ref IndexBufferState shadowState = ref _state.ShadowState.IndexBufferState;
shadowState.Address.High = addrHigh;
shadowState.Address.Low = addrLow;
shadowState.Type = type;
@@ -359,12 +359,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="addrLow">Low part of the address</param>
public void UpdateUniformBufferState(int size, uint addrHigh, uint addrLow)
{
var shadow = ShadowMode;
ref var state = ref _state.State.UniformBufferState;
SetMmeShadowRamControlMode shadow = ShadowMode;
ref UniformBufferState state = ref _state.State.UniformBufferState;
if (shadow.IsReplay())
{
ref var shadowState = ref _state.ShadowState.UniformBufferState;
ref UniformBufferState shadowState = ref _state.ShadowState.UniformBufferState;
size = shadowState.Size;
addrHigh = shadowState.Address.High;
addrLow = shadowState.Address.Low;
@@ -376,7 +376,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (shadow.IsTrack())
{
ref var shadowState = ref _state.ShadowState.UniformBufferState;
ref UniformBufferState shadowState = ref _state.ShadowState.UniformBufferState;
shadowState.Size = size;
shadowState.Address.High = addrHigh;
shadowState.Address.Low = addrLow;
@@ -390,8 +390,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="offset">Offset to update with</param>
public void SetShaderOffset(int index, uint offset)
{
var shadow = ShadowMode;
ref var shaderState = ref _state.State.ShaderState[index];
SetMmeShadowRamControlMode shadow = ShadowMode;
ref ShaderState shaderState = ref _state.State.ShaderState[index];
if (shadow.IsReplay())
{
@@ -417,8 +417,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// <param name="ubState">Uniform buffer state</param>
public void UpdateUniformBufferState(UniformBufferState ubState)
{
var shadow = ShadowMode;
ref var state = ref _state.State.UniformBufferState;
SetMmeShadowRamControlMode shadow = ShadowMode;
ref UniformBufferState state = ref _state.State.UniformBufferState;
if (shadow.IsReplay())
{