WM Draw Method added to do Overlap assuming swap exchange / flipping,
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 1 Feb 2010 10:02:53 +0000 (10:02 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 1 Feb 2010 10:02:53 +0000 (10:02 +0000)
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.

source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c
source/blender/windowmanager/intern/wm_draw.c
source/creator/creator.c

index 66812ef..24d54ba 100644 (file)
@@ -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) */
 
index fc677d9..a83ff71 100644 (file)
@@ -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}};
        
index 0bbd375..9372e49 100644 (file)
@@ -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);
 
index 1e00286..6244032 100644 (file)
@@ -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);