[MPlayer-cvslog] r18580 - in trunk/libvo: gl_common.c vo_gl.c

reimar subversion at mplayerhq.hu
Mon Jun 5 13:45:33 CEST 2006


Author: reimar
Date: Mon Jun  5 13:45:33 2006
New Revision: 18580

Modified:
   trunk/libvo/gl_common.c
   trunk/libvo/vo_gl.c

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


Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	(original)
+++ trunk/libvo/gl_common.c	Mon Jun  5 13:45:33 2006
@@ -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);

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	(original)
+++ trunk/libvo/vo_gl.c	Mon Jun  5 13:45:33 2006
@@ -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;



More information about the MPlayer-cvslog mailing list