mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-28 03:32:45 +01:00
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:
parent
2dc6cbe51a
commit
62fbac2290
@ -281,11 +281,9 @@ func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, fil
|
|||||||
scale := d / s
|
scale := d / s
|
||||||
|
|
||||||
// Use 'negative' mipmap to render edges correctly (#611, #907).
|
// 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.
|
// It looks like 128 is the enlargement factor that causes edge missings to pass the test TestImageStretch,
|
||||||
var tooBigScale float32 = 128
|
// but we use 64 here for environments where the float precision is low (#1044, #1270).
|
||||||
if !graphicsDriver.HasHighPrecisionFloat() {
|
var tooBigScale float32 = 64
|
||||||
tooBigScale = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
if scale >= tooBigScale*tooBigScale {
|
if scale >= tooBigScale*tooBigScale {
|
||||||
// If the filter is not nearest, the target needs to be rendered with graduation. Don't use mipmaps.
|
// 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.
|
// enough.
|
||||||
if level < -10 {
|
if level < -6 {
|
||||||
level = -10
|
level = -6
|
||||||
}
|
}
|
||||||
return level
|
return level
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user