Skip to content

Commit

Permalink
DrawNode invalidation without framebuffer redraw
Browse files Browse the repository at this point in the history
Framebuffer redraw now needs to be explicitly requested
by calling ForceRedraw() on the BufferedContainer when its cached.
It is also automatically triggered when the source of
Invalidation.DrawNode is a child.
  • Loading branch information
Uncomfy committed Oct 30, 2024
1 parent ae06c25 commit fa8af25
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions osu.Framework/Graphics/Containers/BufferedContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public ColourInfo EffectColour
return;

effectColour = value;
Invalidate(Invalidation.DrawNode);
ForceRedraw();
}
}

Expand All @@ -137,7 +137,7 @@ public BlendingParameters EffectBlending
return;

effectBlending = value;
Invalidate(Invalidation.DrawNode);
ForceRedraw();
}
}

Expand All @@ -156,7 +156,7 @@ public EffectPlacement EffectPlacement
return;

effectPlacement = value;
Invalidate(Invalidation.DrawNode);
ForceRedraw();
}
}

Expand Down Expand Up @@ -223,7 +223,11 @@ public bool RedrawOnScale
/// Forces a redraw of the framebuffer before it is blitted the next time.
/// Only relevant if <see cref="UsingCachedFrameBuffer"/> is true.
/// </summary>
public void ForceRedraw() => Invalidate(Invalidation.DrawNode);
public void ForceRedraw()
{
++updateVersion;
Invalidate(Invalidation.DrawNode);
}

/// <summary>
/// In order to signal the draw thread to re-draw the buffered container we version it.
Expand Down Expand Up @@ -293,7 +297,11 @@ protected override bool OnInvalidate(Invalidation invalidation, InvalidationSour

if ((invalidation & Invalidation.DrawNode) > 0)
{
++updateVersion;
if (source == InvalidationSource.Child)
{
++updateVersion;
}

result = true;
}

Expand Down

0 comments on commit fa8af25

Please sign in to comment.