Tuesday, August 24, 2010

Firefox 4 beta 4 - Hardware Acceleration FTW!

I just wanted to jot down a quick note about something that made me VERY happy today! Firefox 4 beta 4 was released today, and one of the big features that it includes is (On Windows Vista/7 anyway) hardware acceleration via Direct2D. It's disabled by default, but doesn't take much to turn on (and certainly shouldn't be a problem for anyone who's been following WebGL).

First off, let me say that text rendering looks 1000% better when hardware acceleration is enabled. Seriously! I'm usually not one to care about aliasing in my text and whatnot but... WOW! The really exciting bit for me, though, was booting up my Quake 3 demo. With acceleration turned off I'm getting about 20-23 FPS (on par with previous betas), but with acceleration enabled I'm seeing 60-70 FPS! OMGWTFBBQ!?!

A 300% bump in render performance? That's insane! Awesome, but insane! Great work, Firefox crew! I can't wait to get this out of beta and into the average users hands.

(And now Chrome needs to get with the program! Seriously, looking at text in any other browser is gonna bug the crap out of me now!)

UPDATE: Ask and it shall be given, I suppose? I've turned the associated flag on, but can't see any difference in performance due to the apparent message pump cap I mentioned in a newer post. I'll see if I can find some better way of performance testing this later.


  1. Does this include Canvas rendering with Hardware Acceleration?

  2. I don't know, I haven't investigated that yet. I would thing so, however. The nature of the hardware acceleration probably speeds up the canvas naturally anyway.

  3. Going to your Quake3 page I get a million repeats of, depthFunc: invalid enum value 0x0.
    The only thing being rendered is a fiery skybox(?).

    This causes the browser to become unresponsive until I bring forth the activity manager.

    Any ideas on why this might happen? I'd like to experience this "OMGWTFBBQ"! :P

  4. Try refreshing a couple of times. I'm pretty sure I've got a race condition in the resource loading.

  5. Still the same thing, except I occasionally get another error which causes the skybox to get a checkboard pattern instead:

    generateMipmap: texture does not satisfy requirements for generateMipmap

    Looking in the Web Console it looks like all resources are loaded?

  6. Ah, that's a different issue. I think I missed converting one or two of the textures to a power-of-two size, which causes generateMipmaps to fail on browsers that are more strict about the validation (Firefox has just recently tightened down on that.) Not sure why mine worked and yours failed, but I can fix that soon. Thank you for the heads up!

  7. Okay, that should do it! I've ensured that all textures loaded by the demo are POT and generateMipmap friendly now. (You may have to flush your browsers cache to get the resized images.) Actually, I had done that before, and had said as much in my Tech Talk post, but apparently a last minute re-conversion of some images before I uploaded ended up undoing some of my work.

    In any case I believe this should work with your browser now. Let me know if the problems persist!

  8. Argh, I had a long answer written out but then I accidentally pressed Ctrl+Space and managed to close the group. :(

    Anyhow, I forgot to tell you that I'm running Firefox nightlies. Sorry about that, I guess I've been using it for so long that I forgot about it. :-/

    It works fine on Linux now, so thanks for the quick fix! I'll have to wait until tomorrow before I can test on Windows, with Direct2D. I shall await that moment gleefully. =)

    Probably not a "real" problem for a tech demo, as it's running now, but:
    I still get flooded with "invalid enums" several times per second in the Error Console.
    The respawn button (R) doesn't work.
    The hit detection is off, getting stuck in diagonal and "arced" walls. Being placed a bit below the floor after climbing stairs, having to "jump out".

    As I said, no real problems, just thought you should know in case it's of interest.

    I get 25FPS in Chromium nightly and 20FPS in Firefox nightly on Linux.