mipmap: Bug fix: HasHighPrecisionFloat cannot be called before the main loop

Instead, use the common number for the too-big scale.

Fixes #1270
This commit is contained in:
Hajime Hoshi 2020-07-29 12:46:05 +09:00
parent 2dc6cbe51a
commit 62fbac2290

View File

@ -281,11 +281,9 @@ func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, fil
scale := d / s
// Use 'negative' mipmap to render edges correctly (#611, #907).
// It looks like 128 is the enlargement factor that causes edge missings to pass the test TestImageStretch.
var tooBigScale float32 = 128
if !graphicsDriver.HasHighPrecisionFloat() {
tooBigScale = 4
}
// It looks like 128 is the enlargement factor that causes edge missings to pass the test TestImageStretch,
// but we use 64 here for environments where the float precision is low (#1044, #1270).
var tooBigScale float32 = 64
if scale >= tooBigScale*tooBigScale {
// If the filter is not nearest, the target needs to be rendered with graduation. Don't use mipmaps.
@ -310,10 +308,10 @@ func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, fil
}
}
// If tooBigScale is 4, level -10 means that the maximum scale is 4 * 2^10 = 4096. This should be
// If tooBigScale is 64, level -6 means that the maximum scale is 64 * 2^6 = 4096. This should be
// enough.
if level < -10 {
level = -10
if level < -6 {
level = -6
}
return level
}