From 3394d37b4ea6876c0a4484c51ba23e6b8ed08e5a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 19 Dec 2015 11:56:19 +0100 Subject: vo_opengl: refactor how framebuffer depth is passed from backends Store the determined framebuffer depth in struct GL instead of MPGLContext. This means gl_video_set_output_depth() can be removed, and also justifies adding new fields describing framebuffer/backend properties to struct GL instead of having to add more functions just to shovel the information around. Keep in mind that mpgl_load_functions() will wipe struct GL, so the new fields must be set before calling it. --- video/out/opengl/video.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'video/out/opengl/video.c') diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index d2fb4ac38c..a96a95b5c7 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -137,7 +137,6 @@ struct gl_video { struct gl_video_opts opts; bool gl_debug; - int depth_g; int texture_16bit_depth; // actual bits available in 16 bit textures struct gl_shader_cache *sc; @@ -1703,7 +1702,7 @@ static void pass_dither(struct gl_video *p) GL *gl = p->gl; // Assume 8 bits per component if unknown. - int dst_depth = p->depth_g ? p->depth_g : 8; + int dst_depth = gl->fb_g ? gl->fb_g : 8; if (p->opts.dither_depth > 0) dst_depth = p->opts.dither_depth; @@ -2508,6 +2507,9 @@ static void init_gl(struct gl_video *p) debug_check_gl(p, "before init_gl"); + MP_VERBOSE(p, "Reported display depth: R=%d, G=%d, B=%d\n", + gl->fb_r, gl->fb_g, gl->fb_b); + gl->Disable(GL_DITHER); gl_vao_init(&p->vao, gl, sizeof(struct vertex), vertex_vao); @@ -2744,12 +2746,6 @@ void gl_video_config(struct gl_video *p, struct mp_image_params *params) gl_video_reset_surfaces(p); } -void gl_video_set_output_depth(struct gl_video *p, int r, int g, int b) -{ - MP_VERBOSE(p, "Display depth: R=%d, G=%d, B=%d\n", r, g, b); - p->depth_g = g; -} - void gl_video_set_osd_source(struct gl_video *p, struct osd_state *osd) { mpgl_osd_destroy(p->osd); -- cgit v1.2.3