Skip to content

Commit

Permalink
Address CI concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom94 committed Jul 9, 2017
1 parent 35bbfd3 commit 7fb8de5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions osu.Framework/Graphics/OpenGL/Textures/TextureGLSingle.cs
Expand Up @@ -20,22 +20,19 @@ internal class TextureGLSingle : TextureGL
{
public const int MAX_MIPMAP_LEVELS = 3;

private static QuadBatch<TexturedVertex2D> quadBatch;
private static Action<TexturedVertex2D> defaultQuadAction;

private static LinearBatch<TexturedVertex2D> triangleBatch;
private static Action<TexturedVertex2D> defaultTriangleAction;
private static readonly Action<TexturedVertex2D> default_quad_action;
private static readonly Action<TexturedVertex2D> default_triangle_action;

static TextureGLSingle()
{
quadBatch = new QuadBatch<TexturedVertex2D>(512, 128);
defaultQuadAction = quadBatch.Add;
QuadBatch<TexturedVertex2D> quadBatch = new QuadBatch<TexturedVertex2D>(512, 128);
default_quad_action = quadBatch.Add;

// We multiply the size param by 3 such that the amount of vertices is a multiple of the amount of vertices
// per primitive (triangles in this case). Otherwise overflowing the batch will result in wrong
// grouping of vertices into primitives.
triangleBatch = new LinearBatch<TexturedVertex2D>(512 * 3, 128, PrimitiveType.Triangles);
defaultTriangleAction = triangleBatch.Add;
LinearBatch<TexturedVertex2D> triangleBatch = new LinearBatch<TexturedVertex2D>(512 * 3, 128, PrimitiveType.Triangles);
default_triangle_action = triangleBatch.Add;
}

private readonly ConcurrentQueue<TextureUpload> uploadQueue = new ConcurrentQueue<TextureUpload>();
Expand Down Expand Up @@ -151,7 +148,7 @@ public override void DrawTriangle(Triangle vertexTriangle, RectangleF? textureRe
RectangleF inflatedTexRect = texRect.Inflate(inflationAmount);

if (vertexAction == null)
vertexAction = defaultTriangleAction;
vertexAction = default_triangle_action;

// We split the triangle into two, such that we can obtain smooth edges with our
// texture coordinate trick. We might want to revert this to drawing a single
Expand Down Expand Up @@ -226,7 +223,7 @@ public override void DrawQuad(Quad vertexQuad, RectangleF? textureRect, ColourIn
Vector2 blendRange = blendRangeOverride ?? inflationAmount;

if (vertexAction == null)
vertexAction = defaultQuadAction;
vertexAction = default_quad_action;

vertexAction(new TexturedVertex2D
{
Expand Down

0 comments on commit 7fb8de5

Please sign in to comment.