由于执行期间发生错误,命令缓冲区的执行被中止。导致GPU超时错误(IOAF代码2)

时间:2019-02-12 01:11:05

标签: ios swift

我有一个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)

我该如何调试呢?

1 个答案:

答案 0 :(得分:0)

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

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