From 42833614fb6f24e5daa829df47f446fcd0f970ac Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 2 Oct 2022 18:43:59 +0900 Subject: [PATCH] internal/mipmap: bug fix: do not consider filter to determine mipmap level Now the filter argument is not used (a4e9a05b14997f431457955ec7f5cf31e796e112), the filter value can be the nearest filter even though the shader is for the linear filter. As long as `canSkipMipmap` is set correctly, we don't have to consider the parameter `filter`. We should ignore it. Updates #2364 --- internal/mipmap/mipmap.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/mipmap/mipmap.go b/internal/mipmap/mipmap.go index f5f92e67a..b2409d6b3 100644 --- a/internal/mipmap/mipmap.go +++ b/internal/mipmap/mipmap.go @@ -89,13 +89,13 @@ func (m *Mipmap) DrawTriangles(srcs [graphics.ShaderImageCount]*Mipmap, vertices dy2 := vertices[n*indices[3*i+2]+1] sx2 := vertices[n*indices[3*i+2]+2] sy2 := vertices[n*indices[3*i+2]+3] - if l := mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1, filter); level > l { + if l := mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1); level > l { level = l } - if l := mipmapLevelFromDistance(dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, filter); level > l { + if l := mipmapLevelFromDistance(dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2); level > l { level = l } - if l := mipmapLevelFromDistance(dx2, dy2, dx0, dy0, sx2, sy2, sx0, sy0, filter); level > l { + if l := mipmapLevelFromDistance(dx2, dy2, dx0, dy0, sx2, sy2, sx0, sy0); level > l { level = l } } @@ -232,7 +232,7 @@ func (m *Mipmap) disposeMipmaps() { } // mipmapLevel returns an appropriate mipmap level for the given distance. -func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, filter graphicsdriver.Filter) int { +func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32) int { const maxLevel = 6 d := (dx1-dx0)*(dx1-dx0) + (dy1-dy0)*(dy1-dy0) @@ -252,10 +252,6 @@ func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, fil return 0 } - if filter != graphicsdriver.FilterLinear { - return 0 - } - level := 0 for scale < 0.25 { level++