Fix T64421: crash using redraw timer benchmark
This commit is contained in:
@@ -917,6 +917,17 @@ void WM_draw_region_free(ARegion *ar)
|
|||||||
ar->visible = 0;
|
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)
|
void WM_redraw_windows(bContext *C)
|
||||||
{
|
{
|
||||||
wmWindow *win_prev = CTX_wm_window(C);
|
wmWindow *win_prev = CTX_wm_window(C);
|
||||||
|
|||||||
@@ -3085,8 +3085,7 @@ static void redraw_timer_step(bContext *C,
|
|||||||
{
|
{
|
||||||
if (type == eRTDrawRegion) {
|
if (type == eRTDrawRegion) {
|
||||||
if (ar) {
|
if (ar) {
|
||||||
ED_region_do_draw(C, ar);
|
wm_draw_region_test(C, sa, ar);
|
||||||
ar->do_draw = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == eRTDrawRegionSwap) {
|
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) {
|
for (ar_iter = sa_iter->regionbase.first; ar_iter; ar_iter = ar_iter->next) {
|
||||||
if (ar_iter->visible) {
|
if (ar_iter->visible) {
|
||||||
CTX_wm_region_set(C, ar_iter);
|
CTX_wm_region_set(C, ar_iter);
|
||||||
ED_region_do_draw(C, ar_iter);
|
wm_draw_region_test(C, sa_iter, ar_iter);
|
||||||
ar_iter->do_draw = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3156,6 +3154,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
|
|||||||
wmWindow *win = CTX_wm_window(C);
|
wmWindow *win = CTX_wm_window(C);
|
||||||
ScrArea *sa = CTX_wm_area(C);
|
ScrArea *sa = CTX_wm_area(C);
|
||||||
ARegion *ar = CTX_wm_region(C);
|
ARegion *ar = CTX_wm_region(C);
|
||||||
|
wmWindowManager *wm = CTX_wm_manager(C);
|
||||||
double time_start, time_delta;
|
double time_start, time_delta;
|
||||||
const int type = RNA_enum_get(op->ptr, "type");
|
const int type = RNA_enum_get(op->ptr, "type");
|
||||||
const int iter = RNA_int_get(op->ptr, "iterations");
|
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();
|
time_start = PIL_check_seconds_timer();
|
||||||
|
|
||||||
|
wm_window_make_drawable(wm, win);
|
||||||
|
|
||||||
for (a = 0; a < iter; a++) {
|
for (a = 0; a < iter; a++) {
|
||||||
redraw_timer_step(C, bmain, scene, depsgraph, win, sa, ar, type, cfra);
|
redraw_timer_step(C, bmain, scene, depsgraph, win, sa, ar, type, cfra);
|
||||||
iter_steps += 1;
|
iter_steps += 1;
|
||||||
|
|||||||
@@ -39,12 +39,14 @@ typedef struct wmDrawBuffer {
|
|||||||
|
|
||||||
struct ARegion;
|
struct ARegion;
|
||||||
struct bContext;
|
struct bContext;
|
||||||
|
struct ScrArea;
|
||||||
struct wmWindow;
|
struct wmWindow;
|
||||||
|
|
||||||
/* wm_draw.c */
|
/* wm_draw.c */
|
||||||
void wm_draw_update(struct bContext *C);
|
void wm_draw_update(struct bContext *C);
|
||||||
void wm_draw_region_clear(struct wmWindow *win, struct ARegion *ar);
|
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_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);
|
struct GPUTexture *wm_draw_region_texture(struct ARegion *ar, int view);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user