st/mesa: more format code clean-up and removal
authorBrian Paul <brianp@vmware.com>
Wed, 24 Feb 2010 18:23:58 +0000 (11:23 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 24 Feb 2010 18:23:58 +0000 (11:23 -0700)
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_format.h

index 8789d4b750a8e8e0caec05034a10c096c787aca5..c414c7da614bd5c49267a5e05041971438635e2c 100644 (file)
@@ -60,11 +60,11 @@ format_max_bits(enum pipe_format format)
 }
 
 
-/*
- * XXX temporary here
+/**
+ * Return basic GL datatype for the given gallium format.
  */
-GLboolean
-st_get_format_info(enum pipe_format format, struct st_format_info *pinfo)
+GLenum
+st_format_datatype(enum pipe_format format)
 {
    const struct util_format_description *desc;
 
@@ -72,85 +72,50 @@ st_get_format_info(enum pipe_format format, struct st_format_info *pinfo)
    assert(desc);
 
    if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN) {
-#if 0
-      printf("%s\n", util_format_name( format ) );
-#endif
-
-      /* Data type */
-      if (format == PIPE_FORMAT_A1R5G5B5_UNORM || format == PIPE_FORMAT_R5G6B5_UNORM) {
-         pinfo->datatype = GL_UNSIGNED_SHORT;
+      if (format == PIPE_FORMAT_A1R5G5B5_UNORM ||
+          format == PIPE_FORMAT_R5G6B5_UNORM) {
+         return GL_UNSIGNED_SHORT;
       }
       else if (format == PIPE_FORMAT_S8Z24_UNORM ||
                format == PIPE_FORMAT_Z24S8_UNORM) {
-         pinfo->datatype = GL_UNSIGNED_INT_24_8;
+         return GL_UNSIGNED_INT_24_8;
       }
       else {
          const GLuint size = format_max_bits(format);
          if (size == 8) {
             if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED)
-               pinfo->datatype = GL_UNSIGNED_BYTE;
+               return GL_UNSIGNED_BYTE;
             else
-               pinfo->datatype = GL_BYTE;
+               return GL_BYTE;
          }
          else if (size == 16) {
             if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED)
-               pinfo->datatype = GL_UNSIGNED_SHORT;
+               return GL_UNSIGNED_SHORT;
             else
-               pinfo->datatype = GL_SHORT;
+               return GL_SHORT;
          }
          else {
             assert( size <= 32 );
             if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED)
-               pinfo->datatype = GL_UNSIGNED_INT;
+               return GL_UNSIGNED_INT;
             else
-               pinfo->datatype = GL_INT;
+               return GL_INT;
          }
       }
-
-      pinfo->mesa_format = st_pipe_format_to_mesa_format(format);
    }
    else if (format == PIPE_FORMAT_YCBCR) {
-      pinfo->mesa_format = MESA_FORMAT_YCBCR;
-      pinfo->datatype = GL_UNSIGNED_SHORT;
+      return GL_UNSIGNED_SHORT;
    }
    else if (format == PIPE_FORMAT_YCBCR_REV) {
-      pinfo->mesa_format = MESA_FORMAT_YCBCR_REV;
-      pinfo->datatype = GL_UNSIGNED_SHORT;
+      return GL_UNSIGNED_SHORT;
    }
    else {
       /* compressed format? */
       assert(0);
    }
 
-#if 0
-   printf(
-      "ST_FORMAT: R(%u), G(%u), B(%u), A(%u), Z(%u), S(%u)\n",
-      pinfo->red_bits,
-      pinfo->green_bits,
-      pinfo->blue_bits,
-      pinfo->alpha_bits,
-      pinfo->depth_bits,
-      pinfo->stencil_bits );
-#endif
-
-   pinfo->format = format;
-
-   return GL_TRUE;
-}
-
-
-/**
- * Return basic GL datatype for the given format.
- */
-GLenum
-st_format_datatype(enum pipe_format format)
-{
-   struct st_format_info info;
-   if (!st_get_format_info( format, &info )) {
-      assert( 0 );
-      return 0;
-   }
-   return info.datatype;
+   assert(0);
+   return GL_NONE;
 }
 
 
index 721c6aeb3d814d8b6074116b1311e554a98d7d66..6cc5a15b1de4a8f464ca829d8bd2fac6ba2a99de 100644 (file)
 #include "main/formats.h"
 
 
-/**
- * Information for mapping Mesa formats to Gallium formats.
- */
-struct st_format_info
-{
-   enum pipe_format format;
-   gl_format mesa_format;
-   GLenum datatype;
-};
-
-
-GLboolean
-st_get_format_info(enum pipe_format format, struct st_format_info *pinfo);
-
-
 extern GLenum
 st_format_datatype(enum pipe_format format);