0 Replies
      Latest reply on Nov 29, 2019 5:01 AM by C5FlyingSquad
      C5FlyingSquad Level 1 Level 1 (0 points)

        My code initially renders to a texture then I use a blit command encoder to copy that texture to a new empty one. Then in the same rendering pass, I create a new encoder and pass this texture in as an argument. The code below gives an overview. When running it on macOS, it works fine; but when running it on iOS, I get some visual artefacts that cover the entire screen.

         

        // Create render pass descriptor...
        renderPassdecriptor.colorAttachments[0].texture = initialRenderTarget
        // Continue configuring this pass desriptor and other stuff
        
        let firstEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: renderPassDescriptor)
        // Configure firstEncoder and perform draw calls...
        firstEncoder.endEncoding()
        
        let blitEncoder = commandBuffer.makeBlitCommandEncoder()
        blitEncoder.copy(initialRenderTarget, newTexture)
        blitEncoder.endEncoding()
        
        let secondEncoder = commandBuffer.makeRenderCommandEncoder(descriptor: renderPassDescriptor)
        // Encode...
        secondEncoder.endEncoding()