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

Re: [Public WebGL] Addition to WebGLContextLostEvent wrt extensions



Maybe this well help describe my concern.

Imagine you had a i/o device API with a "device lost" and "device recovered" and you wrote code like this.

f = device.openfile(...);
somethingUnrelatedToDevice.addEventHandler("moreDataAvailableEvent", writeMoreData);

function writeMoreData(data) {
  f.write(data);
  if (data.finished) {
    f.closefile();
  }
}

Now imagine while writing the data you get a "device lost" and a "device recovered". You've now written a bad file because you're missing some portion of the middle of the data.

That's the model WebGLContextRestored seems to be providing. You get effectively random failure and random success instead of something more predictable  With the Resetable/Reset model you get random failure but never random success. You recover on your own terms, not some random terms.

Maybe random success is fine and I just can't wrap my head around it yet but right now it's making me feel like it's going to be much harder to write correct code.