mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] x11: make use of eglSwapBuffersWithDamage if it's available
This commit is contained in:
parent
092ce61908
commit
03c247a9ff
@ -943,7 +943,40 @@ static EGLNativeWindowType x11GetEGLNativeWindow(void)
|
||||
static void x11EGLSwapBuffers(EGLDisplay display, EGLSurface surface,
|
||||
const struct Rect * damage, int count)
|
||||
{
|
||||
eglSwapBuffers(display, surface);
|
||||
static bool detectDone = false;
|
||||
static eglSwapBuffersWithDamageKHR_t swapWithDamage = NULL;
|
||||
|
||||
if (!detectDone)
|
||||
{
|
||||
const char *exts = eglQueryString(display, EGL_EXTENSIONS);
|
||||
DEBUG_INFO("%s", exts);
|
||||
if (util_hasGLExt(exts, "EGL_KHR_swap_buffers_with_damage"))
|
||||
swapWithDamage = g_egl_dynProcs.eglSwapBuffersWithDamageKHR;
|
||||
else if (util_hasGLExt(exts, "EGL_EXT_swap_buffers_with_damage"))
|
||||
swapWithDamage = g_egl_dynProcs.eglSwapBuffersWithDamageEXT;
|
||||
|
||||
if (swapWithDamage)
|
||||
DEBUG_INFO("Using eglSwapBuffersWithDamage");
|
||||
|
||||
detectDone = true;
|
||||
}
|
||||
|
||||
if (swapWithDamage && count)
|
||||
{
|
||||
EGLint rects[count*4];
|
||||
EGLint *p = rects;
|
||||
for(int i = 0; i < count; ++i, p += 4)
|
||||
{
|
||||
p[0] = damage[i].x;
|
||||
p[1] = damage[i].y;
|
||||
p[2] = damage[i].w;
|
||||
p[3] = damage[i].h;
|
||||
}
|
||||
|
||||
swapWithDamage(display, surface, rects, count);
|
||||
}
|
||||
else
|
||||
eglSwapBuffers(display, surface);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user