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

Re: [Public WebGL] OT: exception handling

On Fri, Apr 6, 2012 at 1:05 AM, Florian Bösch <pyalot@gmail.com> wrote:
I think the whole idea of context lost is perverted and broken. If a system process runs out of memory. It gets sigtermed, if it oversteps its memory, it gets sighalted, no reasonably programming scheme would do things like silently free memory you've been using. It's why virtual memory managers, swap, protected memory etc. have been invented oh roundabouts 1970 and been thoroughly implemented on all personal computing hardware to around 1985, to being fully supported by any OS by around 1995. GPUs context lost is a barbaric regression to the glory days of 1950 or thereabouts in this regard.

You can rant all you want. Unfortunately it's today's reality. Lost context is not going away anytime soon. That has nothing to do with WebGL. It has to do with the current state of GPUs, drivers and OSes. GPUs are not CPUs. Their memory isn't easily swapped or protected and currently none of them are preempt-able. None of the browser vendors have control over that. Even Apple doesn't write their own drivers or make their own GPUs.


On Fri, Apr 6, 2012 at 4:33 AM, Glenn Maynard <glenn@zewt.org> wrote:
(A thought, though: users could patch their contexts, or WebGLRenderingContext.prototype if they're feeling more invasive, wrapping each function to check for null and throw an exception.  That's a little tricky, since you need to call getError to tell whether a null response is a context lost or a legitimate null response; you'd need some tricks to deal with that without breaking getError.  I think it could be done, though; maybe I'll give it a shot.

I don't believe in whatever flavor you paint context lost, that it's ever going to be handleable in any reasonable way. 100% of current webgl frameworks and probably pretty close to 100% of webgl apps out there are "broken" right now. They'll remain broken, and that's the end of story. It's the one extension nobody will give diddly squat about. If you loose context, you can just as well go and set every ctx function to function(){throw 'go away'} in the context lost callback.