added incomplete() debug function/macro
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 24 Oct 2000 02:53:18 +0000 (02:53 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 24 Oct 2000 02:53:18 +0000 (02:53 +0000)
src/mesa/main/texobj.c

index 5a9b4a1c86c66f88ec464ebedc67d316d631fe54..36a63f63ac5df09b4ba890391d1b910e40eea5d8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.28 2000/10/24 01:13:58 brianp Exp $ */
+/* $Id: texobj.c,v 1.29 2000/10/24 02:53:18 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -156,6 +156,15 @@ void gl_free_texture_object( struct gl_shared_state *shared,
    FREE( t );
 }
 
+#if 0
+static void
+incomplete(const struct gl_texture_object *t, const char *why)
+{
+   printf("Texture Obj %d incomplete because: %s\n", t->Name, why);
+}
+#else
+#define incomplete(a, b)
+#endif
 
 
 /*
@@ -172,6 +181,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
 
    /* Always need level zero image */
    if (!t->Image[baseLevel]) {
+      incomplete(t, "Image[baseLevel] == NULL");
       t->Complete = GL_FALSE;
       return;
    }
@@ -215,6 +225,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
           t->NegZ[baseLevel]->Width2 != w ||
           t->NegZ[baseLevel]->Height2 != h) {
          t->Complete = GL_FALSE;
+         incomplete(t, "Non-quare cubemap image");
          return;
       }
    }
@@ -230,6 +241,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
 
       if (minLevel > maxLevel) {
          t->Complete = GL_FALSE;
+         incomplete(t, "minLevel > maxLevel");
          return;
       }
 
@@ -238,10 +250,12 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
          if (t->Image[i]) {
             if (t->Image[i]->Format != t->Image[baseLevel]->Format) {
                t->Complete = GL_FALSE;
+               incomplete(t, "Format[i] != Format[baseLevel]");
                return;
             }
             if (t->Image[i]->Border != t->Image[baseLevel]->Border) {
                t->Complete = GL_FALSE;
+               incomplete(t, "Border[i] != Border[baseLevel]");
                return;
             }
          }
@@ -258,10 +272,12 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
             if (i >= minLevel && i <= maxLevel) {
                if (!t->Image[i]) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "1D Image[i] == NULL");
                   return;
                }
                if (t->Image[i]->Width2 != width ) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "1D Image[i] bad width");
                   return;
                }
             }
@@ -284,14 +300,17 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
             if (i >= minLevel && i <= maxLevel) {
                if (!t->Image[i]) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "2D Image[i] == NULL");
                   return;
                }
                if (t->Image[i]->Width2 != width) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "2D Image[i] bad width");
                   return;
                }
                if (t->Image[i]->Height2 != height) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "2D Image[i] bad height");
                   return;
                }
                if (width==1 && height==1) {
@@ -317,19 +336,23 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
             }
             if (i >= minLevel && i <= maxLevel) {
                if (!t->Image[i]) {
+                  incomplete(t, "3D Image[i] == NULL");
                   t->Complete = GL_FALSE;
                   return;
                }
                if (t->Image[i]->Width2 != width) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "3D Image[i] bad width");
                   return;
                }
                if (t->Image[i]->Height2 != height) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "3D Image[i] bad height");
                   return;
                }
                if (t->Image[i]->Depth2 != depth) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "3D Image[i] bad depth");
                   return;
                }
             }
@@ -355,6 +378,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
                    !t->PosY[i]  || !t->NegY[i] ||
                    !t->PosZ[i]  || !t->NegZ[i]) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "CubeMap Image[i] == NULL");
                   return;
                }
                /* check that all six images have same size */
@@ -364,6 +388,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
                    t->PosZ[i]->Width2!=width || t->PosZ[i]->Height2!=height ||
                    t->NegZ[i]->Width2!=width || t->NegZ[i]->Height2!=height) {
                   t->Complete = GL_FALSE;
+                  incomplete(t, "CubeMap Image[i] bad size");
                   return;
                }
             }