WM Draw Method added to do Overlap assuming swap exchange / flipping,

and made that the default for windows software opengl because that
seems to be working better at least on XP. Previously this could only
be specified from the command line.
This commit is contained in:
Brecht Van Lommel 2010-02-01 10:02:53 +00:00
parent 3e8a2a5f07
commit a59841b016
4 changed files with 12 additions and 18 deletions

@ -486,6 +486,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_DRAW_OVERLAP 1
#define USER_DRAW_FULL 2
#define USER_DRAW_AUTOMATIC 3
#define USER_DRAW_OVERLAP_FLIP 4
/* tw_flag (transform widget) */

@ -2170,6 +2170,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{USER_DRAW_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically set based on graphics card and driver."},
{USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer", "Use a third buffer for minimal redraws at the cost of more memory."},
{USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap", "Redraw all overlapping regions, minimal memory usage but more redraws."},
{USER_DRAW_OVERLAP_FLIP, "OVERLAP_FLIP", 0, "Overlap Flip", "Redraw all overlapping regions, minimal memory usage but more redraws (for graphics drivers that do flipping)."},
{USER_DRAW_FULL, "FULL", 0, "Full", "Do a full redraw each time, slow, only use for reference or when all else fails."},
{0, NULL, 0, NULL, NULL}};

@ -180,14 +180,13 @@ static void wm_flush_regions_up(bScreen *screen, rcti *dirty)
}
}
static void wm_method_draw_overlap_all(bContext *C, wmWindow *win)
static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
{
wmWindowManager *wm= CTX_wm_manager(C);
bScreen *screen= win->screen;
ScrArea *sa;
ARegion *ar;
static rcti rect= {0, 0, 0, 0};
int exchange= (G.f & G_SWAP_EXCHANGE);
/* flush overlapping regions */
if(screen->regionbase.first) {
@ -400,7 +399,7 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win)
wm_draw_window_clear(win);
win->drawfail= 1;
wm_method_draw_overlap_all(C, win);
wm_method_draw_overlap_all(C, win, 0);
}
static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
@ -688,22 +687,23 @@ void wm_draw_update(bContext *C)
ED_screen_refresh(wm, win);
if(win->drawfail)
wm_method_draw_overlap_all(C, win);
wm_method_draw_overlap_all(C, win, 0);
else if(win->drawmethod == USER_DRAW_AUTOMATIC) {
/* ATI opensource driver is known to be very slow at this,
Windows software driver darkens color on each redraw */
if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE) ||
GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
wm_method_draw_overlap_all(C, win);
if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE))
wm_method_draw_overlap_all(C, win, 0);
else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
wm_method_draw_overlap_all(C, win, 1);
else
wm_method_draw_triple(C, win);
}
else if(win->drawmethod == USER_DRAW_FULL)
wm_method_draw_full(C, win);
else if(win->drawmethod == USER_DRAW_OVERLAP)
wm_method_draw_overlap_all(C, win);
/*else if(win->drawmethod == USER_DRAW_DAMAGE)
wm_method_draw_damage(C, win);*/
wm_method_draw_overlap_all(C, win, 0);
else if(win->drawmethod == USER_DRAW_OVERLAP_FLIP)
wm_method_draw_overlap_all(C, win, 1);
else // if(win->drawmethod == USER_DRAW_TRIPLE)
wm_method_draw_triple(C, win);

@ -372,13 +372,6 @@ static int prefsize(int argc, char **argv, void *data)
return 4;
}
static int swap_exchange(int argc, char **argv, void *data)
{
G.f |= G_SWAP_EXCHANGE;
return 0;
}
static int with_borders(int argc, char **argv, void *data)
{
/* with borders XXX OLD CRUFT!*/
@ -846,7 +839,6 @@ void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
/* second pass: custom window stuff */
BLI_argsAdd(ba, "-p", 2, prefsize, NULL);
BLI_argsAdd(ba, "-E", 2, swap_exchange, NULL);
BLI_argsAdd(ba, "-w", 2, with_borders, NULL);
BLI_argsAdd(ba, "-W", 2, without_borders, NULL);
BLI_argsAdd(ba, "-R", 2, register_extension, ba);