OSDN Git Service

mesa: add missing texture strings in tex_target_name()
[android-x86/external-mesa.git] / src / mesa / main / debug.c
index 0e73fcb..9434c1e 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
  *
  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "mtypes.h"
@@ -51,9 +51,14 @@ tex_target_name(GLenum tgt)
       { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" },
       { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" },
       { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" },
+      { GL_TEXTURE_CUBE_MAP_ARRAY, "GL_TEXTURE_CUBE_MAP_ARRAY" },
+      { GL_TEXTURE_BUFFER, "GL_TEXTURE_BUFFER" },
+      { GL_TEXTURE_2D_MULTISAMPLE, "GL_TEXTURE_2D_MULTISAMPLE" },
+      { GL_TEXTURE_2D_MULTISAMPLE_ARRAY, "GL_TEXTURE_2D_MULTISAMPLE_ARRAY" },
       { GL_TEXTURE_EXTERNAL_OES, "GL_TEXTURE_EXTERNAL_OES" }
    };
    GLuint i;
+   STATIC_ASSERT(Elements(tex_targets) == NUM_TEXTURE_TARGETS);
    for (i = 0; i < Elements(tex_targets); i++) {
       if (tex_targets[i].target == tgt)
          return tex_targets[i].name;
@@ -66,7 +71,7 @@ void
 _mesa_print_state( const char *msg, GLuint state )
 {
    _mesa_debug(NULL,
-          "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+          "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
           msg,
           state,
           (state & _NEW_MODELVIEW)       ? "ctx->ModelView, " : "",
@@ -88,7 +93,6 @@ _mesa_print_state( const char *msg, GLuint state )
           (state & _NEW_TEXTURE)         ? "ctx->Texture, " : "",
           (state & _NEW_TRANSFORM)       ? "ctx->Transform, " : "",
           (state & _NEW_VIEWPORT)        ? "ctx->Viewport, " : "",
-          (state & _NEW_PACKUNPACK)      ? "ctx->Pack/Unpack, " : "",
           (state & _NEW_ARRAY)           ? "ctx->Array, " : "",
           (state & _NEW_RENDERMODE)      ? "ctx->RenderMode, " : "",
           (state & _NEW_BUFFERS)         ? "ctx->Visual, ctx->DrawBuffer,, " : "");
@@ -96,27 +100,6 @@ _mesa_print_state( const char *msg, GLuint state )
 
 
 
-void
-_mesa_print_tri_caps( const char *name, GLuint flags )
-{
-   _mesa_debug(NULL,
-          "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s\n",
-          name,
-          flags,
-          (flags & DD_SEPARATE_SPECULAR)   ? "separate-specular, " : "",
-          (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
-          (flags & DD_TRI_UNFILLED)        ? "tri-unfilled, " : "",
-          (flags & DD_TRI_STIPPLE)         ? "tri-stipple, " : "",
-          (flags & DD_TRI_OFFSET)          ? "tri-offset, " : "",
-          (flags & DD_TRI_SMOOTH)          ? "tri-smooth, " : "",
-          (flags & DD_LINE_SMOOTH)         ? "line-smooth, " : "",
-          (flags & DD_LINE_STIPPLE)        ? "line-stipple, " : "",
-          (flags & DD_POINT_SMOOTH)        ? "point-smooth, " : "",
-          (flags & DD_POINT_ATTEN)         ? "point-atten, " : ""
-      );
-}
-
-
 /**
  * Print information about this Mesa version and build options.
  */
@@ -204,7 +187,9 @@ set_debug_flags(const char *str)
    };
    static const struct option opts[] = {
       { "silent", DEBUG_SILENT }, /* turn off debug messages */
-      { "flush", DEBUG_ALWAYS_FLUSH } /* flush after each drawing command */
+      { "flush", DEBUG_ALWAYS_FLUSH }, /* flush after each drawing command */
+      { "incomplete_tex", DEBUG_INCOMPLETE_TEXTURE },
+      { "incomplete_fbo", DEBUG_INCOMPLETE_FBO }
    };
    GLuint i;
 
@@ -281,7 +266,7 @@ write_texture_image(struct gl_texture_object *texObj,
       GLubyte *buffer;
       char s[100];
 
-      buffer = (GLubyte *) malloc(img->Width * img->Height
+      buffer = malloc(img->Width * img->Height
                                         * img->Depth * 4);
 
       store = ctx->Pack; /* save */
@@ -330,7 +315,7 @@ _mesa_write_renderbuffer_image(const struct gl_renderbuffer *rb)
       return;
    }
 
-   buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4);
+   buffer = malloc(rb->Width * rb->Height * 4);
 
    ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
                           format, type, &ctx->DefaultPacking, buffer);
@@ -464,7 +449,7 @@ _mesa_dump_color_buffer(const char *filename)
    const GLuint h = ctx->DrawBuffer->Height;
    GLubyte *buf;
 
-   buf = (GLubyte *) malloc(w * h * 4);
+   buf = malloc(w * h * 4);
 
    _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
    _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -496,8 +481,8 @@ _mesa_dump_depth_buffer(const char *filename)
    GLubyte *buf2;
    GLuint i;
 
-   buf = (GLuint *) malloc(w * h * 4);  /* 4 bpp */
-   buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
+   buf = malloc(w * h * 4);  /* 4 bpp */
+   buf2 = malloc(w * h * 3); /* 3 bpp */
 
    _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
    _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -532,8 +517,8 @@ _mesa_dump_stencil_buffer(const char *filename)
    GLubyte *buf2;
    GLuint i;
 
-   buf = (GLubyte *) malloc(w * h);  /* 1 bpp */
-   buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
+   buf = malloc(w * h);  /* 1 bpp */
+   buf2 = malloc(w * h * 3); /* 3 bpp */
 
    _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
    _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -577,7 +562,7 @@ _mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h,
    }
    else if (format == GL_RGBA && type == GL_FLOAT) {
       /* convert floats to ubyte */
-      GLubyte *buf = (GLubyte *) malloc(w * h * 4 * sizeof(GLubyte));
+      GLubyte *buf = malloc(w * h * 4 * sizeof(GLubyte));
       const GLfloat *f = (const GLfloat *) image;
       GLuint i;
       for (i = 0; i < w * h * 4; i++) {
@@ -588,7 +573,7 @@ _mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h,
    }
    else if (format == GL_RED && type == GL_FLOAT) {
       /* convert floats to ubyte */
-      GLubyte *buf = (GLubyte *) malloc(w * h * sizeof(GLubyte));
+      GLubyte *buf = malloc(w * h * sizeof(GLubyte));
       const GLfloat *f = (const GLfloat *) image;
       GLuint i;
       for (i = 0; i < w * h; i++) {