微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

金属在iOS 14上崩溃

如何解决金属在iOS 14上崩溃

自iOS 14出现以来,我在调用MetalDevice?.makeRenderPipelinestate时,在下面的Metal代码的以下行中崩溃了。

   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
        }

         ....
    }

我在Firebase控制台中看到此崩溃日志,无法重现。

  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)

有人可以告诉我这里有什么问题吗,崩溃日志是什么意思?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。