Cleanup IntPtr casts

This commit is contained in:
Isaac Marovitz 2024-05-09 19:16:26 -04:00
parent 38d900c932
commit e46b671875
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
3 changed files with 8 additions and 7 deletions

View file

@ -7,6 +7,7 @@ using Ryujinx.Graphics.OpenGL.Queries;
using Ryujinx.Graphics.Shader.Translation;
using Silk.NET.OpenGL.Legacy.Extensions.ARB;
using System;
using System.Runtime.InteropServices;
using Sampler = Ryujinx.Graphics.OpenGL.Image.Sampler;
namespace Ryujinx.Graphics.OpenGL
@ -247,11 +248,11 @@ namespace Ryujinx.Graphics.OpenGL
Api.ClampColor(ClampColorTargetARB.FragmentColorArb, ClampColorModeARB.False);
}
private void PrintGpuInformation()
private unsafe void PrintGpuInformation()
{
GpuVendor = Api.GetString(StringName.Vendor);
GpuRenderer = Api.GetString(StringName.Renderer);
GpuVersion = Api.GetString(StringName.Version);
GpuVendor = Marshal.PtrToStringAnsi((IntPtr)Api.GetString(StringName.Vendor));
GpuRenderer = Marshal.PtrToStringAnsi((IntPtr)Api.GetString(StringName.Renderer));
GpuVersion = Marshal.PtrToStringAnsi((IntPtr)Api.GetString(StringName.Version));
Logger.Notice.Print(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})");
}

View file

@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.OpenGL
_api.BindBuffer(BufferTargetARB.CopyWriteBuffer, handle.ToUInt32());
void* ptr = _api.MapBufferRange(BufferTargetARB.CopyWriteBuffer, IntPtr.Zero, (uint)size, MapBufferAccessMask.ReadBit | MapBufferAccessMask.PersistentBit);
_maps[handle] = new IntPtr(ptr);
_maps[handle] = (IntPtr)ptr;
}
public void Unmap(BufferHandle handle)
@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.OpenGL
_api.BindBuffer(BufferTargetARB.CopyWriteBuffer, _copyBufferHandle);
_api.BufferStorage(BufferStorageTarget.CopyWriteBuffer, (uint)requiredSize, IntPtr.Zero, BufferStorageMask.MapReadBit | BufferStorageMask.MapPersistentBit);
_bufferMap = new IntPtr(_api.MapBufferRange(BufferTargetARB.CopyWriteBuffer, IntPtr.Zero, (uint)requiredSize, MapBufferAccessMask.ReadBit | MapBufferAccessMask.PersistentBit));
_bufferMap = (IntPtr)_api.MapBufferRange(BufferTargetARB.CopyWriteBuffer, IntPtr.Zero, (uint)requiredSize, MapBufferAccessMask.ReadBit | MapBufferAccessMask.PersistentBit);
}
}

View file

@ -36,7 +36,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
unsafe
{
_bufferMap = new IntPtr(_api.MapBufferRange(BufferTargetARB.QueryBuffer, IntPtr.Zero, sizeof(long), MapBufferAccessMask.ReadBit | MapBufferAccessMask.WriteBit | MapBufferAccessMask.PersistentBit));
_bufferMap = (IntPtr)_api.MapBufferRange(BufferTargetARB.QueryBuffer, IntPtr.Zero, sizeof(long), MapBufferAccessMask.ReadBit | MapBufferAccessMask.WriteBit | MapBufferAccessMask.PersistentBit);
}
}