Blit before swapping framebuffers

This fixes latency (and also screen corruption when resizing), as we blitted a
framebuffer that had already been displayed on the off-screen window rather
than the one that had just been rendered.
master
Graham 5 years ago
parent 5e18198ae4
commit 0f7b2ea9ca
  1. 4
      gl-natives/src/main/c/jaggl.c

@ -725,6 +725,8 @@ JNIEXPORT jboolean JNICALL Java_jaggl_context_swapBuffers(JNIEnv *env, jclass cl
#elif defined(_WIN32) #elif defined(_WIN32)
result = (jboolean) SwapBuffers(jaggl_device); result = (jboolean) SwapBuffers(jaggl_device);
#elif defined(__APPLE__) && defined(__MACH__) #elif defined(__APPLE__) && defined(__MACH__)
[jaggl_layer blit];
/* /*
* This buffer swap isn't strictly necessary (in fact, I'm not sure if we * This buffer swap isn't strictly necessary (in fact, I'm not sure if we
* need to double buffer at all on macOS), but it is useful when the * need to double buffer at all on macOS), but it is useful when the
@ -735,8 +737,6 @@ JNIEXPORT jboolean JNICALL Java_jaggl_context_swapBuffers(JNIEnv *env, jclass cl
} else { } else {
glFlush(); glFlush();
} }
[jaggl_layer blit];
#else #else
#error Unsupported platform #error Unsupported platform
#endif #endif

Loading…
Cancel
Save