How to properly dispose of my WebGL context in order to avoid the 16 WebGL contexts error? [duplicate]

你离开我真会死。 提交于 2019-12-11 18:41:17

问题


This is a follow up question to this one: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

In that question, it was found that this error happens when you refresh a webGL tab more than 16 times (or collect 16+ contexts across multiple tabs).

However it is not clear how to dispose a WebGL context so that the browser can free up one of the 16 slots for another WebGL context to be able to go there?


回答1:


If that's still happening it's a browser bug and you should file a bug. Refreshing a webpage should free all resources. There is no official way to dispose of a WebGL context just like there's no official way to dispose an Image or a <video> or pretty much anything else in JavaScript.

See: How to free and garbage collect a WebGL context?

Note the WebGL Conformance Tests create thousands of contexts

https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html

On top of all the contexts created in the 1000s of tests there's a few tests specifically about lots of contexts including this one, this one, this one, and this one

So whatever issue you're seeing you probably need to post a repo.



来源:https://stackoverflow.com/questions/54913836/how-to-properly-dispose-of-my-webgl-context-in-order-to-avoid-the-16-webgl-conte

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!