pixijs icon indicating copy to clipboard operation
pixijs copied to clipboard

WEBGL_lose_context.restoreContext is used for restoring context

Open SmiVan opened this issue 4 years ago • 12 comments
trafficstars

https://github.com/pixijs/pixi.js/blob/78516ba04f3fb59f4de06bd0dee5a609d9f91c19/packages/core/src/context/ContextSystem.ts#L98-L102

I'm fairly certain that (WEBGL_lose_context).restoreContext() is not intended to be used to recover from a general loss of context situation, it rather seems to be intended for recovering from (WEBGL_lose_context).loseContext() for debugging purposes.

See the specification and the following discussion on StackOverflow.

This is probably directly related to #7206, where it can be seen that the system can't actually handle real context loss, just a simulated one.

SmiVan avatar Feb 06 '21 15:02 SmiVan

This does seem to be a bug @GoodBoyDigital

ShukantPal avatar Feb 08 '21 02:02 ShukantPal

I think our context loss/restore really needs some help.

bigtimebuddy avatar Feb 08 '21 03:02 bigtimebuddy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '21 17:06 stale[bot]

This remains an issue in the current master branch, it should not be closed.

SmiVan avatar Jun 04 '21 21:06 SmiVan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 06 '21 20:09 stale[bot]

This is still an issue in the current master branch and should not be closed.

I didn't get around to commenting on #7206 before it was closed by stalebot, but we still have that issue in 6.2.0. Currently, we restart the application in the event of a WebGL context loss to get around the sprites not rendering.

In our testing of recovery methods, we were able to get things to recover and render properly after a WebGL context loss by listening for a context loss and then recreating all of the graphics objects and sprites. We ended up not using this recover method this as it would eventually fail if there were multiple context losses in the same session. In the event of successive context losses pretty much everything would stop rendering regardless of when or how it was created.

rj3d avatar Feb 16 '22 00:02 rj3d

Any progress about this? Just want to know the proper way to handle context lost situation, otherwise than recreating the whole applicaiton instances.

naiteluo avatar Mar 04 '22 03:03 naiteluo

I'm going to put a bounty on this if someone wants to take a stab at working on this.

bigtimebuddy avatar Mar 04 '22 10:03 bigtimebuddy

Screen Shot 2022-04-02 at 1 35 32 PM

I think the right solution here is for PixiJS to clear all of its internal state and wait for the webglcontextrestored event? wdyt @bigtimebuddy

ShukantPal avatar Apr 02 '22 17:04 ShukantPal

@bigtimebuddy @Altimor has asked for the bounty to be raised to $500 on behalf of @teamflowhq − how can we pay for this bounty?

ShukantPal avatar Sep 04 '22 21:09 ShukantPal

Please see https://github.com/pixijs/pixijs/wiki/Bounties for details. Basically, a donation to our Open Collective to cover the bounty. I'll remove the current bounty amount.

bigtimebuddy avatar Sep 05 '22 01:09 bigtimebuddy

Thanks @bigtimebuddy. Please see contribution #571998 in the OpenCollective for a bounty of $250!

ShukantPal avatar Sep 12 '22 13:09 ShukantPal

Is it fixed? If yes, is it available only on the latest version and we need to upgrade or is it also available on v5 (we're using 5.3.11)? Because there are some breaking changes while migrating and I'm not familiar with pixi. A previous developer did all the coding.

RoboVij avatar Nov 07 '22 13:11 RoboVij

This bounty has not been claimed or fixed yet.

bigtimebuddy avatar Nov 07 '22 13:11 bigtimebuddy

Ok. Our website has several menu tabs. Two of them use the pixi based component. When switching to normal tabs from pixi-using tab, it's all fine. But when we switch back to pixi-using tab the crash and context loss happens. Is there a way to destroy the context when leaving the pixi-using tab so that when we come back it doesn't crash? Or is it not possible and that's what this issue is referring to?

RoboVij avatar Nov 07 '22 16:11 RoboVij