mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-29 00:06:24 +02:00
misc: chore: Use explicit types in GPU, Device, and Host1x projects
This commit is contained in:
parent
5099548856
commit
1ae349efb1
55 changed files with 350 additions and 339 deletions
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -32,15 +33,15 @@ namespace Ryujinx.Graphics.Device
|
|||
_debugLogCallback = debugLogCallback;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -48,7 +49,7 @@ namespace Ryujinx.Graphics.Device
|
|||
{
|
||||
int index = (offset + i) / RegisterSize;
|
||||
|
||||
if (callbacks != null && callbacks.TryGetValue(field.Name, out var cb))
|
||||
if (callbacks != null && callbacks.TryGetValue(field.Name, out RwCallback cb))
|
||||
{
|
||||
if (cb.Read != null)
|
||||
{
|
||||
|
@ -81,7 +82,7 @@ namespace Ryujinx.Graphics.Device
|
|||
{
|
||||
uint alignedOffset = index * RegisterSize;
|
||||
|
||||
var readCallback = Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_readCallbacks), (nint)index);
|
||||
Func<int> readCallback = Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_readCallbacks), (nint)index);
|
||||
if (readCallback != null)
|
||||
{
|
||||
return readCallback();
|
||||
|
@ -119,7 +120,7 @@ namespace Ryujinx.Graphics.Device
|
|||
uint alignedOffset = index * RegisterSize;
|
||||
DebugWrite(alignedOffset, data);
|
||||
|
||||
ref var storage = ref GetRefIntAlignedUncheck(index);
|
||||
ref int storage = ref GetRefIntAlignedUncheck(index);
|
||||
changed = storage != data;
|
||||
storage = data;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue