Open kripken opened 4 years ago
- Emit a warning in ASSERTIONS mode if
high-performance
is not set, but by default that's likely excessive.
Another option: emit a warning if neither high-performance nor low-power is set. (i.e. powerPreference
is EM_WEBGL_POWER_PREFERENCE_DEFAULT
). I'm pretty sure low-power
is always no-worse than DEFAULT if the app is happy with integrated gpus (Ken, check me on this statement).
And hey, congrats on #10000 :P
Many of the graphical Emscripten applications I've seen do draw fairly complex 3D scenes, so a default to high-performance might be warranted.
An easy way to change the default when invoking the compiler (which would then change the generated JavaScript) would be helpful. Adding command line flags to be able to force either the low-power or high-performance GPU would be good, if that's the direction chosen, to insulate against future changes of Emscripten's default.
Agree that if the application runs well on an integrated GPU, then explicitly specifying a low-power powerPreference should be no worse than using the default.
Browsers are moving to change the default WebGL powerPreference from
high-performance
tolow-power
(e.g. coming soon in Chrome 80).* Just document this more.
+1 for this. I think we should honor the default that browsers take, and solve it via documentation. Not all browsers have the same default.
* Emit a warning in ASSERTIONS mode if `high-performance` is not set, but by default that's likely excessive.
I think rather, in GL_ASSERTIONS || GL_DEBUG mode, print an affirmative non-warning print "Created a WebGL [low-power|high-performance] context with alpha/depth/stencil/whatever flags one got."
to highlight what got created?
@kainino0x: remind me, if I create a GL context with either unset, or explicitly opted high-performance
or low-power
flag, can I afterwards query which type of context I actually got? I do have function emscripten_webgl_get_context_attributes()
that does pull down powerPreference
(https://github.com/emscripten-core/emscripten/blob/599b402ee6cd97cc3f4862254101fb044f10bec9/src/library_html5.js#L2601), but does that get filled by the browser?
(and noooo I was eyeing on grabbing #10000 last night, but we were still one too much away from that!)
@juj the powerPreference will currently be passed back to the application unchanged - default
won't be lowered to low-power
or high-performance
. These are actually requests, and conceivably might not be honored by the user agent.
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.
Maybe I'm wrong but using emscripten_webgl_init_context_attributes
to set the power preference doesn't seem to be working with SDL, is any of the other options implemented?
thanks!
Most browsers don't actually do anything in response to the powerPreference right now. I think it is obeyed by Chrome on Mac, and possibly Safari, but not others. I might be wrong about the exact status.
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.
Browsers are moving to change the default WebGL powerPreference from
high-performance
tolow-power
(e.g. coming soon in Chrome 80). In practice this change of default means that some users (with 2 GPUs) might see the lower-end one used, and for something like a game engine that could be noticeably slower.When creating the WebGL context, perhaps Emscripten should default to
high-performance
? I'd guess most of our users are running higher-end content. However, I'm not totally happy about such a change either, as browsers are preferring the opposite in general.Other options:
high-performance
, instead of writing the extra code to call the C API for context creation and setEmscriptenWebGLContextAttributes.powerPreference = EM_WEBGL_POWER_PREFERENCE_HIGH_PERFORMANCE
.high-performance
is not set, but by default that's likely excessive.Thoughts?
cc @juj @kenrussell @kainino0x