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

Method GrabImage

vgpu/framebuffer.go:120–130  ·  view source on GitHub ↗

RenderFrame functionality https://stackoverflow.com/questions/51477954/vulkan-off-screen-rendering-tiling-optimal-or-linear https://github.com/SaschaWillems/Vulkan/tree/b9f0ac91d2adccc3055a904d3a8f6553b10ff6cd/examples/renderheadless/renderheadless.cpp GrabImage grabs the current framebuffer image,

(dev vk.Device, cmd vk.CommandBuffer)

Source from the content-addressed store, hash-verified

118// which must have the cmdBegin called already.
119// call this after: sys.MemCmdEndSubmitWaitFree()
120func (fb *Framebuffer) GrabImage(dev vk.Device, cmd vk.CommandBuffer) {
121 fb.Render.ConfigGrab(dev) // ensure image grab setup
122 // first, prepare ImageGrab to receive copy from render image.
123 // apparently, the color attachment, with src flag already set, does not need this.
124
125 // todo: for Surface frame, transition src image
126
127 fb.Render.Grab.TransitionForDst(cmd, vk.PipelineStageTransferBit) // no idea why, but SaschaWillems does
128 vk.CmdCopyImage(cmd, fb.Image.Image, vk.ImageLayoutTransferSrcOptimal, fb.Render.Grab.Image, vk.ImageLayoutTransferDstOptimal, 1, []vk.ImageCopy{fb.Render.Grab.CopyImageRec()})
129 fb.Render.Grab.TransitionDstToGeneral(cmd)
130}
131
132// CopyToImage copies the current framebuffer image to given image dest
133// using given command buffer which must have the cmdBegin called already.

Callers 2

ImageMethod · 0.45
ImageCopyMethod · 0.45

Calls 4

ConfigGrabMethod · 0.80
TransitionForDstMethod · 0.80
CopyImageRecMethod · 0.80

Tested by

no test coverage detected