import QuartzCore import UIKit // Render a single frame. The timer calls this directly: an EGL/ANGLE surface // presents into the view's layer, so there is no draw(_:) / needsDisplay pass // like in the NSOpenGLView on macOS. func renderDraw(_ vm: RenderVM) { raybri_ios_render(CACurrentMediaTime() - vm.startTime) } // Backing-pixel size of the view, which is what EGL/ANGLE renders into. func renderPixelSize(_ view: UIView) -> [Int32] { let scale = view.contentScaleFactor let w = Int32(max(1, (view.bounds.width * scale).rounded())) let h = Int32(max(1, (view.bounds.height * scale).rounded())) return [w, h] }