自 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)
有人能告诉我这里出了什么问题吗?崩溃日志是什么意思?