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

Re: [Public WebGL] WEBGL_dynamic_texture extension proposal

Recompiling shaders on the fly brings up way too many problems.

*) The shader may fail to compile but you don't get that error until you try to draw. 

GL has no such provision for that and programs would have check for errors after draw calls slowing them down tremendously.

*) Shaders can get arbitrarily complex and know why to know how complex until draw time

uniform sampler2D textures[16];   // Is that 16 2D textures or 16 video textures (which is really 48 textures)?

*) The speed of a shader can change drastically from use to use. You'd have to do timing with every combination of inputs.

*) Compiling shaders can be slow, currently an application can deal with that at init time (put up a "loading..." message) etc. but if shaders get arbitrarily recompiled at draw time the app has no way to know if and when there will be a significant pause that they need to guide the user through.

*) Massively complicating WebGL implementations

On Thu, Jul 5, 2012 at 5:19 AM, Florian Bösch <[email protected]> wrote:
A suggestion to deal with the dynamic uniform typing issue was brought up on #webgl as an API to provide a uniform "hint" at shader compile time, so that at least generating the huge sets of differing shaders is a fairly orderly process and has a "fast" path. If no hint would be provided, the shader would be allowed to recompile on the "slow path".