Overhaul of texture image handling.
[mesa.git] / src / mesa / main / enums.c
index b1b40a95cad89e8a660a88cadfb107bf8ef89b28..5a4d871226a144443ccb3f532551363f2081ea3e 100644 (file)
@@ -1,43 +1,48 @@
-/* $Id: enums.c,v 1.3 1999/10/13 18:42:50 brianp Exp $ */
+/* $Id: enums.c,v 1.11 2001/01/17 02:49:38 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.1
- * 
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
- * 
+ * Version:  3.3
+ *
+ * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  * and/or sell copies of the Software, and to permit persons to whom the
  * Software is furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included
  * in all copies or substantial portions of the Software.
- * 
+ *
  * 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.
+ * 
+ * Author:
+ *    Keith Whitwell <keithw@valinux.com>
  */
 
 
-#include "GL/gl.h"
+#ifdef PC_HEADER
+#include "all.h"
+#else
+#include "glheader.h"
 #include "enums.h"
-#include "macros.h"
-#include <stdlib.h>
-#include <string.h>
+#include "mem.h"
+#endif
 
 
-typedef struct { 
-   const char *c; 
-   int n; 
+typedef struct {
+   const char *c;
+   int n;
 } enum_elt;
 
-enum_elt all_enums[] = 
+enum_elt all_enums[] =
 {
    /* Boolean values */
    { "GL_FALSE", 0 },
@@ -767,6 +772,12 @@ enum_elt all_enums[] =
    { "GL_CLIENT_ACTIVE_TEXTURE_ARB", 0x84E1 },
    { "GL_MAX_TEXTURE_UNITS_ARB", 0x84E2 },
 
+   { "GL_OCCLUSION_TEST_HP", 0x8165 },
+   { "GL_OCCLUSION_TEST_RESULT_HP", 0x8166 },
+
+   { "GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500 },
+   { "GL_TEXTUER_LOD_BIAS_EXT", 0x8501 },
+
    { "GL_NORMAL_MAP_NV", 0x8511 },
    { "GL_REFLECTION_MAP_NV", 0x8512 },
 
@@ -793,11 +804,38 @@ enum_elt all_enums[] =
    { "GL_NATIVE_GRAPHICS_HANDLE_PGI", 107010 },
 
    /* GL_EXT_compiled_vertex_array */
-   { "GL_ARRAY_ELEMENT_LOCK_FIRST_SGI", 0x81A8},
-   { "GL_ARRAY_ELEMENT_LOCK_COUNT_SGI", 0x81A9},
+   { "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", 0x81A8},
+   { "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", 0x81A9},
 
    /* GL_EXT_clip_volume_hint */
-   { "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0}
+   { "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0},
+
+   /* GL_EXT_texture_env_combine */
+   { "GL_COMBINE_EXT", 0x8570 },
+   { "GL_COMBINE_RGB_EXT", 0x8571 },
+   { "GL_COMBINE_ALPHA_EXT", 0x8572 },
+   { "GL_SOURCE0_RGB_EXT", 0x8580 },
+   { "GL_SOURCE1_RGB_EXT", 0x8581 },
+   { "GL_SOURCE2_RGB_EXT", 0x8582 },
+   { "GL_SOURCE0_ALPHA_EXT", 0x8588 },
+   { "GL_SOURCE1_ALPHA_EXT", 0x8589 },
+   { "GL_SOURCE2_ALPHA_EXT", 0x858A },
+   { "GL_OPERAND0_RGB_EXT", 0x8590 },
+   { "GL_OPERAND1_RGB_EXT", 0x8591 },
+   { "GL_OPERAND2_RGB_EXT", 0x8592 },
+   { "GL_OPERAND0_ALPHA_EXT", 0x8598 },
+   { "GL_OPERAND1_ALPHA_EXT", 0x8599 },
+   { "GL_OPERAND2_ALPHA_EXT", 0x859A },
+   { "GL_RGB_SCALE_EXT", 0x8573 },
+   { "GL_ADD_SIGNED_EXT", 0x8574 },
+   { "GL_INTERPOLATE_EXT", 0x8575 },
+   { "GL_CONSTANT_EXT", 0x8576 },
+   { "GL_PRIMARY_COLOR_EXT", 0x8577 },
+   { "GL_PREVIOUS_EXT", 0x8578 },
+
+   /* GL_EXT_texture_env_dot3 */
+   { "GL_DOT3_RGB_EXT", 0x8740 },
+   { "GL_DOT3_RGBA_EXT", 0x8741 },
 
 };
 
@@ -808,7 +846,7 @@ typedef int (GLWINAPIV *cfunc)(const void *, const void *);
 static enum_elt **index1 = 0;
 static int sorted = 0;
 
-static int compar_name( const enum_elt *a, const enum_elt *b ) 
+static int compar_name( const enum_elt *a, const enum_elt *b )
 {
    return strcmp(a->c, b->c);
 }
@@ -816,7 +854,7 @@ static int compar_name( const enum_elt *a, const enum_elt *b )
 
 /* note the extra level of indirection
  */
-static int compar_nr( const enum_elt **a, const enum_elt **b ) 
+static int compar_nr( const enum_elt **a, const enum_elt **b )
 {
    return (*a)->n - (*b)->n;
 }
@@ -828,10 +866,10 @@ static void sort_enums( void )
    index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) );
    sorted = 1;
 
-   qsort( all_enums, Elements(all_enums), sizeof(*all_enums), 
+   qsort( all_enums, Elements(all_enums), sizeof(*all_enums),
          (cfunc) compar_name );
 
-   for (i = 0 ; i < Elements(all_enums) ; i++) 
+   for (i = 0 ; i < Elements(all_enums) ; i++)
       index1[i] = &all_enums[i];
 
    qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr );
@@ -844,14 +882,14 @@ int gl_lookup_enum_by_name( const char *symbol )
    enum_elt tmp;
    enum_elt *e;
 
-   if (!sorted) 
+   if (!sorted)
       sort_enums();
 
-   if (!symbol) 
+   if (!symbol)
       return 0;
 
    tmp.c = symbol;
-   e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums), 
+   e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums),
                            sizeof(*all_enums), (cfunc) compar_name );
 
    return e ? e->n : -1;
@@ -862,33 +900,16 @@ const char *gl_lookup_enum_by_nr( int nr )
 {
    enum_elt tmp, *e, **f;
 
-   if (!sorted) 
+   if (!sorted)
       sort_enums();
 
    tmp.n = nr;
    e = &tmp;
 
-   f = (enum_elt **)bsearch( &e, index1, Elements(all_enums), 
+   f = (enum_elt **)bsearch( &e, index1, Elements(all_enums),
                             sizeof(*index1), (cfunc) compar_nr );
 
    return f ? (*f)->c : "(unknown)";
 }
 
 
-#if 0
-int main()
-{
-   int i;
-   static const char *test[] = {
-      "GL_POLYGON",
-      "GL_TRUE",
-      "GL_BANANA",
-      "GL_REFLECTION_MAP_NV",
-   };
-
-   for (i = 0 ; i < Elements(test) ; i++) {
-      int d = gl_lookup_enum_by_name( test[i] );
-      printf("%s --> %d --> %s\n", test[i], d, gl_lookup_enum_by_nr( d ));
-   }       
-}
-#endif