Skip to content

Commit

Permalink
Query max texture size only once instead of every time it's needed. (#…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
EliteMasterEric and Geokureli authored Feb 18, 2025
1 parent 2601ce2 commit 6a2d6ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flixel/system/frontEnds/BitmapFrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,13 @@ class BitmapFrontEnd
}

#if FLX_OPENGL_AVAILABLE
static var _maxTextureSize = -1;
function get_maxTextureSize():Int
{
if (FlxG.stage.window.context.attributes.hardware)
return cast GL.getParameter(GL.MAX_TEXTURE_SIZE);
if (_maxTextureSize < 0 && FlxG.stage.window.context.attributes.hardware)
_maxTextureSize = cast GL.getParameter(GL.MAX_TEXTURE_SIZE);

return -1;
return _maxTextureSize;
}
#end

Expand Down

0 comments on commit 6a2d6ef

Please sign in to comment.