如何在Metal的“ draw(in :)”函数中存储内核映像?

时间:2019-07-23 08:57:21

标签: metal metalkit

我可以使用内核函数渲染内核图像,并且可以将重做的图像获取到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()
    }


0 个答案:

没有答案