Hey Folks!
Recently I accidentally upgraded Android’s FireFox to the latest 80 version. Yeah that piece
of *#@p where Mozilla decided to change everything. Apparently they changed even more than you
might think.
FireFox on Android always wasn’t my #1 choice since the performance was always way behind Chrome.
Usually an OpenFl game utilizing the Starling port and thus WebGl 2.0 runs at the full 60fps on
Chrome versus something around 40-50 on FireFox.
But with the latest FireFox suddenly the framerate dropped to useless 5 fps. Yeah you read right! Five!
Of course my initial thought was that my game was too demanding on the GFX side - though that wouldn’t
explain why the framerate has been way better before.
So I created a minimalistic test application with allow-high-dpi
set to true
, which doesn’t do much
beside utilizing the whole browser window and displaying a simple quad.
The result: the same freaking 5 fps again!
Of course I’m a little worried now since this makes the games effectively unplayable on FireFox and
I’m really wondering if anyone in here is experiencing the same?
Interestingly I just can replicate the issue with OpenFl based WebGl 2.0 games - others created using
pixi.js or the like don’t seem to suffer the same. Is there something inside OpenFl’s renderer which
needs modification to compensate for the new FireFox?
Here’s the code for the aforementioned minimalistic test:
Main.hx
package;
import openfl.display.Sprite;
import openfl.events.Event;
import openfl.Lib;
import openfl.display.StageScaleMode;
import openfl.geom.Rectangle;
import openfl.geom.Matrix;
import starling.core.Starling;
import flash.display3D.Context3DRenderMode;
class Main extends Sprite
{
private var mStarling:Starling;
private static var sw:Float = 0;
private static var sh:Float = 0;
public function new()
{
super();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(event:Dynamic):Void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
stage.scaleMode = StageScaleMode.NO_SCALE;
start();
}
private function start():Void
{
sw = Lib.application.window.width * stage.window.scale;
sh = Lib.application.window.height * stage.window.scale;
var rect:Rectangle = new Rectangle(0, 0, 0, 0);
rect.width = sw;
rect.height = sh; trace(rect);
mStarling = new Starling(Test, stage, rect, null, Context3DRenderMode.AUTO, "auto");
mStarling.addEventListener(starling.events.Event.ROOT_CREATED, function():Void
{
var game:Test = cast(mStarling.root, Test);
game.init();
});
mStarling.stage.stageWidth = Std.int(sw);
mStarling.stage.stageHeight = Std.int(sh);
mStarling.start();
}
}
Test.hx
package;
import starling.core.Starling;
import starling.display.Sprite;
import starling.display.Sprite3D;
import starling.display.Stage;
import starling.display.Quad;
@:keep class Test extends Sprite
{
public function new()
{
super();
}
public function init():Void
{
Starling.current.showStats = true;
var sprite3D = new Sprite3D();
var quad:Quad = new Quad(200, 200, 0xff0000);
sprite3D.addChild(quad);
sprite3D.x = stage.stageWidth / 2 - 100;
sprite3D.y = stage.stageHeight / 2-100;
sprite3D.rotationX = 45 * Math.PI / 180;
addChild(sprite3D);
}
}
project.xml
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- NMML reference: https://gist.github.com/1763850 -->
<!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
<meta title="FireFoxStarling" package="FireFoxStarling" version="1.0.0" company="" />
<!-- output -->
<app main="Main" file="FireFoxStarling" path="bin" />
<window background="#103860" fps="60" />
<window width="640" height="480" unless="mobile" />
<window width="0" height="0" resizable="true" fps="60" if="html5" />
<window orientation="landscape" vsync="false" antialiasing="0" if="cpp" />
<window allow-high-dpi="true" />
<!-- classpath, haxe libs -->
<source path="src" />
<haxelib name="openfl" />
<haxelib name="actuate" />
<haxelib name="starling" />
<!-- assets -->
<icon path="assets/openfl.svg" />
<assets path="assets/img" rename="img" />
<!-- optimize output
<haxeflag name="-dce full" /> -->
<haxeflag name="--no-traces" if="final" />
</project>