Factor out the YUV->RGB conversion auto-selection and also

enable auto-selection of ATI fragment shaders since they
should do accurate conversions now.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31006 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar
2010-04-04 16:56:30 +00:00
parent ad26195a80
commit b8a7ed8a79
4 changed files with 18 additions and 4 deletions
+14
View File
@@ -1379,6 +1379,20 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) {
free(yuv_prog);
}
/**
* \brief detect the best YUV->RGB conversion method available
*/
int glAutodetectYUVConversion(void) {
const char *extensions = mpglGetString(GL_EXTENSIONS);
if (strstr(extensions, "GL_ARB_fragment_program"))
return YUV_CONVERSION_FRAGMENT;
if (strstr(extensions, "GL_ATI_text_fragment_shader"))
return YUV_CONVERSION_TEXT_FRAGMENT;
if (strstr(extensions, "GL_ATI_fragment_shader"))
return YUV_CONVERSION_COMBINERS_ATI;
return YUV_CONVERSION_NONE;
}
/**
* \brief setup YUV->RGB conversion
* \param parms struct containing parameters like conversion and scaler type,
+1
View File
@@ -345,6 +345,7 @@ typedef struct {
float filter_strength;
} gl_conversion_params_t;
int glAutodetectYUVConversion(void);
void glSetupYUVConversion(gl_conversion_params_t *params);
void glEnableYUVConversion(GLenum target, int type);
void glDisableYUVConversion(GLenum target, int type);
+2 -1
View File
@@ -480,7 +480,8 @@ static void autodetectGlExtensions(void) {
if (ati_hack == -1) ati_hack = ati_broken_pbo;
if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0;
if (use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0;
if (use_yuv == -1) use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
if (use_yuv == -1)
use_yuv = glAutodetectYUVConversion();
if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2))
mp_msg(MSGT_VO, MSGL_WARN, "[gl] Selected scaling mode may be broken on ATI cards.\n"
"Tell _them_ to fix GL_REPEAT if you have issues.\n");
+1 -3
View File
@@ -886,7 +886,6 @@ static int preinit(const char *arg)
}
if(!init_mpglcontext(&glctx, gltype)) goto err_out;
if (use_yuv == -1) {
const char *extensions;
#ifdef CONFIG_GL_WIN32
if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1)
#else
@@ -895,8 +894,7 @@ static int preinit(const char *arg)
goto err_out;
if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
goto err_out;
extensions = mpglGetString(GL_EXTENSIONS);
use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
use_yuv = glAutodetectYUVConversion();
}
return 0;