vlc | branch: master | [email protected] <[email protected]> | Fri Jul 7 17:19:30 2017 +0200| [4546bd4d5dac831e99f11b4daace222ce5267473] | committer: Jean-Baptiste Kempf
vout: opengl: resize fmt to the max size the HW can handle This fixes the issue #18215 for Linux, MacOS and Windows when using OpenGL vout, as well as the issue #18214. Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4546bd4d5dac831e99f11b4daace222ce5267473 --- modules/video_output/opengl/vout_helper.c | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c index 82650b7a85..075b1c2ee8 100644 --- a/modules/video_output/opengl/vout_helper.c +++ b/modules/video_output/opengl/vout_helper.c @@ -602,6 +602,35 @@ opengl_init_program(vout_display_opengl_t *vgl, struct prgm *prgm, return VLC_SUCCESS; } +static void +ResizeFormatToGLMaxTexSize(video_format_t *fmt, unsigned int max_tex_size) +{ + if (fmt->i_width > fmt->i_height) + { + unsigned int const vis_w = fmt->i_visible_width; + unsigned int const vis_h = fmt->i_visible_height; + unsigned int const nw_w = max_tex_size; + unsigned int const nw_vis_w = nw_w * vis_w / fmt->i_width; + + fmt->i_height = nw_w * fmt->i_height / fmt->i_width; + fmt->i_width = nw_w; + fmt->i_visible_height = nw_vis_w * vis_h / vis_w; + fmt->i_visible_width = nw_vis_w; + } + else + { + unsigned int const vis_w = fmt->i_visible_width; + unsigned int const vis_h = fmt->i_visible_height; + unsigned int const nw_h = max_tex_size; + unsigned int const nw_vis_h = nw_h * vis_h / fmt->i_height; + + fmt->i_width = nw_h * fmt->i_width / fmt->i_height; + fmt->i_height = nw_h; + fmt->i_visible_width = nw_vis_h * vis_w / vis_h; + fmt->i_visible_height = nw_vis_h; + } +} + vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, const vlc_fourcc_t **subpicture_chromas, vlc_gl_t *gl, @@ -700,6 +729,15 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, #endif #undef GET_PROC_ADDR + /* Resize the format if it is greater than the maximum texture size + * supported by the hardware */ + GLint max_tex_size; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size); + + if ((GLint)fmt->i_width > max_tex_size || + (GLint)fmt->i_height > max_tex_size) + ResizeFormatToGLMaxTexSize(fmt, max_tex_size); + #if defined(USE_OPENGL_ES2) /* OpenGL ES 2 includes support for non-power of 2 textures by specification * so checks for extensions are bound to fail. Check for OpenGL ES version instead. */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
