mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphicsdriver/opengl: Avoid unnecessary creation of Uint16Array/Float32Array
Updates #1426
This commit is contained in:
parent
5897e1ab7c
commit
44e2455c65
@ -455,16 +455,14 @@ func (c *context) bindElementArrayBuffer(b buffer) {
|
||||
|
||||
func (c *context) arrayBufferSubData(data []float32) {
|
||||
gl := c.gl
|
||||
arr8 := jsutil.TemporaryUint8Array(len(data) * 4)
|
||||
arr := js.Global().Get("Float32Array").New(arr8.Get("buffer"), arr8.Get("byteOffset"), len(data))
|
||||
arr := jsutil.TemporaryUint8Array(len(data) * 4)
|
||||
jsutil.CopySliceToJS(arr, data)
|
||||
gl.Call("bufferSubData", gles.ARRAY_BUFFER, 0, arr)
|
||||
}
|
||||
|
||||
func (c *context) elementArrayBufferSubData(data []uint16) {
|
||||
gl := c.gl
|
||||
arr8 := jsutil.TemporaryUint8Array(len(data) * 2)
|
||||
arr := js.Global().Get("Uint16Array").New(arr8.Get("buffer"), arr8.Get("byteOffset"), len(data))
|
||||
arr := jsutil.TemporaryUint8Array(len(data) * 2)
|
||||
jsutil.CopySliceToJS(arr, data)
|
||||
gl.Call("bufferSubData", gles.ELEMENT_ARRAY_BUFFER, 0, arr)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user