1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-05 22:52:18 +00:00

Move/add checks to avoid crashes and make error messages less confusing

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18580 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2006-06-05 11:45:33 +00:00
parent a0a494e6f2
commit fbae2ba72b
2 changed files with 15 additions and 11 deletions

View File

@ -513,6 +513,11 @@ static void glSetupYUVCombiners(float uvcos, float uvsin) {
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 @@ static void glSetupYUVCombiners(float uvcos, float uvsin) {
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 @@ static void glSetupYUVCombinersATI(float uvcos, float uvsin) {
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 @@ static void glSetupYUVCombinersATI(float uvcos, float uvsin) {
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);

View File

@ -274,6 +274,10 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
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;