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

Add a 'webglcontextrecreationready' event #3509

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davychxn
Copy link

This event is designed under the background of surging online visits to more and more extremely high traffic WebGL only websites. Nowadays daily visits at the level of 10 million to a single WebGL dependent webpage are not rare. (Theorically at least a visit per 8.6 milliseconds) User client GPUs are often shared between applications. If another GPU dependent application causes temporary hardware issues, like running long shaders. A certain percentage of website users can run into such situations, hence fail to create WebGL context. We lack such an context independent event to inform users when is the most applicable timepoint to recreate context.

This event is designed under the background of surging online visits to more
and more extremely high traffic WebGL only websites. Nowadays daily visits at
the level of 10 million to a single WebGL dependent webpage are not rare.
(Theorically at least a visit per 8.6 milliseconds)
User client GPUs are often shared between applications. If another GPU dependent
application causes temporary hardware issues, like running long shaders.
A certain percentage of website users can run into such situations, hence fail to
create WebGL context. We lack such an context independent event to inform users
when is the most applicable timepoint to recreate context.
@CLAassistant
Copy link

CLAassistant commented Dec 24, 2022

CLA assistant check
All committers have signed the CLA.

@HarelM
Copy link

HarelM commented Dec 24, 2022

+1
From a MapLibre maintainer (a library that heavily uses webgl in the browser) point of view there's a need to reduce the webgl creation failure rate. I believe this will help.

@greggman
Copy link
Contributor

I don't think I understand what you expect to happen. The browser as no info about when is a good time to create/re-create a context.

If you get a contextlost event, my suggestion would be to tell the user either directly or indirectly and let them try again. If you can't create a context at all then you can either ask the user "try again?" or you can fall back to something else. (Google maps for example falls back to 2D canvas)

To be slight more critical of the proposal

This event is designed under the background of surging online visits to more
and more extremely high traffic WebGL only websites. Nowadays daily visits at
the level of 10 million to a single WebGL dependent webpage are not rare.
(Theorically at least a visit per 8.6 milliseconds)

What does any of this have to do with browser or WebGL. A browser has no idea how much traffic any individual site gets. The fact that some sites get 10 million hits has nothing to do with WebGL.

"webglcontextrecreationready" at canvas, if the initial context creation failed caused by temporary hardware issues.

The browser doesn't have any knowledge of "temporary hardware issues"

You might see such issues at a certain rate by extremely high trafficing WebGL only websites.

That a site has high traffic is unrelated to WebGL.

@davychxn
Copy link
Author

I don't think I understand what you expect to happen. The browser as no info about when is a good time to create/re-create a context.

If you get a contextlost event, my suggestion would be to tell the user either directly or indirectly and let them try again. If you can't create a context at all then you can either ask the user "try again?" or you can fall back to something else. (Google maps for example falls back to 2D canvas)

To be slight more critical of the proposal

This event is designed under the background of surging online visits to more
and more extremely high traffic WebGL only websites. Nowadays daily visits at
the level of 10 million to a single WebGL dependent webpage are not rare.
(Theorically at least a visit per 8.6 milliseconds)

What does any of this have to do with browser or WebGL. A browser has no idea how much traffic any individual site gets. The fact that some sites get 10 million hits has nothing to do with WebGL.

"webglcontextrecreationready" at canvas, if the initial context creation failed caused by temporary hardware issues.

The browser doesn't have any knowledge of "temporary hardware issues"

You might see such issues at a certain rate by extremely high trafficing WebGL only websites.

That a site has high traffic is unrelated to WebGL.

Hi Gregg, merry Christmas! How is the weather in Tokyo?

Your background really awesome. You started development job since 1991? In that year I got my first Family Computer of Nintendo. My dad found that for me from one of his close friends.

I think you are right, but I still want to explain my understanding a bit more.

If you get a contextlost event, my suggestion would be to tell the user either directly or indirectly and let them try again. If you can't create a context at all then you can either ask the user "try again?" or you can fall back to something else. (Google maps for example falls back to 2D canvas)

If your products (Like Bing Maps or Google Maps) have users coming in almost every milliseconds, I think the service providers don't want them to see a popup telling them try again themselves from time to time? The products revenue heavily depend on user experiences.

Yeah, falls back to 2D canvas should be a good idea for a long time. But something like online Maps with worldwide service, most of them doing vectorgraph rendering. And Maps will have more and more details and information integrated into data sources. WebGL only rendering should be more beneficial for the users and industry? (Like the product I saw @HarelM was mentioning?)

What does any of this have to do with browser or WebGL. A browser has no idea how much traffic any individual site gets. The fact that some sites get 10 million hits has nothing to do with WebGL.

Yeah, a browser doesn't need to know that or be able to know that, I agree. But if we introduce the event and have GPU drivers implement it. A browser can help more users prevent that? With less efforts? And more secure or reliable? Otherwise users will need to implement their own retry mechanisms. A event can make things easier.

The browser doesn't have any knowledge of "temporary hardware issues"

I'm not sure about this part. I didn't contribute any code to Chromium, but I would like to if I find the chance.
If we already have a 'webglcontextrestored' event, maybe we can some way? But this 'webglcontextrestored' depends on a existing context. If we never have one, maybe we still want a similar event (Independent on a context but dependent on a canvas)?

Do I have a chance to become a member? But I don't want to pay a member fee higher than 199 USD a year!

@davychxn
Copy link
Author

Need more plans on the issue. Close it for now.

@davychxn davychxn closed this Jan 19, 2023
@davychxn
Copy link
Author

davychxn commented Apr 7, 2024

Reopen it for future reference. I still believe the proposal could be hepful.

@davychxn davychxn reopened this Apr 7, 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

Successfully merging this pull request may close these issues.

4 participants