diff options
-rw-r--r-- | libvo/gl_common.c | 109 | ||||
-rw-r--r-- | libvo/gl_common.h | 60 | ||||
-rw-r--r-- | libvo/vo_gl.c | 7 |
3 files changed, 7 insertions, 169 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 310d31f7b3..bbcbeb2f3b 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -371,14 +371,6 @@ static const extfunc_desc_t extfuncs[] = { ("glUnmapBuffer", "glUnmapBufferARB")), DEF_EXT_DESC(BufferData, NULL, ("glBufferData", "glBufferDataARB")), - DEF_EXT_DESC(CombinerParameterfv, "NV_register_combiners", - ("glCombinerParameterfv", "glCombinerParameterfvNV")), - DEF_EXT_DESC(CombinerParameteri, "NV_register_combiners", - ("glCombinerParameteri", "glCombinerParameteriNV")), - DEF_EXT_DESC(CombinerInput, "NV_register_combiners", - ("glCombinerInput", "glCombinerInputNV")), - DEF_EXT_DESC(CombinerOutput, "NV_register_combiners", - ("glCombinerOutput", "glCombinerOutputNV")), DEF_EXT_DESC(BeginFragmentShader, "ATI_fragment_shader", ("glBeginFragmentShaderATI")), DEF_EXT_DESC(EndFragmentShader, "ATI_fragment_shader", @@ -642,86 +634,6 @@ void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type, gl->TexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data); } -static void fillUVcoeff(GLfloat *ucoef, GLfloat *vcoef, - float uvcos, float uvsin) -{ - int i; - ucoef[0] = 0 * uvcos + 1.403 * uvsin; - vcoef[0] = 0 * uvsin + 1.403 * uvcos; - ucoef[1] = -0.344 * uvcos + -0.714 * uvsin; - vcoef[1] = -0.344 * uvsin + -0.714 * uvcos; - ucoef[2] = 1.770 * uvcos + 0 * uvsin; - vcoef[2] = 1.770 * uvsin + 0 * uvcos; - ucoef[3] = 0; - vcoef[3] = 0; - // Coefficients (probably) must be in [0, 1] range, whereas they originally - // are in [-2, 2] range, so here comes the trick: - // First put them in the [-0.5, 0.5] range, then add 0.5. - // This can be undone with the HALF_BIAS and SCALE_BY_FOUR arguments - // for CombinerInput and CombinerOutput (or the respective ATI variants) - for (i = 0; i < 4; i++) { - ucoef[i] = ucoef[i] * 0.25 + 0.5; - vcoef[i] = vcoef[i] * 0.25 + 0.5; - } -} - -/** - * \brief Setup register combiners for YUV to RGB conversion. - * \param uvcos used for saturation and hue adjustment - * \param uvsin used for saturation and hue adjustment - */ -static void glSetupYUVCombiners(GL *gl, float uvcos, float uvsin) -{ - GLfloat ucoef[4]; - GLfloat vcoef[4]; - GLint i; - if (!gl->CombinerInput || !gl->CombinerOutput || - !gl->CombinerParameterfv || !gl->CombinerParameteri) { - mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n"); - return; - } - gl->GetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &i); - if (i < 2) - mp_msg(MSGT_VO, MSGL_ERR, - "[gl] 2 general combiners needed for YUV combiner support (found %i)\n", i); - gl->GetIntegerv(GL_MAX_TEXTURE_UNITS, &i); - if (i < 3) - mp_msg(MSGT_VO, MSGL_ERR, - "[gl] 3 texture units needed for YUV combiner support (found %i)\n", i); - fillUVcoeff(ucoef, vcoef, uvcos, uvsin); - gl->CombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef); - gl->CombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef); - - // UV first, like this green component cannot overflow - gl->CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, - GL_TEXTURE1, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - gl->CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, - GL_CONSTANT_COLOR0_NV, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - gl->CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, - GL_TEXTURE2, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - gl->CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, - GL_CONSTANT_COLOR1_NV, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - gl->CombinerOutput(GL_COMBINER0_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, - GL_SPARE0_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, - GL_FALSE, GL_FALSE); - - // stage 2 - gl->CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV, - GL_SIGNED_IDENTITY_NV, GL_RGB); - gl->CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_ZERO, - GL_UNSIGNED_INVERT_NV, GL_RGB); - gl->CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV, - GL_TEXTURE0, GL_SIGNED_IDENTITY_NV, GL_RGB); - gl->CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV, GL_ZERO, - GL_UNSIGNED_INVERT_NV, GL_RGB); - gl->CombinerOutput(GL_COMBINER1_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, - GL_SPARE0_NV, GL_NONE, GL_NONE, GL_FALSE, - GL_FALSE, GL_FALSE); - - // leave final combiner stage in default mode - gl->CombinerParameteri(GL_NUM_GENERAL_COMBINERS_NV, 2); -} - /** * \brief Setup ATI version of register combiners for YUV to RGB conversion. * \param csp_params parameters used for colorspace conversion @@ -1386,16 +1298,11 @@ int glAutodetectYUVConversion(GL *gl) */ void glSetupYUVConversion(GL *gl, gl_conversion_params_t *params) { - float uvcos = params->csp_params.saturation * cos(params->csp_params.hue); - float uvsin = params->csp_params.saturation * sin(params->csp_params.hue); if (params->chrom_texw == 0) params->chrom_texw = 1; if (params->chrom_texh == 0) params->chrom_texh = 1; switch (YUV_CONVERSION(params->type)) { - case YUV_CONVERSION_COMBINERS: - glSetupYUVCombiners(gl, uvcos, uvsin); - break; case YUV_CONVERSION_COMBINERS_ATI: glSetupYUVFragmentATI(gl, ¶ms->csp_params, 0); break; @@ -1425,14 +1332,6 @@ void glSetupYUVConversion(GL *gl, gl_conversion_params_t *params) void glEnableYUVConversion(GL *gl, GLenum target, int type) { switch (YUV_CONVERSION(type)) { - case YUV_CONVERSION_COMBINERS: - gl->ActiveTexture(GL_TEXTURE1); - gl->Enable(target); - gl->ActiveTexture(GL_TEXTURE2); - gl->Enable(target); - gl->ActiveTexture(GL_TEXTURE0); - gl->Enable(GL_REGISTER_COMBINERS_NV); - break; case YUV_CONVERSION_COMBINERS_ATI: gl->ActiveTexture(GL_TEXTURE1); gl->Enable(target); @@ -1468,14 +1367,6 @@ void glEnableYUVConversion(GL *gl, GLenum target, int type) void glDisableYUVConversion(GL *gl, GLenum target, int type) { switch (YUV_CONVERSION(type)) { - case YUV_CONVERSION_COMBINERS: - gl->ActiveTexture(GL_TEXTURE1); - gl->Disable(target); - gl->ActiveTexture(GL_TEXTURE2); - gl->Disable(target); - gl->ActiveTexture(GL_TEXTURE0); - gl->Disable(GL_REGISTER_COMBINERS_NV); - break; case YUV_CONVERSION_COMBINERS_ATI: gl->ActiveTexture(GL_TEXTURE1); gl->Disable(target); diff --git a/libvo/gl_common.h b/libvo/gl_common.h index 6b39927783..a56248403a 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -80,57 +80,6 @@ #ifndef GL_TEXT_FRAGMENT_SHADER_ATI #define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 #endif -#ifndef GL_REGISTER_COMBINERS_NV -#define GL_REGISTER_COMBINERS_NV 0x8522 -#endif -#ifndef GL_MAX_GENERAL_COMBINERS_NV -#define GL_MAX_GENERAL_COMBINERS_NV 0x854D -#endif -#ifndef GL_NUM_GENERAL_COMBINERS_NV -#define GL_NUM_GENERAL_COMBINERS_NV 0x854E -#endif -#ifndef GL_CONSTANT_COLOR0_NV -#define GL_CONSTANT_COLOR0_NV 0x852A -#endif -#ifndef GL_CONSTANT_COLOR1_NV -#define GL_CONSTANT_COLOR1_NV 0x852B -#endif -#ifndef GL_COMBINER0_NV -#define GL_COMBINER0_NV 0x8550 -#endif -#ifndef GL_COMBINER1_NV -#define GL_COMBINER1_NV 0x8551 -#endif -#ifndef GL_VARIABLE_A_NV -#define GL_VARIABLE_A_NV 0x8523 -#endif -#ifndef GL_VARIABLE_B_NV -#define GL_VARIABLE_B_NV 0x8524 -#endif -#ifndef GL_VARIABLE_C_NV -#define GL_VARIABLE_C_NV 0x8525 -#endif -#ifndef GL_VARIABLE_D_NV -#define GL_VARIABLE_D_NV 0x8526 -#endif -#ifndef GL_UNSIGNED_INVERT_NV -#define GL_UNSIGNED_INVERT_NV 0x8537 -#endif -#ifndef GL_HALF_BIAS_NORMAL_NV -#define GL_HALF_BIAS_NORMAL_NV 0x853A -#endif -#ifndef GL_SIGNED_IDENTITY_NV -#define GL_SIGNED_IDENTITY_NV 0x853C -#endif -#ifndef GL_SCALE_BY_FOUR_NV -#define GL_SCALE_BY_FOUR_NV 0x853F -#endif -#ifndef GL_DISCARD_NV -#define GL_DISCARD_NV 0x8530 -#endif -#ifndef GL_SPARE0_NV -#define GL_SPARE0_NV 0x852E -#endif #ifndef GL_FRAGMENT_SHADER_ATI #define GL_FRAGMENT_SHADER_ATI 0x8920 #endif @@ -317,6 +266,7 @@ int loadGPUProgram(GL *gl, GLenum target, char *prog); //! do not use YUV conversion, this should always stay 0 #define YUV_CONVERSION_NONE 0 //! use nVidia specific register combiners for YUV conversion +//! implementation has been removed #define YUV_CONVERSION_COMBINERS 1 //! use a fragment program for YUV conversion #define YUV_CONVERSION_FRAGMENT 2 @@ -362,7 +312,6 @@ static inline int glYUVLargeRange(int conv) { switch (conv) { case YUV_CONVERSION_NONE: - case YUV_CONVERSION_COMBINERS: case YUV_CONVERSION_COMBINERS_ATI: case YUV_CONVERSION_FRAGMENT_LOOKUP3D: case YUV_CONVERSION_TEXT_FRAGMENT: @@ -516,13 +465,6 @@ struct GL { GLvoid * (GLAPIENTRY * MapBuffer)(GLenum, GLenum); GLboolean (GLAPIENTRY *UnmapBuffer)(GLenum); void (GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum); - void (GLAPIENTRY *CombinerParameterfv)(GLenum, const GLfloat *); - void (GLAPIENTRY *CombinerParameteri)(GLenum, GLint); - void (GLAPIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, - GLenum); - void (GLAPIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, - GLenum, GLenum, GLboolean, GLboolean, - GLboolean); void (GLAPIENTRY *BeginFragmentShader)(void); void (GLAPIENTRY *EndFragmentShader)(void); void (GLAPIENTRY *SampleMap)(GLuint, GLuint, GLenum); diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 37d9727486..1ab5af6ac3 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1264,7 +1264,7 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw, " also try to use the GL_MESA_ycbcr_texture extension\n" " yuv=<n>\n" " 0: use software YUV to RGB conversion.\n" - " 1: use register combiners (nVidia only, for older cards).\n" + " 1: deprecated, will use yuv=2 (used to be nVidia register combiners).\n" " 2: use fragment program.\n" " 3: use fragment program with gamma correction.\n" " 4: use fragment program with gamma correction via lookup.\n" @@ -1312,6 +1312,11 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw, "removed. Use --noaspect instead.\n"); return -1; } + if (p->use_yuv == 1) { + mp_msg(MSGT_VO, MSGL_WARN, "[gl] yuv=1 (nVidia register combiners) have" + " been removed, using yuv=2 instead.\n"); + p->use_yuv = 2; + } p->glctx = init_mpglcontext(gltype, vo); if (!p->glctx) goto err_out; |