graphics: Use copy function in appendVertices

This commit is contained in:
Hajime Hoshi 2018-06-17 01:09:05 +09:00
parent b4ace53596
commit f6b7a6be73

View File

@ -69,11 +69,7 @@ func (q *commandQueue) appendVertices(vertices []float32) {
n := q.nvertices + len(vertices) - len(q.vertices) n := q.nvertices + len(vertices) - len(q.vertices)
q.vertices = append(q.vertices, make([]float32, n)...) q.vertices = append(q.vertices, make([]float32, n)...)
} }
// for-loop might be faster than copy: copy(q.vertices[q.nvertices:], vertices)
// On GopherJS, copy might cause subarray calls.
for i := range vertices {
q.vertices[q.nvertices+i] = vertices[i]
}
q.nvertices += len(vertices) q.nvertices += len(vertices)
} }