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

Re: [Public WebGL] preserveDrawingBuffer = false

Some complications: do you trigger this behavior at the beginning of every DOM event dispatch, or at the beginning of each event handler invocation[1]? What happens if a WebGL call causes an event to be fired synchronously, causing nested callbacks? There are probably interactions with other specs that I'm not thinking of, too. Also, needing to check a list of callback hooks before all script callbacks are executed could cause overhead for everything else. It would be good to avoid all of this.

You could think about an explicit ctx.present() function. Instead of drawing functions marking the drawing buffer as modified (ready to be presented to the compositor and then cleared), present() would do that. Calling any drawing function on a drawing buffer marked as modified would clear it (if preserveDrawingBuffer is false) and mark the drawing buffer unmodified, regardless of entering or exiting any callbacks. This would replace the clearing that currently happens after compositing, and give completely deterministic behavior. The backwards-incompatibility would be unfortunate, though, even though it's a trivial change for users.

[1] http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dispatching-events

Glenn Maynard