-
Notifications
You must be signed in to change notification settings - Fork 214
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 support for restoring upon context loss #74
Comments
hey thanks again. Yeah I've had this on the todo list for a couple of years, but I'm not really sure how useful it actually is. I have to do an inspection to see what would be entailed, and then consider it based on how it would affect the framework vs the very small percentage of use cases (in the worst case scenario, user would have to refresh). Are there any major use-cases (like VR?) you know of that I'm missing, that absolutely would need it? In one of your MDN links for the resource release issue, they actually suggest triggering |
So there are 2 main use case for this, firstly mobile devices especially android tend to lose context quite often, usually it happens du to user going to other gpu based or when resources are running out, phone can decide to free context, when this happens user will need to refresh page e.c Second use case is if device have multiple cards and it starts to switch between them, in this case webgl will trigger context lose as well Personally I have faced mobile uses case about multiple cards haven't heard really |
But yes VR is having this as well |
I would say this is a must have for the mobile devices, I don't think having to refresh is good. And, if it's worth something, every other dev using ogl that I've talked to had to implement this Would love to contribute on this if needed! If bundle size is a big worry, I think even as part of the /extras would be great and solve all concerns(not sure how that would look like). |
Ah interesting! I haven't come across any implementations yet, so that's news to me. I'm surprised I've never experienced this myself. It would be great to get an idea of what exactly would need to be included. I unfortunately don't have the time to dedicate at the moment. I would assume that basically everything would need to be stored somewhere - eg no more calls direct to the gl context. Currently OGL doesn't keep track of everything you create. In my quick assumptions, it would seem to me that a pretty deep re-structure would be necessary to store everything a dev does with the library, in order for it to automatically re-create everything. |
Yes you need reference to most of parts like geometry and textures also need to store information needed to recreate them. |
I don't know which parts that has to be stored but I wonder if Proxy could be a solution. Simplicity and minimal abstractions are the main features of OGL. I'm worried adding a layer of abstraction to the |
You need to have access to all meshe / textures/ materials/ geometry so need some central point where you have access to all of these |
I created concept of engine that is central point and wrapped all ogl classes in custom creator functions in order to have references when they are created |
This is interesting, but not needed, and shifts a user problem to framework side. We has a huge WebGL application, and by statistics a tab crash by ram/vram issues is more frequently that context losting. |
@eXponenta this is huge thing on newer versions of androids, have logs for these cases same happens on iOS 14 as well, befere 14 it was almost not visisble on iOS |
Was starting to think around context lose restore, how to better add support directly or as plugin to gl https://www.khronos.org/webgl/wiki/HandlingContextLost
Its way simpler to add support inside framework as references to textures, shaders are needed to restore them on lose event, but maybe you have some thought already on this topic ?
The text was updated successfully, but these errors were encountered: