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

Re: [Public WebGL] WEBGL_dynamic_texture extension proposal

On 06/07/2012 02:52, Brandon Jones wrote:
On Thu, Jul 5, 2012 at 1:54 AM, Mark Callow <[email protected]> wrote:

If you use the same sampler type the implementation has to figure out at run-time what type of image it is sampling and may have to recompile the shader when switching between yuv and rgb images.

But as Florian mentioned most frameworks will be forced to do that anyway. Wouldn't it be preferable to have that happen in native code?
What the framework needs to do is a little different. It needs the application to tell it that it wants to use a dynamic image source and then generate or select an appropriate shader. All this can be done before the first draw call. As I mentioned earlier in the thread with the OpenGL architecture there is nowhere other than the draw call where the check and re-compilation could happen.

It's not wonderful either way but I believe that the majority of applications will know in advance which textures will use dynamic sources.

That feels like some sort of hinting system would be more appropriate.
Possibly something like

      setSamplerVariableAsExternalSampler(program, "my_sampler_variable", GL_TRUE);?

IIt would have to be called before shader compilation. I'm not a WebGL implementer so I'm not sure how much that might reduce the complexity vs. having nothing. I think it would still impose a requirement for draw time checks that would reduce performance for every application.