如何正确处理我的 WebGL 上下文以避免 16 个 WebGL 上下文错误? [英] How to properly dispose of my WebGL context in order to avoid the 16 WebGL contexts error?

查看:91
本文介绍了如何正确处理我的 WebGL 上下文以避免 16 个 WebGL 上下文错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是这个问题的后续问题:该主体超过 16 个实时 WebGL 上下文,丢失了最近最少使用的一个.

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

在那个问题中,发现当您刷新 webGL 选项卡超过 16 次(或跨多个选项卡收集 16 个以上的上下文)时会发生此错误.

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).

然而,不清楚如何处理 WebGL 上下文,以便浏览器可以释放 16 个插槽中的一个,以便另一个 WebGL 上下文能够去那里?

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?

推荐答案

如果这仍然发生,则是浏览器错误,您应该提交错误.刷新网页应该释放所有资源.没有官方的方法来处理 WebGL 上下文,就像没有官方的方法来处理 Image 或 JavaScript 中的几乎任何其他内容一样.

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.

参见:如何释放和垃圾收集 WebGL 上下文?

注意 WebGL 一致性测试创建了数千个上下文

Note the WebGL Conformance Tests create thousands of contexts

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

除了在 1000 次测试中创建的所有上下文之外,还有一些专门针对大量上下文的测试,包括 这个这个, 这个,以及这个

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.

这篇关于如何正确处理我的 WebGL 上下文以避免 16 个 WebGL 上下文错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆