Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: crash when WebGL2RenderingContext is not available #10391

Closed
elsassph opened this issue Mar 29, 2024 · 8 comments
Closed

Bug: crash when WebGL2RenderingContext is not available #10391

elsassph opened this issue Mar 29, 2024 · 8 comments
Assignees

Comments

@elsassph
Copy link
Contributor

elsassph commented Mar 29, 2024

Current Behavior

PixiJS 8 can't start when running in an older browser without webGl 2.0 support:

Uncaught (in promise) ReferenceError: WebGL2RenderingContext is not defined

Expected Behavior

I make apps for connected TVs - a lot of models still don't support webGl 2.0. Some even don't support webGl at all.

It would be great if Pixi 8 would gracefully support older browsers supporting only webGl 1.0.

Steps to Reproduce

Run any Pixi app on an TV 3+ years old.

Environment

  • pixi.js version: 8.0
  • Browser & Version: Chrome/53.0.2785.34 Safari/537.36
  • OS & Version: webOS 4.10

Possible Solution

I tried declaring a mock WebGL2RenderingContext class (undefined also fails further during init) to pass the webGl detection but then gl errors happen and nothing renders:

PixiJS Warning:  Provided WebGL context does not support 32 index buffer, large scenes may not render correctly
WebGL: INVALID_ENUM: activeTexture: texture unit out of range
[.Offscreen-For-WebGL-0x123eb0]GL ERROR :GL_INVALID_VALUE : glUniform1iv: texture unit out of range

Line of activeTexture error is: https://github.com/pixijs/pixijs/blob/dev/src/rendering/renderers/gl/texture/GlTextureSystem.ts#L190

Additional Information

No response

@bigtimebuddy
Copy link
Member

@GoodBoyDigital you added support for WebGL1 in v8, right?

@elsassph
Copy link
Contributor Author

@bigtimebuddy I see there seem to be support for webGl 1, but it crashes on systems without support for webGl 2.

@bigtimebuddy
Copy link
Member

Yeah, I gathered that. If I had to guess, we added the internal supported for WebGL1, but probably didn't actually test running in a WebGL1-only environment.

@Zyie
Copy link
Member

Zyie commented Apr 2, 2024

hey @elsassph what version of v8 are you using?

i believe this #10351 should fix the issue and was released in 8.0.4

@Zyie Zyie self-assigned this Apr 2, 2024
@erikdubbelboer
Copy link

@Zyie the issue is still present in 8.0.4. See: #10401

@Zyie Zyie assigned GoodBoyDigital and unassigned Zyie Apr 2, 2024
@Zyie
Copy link
Member

Zyie commented Apr 2, 2024

Yeah this is definitely still an issue, we will look into it!

@mwx0621
Copy link

mwx0621 commented Apr 3, 2024

For Safari in IOS 13.3, there is no global WebGL2RenderingContext in browser. Though this version of safari support webgl2, pixi will crash with "Can't get variable: WebGL2RenderingContext" when calling initFromContext.

@Zyie
Copy link
Member

Zyie commented Apr 10, 2024

This should be fixed in 8.1.0

@Zyie Zyie closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants