Skip to content

Commit

Permalink
internal/graphics: optimization: remove boundary checks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hajimehoshi committed Aug 20, 2023
1 parent d979742 commit 407d7bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/graphics/vertex.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 407d7bd

Please sign in to comment.