mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
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.
This commit is contained in:
+5
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user