Jump to content

WebGL detection and CONTEXT_LOST_WEBGL


Recommended Posts

We have been using Pixi for a couple of years as the backbone for a document publishing tool. Currently we are on v5.3.10

This is kind of a two-parter question:


Now and then we have users that get 'WebGL not detected" in Chrome. If they just reload the page it detects WebGL and everything is OK

It seems like a "race condition" where the GPU just isn't ready yet for Pixi. 

Anyone else seen this and/or know of a workaround?


Lately (especially after Chrome update 93) customers are reporting our solution crashing.

(We have not made any changes in our code for a long time -- and our tests with Chrome update 93 works just fine, so it is hard to say update 93 is the problem)

In Chrome they get this in the console:


In Firefox they get this (along with a "Aw, Snap!" screen)

WebGL warning: <Present>: Swap chain surface creation failed
WebGL context was lost

Anyone else seen / experienced this and/or know of a workaround?


Link to comment
Share on other sites

if you dont have renderTexture's , pixi can just restore the context if you allow it

if you have generated content in videomemory - well, Refresh is the only way. another is to re-generate it.

Here is another very helpful super-advice : find out whats wrong with your app. Maybe you eat too much videomemory.

If you have minimal case, you can ask in https://bugs.chromium.org/p/chromium/issues/list?q=webgl&can=2 

But, usually, there's no way to fight this thing :( Especially if you treat pixi and webgl as black box

Edited by ivan.popelyshev
Link to comment
Share on other sites

Thanks for the answer

A large document eats about 250 MB of GPU Memory, so we don't think that is the problem. 
As the system has been running more or less normally for years we are not sure where to look for bugs

Do you think upgrading to Pixi 6 could fix/reduce any of the problems?

Link to comment
Share on other sites

Hi, I've seen this error before but it was caused by a changed to chrome, whereby too many WebGL instances causes the first instances to crash.

It appears a max WebGL cap was added this year to chrome. If you have too many webGL instances, even in different tabs they then the first to be created will be failed with this error.

I would recommend just checking these things:

1. Are you creating too many instances of Pixi or WebGL

2. Do you have another tab open, popup, or other adverts or features around your app which also use WebGL

I can't find much writeup on the subject but found atleast this article



Edited by Jammy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...