From 5dc258f4e8d31ba0989a811be0d82511026938d3 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 19 Dec 2009 20:48:23 +0000 Subject: Make -vo gl:customprog also work with RGB input (obviously those need to be special RGB fragment programs). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30071 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 6ddb405f36..b85b637be1 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -90,6 +90,9 @@ static int osd_color; static int use_aspect; static int use_ycbcr; +#define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE)) +#define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS) | (1 << YUV_CONVERSION_COMBINERS_ATI))) +#define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT)) static int use_yuv; static int lscale; static int cscale; @@ -492,20 +495,19 @@ static int initGl(uint32_t d_width, uint32_t d_height) { ActiveTexture(GL_TEXTURE2); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, texture_width / 2, texture_height / 2, 128); - switch (use_yuv) { - case YUV_CONVERSION_FRAGMENT_LOOKUP: - case YUV_CONVERSION_FRAGMENT_POW: - case YUV_CONVERSION_FRAGMENT: - if (!GenPrograms || !BindProgram) { - mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n"); - break; - } + ActiveTexture(GL_TEXTURE0); + BindTexture(gl_target, 0); + } + if (image_format == IMGFMT_YV12 || custom_prog) + { + if ((MASK_NOT_COMBINERS & (1 << use_yuv)) || custom_prog) { + if (!GenPrograms || !BindProgram) { + mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n"); + } else { GenPrograms(1, &fragprog); BindProgram(GL_FRAGMENT_PROGRAM, fragprog); - break; + } } - ActiveTexture(GL_TEXTURE0); - BindTexture(gl_target, 0); update_yuvconv(); } glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, @@ -670,14 +672,14 @@ static void do_render(void) { // BindTexture(GL_TEXTURE_2D, texture_id); Color3f(1,1,1); - if (image_format == IMGFMT_YV12) + if (image_format == IMGFMT_YV12 || custom_prog) glEnableYUVConversion(gl_target, yuvconvtype); glDrawTex(0, 0, image_width, image_height, 0, 0, image_width, image_height, texture_width, texture_height, use_rectangle == 1, image_format == IMGFMT_YV12, mpi_flipped ^ vo_flipped); - if (image_format == IMGFMT_YV12) + if (image_format == IMGFMT_YV12 || custom_prog) glDisableYUVConversion(gl_target, yuvconvtype); } @@ -1104,10 +1106,6 @@ static int preinit(const char *arg) return 0; } -#define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE)) -#define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS) | (1 << YUV_CONVERSION_COMBINERS_ATI))) -#define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT)) - static const struct { const char *name; int *value; -- cgit v1.2.3