mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-29 03:27:11 +02:00
misc: Replace references to IntPtr/UIntPtr with nint/nuint + code cleanups.
This commit is contained in:
parent
a09d314817
commit
dfb4854d19
172 changed files with 902 additions and 914 deletions
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
|
||||
private struct PoolItem
|
||||
{
|
||||
public IntPtr Pointer;
|
||||
public nint Pointer;
|
||||
public int Length;
|
||||
public bool InUse;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
{
|
||||
int lengthInBytes = Unsafe.SizeOf<T>() * length;
|
||||
|
||||
IntPtr ptr = IntPtr.Zero;
|
||||
nint ptr = nint.Zero;
|
||||
|
||||
for (int i = 0; i < PoolEntries; i++)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
}
|
||||
}
|
||||
|
||||
if (ptr == IntPtr.Zero)
|
||||
if (ptr == nint.Zero)
|
||||
{
|
||||
ptr = Marshal.AllocHGlobal(lengthInBytes);
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
if (!item.InUse)
|
||||
{
|
||||
item.InUse = true;
|
||||
if (item.Pointer != IntPtr.Zero)
|
||||
if (item.Pointer != nint.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(item.Pointer);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
|
||||
public unsafe void Free<T>(ArrayPtr<T> arr) where T : unmanaged
|
||||
{
|
||||
IntPtr ptr = (IntPtr)arr.ToPointer();
|
||||
nint ptr = (nint)arr.ToPointer();
|
||||
|
||||
for (int i = 0; i < PoolEntries; i++)
|
||||
{
|
||||
|
@ -83,10 +83,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
{
|
||||
ref PoolItem item = ref _pool[i];
|
||||
|
||||
if (item.Pointer != IntPtr.Zero)
|
||||
if (item.Pointer != nint.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(item.Pointer);
|
||||
item.Pointer = IntPtr.Zero;
|
||||
item.Pointer = nint.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public ArrayPtr<byte> UBuffer;
|
||||
public ArrayPtr<byte> VBuffer;
|
||||
|
||||
public readonly unsafe Plane YPlane => new((IntPtr)YBuffer.ToPointer(), YBuffer.Length);
|
||||
public readonly unsafe Plane UPlane => new((IntPtr)UBuffer.ToPointer(), UBuffer.Length);
|
||||
public readonly unsafe Plane VPlane => new((IntPtr)VBuffer.ToPointer(), VBuffer.Length);
|
||||
public readonly unsafe Plane YPlane => new((nint)YBuffer.ToPointer(), YBuffer.Length);
|
||||
public readonly unsafe Plane UPlane => new((nint)UBuffer.ToPointer(), UBuffer.Length);
|
||||
public readonly unsafe Plane VPlane => new((nint)VBuffer.ToPointer(), VBuffer.Length);
|
||||
|
||||
public readonly FrameField Field => FrameField.Progressive;
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
|
||||
public bool HighBd { get; }
|
||||
|
||||
private readonly IntPtr _pointer;
|
||||
private readonly nint _pointer;
|
||||
|
||||
public Surface(int width, int height)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
|
||||
int frameSize = (HighBd ? 2 : 1) * (yplaneSize + 2 * uvplaneSize);
|
||||
|
||||
IntPtr pointer = Marshal.AllocHGlobal(frameSize);
|
||||
nint pointer = Marshal.AllocHGlobal(frameSize);
|
||||
_pointer = pointer;
|
||||
Width = width;
|
||||
Height = height;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue