KhronosGroup/WebGL

Clarify sampler type matching rules

Opened this issue · 0 comments

The current text says:

Texture lookup functions return values as floating point, unsigned integer or signed integer, depending on the sampler type passed to the lookup function. If the wrong sampler type is used for texture access, i.e., the sampler type does not match the texture internal format, the returned values are undefined in OpenGL ES Shading Language 3.00.6. In WebGL, generates an INVALID_OPERATION error in the corresponding draw call, including drawArrays, drawElements, drawArraysInstanced, drawElementsInstanced , and drawRangeElements.

If the sampler type is floating point and the internal texture format is normalized integer, it is considered as a match and the returned values are converted to floating point in the range [0, 1].

  • The first part should mention shadow samplers, i.e.,

    • a shadow sampler cannot be used with a non-depth texture;
    • a shadow sampler cannot be used with a depth texture when its compare mode is none;
    • a non-shadow sampler cannot be used with a depth texture when its compare mode is not none.
  • The second statement should mention that the range is [0, 1] for unsigned normalized and [-1, 1] for signed normalized texture formats.