[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] If you can create N contexts, should you always be able to create N+1 contexts?

Sorry for the awkward subject line, I'll try my best to explain:

I've just finished addressing an issue in Chrome where in some cases canvas.getContext would stop returning WebGL contexts after creating a reasonable amount of them. (See this bug, reported by Patrick Cozzi) After fixing this issue, I've created a conformance test to verify the behavior.

The question is whether or not the behavior tested here is desired. Specifically it tests that N contexts can be created (N = 50 by default) without issue while still holding references to all previous contexts. Functionally the test is extremely similar to context-creation-and-deletion, with the difference being that that test allows the contexts to fall out of scope each iteration so they can be garbage collected. The new test does not require that all N contexts must be active once, however. In Chrome once certain limits are reached the least recently used context will be forcibly lost to make room for the new ones.

That behavior isn't described by the spec, however. There's nothing that says you can't simply start returning null at some point in response to memory pressure. The new test works as-is in Firefox and Safari (And Opera will gain our fix by default), so I don't think it's a big concern, but does anyone have reason to object to testing this behavior? If so, what are your opinions on how large number of context allocations should behave? Is it ever acceptable to fail to return a context if an identical creation previously succeeded?