/* gfx_directx_enable_triple_buffering: * Checks graphic driver for triple buffering capability. */ void gfx_directx_enable_triple_buffering(GFX_DRIVER *drv) { HRESULT hr; hr = IDirectDrawSurface2_GetFlipStatus(DDRAW_SURFACE_OF(gfx_directx_forefront_bitmap)->id, DDGFS_ISFLIPDONE); if ((hr == DD_OK) || (hr == DDERR_WASSTILLDRAWING)) { drv->poll_scroll = gfx_directx_poll_scroll; gfx_capabilities |= GFX_CAN_TRIPLE_BUFFER; } }
/* gfx_directx_poll_scroll: */ int gfx_directx_poll_scroll(void) { HRESULT hr; ASSERT(n_flipping_pages == 3); hr = IDirectDrawSurface2_GetFlipStatus(flipping_page[0]->id, DDGFS_ISFLIPDONE); /* if the surface has been lost, try to restore all surfaces */ if (hr == DDERR_SURFACELOST) { if (restore_all_ddraw_surfaces() == 0) hr = IDirectDrawSurface2_GetFlipStatus(flipping_page[0]->id, DDGFS_ISFLIPDONE); } if (FAILED(hr)) return -1; return 0; }