mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphicsdriver/metal: Refactoring: Use NextPowerOf2Int
This commit is contained in:
parent
a1b1bce43a
commit
a6d3a1e0cb
@ -580,12 +580,9 @@ func (d *Driver) Draw(indexLen int, indexOffset int, mode graphics.CompositeMode
|
||||
viewportSize := [...]float32{float32(w), float32(h)}
|
||||
rce.SetVertexBytes(unsafe.Pointer(&viewportSize[0]), unsafe.Sizeof(viewportSize), 1)
|
||||
|
||||
sourceSize := [...]float32{float32(1), float32(1)}
|
||||
for sourceSize[0] < float32(d.src.width) {
|
||||
sourceSize[0] *= 2
|
||||
}
|
||||
for sourceSize[1] < float32(d.src.height) {
|
||||
sourceSize[1] *= 2
|
||||
sourceSize := [...]float32{
|
||||
float32(graphics.NextPowerOf2Int(d.src.width)),
|
||||
float32(graphics.NextPowerOf2Int(d.src.height)),
|
||||
}
|
||||
rce.SetFragmentBytes(unsafe.Pointer(&sourceSize[0]), unsafe.Sizeof(sourceSize), 2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user