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

Method SetFrameImage

vgpu/vdraw/draw.go:66–82  ·  view source on GitHub ↗

SetFrameImage sets given vgpu.Framebuffer image as a drawing source at index, used in subsequent Draw methods. Must have already been configured to fit!

(idx int, fbi any)

Source from the content-addressed store, hash-verified

64// SetFrameImage sets given vgpu.Framebuffer image as a drawing source at index,
65// used in subsequent Draw methods. Must have already been configured to fit!
66func (dw *Drawer) SetFrameImage(idx int, fbi any) {
67 fb := fbi.(*vgpu.Framebuffer)
68 if fb == nil {
69 return
70 }
71 dw.UpdateMu.Lock()
72 _, tx, _ := dw.Sys.Vars().ValueByIndexTry(0, "Tex", idx)
73 if fb.Format.Size != tx.Texture.Format.Size {
74 dw.UpdateMu.Unlock()
75 dw.ConfigImage(idx, &fb.Format)
76 dw.UpdateMu.Lock()
77 }
78 cmd := dw.Sys.MemCmdStart()
79 fb.CopyToImage(&tx.Texture.Image, dw.Sys.Device.Device, cmd)
80 dw.Sys.MemCmdEndSubmitWaitFree()
81 dw.UpdateMu.Unlock()
82}
83
84////////////////////////////////////////////////////////////////
85// Names

Callers 2

SetFrameImageNameMethod · 0.95
mainFunction · 0.95

Calls 8

ConfigImageMethod · 0.95
MemCmdStartMethod · 0.80
CopyToImageMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
ValueByIndexTryMethod · 0.45
VarsMethod · 0.45

Tested by

no test coverage detected