Forgot your password?
typodupeerror

Comment: Re:Not there yet for "real" interactive framerates (Score 2, Informative) 139

by mdmccool (#10327868) Attached to: Metaprogramming GPUs with Sh
It's similar to preshaders (we thought of the idea independently, and call it something different in the book... uniform lifting... but it is basically the same idea). So I guess it's a little unfair to say "an optimization that no other shading language provides". It also would be possible, in theory, for OpenGL SL implementations to provide this optimization.

In Sh, though, this optimization is internal and automatic, and so invisible to the user. It's important to do it that way, because the shader algebra in Sh lets you turn uniforms into inputs and vice-versa. If you convert an input to a uniform, new uniform lifting optimizations become available, and vice-versa. The system keeps track of the "preshaders" for you in this case, and actually includes a dependency tracking and lazy update system internally. You can create your own "dependent uniforms" if you want, but in general it's unnecessary for a user to worry about or explicitly define lifted computations.

The idea is also related to hoisting computations out of loops. If you think of the data-parallel shading of vertices or fragments as a loop over all vertices and fragments...

Luck, that's when preparation and opportunity meet. -- P.E. Trudeau

Working...