我有一个iOS应用程序,该应用程序使用VNDetectFaceLandmarksRequest从相机供稿中查找面部。这是我于2017年开始的项目,最近又开始进行。我正在异步DispatchQueue中运行请求,但出现以下错误:

Execution of the command buffer was aborted due to an error during execution. Caused GPU Timeout Error (IOAF code 2)
Execution of the command buffer was aborted due to an error during execution. Ignored (for causing prior/excessive GPU errors) (IOAF code 4)


我该如何调试?

最佳答案

如果我使用未正确初始化的纹理,则会收到此错误。添加一些基本设置并为Metal快速创建纹理,如下所示:

    let texDescriptor = MTLTextureDescriptor.texture2DDescriptor(pixelFormat: MTLPixelFormat.rgba8Unorm, width: 128, height: 128, mipmapped: false)
    textureImage = device.makeTexture(descriptor: texDescriptor)

10-08 05:44