[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] option for suggesting "low power" mode at context creation

This topic came up at the F2F meeting. It's not clear if this is a significant/temporary issue or not, and there wasn't any consensus on approach, so I'm sending this to get broader feedback.

Currently, in WebKit (or Apple's port of it), WebGL will always use a discrete GPU on an OS X dual-GPU system. This follows the system behaviour, where any OpenGL application gets the discrete GPU unless it explicitly asks otherwise (and even then it is not guaranteed to get the integrated card, nor stay on it). The idea is that if you're doing OpenGL, you're probably wanting the highest performance possible.

WebGL has no way to indicate one way or the other. This came up recently in a complaint that an older version of the popular JavaScript library Modernizr was detecting WebGL support by creating a context (and thus firing up the discrete GPU). It then deleted the context (thus reverting to the integrated GPU). This was on a page that had no other WebGL code - it was just detecting the possibility.

It might be nice if at WebGL context creation time you could pass in some flag indicating that you are not concerned with raw performance, or that the system can opt into a lower power mode if possible. For example, it could be that your WebGL only draws once to create a background image for the page. A game that wants to run at 60fps would not request this mode.

canvasEl.getContext("webgl", { suggestLowPower: true });

NOTE: I have no good ideas for the naming of anything here

This is just a hint. If you requested antialiasing and low-power, the desire for AA would win (if only the discrete GPU supported it, for example).

Another suggestion was a list of priorities:

canvasEl.getContext("webgl", { priorities: ["performance", "poweruse"])

(where the priority values would be constants defined in the spec, not arbitrary strings)

Yet another option would be to always use low-power mode on these system configurations. We don't really have control over if/when the system will decide to automatically upgrade though, so some benchmarks would suffer.

And yet another option is to avoid the initial problem by having a method to indicate whether WebGL is supported: canvasEl.supportsContext("webgl"). I've proposed this to HTML5 (or HTML.next) and the reaction is an almost 50/50 split. Obviously, you'd still need to create a context to know for sure.

At the moment I'm actually tempted to turn on low-power mode for all dual-GPU systems on OS X and see what the performance fallout is.


You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl