When batching, don't place barriers between every copy

This commit is contained in:
riperiperi 2024-02-15 19:14:19 +00:00
parent 1a85c9a00b
commit a46b1bd88c
2 changed files with 9 additions and 4 deletions

View file

@ -49,11 +49,15 @@ namespace Ryujinx.Graphics.OpenGL.Queries
GL.BeginQuery(_type, Query); GL.BeginQuery(_type, Query);
} }
public unsafe void CopyQueryResult() public unsafe void CopyQueryResult(bool withBarrier)
{ {
GL.BindBuffer(BufferTarget.QueryBuffer, _buffer); GL.BindBuffer(BufferTarget.QueryBuffer, _buffer);
GL.GetQueryObject(Query, GetQueryObjectParam.QueryResult, (long*)0); 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) public void End(bool withResult)
@ -64,7 +68,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
{ {
if (!_parent.QueueCopy(this)) if (!_parent.QueueCopy(this))
{ {
CopyQueryResult(); CopyQueryResult(true);
} }
} }
else else

View file

@ -66,9 +66,10 @@ namespace Ryujinx.Graphics.OpenGL.Queries
{ {
if (_queuedCopies.Count > 0) if (_queuedCopies.Count > 0)
{ {
int i = 0;
foreach (BufferedQuery query in _queuedCopies) foreach (BufferedQuery query in _queuedCopies)
{ {
query.CopyQueryResult(); query.CopyQueryResult(_queuedCopies.Count == ++i);
} }
_queuedCopies.Clear(); _queuedCopies.Clear();