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

Re: [Public WebGL] Spec change request.



----- Original Message -----
> When I benchmark my rendering code - I find that an unreasonable
> percentage of the time is spent doing this:
> 
> if ( someUniformLocation != null )
> <==== THIS!
> gl.uniformXXX ( someUniformLocation, XXX ) ;
> 
> ...in situations where a uniform variable might not exist in the
> shader
> in some rendering passes but does exist in others (eg, when the shadow
> and depth rendering passes don't need to see textures and such).
> 
> Losing the 'if' test would speed things up significantly.
> 
> It would be a performance win if all of the various uniform setter
> functions would legally accept a 'null' location (and do nothing)
> without flagging an error in that circumstance. An 'if' in C++ (which
> you're probably doing anyway in order to do error detection) is much
> faster than doing one in JavaScript - and I don't see any downsides.
> 
> Any chance of a spec change?

If that if() is slow in JS, shouldn't that rather be fixed at the level of the JS engines? I mean, the if(x!=null) test is going to be done anyway, it's currently done in JS and you're asking for it to be done in the (typically c++) implementation code. It should in theory be possible for JS JIT compilers to compile if(x!=null) very efficiently, as far as I can see. If that's not the case, fixing it in the JS would benefit a lot more code, without having add this kind of special case into the WebGL spec.

Benoit

> 
> -- Steve
> 
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: