我可以使用内核函数渲染内核图像,并且可以将重做的图像获取到MTLTexture类(在代码kernelDestTexture
中),但是在那之后:如何获取渲染的图像?
// MTKView delegate function
func draw(in view: MTKView) {
updateBuffers()
let commandBuffer = commandQueue.makeCommandBuffer()!
// by encode function i can draw kernel image to MTLTexture
originalKernel.encode(commandBuffer: commandBuffer, sourceTexture: kernelSourceTexture!, destinationTexture: kernelDestTexture!)
/* omit
.
.
.
*/
commandBuffer.commit()
}