This commit is contained in:
Михаил Капелько committed 2026-10-30 16:56:50 +03:00
1 parent cd82f445d3
commit 5e5537aee6
5 files changed
+20 -18

No files matched your search

+4 -4
View File
@@ -5,8 +5,9 @@ import UIKit
func renderDeinit(_ vm: RenderVM) {
vm.timer?.invalidate()
vm.timer = nil
guard eglMakeCurrentContext(&vm.glView.st) else { return }
eglMakeCurrentContext(&vm.glView.st)
raybriShutdown()
eglMakeCurrent(vm.glView.st.display, nil, nil, nil)
eglDestroySurface(vm.glView.st.display, vm.glView.st.surface)
eglDestroyContext(vm.glView.st.display, vm.glView.st.ctx)
@@ -14,8 +15,7 @@ func renderDeinit(_ vm: RenderVM) {
}
func renderInit(_ vm: RenderVM) {
// UIKit has no NSOpenGLContext: EGL/ANGLE renders into the view's layer,
// so the layer is what the bridge needs to create its surface from.
// On iOS EGL/ANGLE renders into the UIView's layer
let layer = Unmanaged.passUnretained(vm.glView.layer).toOpaque()
vm.glView.st.caLayer = layer
@@ -32,7 +32,7 @@ func renderStartTimer(_ vm: RenderVM) {
// The frame is presented by eglSwapBuffers into the view's layer, not by
// CoreGraphics, so the timer drives the rendering itself instead of
// invalidating the view for a draw(_:) pass the way macOS does.
// invalidating the view for a draw(_:) pass the way macOS does
let timer = Timer(timeInterval: 1.0 / RENDER_FPS, repeats: true) { [weak vm] _ in
guard let vm else { return }
renderDraw(vm)