libobs-opengl: Disable v-sync when drawing on linux

Prevents glXSwapBuffers from stalling.  It would have to stall and wait
for the next frame for each and every single additional swap chain.
This commit is contained in:
jp9000 2016-01-25 10:43:53 -08:00
parent aa48c6e9bc
commit 9cded466dc

View File

@ -561,12 +561,40 @@ extern void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
}
}
enum swap_type {
SWAP_TYPE_NORMAL,
SWAP_TYPE_EXT,
SWAP_TYPE_MESA,
SWAP_TYPE_SGI,
};
extern void device_present(gs_device_t *device)
{
static bool initialized = false;
static enum swap_type swap_type = SWAP_TYPE_NORMAL;
Display *display = device->plat->display;
XID window = device->cur_swap->wi->window;
if (!initialized) {
if (GLAD_GLX_EXT_swap_control)
swap_type = SWAP_TYPE_EXT;
else if (GLAD_GLX_MESA_swap_control)
swap_type = SWAP_TYPE_MESA;
else if (GLAD_GLX_SGI_swap_control)
swap_type = SWAP_TYPE_SGI;
initialized = true;
}
/* TODO: Handle XCB events. */
switch (swap_type) {
case SWAP_TYPE_EXT: glXSwapIntervalEXT(display, window, 0); break;
case SWAP_TYPE_MESA: glXSwapIntervalMESA(0); break;
case SWAP_TYPE_SGI: glXSwapIntervalSGI(0); break;
case SWAP_TYPE_NORMAL:;
}
glXSwapBuffers(display, window);
}