Skip to content

Commit

Permalink
update WriteBuffer and WriteTexture to use new BytesToJS function
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Sep 6, 2024
1 parent 4c0db81 commit ebc3cb1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions wgpu/queue_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ func (g Queue) Submit(commandBuffers ...*CommandBuffer) {
// WriteBuffer as described:
// https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writebuffer
func (g Queue) WriteBuffer(buffer *Buffer, offset uint64, data []byte) (err error) {
dataSize := stageBufferData(data)
g.jsValue.Call("writeBuffer", pointerToJS(buffer), offset, uint8Array, uint64(0), dataSize)
g.jsValue.Call("writeBuffer", pointerToJS(buffer), offset, BytesToJS(data), uint64(0), len(data))
return
}

// WriteTexture as described:
// https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writetexture
func (g Queue) WriteTexture(destination *ImageCopyTexture, data []byte, dataLayout *TextureDataLayout, writeSize *Extent3D) (err error) {
stageBufferData(data)
g.jsValue.Call("writeTexture", pointerToJS(destination), uint8Array, pointerToJS(dataLayout), pointerToJS(writeSize))
g.jsValue.Call("writeTexture", pointerToJS(destination), BytesToJS(data), pointerToJS(dataLayout), pointerToJS(writeSize))
return
}

Expand Down

0 comments on commit ebc3cb1

Please sign in to comment.