vo_gpu_next: avoid 0x0 resizes

It is possible for vo_gpu_next to attempt a resize before the windowing
backend is fully initialized. In practice, this can happen on wayland
which means libplacebo attempts a 0x0 resize. Depending on the API, a
0x0 resize may be allowed (vulkan or d3d11), but libplacebo just returns
a 0 in this case which mpv doesn't do anything with anyway. In the case
of opengl, this usage is explictly forbidden and will result in a
warning which may confuse users. Solve this by just not trying a resize
if dwidth and dheight in the vo are not available. Fixes #10083.
This commit is contained in:
Dudemanguy 2022-04-22 15:06:20 -05:00
parent 9d133eb00b
commit 6407095871
1 changed files with 4 additions and 2 deletions

View File

@ -1021,8 +1021,10 @@ static void resize(struct vo *vo)
struct mp_rect src, dst; struct mp_rect src, dst;
struct mp_osd_res osd; struct mp_osd_res osd;
vo_get_src_dst_rects(vo, &src, &dst, &osd); vo_get_src_dst_rects(vo, &src, &dst, &osd);
gpu_ctx_resize(p->context, vo->dwidth, vo->dheight); if (vo->dwidth && vo->dheight) {
vo->want_redraw = true; gpu_ctx_resize(p->context, vo->dwidth, vo->dheight);
vo->want_redraw = true;
}
if (mp_rect_equals(&p->src, &src) && if (mp_rect_equals(&p->src, &src) &&
mp_rect_equals(&p->dst, &dst) && mp_rect_equals(&p->dst, &dst) &&