Mercurial > mplayer.hg
changeset 18579:fc3f25278021
Move/add checks to avoid crashes and make error messages less confusing
author | reimar |
---|---|
date | Mon, 05 Jun 2006 11:45:33 +0000 |
parents | eef0850d4a4b |
children | d444160ee47c |
files | libvo/gl_common.c libvo/vo_gl.c |
diffstat | 2 files changed, 15 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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;