0

The site is constantly running on the terminal, and sometimes it gives the following error

WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.

But when loading the page, a message appears about the use of webgl2. I cannot catch a similar error, but users sometimes get it.

I have pixi.js 6.1.3 and hardware acceleration enabled

What could be the problem?

1
  • 3
    Isn't the error pretty clear?
    – Pointy
    Nov 26, 2021 at 4:01

1 Answer 1

0

PixiJS requires stencil buffer to initialize and stencil buffer is not always supported on devices with WebGL support. See the source of the isWebGLSupported function in PixiJS source, specifically these lines:

const contextOptions = {
    stencil: true,
    failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,
};

What you potentially could do to support devices with WebGL without stencil is to overwrite the PixiJS function that creates the Renderer instance and use stencil: false in contextOptions. I'm talking about the Renderer.create() function.

Note, that by disabling stencil buffer PixiJS might not work correctly or at all, depending how it's written. Stencil buffer is used in PixiJS for masking, so if you do not use masks, you might be fine.

This PixiJS issue was already reported: https://github.com/pixijs/pixijs/issues/5902

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.