From 66be276f69d95fd5aefbaef749dda8883d337d6d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2013 19:58:32 +0200 Subject: [PATCH] gl_video: reduce output with -v, skip useless header parts Originally, the header wasn't supposed to contain random compatibility stuff, but now all that is printed with -v. Add a hack to skip it and to reduce the noise. --- video/out/gl_video.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index f24163d13f..7c6ecd426e 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -632,12 +632,15 @@ static void bind_attrib_locs(GL *gl, GLuint program) gl->BindAttribLocation(program, VERTEX_ATTRIB_TEXCOORD, "vertex_texcoord"); } +#define PRELUDE_END "// -- prelude end\n" + static GLuint create_program(GL *gl, const char *name, const char *header, const char *vertex, const char *frag) { - mp_msg(MSGT_VO, MSGL_V, "[gl] compiling shader program '%s'\n", name); - mp_msg(MSGT_VO, MSGL_V, "[gl] header:\n"); - mp_log_source(MSGT_VO, MSGL_V, header); + mp_msg(MSGT_VO, MSGL_V, "[gl] compiling shader program '%s', header:\n", name); + const char *real_header = strstr(header, PRELUDE_END); + real_header = real_header ? real_header + strlen(PRELUDE_END) : header; + mp_log_source(MSGT_VO, MSGL_V, real_header); GLuint prog = gl->CreateProgram(); prog_create_shader(gl, prog, GL_VERTEX_SHADER, header, vertex); prog_create_shader(gl, prog, GL_FRAGMENT_SHADER, header, frag); @@ -703,8 +706,8 @@ static void compile_shaders(struct gl_video *p) char *shader_prelude = get_section(tmp, src, "prelude"); char *s_video = get_section(tmp, src, "frag_video"); - char *header = talloc_asprintf(tmp, "#version %d\n%s", gl->glsl_version, - shader_prelude); + char *header = talloc_asprintf(tmp, "#version %d\n%s%s", gl->glsl_version, + shader_prelude, PRELUDE_END); // Need to pass alpha through the whole chain. (Not needed for OSD shaders.) shader_def_opt(&header, "USE_ALPHA", p->opts.enable_alpha);