From d079395c5d33749422e730697092f7d8e2bb3263 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Sep 2012 20:28:05 +0200 Subject: vo_opengl: always check GL errors in first 5 frames Normally, we don't want to call glGetError() all the time, because this supposedly causes slowdowns. (I could not measure any on Linux with nVidia binary drivers; maybe it's due to the fact that we have only a few, expensive calls per frame.) However, having to ask users to add the "debug" suboption when trying to diagnose problems is very annoying. Since most errors happen during initialization only, enabling it for the first 5 frames only is an interesting compromise. --- libvo/vo_opengl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libvo/vo_opengl.c b/libvo/vo_opengl.c index 2f1cc0545b..92cc489e47 100644 --- a/libvo/vo_opengl.c +++ b/libvo/vo_opengl.c @@ -234,6 +234,8 @@ struct gl_priv { struct vo_rect dst_rect; // video rectangle on output window int border_x, border_y; // OSD borders int vp_x, vp_y, vp_w, vp_h; // GL viewport + + int frames_rendered; }; struct fmt_entry { @@ -275,7 +277,7 @@ static void default_tex_params(struct GL *gl, GLenum target, GLint filter) static void debug_check_gl(struct gl_priv *p, const char *msg) { - if (p->use_gl_debug) + if (p->use_gl_debug || p->frames_rendered < 5) glCheckError(p->gl, msg); } @@ -1238,6 +1240,8 @@ static void flip_page(struct vo *vo) { gl->Clear(GL_COLOR_BUFFER_BIT); } + + p->frames_rendered++; } static int draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, -- cgit v1.2.3