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
This commit is contained in:
Hajime Hoshi 2023-08-20 15:36:56 +09:00
parent d9797423e5
commit 407d7bd43f

View File

@ -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)