Engine creation options probably small bug

Hi. babyloners!

Probably i faced up with small bug:

engine = new Engine(canvas, true, {powerPreference:'low-power'});
console.log(engine.getCreationOptions().powerPreference); // 'hight-performance'

or it works somehow else?

To set powerPreference you need to also set “doNotHandleContextLost” to true (in the engine creation options). otherwise it is overwritten.

3 Likes

Thank you for fast answer! Got it )

@RaananW Could use please explain why we also should set doNotHandleContextLost?

That’s because the engine set powerPreference to “high-performance” before creating the webgl context when you enable context lost handling. I don’t know really why, maybe there’s an incompatibility between both… Maybe @sebavan will know.

Yeah, my question was about why it overrides instead using from options

I think it is a bug tbh :slight_smile:

1 Like

I can create a PR if it so)

Done [Bugfix] Respect options.powerPreference without doNotHandleContextLost flag by afrokick · Pull Request #13680 · BabylonJS/Babylon.js · GitHub @sebavan @Evgeni_Popov

2 Likes