mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 09:53:35 +01:00
End empty gl queries before returning them to the pool. (#1806)
This commit is contained in:
parent
8a6607540e
commit
06057a99a6
3 changed files with 11 additions and 7 deletions
|
@ -44,14 +44,17 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
||||||
GL.BeginQuery(_type, Query);
|
GL.BeginQuery(_type, Query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void End()
|
public unsafe void End(bool withResult)
|
||||||
{
|
{
|
||||||
GL.EndQuery(_type);
|
GL.EndQuery(_type);
|
||||||
|
|
||||||
GL.BindBuffer(BufferTarget.QueryBuffer, _buffer);
|
if (withResult)
|
||||||
|
{
|
||||||
|
GL.BindBuffer(BufferTarget.QueryBuffer, _buffer);
|
||||||
|
|
||||||
Marshal.WriteInt64(_bufferMap, -1L);
|
Marshal.WriteInt64(_bufferMap, -1L);
|
||||||
GL.GetQueryObject(Query, GetQueryObjectParam.QueryResult, (long*)0);
|
GL.GetQueryObject(Query, GetQueryObjectParam.QueryResult, (long*)0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetResult(out long result)
|
public bool TryGetResult(out long result)
|
||||||
|
|
|
@ -107,13 +107,14 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
||||||
|
|
||||||
if (draws > 0)
|
if (draws > 0)
|
||||||
{
|
{
|
||||||
_current.Complete();
|
_current.Complete(true);
|
||||||
_events.Enqueue(_current);
|
_events.Enqueue(_current);
|
||||||
|
|
||||||
_current.OnResult += resultHandler;
|
_current.OnResult += resultHandler;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_current.Complete(false);
|
||||||
_current.Dispose();
|
_current.Dispose();
|
||||||
resultHandler(_current, 0);
|
resultHandler(_current, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,9 @@ namespace Ryujinx.Graphics.OpenGL.Queries
|
||||||
ClearCounter = true;
|
ClearCounter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Complete()
|
internal void Complete(bool withResult)
|
||||||
{
|
{
|
||||||
_counter.End();
|
_counter.End(withResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool TryConsume(ref ulong result, bool block, AutoResetEvent wakeSignal = null)
|
internal bool TryConsume(ref ulong result, bool block, AutoResetEvent wakeSignal = null)
|
||||||
|
|
Loading…
Reference in a new issue