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)
| 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! |
| 66 | func (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 |
no test coverage detected