Mercurial > mplayer.hg
comparison libvo/gl_common.c @ 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 | 106a0c366002 |
comparison
equal
deleted
inserted
replaced
18578:eef0850d4a4b | 18579:fc3f25278021 |
---|---|
511 */ | 511 */ |
512 static void glSetupYUVCombiners(float uvcos, float uvsin) { | 512 static void glSetupYUVCombiners(float uvcos, float uvsin) { |
513 GLfloat ucoef[4]; | 513 GLfloat ucoef[4]; |
514 GLfloat vcoef[4]; | 514 GLfloat vcoef[4]; |
515 GLint i; | 515 GLint i; |
516 if (!CombinerInput || !CombinerOutput || | |
517 !CombinerParameterfv || !CombinerParameteri) { | |
518 mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n"); | |
519 return; | |
520 } | |
516 glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &i); | 521 glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &i); |
517 if (i < 2) | 522 if (i < 2) |
518 mp_msg(MSGT_VO, MSGL_ERR, | 523 mp_msg(MSGT_VO, MSGL_ERR, |
519 "[gl] 2 general combiners needed for YUV combiner support (found %i)\n", i); | 524 "[gl] 2 general combiners needed for YUV combiner support (found %i)\n", i); |
520 glGetIntegerv (GL_MAX_TEXTURE_UNITS, &i); | 525 glGetIntegerv (GL_MAX_TEXTURE_UNITS, &i); |
521 if (i < 3) | 526 if (i < 3) |
522 mp_msg(MSGT_VO, MSGL_ERR, | 527 mp_msg(MSGT_VO, MSGL_ERR, |
523 "[gl] 3 texture units needed for YUV combiner support (found %i)\n", i); | 528 "[gl] 3 texture units needed for YUV combiner support (found %i)\n", i); |
524 if (!CombinerInput || !CombinerOutput || | |
525 !CombinerParameterfv || !CombinerParameteri) { | |
526 mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n"); | |
527 return; | |
528 } | |
529 fillUVcoeff(ucoef, vcoef, uvcos, uvsin); | 529 fillUVcoeff(ucoef, vcoef, uvcos, uvsin); |
530 CombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef); | 530 CombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef); |
531 CombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef); | 531 CombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef); |
532 | 532 |
533 // UV first, like this green component cannot overflow | 533 // UV first, like this green component cannot overflow |
570 */ | 570 */ |
571 static void glSetupYUVCombinersATI(float uvcos, float uvsin) { | 571 static void glSetupYUVCombinersATI(float uvcos, float uvsin) { |
572 GLfloat ucoef[4]; | 572 GLfloat ucoef[4]; |
573 GLfloat vcoef[4]; | 573 GLfloat vcoef[4]; |
574 GLint i; | 574 GLint i; |
575 if (!BeginFragmentShader || !EndFragmentShader || | |
576 !SetFragmentShaderConstant || !SampleMap || | |
577 !ColorFragmentOp2 || !ColorFragmentOp3) { | |
578 mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n"); | |
579 return; | |
580 } | |
575 glGetIntegerv(GL_NUM_FRAGMENT_REGISTERS_ATI, &i); | 581 glGetIntegerv(GL_NUM_FRAGMENT_REGISTERS_ATI, &i); |
576 if (i < 3) | 582 if (i < 3) |
577 mp_msg(MSGT_VO, MSGL_ERR, | 583 mp_msg(MSGT_VO, MSGL_ERR, |
578 "[gl] 3 registers needed for YUV combiner (ATI) support (found %i)\n", i); | 584 "[gl] 3 registers needed for YUV combiner (ATI) support (found %i)\n", i); |
579 glGetIntegerv (GL_MAX_TEXTURE_UNITS, &i); | 585 glGetIntegerv (GL_MAX_TEXTURE_UNITS, &i); |
580 if (i < 3) | 586 if (i < 3) |
581 mp_msg(MSGT_VO, MSGL_ERR, | 587 mp_msg(MSGT_VO, MSGL_ERR, |
582 "[gl] 3 texture units needed for YUV combiner (ATI) support (found %i)\n", i); | 588 "[gl] 3 texture units needed for YUV combiner (ATI) support (found %i)\n", i); |
583 if (!BeginFragmentShader || !EndFragmentShader || | |
584 !SetFragmentShaderConstant || !SampleMap || | |
585 !ColorFragmentOp2 || !ColorFragmentOp3) { | |
586 mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n"); | |
587 return; | |
588 } | |
589 fillUVcoeff(ucoef, vcoef, uvcos, uvsin); | 589 fillUVcoeff(ucoef, vcoef, uvcos, uvsin); |
590 BeginFragmentShader(); | 590 BeginFragmentShader(); |
591 SetFragmentShaderConstant(GL_CON_0_ATI, ucoef); | 591 SetFragmentShaderConstant(GL_CON_0_ATI, ucoef); |
592 SetFragmentShaderConstant(GL_CON_1_ATI, vcoef); | 592 SetFragmentShaderConstant(GL_CON_1_ATI, vcoef); |
593 SampleMap(GL_REG_0_ATI, GL_TEXTURE0, GL_SWIZZLE_STR_ATI); | 593 SampleMap(GL_REG_0_ATI, GL_TEXTURE0, GL_SWIZZLE_STR_ATI); |