diff --git a/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs b/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs index d9add25cd6..09f71aa02e 100644 --- a/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs +++ b/src/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs @@ -49,11 +49,15 @@ namespace Ryujinx.Graphics.OpenGL.Queries GL.BeginQuery(_type, Query); } - public unsafe void CopyQueryResult() + public unsafe void CopyQueryResult(bool withBarrier) { GL.BindBuffer(BufferTarget.QueryBuffer, _buffer); GL.GetQueryObject(Query, GetQueryObjectParam.QueryResult, (long*)0); - GL.MemoryBarrier(MemoryBarrierFlags.QueryBufferBarrierBit | MemoryBarrierFlags.ClientMappedBufferBarrierBit); + + if (withBarrier) + { + GL.MemoryBarrier(MemoryBarrierFlags.QueryBufferBarrierBit | MemoryBarrierFlags.ClientMappedBufferBarrierBit); + } } public void End(bool withResult) @@ -64,7 +68,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries { if (!_parent.QueueCopy(this)) { - CopyQueryResult(); + CopyQueryResult(true); } } else diff --git a/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs b/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs index ba64b84cc5..0191a7e86d 100644 --- a/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs +++ b/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs @@ -66,9 +66,10 @@ namespace Ryujinx.Graphics.OpenGL.Queries { if (_queuedCopies.Count > 0) { + int i = 0; foreach (BufferedQuery query in _queuedCopies) { - query.CopyQueryResult(); + query.CopyQueryResult(_queuedCopies.Count == ++i); } _queuedCopies.Clear();