[Impeller] Document mip bias. (flutter/engine#49602)
Add doc strings explaining what the mip bias does and where it came from.
This commit is contained in:
@@ -24,8 +24,11 @@ const float kHalfSqrtTwo = 0.70710678118;
|
||||
// sqrt(3)
|
||||
const float kSqrtThree = 1.73205080757;
|
||||
|
||||
// The default mip bias to use when sampling textures.
|
||||
// This value biases towards sampling from a lower mip level (bigger size),
|
||||
// which results in sharper looking images when mip sampling is enabled. This is
|
||||
// the same constant that Skia uses.
|
||||
const float kDefaultMipBias = -0.475;
|
||||
|
||||
const float kDefaultMipBiasHalf = -0.475hf;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
/// If `y_coord_scale` < 0.0, the Y coordinate is flipped. This is useful
|
||||
/// for Impeller graphics backends that use a flipped framebuffer coordinate
|
||||
/// space.
|
||||
///
|
||||
/// A negative mip bias is applied to improve the sharpness of scaled down
|
||||
/// images when mip sampling is enabled. See `kDefaultMipBias` for more detail.
|
||||
vec4 IPSample(sampler2D texture_sampler, vec2 coords, float y_coord_scale) {
|
||||
return texture(texture_sampler, IPRemapCoords(coords, y_coord_scale),
|
||||
kDefaultMipBias);
|
||||
|
||||
Reference in New Issue
Block a user