Metal crashes on iOS 14

848 views Asked by At

I am getting the crash in the following line in my Metal code below while calling metalDevice?.makeRenderPipelineState ever since iOS 14 came.

   commandQueue = MetalCamera.renderCommandQueue
    metalLibrary = metalDevice?.makeDefaultLibrary()
    
    if let library = metalLibrary {
        let vertexShader = library.makeFunction(name: "vertexShaderPassthru")
        let fragmentShaderYUV = library.makeFunction(name: "fragmentShaderYUV")
        
        let pipelineDescriptorYUV = MTLRenderPipelineDescriptor()
        pipelineDescriptorYUV.sampleCount = 1
        pipelineDescriptorYUV.colorAttachments[0].pixelFormat = .bgra8Unorm
        pipelineDescriptorYUV.depthAttachmentPixelFormat = .invalid
        
        pipelineDescriptorYUV.vertexFunction = vertexShader
        pipelineDescriptorYUV.fragmentFunction = fragmentShaderYUV
        
        do {
           /* Crashes in the line below */
            try pipelineStateYUV = metalDevice?.makeRenderPipelineState(descriptor: pipelineDescriptorYUV) 
        }
        catch {
            assertionFailure("Failed creating a render state pipeline. Can't render the texture without one.")
            return
        }

         ....
    }

I see this crash log in Firebase console and can not reproduce this.

  Crashed: com.capturePipeline.videoOut
  EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000007dffff0008
  keyboard_arrow_up


Crashed: com.capturePipeline.videoOut
0  libobjc.A.dylib                0x1ad787978 objc_msgSend + 24
1  Metal                          0x1aeed563c validateWithDevice(id<MTLDevice>,     MTLRenderPipelineDescriptorPrivate const&) + 324
 2  Metal                          0x1aeed5458 -[MTLRenderPipelineDescriptorInternal validateWithDevice:error:] + 104
 3  AGXMetalA13                    0x1e2166774 (Missing)
 4  AGXMetalA13                    0x1e2168b80 (Missing)
 5  MyApp                       0x102eaf184 MetalFrameRenderer.setupMetalPipeline() + 332 (MetalFrameRenderer.swift:332)

Can someone tell me what is wrong here and what does crash log mean?

0

There are 0 answers