# HG changeset patch # User reimar # Date 1149507933 0 # Node ID fc3f252780219a0c6e0487133b3d985c8308018f # Parent eef0850d4a4bae8e397ecc3c90a2db037a5fe752 Move/add checks to avoid crashes and make error messages less confusing diff -r eef0850d4a4b -r fc3f25278021 libvo/gl_common.c --- a/libvo/gl_common.c Mon Jun 05 11:26:33 2006 +0000 +++ b/libvo/gl_common.c Mon Jun 05 11:45:33 2006 +0000 @@ -513,6 +513,11 @@ GLfloat ucoef[4]; GLfloat vcoef[4]; GLint i; + if (!CombinerInput || !CombinerOutput || + !CombinerParameterfv || !CombinerParameteri) { + mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n"); + return; + } glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &i); if (i < 2) mp_msg(MSGT_VO, MSGL_ERR, @@ -521,11 +526,6 @@ if (i < 3) mp_msg(MSGT_VO, MSGL_ERR, "[gl] 3 texture units needed for YUV combiner support (found %i)\n", i); - if (!CombinerInput || !CombinerOutput || - !CombinerParameterfv || !CombinerParameteri) { - mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n"); - return; - } fillUVcoeff(ucoef, vcoef, uvcos, uvsin); CombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef); CombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef); @@ -572,6 +572,12 @@ GLfloat ucoef[4]; GLfloat vcoef[4]; GLint i; + if (!BeginFragmentShader || !EndFragmentShader || + !SetFragmentShaderConstant || !SampleMap || + !ColorFragmentOp2 || !ColorFragmentOp3) { + mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n"); + return; + } glGetIntegerv(GL_NUM_FRAGMENT_REGISTERS_ATI, &i); if (i < 3) mp_msg(MSGT_VO, MSGL_ERR, @@ -580,12 +586,6 @@ if (i < 3) mp_msg(MSGT_VO, MSGL_ERR, "[gl] 3 texture units needed for YUV combiner (ATI) support (found %i)\n", i); - if (!BeginFragmentShader || !EndFragmentShader || - !SetFragmentShaderConstant || !SampleMap || - !ColorFragmentOp2 || !ColorFragmentOp3) { - mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n"); - return; - } fillUVcoeff(ucoef, vcoef, uvcos, uvsin); BeginFragmentShader(); SetFragmentShaderConstant(GL_CON_0_ATI, ucoef); diff -r eef0850d4a4b -r fc3f25278021 libvo/vo_gl.c --- a/libvo/vo_gl.c Mon Jun 05 11:26:33 2006 +0000 +++ b/libvo/vo_gl.c Mon Jun 05 11:45:33 2006 +0000 @@ -274,6 +274,10 @@ glBindTexture(GL_TEXTURE_2D, lookupTex); 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; + } GenPrograms(1, &fragprog); BindProgram(GL_FRAGMENT_PROGRAM, fragprog); break;