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

Method TransferRegsToGPU

vgpu/memory.go:407–424  ·  view source on GitHub ↗

TransferRegsToGPU transfers memory from CPU to GPU for given regions, using a one-time memory command buffer. All buffs must be of the same type.

(regs []MemReg)

Source from the content-addressed store, hash-verified

405// using a one-time memory command buffer.
406// All buffs must be of the same type.
407func (mm *Memory) TransferRegsToGPU(regs []MemReg) {
408 if len(regs) == 0 {
409 return
410 }
411 bt := regs[0].BuffType
412 if bt == StorageBuff {
413 mm.TransferStorageRegsToGPU(regs)
414 return
415 }
416 buff := mm.Buffs[bt]
417 if buff.Size == 0 || buff.DevMem == vk.NullDeviceMemory {
418 return
419 }
420 cmd := mm.CmdPool.NewBuffer(&mm.Device)
421 mm.CmdPool.BeginCmdOneTime()
422 mm.CmdTransferRegsToGPU(cmd, buff, regs)
423 mm.CmdPool.EndSubmitWaitFree(&mm.Device)
424}
425
426// TransferRegsFromGPU transfers memory from GPU to CPU for given regions,
427// using a one-time memory command buffer.

Callers 2

SyncToGPUBuffMethod · 0.95
TransferToGPUBuffMethod · 0.95

Calls 5

CmdTransferRegsToGPUMethod · 0.95
BeginCmdOneTimeMethod · 0.80
EndSubmitWaitFreeMethod · 0.80
NewBufferMethod · 0.45

Tested by

no test coverage detected