Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix renderers can't batch vertices with the same blending parameters in some cases #6366

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ private void updateQuadBatch(IRenderer renderer)
quadBatch = renderer.CreateQuadBatch<TexturedVertex2D>(100, 1000);
}

// Children will set their own blending parameters.
internal override bool SetBlending => false;

protected override void Draw(IRenderer renderer)
{
updateQuadBatch(renderer);
Expand Down
9 changes: 8 additions & 1 deletion osu.Framework/Graphics/DrawNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public virtual void ApplyState()
InvalidationID = Source.InvalidationID;
}

/// <summary>
/// Whether the renderer should set blending parameters of this <see cref="DrawNode"/>.
/// </summary>
internal virtual bool SetBlending => true;

/// <summary>
/// Draws this <see cref="DrawNode"/> to the screen.
/// </summary>
Expand All @@ -76,7 +81,9 @@ public virtual void ApplyState()
/// <param name="renderer">The renderer to draw with.</param>
protected virtual void Draw(IRenderer renderer)
{
renderer.SetBlend(DrawColourInfo.Blending);
if (SetBlending)
renderer.SetBlend(DrawColourInfo.Blending);

renderer.BackbufferDepth.Set(drawDepth);
}

Expand Down
Loading