Skip to content

Commit

Permalink
Merge pull request #26636 from EVAST9919/triangles-batch
Browse files Browse the repository at this point in the history
Remove local vertex batching from triangles backgrounds
  • Loading branch information
peppy committed Jan 20, 2024
2 parents e669e28 + 45effdb commit 1e44ba6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
11 changes: 1 addition & 10 deletions osu.Game/Graphics/Backgrounds/Triangles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using osu.Framework.Allocation;
using System.Collections.Generic;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Rendering.Vertices;
using osu.Framework.Lists;
using osu.Framework.Bindables;

Expand Down Expand Up @@ -264,7 +263,6 @@ private class TrianglesDrawNode : DrawNode
private readonly Vector2 triangleSize = new Vector2(1f, equilateral_triangle_ratio) * triangle_size;

private Vector2 size;
private IVertexBatch<TexturedVertex2D> vertexBatch;

public TrianglesDrawNode(Triangles source)
: base(source)
Expand All @@ -290,12 +288,6 @@ protected override void Draw(IRenderer renderer)
{
base.Draw(renderer);

if (Source.AimCount > 0 && (vertexBatch == null || vertexBatch.Size != Source.AimCount))
{
vertexBatch?.Dispose();
vertexBatch = renderer.CreateQuadBatch<TexturedVertex2D>(Source.AimCount, 1);
}

borderDataBuffer ??= renderer.CreateUniformBuffer<TriangleBorderData>();
borderDataBuffer.Data = borderDataBuffer.Data with
{
Expand Down Expand Up @@ -333,7 +325,7 @@ protected override void Draw(IRenderer renderer)
triangleQuad.Height
) / relativeSize;

renderer.DrawQuad(texture, drawQuad, colourInfo, new RectangleF(0, 0, 1, 1), vertexBatch.AddAction, textureCoords: textureCoords);
renderer.DrawQuad(texture, drawQuad, colourInfo, new RectangleF(0, 0, 1, 1), textureCoords: textureCoords);
}

shader.Unbind();
Expand All @@ -356,7 +348,6 @@ protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);

vertexBatch?.Dispose();
borderDataBuffer?.Dispose();
}
}
Expand Down
12 changes: 1 addition & 11 deletions osu.Game/Graphics/Backgrounds/TrianglesV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using osu.Framework.Allocation;
using System.Collections.Generic;
using osu.Framework.Graphics.Rendering;
using osu.Framework.Graphics.Rendering.Vertices;
using osu.Framework.Bindables;
using osu.Framework.Graphics;

Expand Down Expand Up @@ -196,8 +195,6 @@ private class TrianglesDrawNode : DrawNode
private float texelSize;
private bool masking;

private IVertexBatch<TexturedVertex2D>? vertexBatch;

public TrianglesDrawNode(TrianglesV2 source)
: base(source)
{
Expand Down Expand Up @@ -235,12 +232,6 @@ protected override void Draw(IRenderer renderer)
if (Source.AimCount == 0 || thickness == 0)
return;

if (vertexBatch == null || vertexBatch.Size != Source.AimCount)
{
vertexBatch?.Dispose();
vertexBatch = renderer.CreateQuadBatch<TexturedVertex2D>(Source.AimCount, 1);
}

borderDataBuffer ??= renderer.CreateUniformBuffer<TriangleBorderData>();
borderDataBuffer.Data = borderDataBuffer.Data with
{
Expand Down Expand Up @@ -273,7 +264,7 @@ protected override void Draw(IRenderer renderer)
triangleQuad.Height
) / relativeSize;

renderer.DrawQuad(texture, drawQuad, DrawColourInfo.Colour.Interpolate(triangleQuad), new RectangleF(0, 0, 1, 1), vertexBatch.AddAction, textureCoords: textureCoords);
renderer.DrawQuad(texture, drawQuad, DrawColourInfo.Colour.Interpolate(triangleQuad), new RectangleF(0, 0, 1, 1), textureCoords: textureCoords);
}

shader.Unbind();
Expand All @@ -296,7 +287,6 @@ protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);

vertexBatch?.Dispose();
borderDataBuffer?.Dispose();
}
}
Expand Down

0 comments on commit 1e44ba6

Please sign in to comment.