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

Re: [Public WebGL] WEBGL_dynamic_texture extension proposal

On Fri, Jul 6, 2012 at 12:19 PM, Mark Callow <[email protected]> wrote:
How do/will these frameworks handle the many sampler types in other versions of GLSL? There's a different type of sampler for every texture target.

sampler1D, sampler2D, sampler3D, samplerCube, sampler2DRect, sampler1DShadow, sampler2DShadow, sampler2DRectShadow, sampler2DMS and samplerCubeArrayShadow cannot be used in place of the other. Each of these brings a distinct functionality/semantic inside shaders that differs in how to use them. For instance, you would not be trying to drop in a samplerCube in place of a sampler2D.

The sampler*Array vs. the sampler* functions are serviced by the same underlying sampler* type, sampler*Array is just an array of them, hence you would not try to drop in an array in place of a single sampler.

isampler* and usampler* can be dropped in "in place" of floating point samplers, however the code using these is well aware that he only makes a convenience conversion to avoid a cast, this has no bearing outside of the shader.

OpenGL hitherto contains *no* single sampler type that uses the exact same semantic yet only introduces the type to distinguish between an opaque internal conversion process. All types represent semantic concepts transparently and as such will not prompt variant compiling because "variants" would not make sense in their context.