Post

Replies

Boosts

Views

Activity

Reply to Slow performance on iPhone 12/Pro/Max when copying pixel data from metal texture
I am encountering the exact same symptoms. I have an iPhone 12ProMax and an iPad Pro and I tried the exact same code. For testing, I used the time to copy the CurrentDrawable of MTKView to the CPU side with getBytes in NSLog. Of course, both are the exact same code. Both operating systems are the latest. iPad PRO : W2388px H1668px - 3msec iPhone 12 Pro Max : W1920px H1440px - 40msec I think it's strange that the difference is more than 10 times larger than the iPad PRO, which has a much larger texture size to process. func draw(in view: MTKView) {           guard let texture = view.currentDrawable?.texture else {       print("Drawable texture is not ready.")       return     }           let w = texture.width     let h = texture.height     let bytesPerPixel: Int = 4     let imageByteCount = w * h * bytesPerPixel     let bytesPerRow = w * bytesPerPixel     var src: UnsafeMutablePointerUInt8     NSLog("Start memory alloc")     src = UnsafeMutablePointerUInt8.allocate(capacity: imageByteCount)     let region = MTLRegionMake2D(0, 0, w, h)     NSLog("Start")     texture.getBytes(src, bytesPerRow: bytesPerRow, from: region, mipmapLevel: 0)     NSLog("End") src.deallocate()  }
May ’21
Reply to Performance degradation of camera image acquisition with ARKit on iPhone 12 Pro with iOS 14.5.1.
I have encountered similar symptoms. Calling not only CIImage but also MTLTexture and other classes that allocate memory on the GPU takes a very long time. I guess it is taking time to copy memory from CPU to GPU. Note that I encountered this phenomenon with iPhone 12 Pro Max (iOS 14.5.1) and confirmed that there is no problem with iPad Pro 4th (PadOS 14.5).
May ’21