diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-21 13:34:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-21 13:35:57 +0300 |
commit | ad4dd3ebeffb34de1892d02bd372918f4866b7de (patch) | |
tree | 96d3385e052d8f6c3cf5c88e97e472857ff085ec /source/blender | |
parent | b03ee4828be1032052ee4f81f15691a56cde3415 (diff) |
Fix T64421: crash using redraw timer benchmark
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 11 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_draw.h | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 6ecbf4ef5ac..6b6a04cacad 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -917,6 +917,17 @@ void WM_draw_region_free(ARegion *ar) ar->visible = 0; } +void wm_draw_region_test(bContext *C, ScrArea *sa, ARegion *ar) +{ + /* Function for redraw timer benchmark. */ + bool use_viewport = wm_region_use_viewport(sa, ar); + wm_draw_region_buffer_create(ar, false, use_viewport); + wm_draw_region_bind(ar, 0); + ED_region_do_draw(C, ar); + wm_draw_region_unbind(ar, 0); + ar->do_draw = false; +} + void WM_redraw_windows(bContext *C) { wmWindow *win_prev = CTX_wm_window(C); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 0bb2fd58824..4a99c2de6e7 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3085,8 +3085,7 @@ static void redraw_timer_step(bContext *C, { if (type == eRTDrawRegion) { if (ar) { - ED_region_do_draw(C, ar); - ar->do_draw = false; + wm_draw_region_test(C, sa, ar); } } else if (type == eRTDrawRegionSwap) { @@ -3110,8 +3109,7 @@ static void redraw_timer_step(bContext *C, for (ar_iter = sa_iter->regionbase.first; ar_iter; ar_iter = ar_iter->next) { if (ar_iter->visible) { CTX_wm_region_set(C, ar_iter); - ED_region_do_draw(C, ar_iter); - ar_iter->do_draw = false; + wm_draw_region_test(C, sa_iter, ar_iter); } } } @@ -3156,6 +3154,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); + wmWindowManager *wm = CTX_wm_manager(C); double time_start, time_delta; const int type = RNA_enum_get(op->ptr, "type"); const int iter = RNA_int_get(op->ptr, "iterations"); @@ -3169,6 +3168,8 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) time_start = PIL_check_seconds_timer(); + wm_window_make_drawable(wm, win); + for (a = 0; a < iter; a++) { redraw_timer_step(C, bmain, scene, depsgraph, win, sa, ar, type, cfra); iter_steps += 1; diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h index ede2b3191b9..1849975d560 100644 --- a/source/blender/windowmanager/wm_draw.h +++ b/source/blender/windowmanager/wm_draw.h @@ -39,12 +39,14 @@ typedef struct wmDrawBuffer { struct ARegion; struct bContext; +struct ScrArea; struct wmWindow; /* wm_draw.c */ void wm_draw_update(struct bContext *C); void wm_draw_region_clear(struct wmWindow *win, struct ARegion *ar); void wm_draw_region_blend(struct ARegion *ar, int view, bool blend); +void wm_draw_region_test(struct bContext *C, struct ScrArea *sa, struct ARegion *ar); struct GPUTexture *wm_draw_region_texture(struct ARegion *ar, int view); |