MCPcopy Create free account
hub / github.com/cogentcore/core / CopyToBytes

Method CopyToBytes

vgpu/vals.go:198–206  ·  view source on GitHub ↗

CopyToBytes copies bytes from val to given source pointer into memory. Use this for struct data types to retrieve computed results.

(srcPtr unsafe.Pointer)

Source from the content-addressed store, hash-verified

196// CopyToBytes copies bytes from val to given source pointer into memory.
197// Use this for struct data types to retrieve computed results.
198func (vl *Value) CopyToBytes(srcPtr unsafe.Pointer) {
199 if err := vl.PaddedArrayCheck(); err != nil {
200 log.Println(err)
201 return
202 }
203 dst := vl.Bytes()
204 src := (*[ByteCopyMemoryLimit]byte)(srcPtr)[:vl.AllocSize]
205 copy(src, dst)
206}
207
208// SetGoImage sets Texture image data from an *image.RGBA standard Go image,
209// at given layer, and sets the Mod flag, so it will be sync'd by Memory

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 3

PaddedArrayCheckMethod · 0.95
BytesMethod · 0.95
PrintlnMethod · 0.80

Tested by

no test coverage detected