Mercurial > mplayer.hg
comparison libvo/vo_gl.c @ 30029:0cc0965bc4c3
Make -vo gl:customprog also work with RGB input (obviously those need to be
special RGB fragment programs).
author | reimar |
---|---|
date | Sat, 19 Dec 2009 20:48:23 +0000 |
parents | b7a703cf9178 |
children | 791920428fbd |
comparison
equal
deleted
inserted
replaced
30028:9ad7756adfa8 | 30029:0cc0965bc4c3 |
---|---|
88 static int eosdtexCnt; | 88 static int eosdtexCnt; |
89 static int osd_color; | 89 static int osd_color; |
90 | 90 |
91 static int use_aspect; | 91 static int use_aspect; |
92 static int use_ycbcr; | 92 static int use_ycbcr; |
93 #define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE)) | |
94 #define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS) | (1 << YUV_CONVERSION_COMBINERS_ATI))) | |
95 #define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT)) | |
93 static int use_yuv; | 96 static int use_yuv; |
94 static int lscale; | 97 static int lscale; |
95 static int cscale; | 98 static int cscale; |
96 static float filter_strength; | 99 static float filter_strength; |
97 static int yuvconvtype; | 100 static int yuvconvtype; |
490 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, | 493 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, |
491 texture_width / 2, texture_height / 2, 128); | 494 texture_width / 2, texture_height / 2, 128); |
492 ActiveTexture(GL_TEXTURE2); | 495 ActiveTexture(GL_TEXTURE2); |
493 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, | 496 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, |
494 texture_width / 2, texture_height / 2, 128); | 497 texture_width / 2, texture_height / 2, 128); |
495 switch (use_yuv) { | 498 ActiveTexture(GL_TEXTURE0); |
496 case YUV_CONVERSION_FRAGMENT_LOOKUP: | 499 BindTexture(gl_target, 0); |
497 case YUV_CONVERSION_FRAGMENT_POW: | 500 } |
498 case YUV_CONVERSION_FRAGMENT: | 501 if (image_format == IMGFMT_YV12 || custom_prog) |
499 if (!GenPrograms || !BindProgram) { | 502 { |
500 mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n"); | 503 if ((MASK_NOT_COMBINERS & (1 << use_yuv)) || custom_prog) { |
501 break; | 504 if (!GenPrograms || !BindProgram) { |
502 } | 505 mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n"); |
506 } else { | |
503 GenPrograms(1, &fragprog); | 507 GenPrograms(1, &fragprog); |
504 BindProgram(GL_FRAGMENT_PROGRAM, fragprog); | 508 BindProgram(GL_FRAGMENT_PROGRAM, fragprog); |
505 break; | 509 } |
506 } | 510 } |
507 ActiveTexture(GL_TEXTURE0); | |
508 BindTexture(gl_target, 0); | |
509 update_yuvconv(); | 511 update_yuvconv(); |
510 } | 512 } |
511 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, | 513 glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, GL_LINEAR, |
512 texture_width, texture_height, 0); | 514 texture_width, texture_height, 0); |
513 | 515 |
668 static void do_render(void) { | 670 static void do_render(void) { |
669 // Enable(GL_TEXTURE_2D); | 671 // Enable(GL_TEXTURE_2D); |
670 // BindTexture(GL_TEXTURE_2D, texture_id); | 672 // BindTexture(GL_TEXTURE_2D, texture_id); |
671 | 673 |
672 Color3f(1,1,1); | 674 Color3f(1,1,1); |
673 if (image_format == IMGFMT_YV12) | 675 if (image_format == IMGFMT_YV12 || custom_prog) |
674 glEnableYUVConversion(gl_target, yuvconvtype); | 676 glEnableYUVConversion(gl_target, yuvconvtype); |
675 glDrawTex(0, 0, image_width, image_height, | 677 glDrawTex(0, 0, image_width, image_height, |
676 0, 0, image_width, image_height, | 678 0, 0, image_width, image_height, |
677 texture_width, texture_height, | 679 texture_width, texture_height, |
678 use_rectangle == 1, image_format == IMGFMT_YV12, | 680 use_rectangle == 1, image_format == IMGFMT_YV12, |
679 mpi_flipped ^ vo_flipped); | 681 mpi_flipped ^ vo_flipped); |
680 if (image_format == IMGFMT_YV12) | 682 if (image_format == IMGFMT_YV12 || custom_prog) |
681 glDisableYUVConversion(gl_target, yuvconvtype); | 683 glDisableYUVConversion(gl_target, yuvconvtype); |
682 } | 684 } |
683 | 685 |
684 /** | 686 /** |
685 * \param type bit 0: render OSD, bit 1: render EOSD | 687 * \param type bit 0: render OSD, bit 1: render EOSD |
1102 if (!init_mpglcontext(&glctx, gltype)) return -1; | 1104 if (!init_mpglcontext(&glctx, gltype)) return -1; |
1103 | 1105 |
1104 return 0; | 1106 return 0; |
1105 } | 1107 } |
1106 | 1108 |
1107 #define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE)) | |
1108 #define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS) | (1 << YUV_CONVERSION_COMBINERS_ATI))) | |
1109 #define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT)) | |
1110 | |
1111 static const struct { | 1109 static const struct { |
1112 const char *name; | 1110 const char *name; |
1113 int *value; | 1111 int *value; |
1114 int supportmask; | 1112 int supportmask; |
1115 } eq_map[] = { | 1113 } eq_map[] = { |