From: Eric B. <ebo...@us...> - 2002-01-22 09:49:24
|
Update of /cvsroot/alleg/allegro/src/win In directory usw-pr-cvs1:/tmp/cvs-serv22662/src/win Modified Files: wddaccel.c wddfull.c wddovl.c wddraw.c wddraw.h wddwin.c Log Message: Uncoupled hardware-accelerated drawing and triple buffering for the DirectDraw gfx drivers Index: wddaccel.c =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wddaccel.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- wddaccel.c 2001/06/05 21:38:46 1.7 +++ wddaccel.c 2002/01/22 09:49:20 1.8 @@ -452,7 +452,7 @@ /* enable_acceleration: - * checks graphic driver for capabilities to accelerate Allegro + * Checks graphic driver for capabilities to accelerate Allegro. */ int enable_acceleration(GFX_DRIVER * drv) { @@ -498,12 +498,24 @@ gfx_capabilities |= (GFX_HW_VRAM_BLIT_MASKED | GFX_HW_SYS_TO_VRAM_BLIT_MASKED); } - /* triple buffering? */ + return 0; +} + + + +/* enable_triple_buffering: + * Checks graphic driver for triple buffering capability. + */ +int enable_triple_buffering(GFX_DRIVER *drv) +{ + HRESULT hr; + hr = IDirectDrawSurface2_GetFlipStatus(BMP_EXTRA(dd_frontbuffer)->surf, DDGFS_ISFLIPDONE); - if (hr == DDERR_WASSTILLDRAWING || hr == DD_OK) { + if ((hr == DD_OK) || (hr == DDERR_WASSTILLDRAWING)) { drv->poll_scroll = gfx_directx_poll_scroll; gfx_capabilities |= GFX_CAN_TRIPLE_BUFFER; } return 0; } + Index: wddfull.c =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wddfull.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- wddfull.c 2002/01/16 13:34:50 1.13 +++ wddfull.c 2002/01/22 09:49:20 1.14 @@ -172,10 +172,13 @@ _enter_critical(); - bmp = gfx_directx_init(&gfx_directx_accel, TRUE, w, h, v_w, v_h, color_depth); + bmp = gfx_directx_init(&gfx_directx_accel, w, h, v_w, v_h, color_depth); - if (bmp) + if (bmp) { + enable_acceleration(&gfx_directx_accel); + enable_triple_buffering(&gfx_directx_accel); finalize_fullscreen_init(); + } _exit_critical(); @@ -192,10 +195,12 @@ _enter_critical(); - bmp = gfx_directx_init(&gfx_directx_soft, FALSE, w, h, v_w, v_h, color_depth); + bmp = gfx_directx_init(&gfx_directx_soft, w, h, v_w, v_h, color_depth); - if (bmp) + if (bmp) { + enable_triple_buffering(&gfx_directx_soft); finalize_fullscreen_init(); + } _exit_critical(); @@ -212,7 +217,7 @@ _enter_critical(); - bmp = gfx_directx_init(&gfx_directx_safe, FALSE, w, h, v_w, v_h, color_depth); + bmp = gfx_directx_init(&gfx_directx_safe, w, h, v_w, v_h, color_depth); if (bmp) finalize_fullscreen_init(); Index: wddovl.c =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wddovl.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- wddovl.c 2002/01/21 12:59:49 1.28 +++ wddovl.c 2002/01/22 09:49:20 1.29 @@ -410,6 +410,9 @@ /* use hardware accelerated primitives */ enable_acceleration(&gfx_directx_ovl); + /* use triple buffering */ + enable_triple_buffering(&gfx_directx_ovl); + /* connect to the system driver */ win_gfx_driver = &win_gfx_driver_overlay; Index: wddraw.c =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wddraw.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- wddraw.c 2002/01/21 12:59:49 1.22 +++ wddraw.c 2002/01/22 09:49:20 1.23 @@ -212,7 +212,7 @@ /* gfx_directx_init: */ -struct BITMAP *gfx_directx_init(GFX_DRIVER *drv, int accel, int w, int h, int v_w, int v_h, int color_depth) +struct BITMAP *gfx_directx_init(GFX_DRIVER *drv, int w, int h, int v_w, int v_h, int color_depth) { if ((v_w != w && v_w != 0) || (v_h != h && v_h != 0)) { ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported virtual resolution")); @@ -252,9 +252,6 @@ /* create front buffer */ dd_frontbuffer = make_directx_bitmap(dd_prim_surface, w, h, BMP_ID_VIDEO); - - if (accel) - enable_acceleration(drv); return dd_frontbuffer; Index: wddraw.h =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wddraw.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- wddraw.h 2002/01/21 12:59:49 1.28 +++ wddraw.h 2002/01/22 09:49:20 1.29 @@ -46,7 +46,7 @@ /* driver routines */ -AL_FUNC(BITMAP *, gfx_directx_init, (GFX_DRIVER *drv, int accel, int w, int h, int v_w, int v_h, int color_depth)); +AL_FUNC(BITMAP *, gfx_directx_init, (GFX_DRIVER *drv, int w, int h, int v_w, int v_h, int color_depth)); AL_FUNC(void, gfx_directx_exit, (BITMAP *bmp)); AL_FUNC(void, gfx_directx_sync, (void)); AL_FUNC(void, gfx_directx_set_palette, (AL_CONST RGB *p, int from, int to, int vsync)); @@ -74,6 +74,7 @@ /* driver initialisation and shutdown (from wddaccel.c) */ AL_FUNC(int, enable_acceleration, (GFX_DRIVER *drv)); +AL_FUNC(int, enable_triple_buffering, (GFX_DRIVER *drv)); /* video mode setting (from wddmode.c) */ Index: wddwin.c =================================================================== RCS file: /cvsroot/alleg/allegro/src/win/wddwin.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- wddwin.c 2002/01/21 12:59:49 1.48 +++ wddwin.c 2002/01/22 09:49:20 1.49 @@ -51,7 +51,7 @@ gfx_directx_create_video_bitmap, gfx_directx_destroy_video_bitmap, gfx_directx_show_video_bitmap_win, - gfx_directx_show_video_bitmap_win, + NULL, gfx_directx_create_system_bitmap, gfx_directx_destroy_system_bitmap, NULL, // AL_METHOD(int, set_mouse_sprite, (struct BITMAP *sprite, int xfocus, int yfocus)); |