mirror of
https://github.com/osukey/osukey.git
synced 2025-05-07 06:37:18 +09:00
Limit maximum triangles to avoid GL buffer overflow
This commit is contained in:
parent
d176804793
commit
07fec268c0
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics.Batches;
|
using osu.Framework.Graphics.Batches;
|
||||||
|
using osu.Framework.Graphics.OpenGL.Buffers;
|
||||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
|
|
||||||
@ -181,7 +182,10 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
|
|
||||||
private void addTriangles(bool randomY)
|
private void addTriangles(bool randomY)
|
||||||
{
|
{
|
||||||
AimCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
// limited by the maximum size of QuadVertexBuffer for safety.
|
||||||
|
const int max_triangles = QuadVertexBuffer<TexturedVertex2D>.MAX_QUADS;
|
||||||
|
|
||||||
|
AimCount = (int)Math.Min(max_triangles, (DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio));
|
||||||
|
|
||||||
for (int i = 0; i < AimCount - parts.Count; i++)
|
for (int i = 0; i < AimCount - parts.Count; i++)
|
||||||
parts.Add(createTriangle(randomY));
|
parts.Add(createTriangle(randomY));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user