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

Re: [Public WebGL] Caching shader compile assembly





On Wed, May 2, 2012 at 4:07 PM, Glenn Maynard <glenn@zewt.org> wrote:
On Wed, May 2, 2012 at 5:50 PM, Gregg Tavares (勤) <gman@google.com> wrote:
You can't know how long to set the timeout but you can make the entire thing effectively async. Certainly a async API might be nice in the future. I'm just pointing out what's available now. Note: You probably need Chrome 20 to get the full effect.

Unfortunately, if you don't wait long enough, you can't distinguish whether the false result means "the link failed" or "the link hasn't happened yet (so wait and try again)".  It's pretty close, though.

Yes you can. GL requires calling glGetProgramiv (in WebGL gl.getProgramParameter) returns the correct result for the link (same for glGetShaderiv, gl.getShaderParameter) 

So, all that happens is if you setTimeout to 1000ms and it takes 1500ms to compile the shader then you'll wait 500ms when you call gl.getProgramParameter


 
 


--
Glenn Maynard