[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Extension proposal: WEBGL_lose_context
Here's the other problem I have with this extension.
#2) To be able to write lost context conformance tests
#3) To test the browser's handing of lost context.
The problem with but #2 and #3 is that this extension WILL NOT ACHIEVE EITHER OF THOSE GOALS.
Same for clearing the backbuffer on resize. Easily 20-30 calls are required. If the user has an FBO bound it must be unbound, the clear color, color mask, depth clear value, depth mask, stencil clear value, stencil mask and scissor must all be set to something that will allow the backbufffer (virtual or real) to be cleared. Then all of those must be restored to whatever the user had previously. Lost context can occur between any of those 20-30 gl calls. Again. This extension will NOT test the implementation handles this case.
Another example, ctx.getProgramInfoLog. The underlying implementation is probably written something like this
glGetProgramiv(service_id_, GL_INFO_LOG_LENGTH, &max_len);
scoped_array<char> temp(new char[max_len]);
glGetProgramInfoLog(service_id_, max_len, &len, temp.get());
return DOMString(temp.get(), len);
There's a LOST_CONTEXT bug in this code. max_len and len need to be set before calling glGetProgramiv and glGetProgramLogInfo. If not set and the context is lost they will be undefined. They will then be used to allocate a temp buffer of a random size then make a DOMString of a random length full of garbage
The proposed extension will not test this. Nor will it test that the first call succeeds and the second one fails because of LOST CONTEXT.