mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-05 23:43:04 +00:00
Fix some warnings
This commit is contained in:
parent
2b07d783c8
commit
bab7457b99
9 changed files with 38 additions and 27 deletions
|
@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
size,
|
||||
PixelFormat.RgbaInteger,
|
||||
PixelType.UnsignedByte,
|
||||
(IntPtr)valueArr);
|
||||
valueArr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
uint handle = api.GenBuffer();
|
||||
|
||||
api.BindBuffer(BufferTargetARB.CopyWriteBuffer, handle);
|
||||
api.BufferData(BufferTargetARB.CopyWriteBuffer, (uint)size, UIntPtr.Zero, BufferUsageARB.DynamicDraw);
|
||||
api.BufferData(BufferTargetARB.CopyWriteBuffer, (uint)size, in UIntPtr.Zero, BufferUsageARB.DynamicDraw);
|
||||
|
||||
return Handle.FromUInt32<BufferHandle>(handle);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
uint handle = api.GenBuffer();
|
||||
|
||||
api.BindBuffer(BufferTargetARB.CopyWriteBuffer, handle);
|
||||
api.BufferStorage(BufferStorageTarget.CopyWriteBuffer, (uint)size, UIntPtr.Zero,
|
||||
api.BufferStorage(BufferStorageTarget.CopyWriteBuffer, (uint)size, in UIntPtr.Zero,
|
||||
BufferStorageMask.MapPersistentBit |
|
||||
BufferStorageMask.MapCoherentBit |
|
||||
BufferStorageMask.ClientStorageBit |
|
||||
|
@ -97,7 +97,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
public static void Resize(GL api, BufferHandle handle, int size)
|
||||
{
|
||||
api.BindBuffer(BufferTargetARB.CopyWriteBuffer, handle.ToUInt32());
|
||||
api.BufferData(BufferTargetARB.CopyWriteBuffer, (uint)size, UIntPtr.Zero, BufferUsageARB.StreamCopy);
|
||||
api.BufferData(BufferTargetARB.CopyWriteBuffer, (uint)size, in UIntPtr.Zero, BufferUsageARB.StreamCopy);
|
||||
}
|
||||
|
||||
public static void SetData(GL api, BufferHandle buffer, int offset, ReadOnlySpan<byte> data)
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
if (logLevel == GraphicsDebugLevel.None)
|
||||
{
|
||||
gl.Disable(EnableCap.DebugOutputSynchronous);
|
||||
gl.DebugMessageCallback(null, IntPtr.Zero);
|
||||
gl.DebugMessageCallback(null, in IntPtr.Zero);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_counter = 0;
|
||||
_debugCallback = GLDebugHandler;
|
||||
|
||||
gl.DebugMessageCallback(_debugCallback, IntPtr.Zero);
|
||||
gl.DebugMessageCallback(_debugCallback, in IntPtr.Zero);
|
||||
|
||||
Logger.Warning?.Print(LogClass.Gpu, "OpenGL Debugging is enabled. Performance will be negatively impacted.");
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
switch (mode)
|
||||
{
|
||||
case AddressMode.Clamp:
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
return TextureWrapMode.Clamp;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
case AddressMode.Repeat:
|
||||
return TextureWrapMode.Repeat;
|
||||
case AddressMode.MirrorClamp:
|
||||
|
@ -33,7 +35,9 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(AddressMode)} enum value: {mode}.");
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
return TextureWrapMode.Clamp;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
}
|
||||
|
||||
public static NV Convert(this AdvancedBlendOp op)
|
||||
|
@ -451,7 +455,9 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
case PrimitiveTopology.Quads:
|
||||
return PrimitiveType.Quads;
|
||||
case PrimitiveTopology.QuadStrip:
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
return PrimitiveType.QuadStrip;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
case PrimitiveTopology.Polygon:
|
||||
return PrimitiveType.TriangleFan;
|
||||
case PrimitiveTopology.LinesAdjacency:
|
||||
|
|
|
@ -152,8 +152,10 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
public static bool SupportsQuadsCheck(GL api)
|
||||
{
|
||||
api.GetError(); // Clear any existing error.
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
api.Begin(PrimitiveType.Quads);
|
||||
api.End();
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
return api.GetError() == GLEnum.NoError;
|
||||
}
|
||||
|
|
|
@ -464,7 +464,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
|||
_copyPboSize = requiredSize;
|
||||
|
||||
_gd.Api.BindBuffer(BufferTargetARB.PixelPackBuffer, _copyPboHandle);
|
||||
_gd.Api.BufferData(BufferTargetARB.PixelPackBuffer, (uint)requiredSize, IntPtr.Zero, BufferUsageARB.DynamicCopy);
|
||||
_gd.Api.BufferData(BufferTargetARB.PixelPackBuffer, (uint)requiredSize, in IntPtr.Zero, BufferUsageARB.DynamicCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_copyBufferSize = requiredSize;
|
||||
|
||||
_api.BindBuffer(BufferTargetARB.CopyWriteBuffer, _copyBufferHandle);
|
||||
_api.BufferStorage(BufferStorageTarget.CopyWriteBuffer, (uint)requiredSize, IntPtr.Zero, BufferStorageMask.MapReadBit | BufferStorageMask.MapPersistentBit);
|
||||
_api.BufferStorage(BufferStorageTarget.CopyWriteBuffer, (uint)requiredSize, in IntPtr.Zero, BufferStorageMask.MapReadBit | BufferStorageMask.MapPersistentBit);
|
||||
|
||||
_bufferMap = (IntPtr)_api.MapBufferRange(BufferTargetARB.CopyWriteBuffer, IntPtr.Zero, (uint)requiredSize, MapBufferAccessMask.ReadBit | MapBufferAccessMask.PersistentBit);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,9 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
{
|
||||
DrawQuadsImpl(vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
}
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
else if (_primitiveType == PrimitiveType.QuadStrip && !_gd.Capabilities.SupportsQuads)
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
{
|
||||
DrawQuadStripImpl(vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
}
|
||||
|
@ -376,7 +378,9 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
firstVertex,
|
||||
firstInstance);
|
||||
}
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
else if (_primitiveType == PrimitiveType.QuadStrip && !_gd.Capabilities.SupportsQuads)
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
{
|
||||
DrawQuadStripIndexedImpl(
|
||||
indexCount,
|
||||
|
@ -476,7 +480,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
PrimitiveType.TriangleFan,
|
||||
countsPtr,
|
||||
_elementsType,
|
||||
indicesPtr,
|
||||
in indicesPtr,
|
||||
(uint)quadsCount,
|
||||
baseVerticesPtr);
|
||||
}
|
||||
|
@ -523,7 +527,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
PrimitiveType.TriangleFan,
|
||||
countsPtr,
|
||||
_elementsType,
|
||||
indicesPtr,
|
||||
in indicesPtr,
|
||||
(uint)quadsCount,
|
||||
baseVerticesPtr);
|
||||
}
|
||||
|
@ -538,7 +542,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
{
|
||||
if (firstInstance == 0 && firstVertex == 0 && instanceCount == 1)
|
||||
{
|
||||
_gd.Api.DrawElements(_primitiveType, (uint)indexCount, _elementsType, indexBaseOffset);
|
||||
_gd.Api.DrawElements(_primitiveType, (uint)indexCount, _elementsType, in indexBaseOffset);
|
||||
}
|
||||
else if (firstInstance == 0 && instanceCount == 1)
|
||||
{
|
||||
|
@ -546,7 +550,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_primitiveType,
|
||||
(uint)indexCount,
|
||||
_elementsType,
|
||||
indexBaseOffset,
|
||||
in indexBaseOffset,
|
||||
firstVertex);
|
||||
}
|
||||
else if (firstInstance == 0 && firstVertex == 0)
|
||||
|
@ -555,7 +559,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_primitiveType,
|
||||
(uint)indexCount,
|
||||
_elementsType,
|
||||
indexBaseOffset,
|
||||
in indexBaseOffset,
|
||||
(uint)instanceCount);
|
||||
}
|
||||
else if (firstInstance == 0)
|
||||
|
@ -564,7 +568,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_primitiveType,
|
||||
(uint)indexCount,
|
||||
_elementsType,
|
||||
indexBaseOffset,
|
||||
in indexBaseOffset,
|
||||
(uint)instanceCount,
|
||||
firstVertex);
|
||||
}
|
||||
|
@ -574,7 +578,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_primitiveType,
|
||||
(uint)indexCount,
|
||||
_elementsType,
|
||||
indexBaseOffset,
|
||||
in indexBaseOffset,
|
||||
(uint)instanceCount,
|
||||
(uint)firstInstance);
|
||||
}
|
||||
|
@ -584,7 +588,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_primitiveType,
|
||||
(uint)indexCount,
|
||||
_elementsType,
|
||||
indexBaseOffset,
|
||||
in indexBaseOffset,
|
||||
(uint)instanceCount,
|
||||
firstVertex,
|
||||
(uint)firstInstance);
|
||||
|
@ -605,7 +609,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
_gd.Api.BindBuffer(BufferTargetARB.DrawIndirectBuffer, indirectBuffer.Handle.ToUInt32());
|
||||
|
||||
_gd.Api.DrawElementsIndirect(_primitiveType, _elementsType, (IntPtr)indirectBuffer.Offset);
|
||||
_gd.Api.DrawElementsIndirect(_primitiveType, _elementsType, indirectBuffer.Offset);
|
||||
|
||||
_vertexArray.RestoreIndexBuffer();
|
||||
|
||||
|
@ -630,7 +634,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_gd.Api.MultiDrawElementsIndirectCount(
|
||||
_primitiveType,
|
||||
_elementsType,
|
||||
(IntPtr)indirectBuffer.Offset,
|
||||
indirectBuffer.Offset,
|
||||
parameterBuffer.Offset,
|
||||
(uint)maxDrawCount,
|
||||
(uint)stride);
|
||||
|
@ -652,7 +656,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
_gd.Api.BindBuffer(BufferTargetARB.DrawIndirectBuffer, indirectBuffer.Handle.ToUInt32());
|
||||
|
||||
_gd.Api.DrawArraysIndirect(_primitiveType, (IntPtr)indirectBuffer.Offset);
|
||||
_gd.Api.DrawArraysIndirect(_primitiveType, indirectBuffer.Offset);
|
||||
|
||||
PostDraw();
|
||||
}
|
||||
|
@ -672,7 +676,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
_gd.Api.MultiDrawArraysIndirectCount(
|
||||
_primitiveType,
|
||||
(IntPtr)indirectBuffer.Offset,
|
||||
indirectBuffer.Offset,
|
||||
parameterBuffer.Offset,
|
||||
(uint)maxDrawCount,
|
||||
(uint)stride);
|
||||
|
@ -778,6 +782,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_tfEnabled = false;
|
||||
}
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
public void SetAlphaTest(bool enable, float reference, CompareOp op)
|
||||
{
|
||||
if (!enable)
|
||||
|
@ -789,6 +794,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
_gd.Api.AlphaFunc((AlphaFunction)op.Convert(), reference);
|
||||
_gd.Api.Enable(EnableCap.AlphaTest);
|
||||
}
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
public void SetBlendState(AdvancedBlendDescriptor blend)
|
||||
{
|
||||
|
@ -1068,6 +1074,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin)
|
||||
{
|
||||
// GL_POINT_SPRITE was deprecated in core profile 3.2+ and causes GL_INVALID_ENUM when set.
|
||||
|
@ -1098,6 +1105,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
// From the spec, GL_INVALID_VALUE is generated if size is less than or equal to 0.
|
||||
_gd.Api.PointSize(Math.Max(float.Epsilon, size));
|
||||
}
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
public void SetPolygonMode(GAL.PolygonMode frontMode, GAL.PolygonMode backMode)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
{
|
||||
fixed (byte* ptr = code)
|
||||
{
|
||||
_gd.Api.ProgramBinary(Handle, (GLEnum)binaryFormat, (IntPtr)ptr, (uint)code.Length - 4);
|
||||
_gd.Api.ProgramBinary(Handle, (GLEnum)binaryFormat, ptr, (uint)code.Length - 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,12 +27,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
|||
_type = type;
|
||||
|
||||
_api.BindBuffer(BufferTargetARB.QueryBuffer, _buffer);
|
||||
|
||||
unsafe
|
||||
{
|
||||
long defaultValue = DefaultValue;
|
||||
_api.BufferStorage(BufferStorageTarget.QueryBuffer, sizeof(long), (IntPtr)(&defaultValue), BufferStorageMask.MapReadBit | BufferStorageMask.MapWriteBit | BufferStorageMask.MapPersistentBit);
|
||||
}
|
||||
_api.BufferStorage(BufferStorageTarget.QueryBuffer, sizeof(long), DefaultValue, BufferStorageMask.MapReadBit | BufferStorageMask.MapWriteBit | BufferStorageMask.MapPersistentBit);
|
||||
|
||||
unsafe
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue