Reduce division operators

It looks like runtime.wasmDiv takes account for a big part at CPU
usages with examples/sprites.
This commit is contained in:
Hajime Hoshi
2019-09-27 03:28:07 +09:00
parent 3cf867035d
commit af6bda48c3
2 changed files with 4 additions and 2 deletions

View File

@@ -192,7 +192,8 @@ func (q *commandQueue) Flush() {
const dstAdjustmentFactor = 1.0 / 256.0
const texelAdjustmentFactor = 1.0 / 512.0
for i := 0; i < q.nvertices/graphics.VertexFloatNum; i++ {
n := q.nvertices / graphics.VertexFloatNum
for i := 0; i < n; i++ {
s := q.srcSizes[i]
// Convert pixels to texels.