From 407d7bd43f60be9cbddd50c6ae9e330ff2bd53c4 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 20 Aug 2023 15:36:56 +0900 Subject: [PATCH] internal/graphics: optimization: remove boundary checks Before: ``` $ go build -gcflags="-d=ssa/check_bce" ./internal/graphics internal/graphics/vertex.go:83:9: Found IsSliceInBounds internal/graphics/vertex.go:85:5: Found IsInBounds internal/graphics/vertex.go:86:5: Found IsInBounds ... ``` After: ``` $ go build -gcflags="-d=ssa/check_bce" ./internal/graphics internal/graphics/vertex.go:83:11: Found IsSliceInBounds internal/graphics/shader.go:134:37: Found IsSliceInBounds ``` Updates #2601 --- internal/graphics/vertex.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/graphics/vertex.go b/internal/graphics/vertex.go index d20c2cac7..41f0ac7d5 100644 --- a/internal/graphics/vertex.go +++ b/internal/graphics/vertex.go @@ -80,7 +80,7 @@ func QuadVertices(dst []float32, sx0, sy0, sx1, sy1 float32, a, b, c, d, tx, ty u0, v0, u1, v1 := sx0, sy0, sx1, sy1 // This function is very performance-sensitive and implement in a very dumb way. - _ = dst[:4*VertexFloatCount] + dst = dst[:4*VertexFloatCount] dst[0] = adjustDestinationPixel(tx) dst[1] = adjustDestinationPixel(ty)