diff --git a/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs b/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs index dc406e84a..a12cdd467 100644 --- a/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs +++ b/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs @@ -23,7 +23,8 @@ namespace Ryujinx.Graphics.OpenGL.Effects public static uint CompileProgram(GL api, string[] shaders, ShaderType shaderType) { var shader = api.CreateShader(shaderType); - api.ShaderSource(shader, (uint)shaders.Length, shaders, 0); + var length = 0; + api.ShaderSource(shader, (uint)shaders.Length, shaders, in length); api.CompileShader(shader); var program = api.CreateProgram(); diff --git a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs index 5f97fc25a..1ead524a1 100644 --- a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -419,11 +419,13 @@ namespace Ryujinx.Graphics.OpenGL { for (int quadIndex = 0; quadIndex < quadsCount; quadIndex++) { + var indices = indexBaseOffset + quadIndex * 4 * indexElemSize; + _gd.Api.DrawElementsInstancedBaseVertexBaseInstance( PrimitiveType.TriangleFan, 4, _elementsType, - indexBaseOffset + quadIndex * 4 * indexElemSize, + in indices, (uint)instanceCount, firstVertex, (uint)firstInstance); @@ -433,11 +435,13 @@ namespace Ryujinx.Graphics.OpenGL { for (int quadIndex = 0; quadIndex < quadsCount; quadIndex++) { + var indices = indexBaseOffset + quadIndex * 4 * indexElemSize; + _gd.Api.DrawElementsInstancedBaseInstance( PrimitiveType.TriangleFan, 4, _elementsType, - indexBaseOffset + quadIndex * 4 * indexElemSize, + in indices, (uint)instanceCount, (uint)firstInstance); } @@ -446,11 +450,13 @@ namespace Ryujinx.Graphics.OpenGL { for (int quadIndex = 0; quadIndex < quadsCount; quadIndex++) { + var indices = indexBaseOffset + quadIndex * 4 * indexElemSize; + _gd.Api.DrawElementsInstanced( PrimitiveType.TriangleFan, 4, _elementsType, - indexBaseOffset + quadIndex * 4 * indexElemSize, + in indices, (uint)instanceCount); } } @@ -609,7 +615,8 @@ namespace Ryujinx.Graphics.OpenGL _gd.Api.BindBuffer(BufferTargetARB.DrawIndirectBuffer, indirectBuffer.Handle.ToUInt32()); - _gd.Api.DrawElementsIndirect(_primitiveType, _elementsType, indirectBuffer.Offset); + var offset = indirectBuffer.Offset; + _gd.Api.DrawElementsIndirect(_primitiveType, _elementsType, in offset); _vertexArray.RestoreIndexBuffer(); @@ -631,10 +638,11 @@ namespace Ryujinx.Graphics.OpenGL _gd.Api.BindBuffer(BufferTargetARB.DrawIndirectBuffer, indirectBuffer.Handle.ToUInt32()); _gd.Api.BindBuffer(BufferTargetARB.ParameterBuffer, parameterBuffer.Handle.ToUInt32()); + var offset = indirectBuffer.Offset; _gd.Api.MultiDrawElementsIndirectCount( _primitiveType, _elementsType, - indirectBuffer.Offset, + in offset, parameterBuffer.Offset, (uint)maxDrawCount, (uint)stride); @@ -656,7 +664,8 @@ namespace Ryujinx.Graphics.OpenGL _gd.Api.BindBuffer(BufferTargetARB.DrawIndirectBuffer, indirectBuffer.Handle.ToUInt32()); - _gd.Api.DrawArraysIndirect(_primitiveType, indirectBuffer.Offset); + var offset = indirectBuffer.Offset; + _gd.Api.DrawArraysIndirect(_primitiveType, in offset); PostDraw(); } @@ -674,9 +683,10 @@ namespace Ryujinx.Graphics.OpenGL _gd.Api.BindBuffer(BufferTargetARB.DrawIndirectBuffer, indirectBuffer.Handle.ToUInt32()); _gd.Api.BindBuffer(BufferTargetARB.ParameterBuffer, parameterBuffer.Handle.ToUInt32()); + var offset = indirectBuffer.Offset; _gd.Api.MultiDrawArraysIndirectCount( _primitiveType, - indirectBuffer.Offset, + in offset, parameterBuffer.Offset, (uint)maxDrawCount, (uint)stride); diff --git a/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs b/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs index 8c9ce1d28..03762eb78 100644 --- a/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs +++ b/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs @@ -27,7 +27,9 @@ namespace Ryujinx.Graphics.OpenGL.Queries _type = type; _api.BindBuffer(BufferTargetARB.QueryBuffer, _buffer); - _api.BufferStorage(BufferStorageTarget.QueryBuffer, sizeof(long), DefaultValue, BufferStorageMask.MapReadBit | BufferStorageMask.MapWriteBit | BufferStorageMask.MapPersistentBit); + + var defaultValue = DefaultValue; + _api.BufferStorage(BufferStorageTarget.QueryBuffer, sizeof(long), in defaultValue, BufferStorageMask.MapReadBit | BufferStorageMask.MapWriteBit | BufferStorageMask.MapPersistentBit); unsafe {