Skip to content

Commit

Permalink
Further reduce visibility of triple buffer in GameHost
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jun 28, 2024
1 parent b96db6a commit 1823132
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal abstract class VeldridVertexBatch<T> : IVertexBatch<T>
/// <summary>
/// Most documentation recommends that three buffers are used to avoid contention.
///
/// We already have a triple buffer (see <see cref="GameHost.DrawRoots"/>) governing draw nodes.
/// We already have a triple buffer governing draw nodes.
/// In theory we could set this to two, but there's also a global usage of a vertex batch in <see cref="VeldridRenderer"/> (see <see cref="Renderer.DefaultQuadBatch"/>).
///
/// So this is for now an unfortunate memory overhead. Further work could be done to provide
Expand Down
8 changes: 4 additions & 4 deletions osu.Framework/Platform/GameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ protected virtual void OnExited()
Exited?.Invoke();
}

protected TripleBuffer<DrawNode> DrawRoots = new TripleBuffer<DrawNode>();
private readonly TripleBuffer<DrawNode> drawRoots = new TripleBuffer<DrawNode>();

protected Container Root;
internal Container Root { get; private set; }

private ulong frameCount;

Expand All @@ -479,7 +479,7 @@ protected virtual void UpdateFrame()
Root.UpdateSubTree();
Root.UpdateSubTreeMasking();

using (var buffer = DrawRoots.GetForWrite())
using (var buffer = drawRoots.GetForWrite())
buffer.Object = Root.GenerateDrawNodeSubtree(frameCount, buffer.Index, false);
}

Expand Down Expand Up @@ -511,7 +511,7 @@ protected virtual void DrawFrame()
Renderer.WaitUntilNextFrameReady();

didRenderFrame = false;
buffer = DrawRoots.GetForRead();
buffer = drawRoots.GetForRead();
}

if (buffer == null)
Expand Down

0 comments on commit 1823132

Please sign in to comment.