Gvec4 texture() automatically set lod/mipmapLevel for texture with mipmap? any specification about how it do this?

gvec4 texture() automatically set lod/mipmapLevel for texture with mipmap? any specification about how it do this?
moreover, does all vendors support this bias for texture() when using openglES?
Thanks!

In the OpenGL 4.6 specification, it’s covered in §8.14.1, “Scale Factor and Level-of-Detail”.

A summary: In the absence of anisotropic filtering, the scale factor ρ is calculated as max(|∂T/∂x|,|∂T/∂y|) where T is the texture coordinates. Note that this is different from the GLSL fwidth function, which uses the Manhattan metric (taxicab metric) rather than the maximum metric. The base level of detail (before bias is added) is the base-2 logarithm of ρ. For textureGrad, the partial derivatives ∂T/∂x and ∂T/∂y are passed in as parameters; for texture, they’re calculated as if by dFdx and dFdy.

Anisotropic filtering is implementation dependent.

The specifications (both OpenGL 4.6 and OpenGL ES 3.0) state that the minimum value for GL_MAX_TEXTURE_LOD_BIAS is 2.0, which implies that a conforming implementation is required to support it (i.e. they can’t clamp the supplied bias to zero, which would be the same as ignoring it).

thank you very much!
when use gvec4 textureLod(gsampler2D sampler, vec2 P, float lod); float lod was set to use this specified mipmap level.
when use gvec4 texture(gsampler2D sampler, vec2 P, [float bias]); there is no parem for float lod SO float lod was caculated inside the driver automatically AND it can find the best value for float lod? [float bias] is used to bias ALL float lod caculated mipmap level ?
is this right? Thanks!

Yes. The LoD is calculated as the base-2 logarithm of the minification factor. So if the texture is displayed 1:1 (1 texel to 1 pixel), the calculated LoD is 0.0, at half size (each pixel covers 2×2 texels) the calculated LoD is 1.0, etc.

The bias is simply added to the calculated LoD to obtain the actual LoD used for selecting mipmap levels.

So e.g. texture is roughly equivalent to e.g.

vec4 texture(sampler2D sampler, vec2 P, float bias=0.0) {
    float scale = max(length(dFdx(P)),length(dFdy(P)));
    return textureLod(sampler,P,scale+bias);
}

Note that the use of implicit derivatives means that texture can only be used in a fragment shader, because implicit derivatives are undefined elsewhere. Similarly, it can only be used (reliably) inside uniform control flow, i.e. you can’t use it within a conditional statement unless the controlling expression is uniform or dynamically uniform (depending upon version).