Skip to content

Commit 6a2d6ef

Browse files
Query max texture size only once instead of every time it's needed. (#3369)
* Query max texture size only once. * use local static, cleanup and fix cuddled brackets * remove local static --------- Co-authored-by: George Kurelic <[email protected]>
1 parent 2601ce2 commit 6a2d6ef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

flixel/system/frontEnds/BitmapFrontEnd.hx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,13 @@ class BitmapFrontEnd
342342
}
343343

344344
#if FLX_OPENGL_AVAILABLE
345+
static var _maxTextureSize = -1;
345346
function get_maxTextureSize():Int
346347
{
347-
if (FlxG.stage.window.context.attributes.hardware)
348-
return cast GL.getParameter(GL.MAX_TEXTURE_SIZE);
348+
if (_maxTextureSize < 0 && FlxG.stage.window.context.attributes.hardware)
349+
_maxTextureSize = cast GL.getParameter(GL.MAX_TEXTURE_SIZE);
349350

350-
return -1;
351+
return _maxTextureSize;
351352
}
352353
#end
353354

0 commit comments

Comments
 (0)