The textureQueryLod call returns two components:
Are they both same?
When you have a problem like this and find it cannot be sufficiently answered by looking at the basic API documentation for a class of GLSL functions, you should consult the formal GLSL specification.
If you read the specification, specifically Section 8.9.1 - Texture Query Functions, you will come across a very detailed explanation of the "used" mipmap level. In short, this value is the fractional component that would be used to select the nearest mipmap level(s) during during minification+mipmap filtering.
With that out of the way, you should have the theoretical basis to understand the pseudo-code presented in the specification on pp. 155:
float ComputeAccessedLod(float computedLod)
{
// Clamp the computed LOD according to the texture LOD clamps.
if (computedLod < TEXTURE_MIN_LOD) computedLod = TEXTURE_MIN_LOD;
if (computedLod > TEXTURE_MAX_LOD) computedLod = TEXTURE_MAX_LOD;
// Clamp the computed LOD to the range of accessible levels.
if (computedLod < 0.0)
computedLod = 0.0;
if (computedLod > (float)
maxAccessibleLevel) computedLod = (float) maxAccessibleLevel;
// Return a value according to the min filter.
if (TEXTURE_MIN_FILTER is LINEAR or NEAREST) {
return 0.0;
} else if (TEXTURE_MIN_FILTER is NEAREST_MIPMAP_NEAREST
or LINEAR_MIPMAP_NEAREST) {
return ceil(computedLod + 0.5) - 1.0;
} else {
return computedLod;
}
}
There are three branches in this pseudo-code:
The second component returned by textureQueryLod (...)
is the unclamped integer LOD.