From 064ecf3497bfbb14b2dbdfad30c9a575b0212631 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 1 Sep 2019 20:10:12 +0100 Subject: [PATCH] Disable CAOpenGLLayer asynchronous mode canDrawInCGLContext is called far more often than blit, so it seems like a waste of effort. --- gl-natives/src/main/c/jaggl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gl-natives/src/main/c/jaggl.c b/gl-natives/src/main/c/jaggl.c index c8676e1..0142ae8 100644 --- a/gl-natives/src/main/c/jaggl.c +++ b/gl-natives/src/main/c/jaggl.c @@ -211,7 +211,7 @@ static void *jaggl_proc_addr(const char *name) { - (id)init { self = [super init]; if (self) { - self.asynchronous = YES; + self.asynchronous = NO; self.opaque = YES; self.needsDisplayOnBoundsChange = YES; self.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; @@ -257,6 +257,10 @@ static void *jaggl_proc_addr(const char *name) { glBlitFramebufferEXT(0, 0, framebuffer_width, framebuffer_height, 0, 0, framebuffer_width, framebuffer_height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + dispatch_sync(dispatch_get_main_queue(), ^{ + [self setNeedsDisplay]; + }); } - (BOOL)canDrawInCGLContext:(CGLContextObj)context