Replies: 5 comments
-
Depending on how the context has been lost, I think you don't have any options than to create a fresh You can't really rely on restoreContext because the context dies "by itself", and you can't wait for a restore event to occur, if for instance the context died because of resource usage (too many contexts create, too much VRAM used). In a nutshell it's a bit of a tricky problem IMO, because:
Maybe I am completly wrong on this, but I haven't found any really good handling of this case. |
Beta Was this translation helpful? Give feedback.
-
Thanks for that insight @DavidPeicho. Assuming we wanted to take a stab at this issue, some assorted thoughts:
@hujasonx a compromise approach might be for us to expose a method on the element to force-restore the context. This would allow the content author, who naturally has a broader understanding of the page and the context where it is running, to decide if and when to attempt a context restore. That said, I think that given what @DavidPeicho rightly pointed out, restoring the context right now will require a somewhat heavy-handed change (due to the likely need to re-load models, re-generate environment lighting, etc). We would be happy to accept such a change, just keep in mind that it will likely require a bit of work to get it right. |
Beta Was this translation helpful? Give feedback.
-
Except doing it manually (using loseContext()and restoreContext()) there is nothing else right now coming out of my mind. You could create your test case by randomly sending a
Yes, I agree with that, creating a new context without prior knowledge of what the page is doing would be terrible for the end user. But unfortunately, I still didn't find any better idea than swapping the canvas with a fresh one 😢 But at least, exposing an event |
Beta Was this translation helpful? Give feedback.
-
We do already throw webglcontextlost errors, which we can piggyback off of. Does it make sense to add the opengl error type as an field to the error message so that the application developer can log them or make a more educated decision regarding whether or not to call a forceContextRestore()? |
Beta Was this translation helpful? Give feedback.
-
@hujasonx Yah, any contextual info that makes those errors more actionable would be a welcome addition. |
Beta Was this translation helpful? Give feedback.
-
We would like to be able to more gracefully handle loss of opengl context. What are your opinions on adding max-retries attribute or something similar and have model-viewer attempt to re establish the opengl context on context loss?
Beta Was this translation helpful? Give feedback.
All reactions