Some initial RGB and RGBA floating point texture formats.
[mesa.git] / src / mesa / main / mtypes.h
index 23ff3548c24e61ae4613679d6830f819583c08d7..815f352701fcf92f937230c2305ea10fdda7b9dd 100644 (file)
@@ -7,9 +7,9 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.1
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2004  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"),
@@ -447,22 +447,22 @@ struct gl_current_attrib {
    /*@{*/
    GLfloat Attrib[VERT_ATTRIB_MAX][4];         /**< Current vertex attributes
                                                  *  indexed by VERT_ATTRIB_* */
-   GLuint Index;                               /**< Current color index */
+   GLfloat Index;                              /**< Current color index */
    GLboolean EdgeFlag;                         /**< Current edge flag */
    /*@}*/
 
    /**
     * \name Values are always valid.  
     * 
-    * \note BTW, note how similar this set of attributes is to the SWvertex data type
-    * in the software rasterizer...
+    * \note BTW, note how similar this set of attributes is to the SWvertex
+    * data type in the software rasterizer...
     */
    /*@{*/
    GLfloat RasterPos[4];                       /**< Current raster position */
    GLfloat RasterDistance;                     /**< Current raster distance */
    GLfloat RasterColor[4];                     /**< Current raster color */
    GLfloat RasterSecondaryColor[4];             /**< Current raster secondary color */
-   GLuint RasterIndex;                         /**< Current raster index */
+   GLfloat RasterIndex;                                /**< Current raster index */
    GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/**< Current raster texcoords */
    GLboolean RasterPosValid;                   /**< Raster pos valid flag */
    /*@}*/
@@ -955,20 +955,31 @@ struct gl_stencil_attrib {
 #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
 #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
 
+
 /**
- * Texel fetch function prototype.
+ * Texel fetch function prototype.  We use texel fetch functions to
+ * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
+ * texture images.  These functions help to isolate us from the gritty
+ * details of all the various texture image encodings.
  * 
  * \param texImage texture image.
  * \param col texel column.
  * \param row texel row.
- * \param img texel level.
- * \param texelOut output texel. If \p texImage is color-index, \p texelOut
- * returns <tt>GLchan[1]</tt>.  If \p texImage is depth, \p texelOut returns
- * <tt>GLfloat[1]</tt>.  Otherwise, \p texelOut returns <tt>GLchan[4]</tt>.
+ * \param img texel image level/layer.
+ * \param texelOut output texel (up to 4 GLchans)
+ */
+typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
+                                 GLint col, GLint row, GLint img,
+                                 GLchan *texelOut );
+
+/**
+ * As above, but returns floats.
+ * Used for depth component images and for upcoming signed/float
+ * texture images.
  */
-typedef void (*FetchTexelFunc)( const struct gl_texture_image *texImage,
-                                GLint col, GLint row, GLint img,
-                                GLvoid *texelOut );
+typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
+                                 GLint col, GLint row, GLint img,
+                                 GLfloat *texelOut );
 
 /**
  * Texture format record 
@@ -995,9 +1006,12 @@ struct gl_texture_format {
     * \name Texel fetch function pointers
     */
    /*@{*/
-   FetchTexelFunc FetchTexel1D;
-   FetchTexelFunc FetchTexel2D;
-   FetchTexelFunc FetchTexel3D;
+   FetchTexelFuncC FetchTexel1D;
+   FetchTexelFuncC FetchTexel2D;
+   FetchTexelFuncC FetchTexel3D;
+   FetchTexelFuncF FetchTexel1Df;
+   FetchTexelFuncF FetchTexel2Df;
+   FetchTexelFuncF FetchTexel3Df;
    /*@}*/
 };
 
@@ -1033,7 +1047,8 @@ struct gl_texture_image {
 
    const struct gl_texture_format *TexFormat;
 
-   FetchTexelFunc FetchTexel;  /**< Texel fetch function pointer */
+   FetchTexelFuncC FetchTexelc;        /**< GLchan texel fetch function pointer */
+   FetchTexelFuncF FetchTexelf;        /**< Float texel fetch function pointer */
 
    GLboolean IsCompressed;     /**< GL_ARB_texture_compression */
    GLuint CompressedSize;      /**< GL_ARB_texture_compression */
@@ -1317,7 +1332,6 @@ struct gl_array_attrib {
 
    struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];  /**< GL_NV_vertex_program */
 
-   GLint TexCoordInterleaveFactor;
    GLint ActiveTexture;                /**< Client Active Texture */
    GLuint LockFirst;            /**< GL_EXT_compiled_vertex_array */
    GLuint LockCount;            /**< GL_EXT_compiled_vertex_array */
@@ -1653,10 +1667,10 @@ struct gl_frame_buffer
 
    /** \name Software alpha planes */
    /*@{*/
-   GLvoid *FrontLeftAlpha;     /**< array [Width*Height] of GLubyte */
-   GLvoid *BackLeftAlpha;      /**< array [Width*Height] of GLubyte */
-   GLvoid *FrontRightAlpha;    /**< array [Width*Height] of GLubyte */
-   GLvoid *BackRightAlpha;     /**< array [Width*Height] of GLubyte */
+   GLchan *FrontLeftAlpha;     /**< array [Width*Height] of GLchan */
+   GLchan *BackLeftAlpha;      /**< array [Width*Height] of GLchan */
+   GLchan *FrontRightAlpha;    /**< array [Width*Height] of GLchan */
+   GLchan *BackRightAlpha;     /**< array [Width*Height] of GLchan */
    /*@}*/
 
    /** 
@@ -1872,7 +1886,7 @@ struct matrix_stack
 /**
  * \name Bits to indicate what state has changed.  
  *
- * 6 unused flags.
+ * 4 unused flags.
  */
 /*@{*/
 #define _NEW_MODELVIEW         0x1        /**< __GLcontextRec::ModelView */
@@ -1929,7 +1943,7 @@ struct matrix_stack
 #define _NEW_ARRAY_TEXCOORD_5       VERT_BIT_TEX5
 #define _NEW_ARRAY_TEXCOORD_6       VERT_BIT_TEX6
 #define _NEW_ARRAY_TEXCOORD_7       VERT_BIT_TEX7
-#define _NEW_ARRAY_ATTRIB_0         0x1  /* alias conventional arrays */
+#define _NEW_ARRAY_ATTRIB_0         0x10000  /* start at bit 16 */
 #define _NEW_ARRAY_ALL              0xffffffff
 
 
@@ -1966,7 +1980,7 @@ struct matrix_stack
  */
 /*@{*/
 #define _DD_NEW_FLATSHADE                _NEW_LIGHT
-#define _DD_NEW_SEPARATE_SPECULAR        (_NEW_LIGHT | _NEW_FOG)
+#define _DD_NEW_SEPARATE_SPECULAR        (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM)
 #define _DD_NEW_TRI_CULL_FRONT_BACK      _NEW_POLYGON
 #define _DD_NEW_TRI_LIGHT_TWOSIDE        _NEW_LIGHT
 #define _DD_NEW_TRI_UNFILLED             _NEW_POLYGON
@@ -2027,6 +2041,27 @@ struct gl_tnl_module {
    /*@}*/
 };
 
+struct mesa_list_state {
+   GLuint CallDepth;           /**< Current recursion calling depth */
+   Node *CurrentListPtr;       /**< Head of list being compiled */
+   GLuint CurrentListNum;      /**< Number of the list being compiled */
+   Node *CurrentBlock;         /**< Pointer to current block of nodes */
+   GLuint CurrentPos;          /**< Index into current block of nodes */
+   GLvertexformat ListVtxfmt;
+
+   GLubyte ActiveAttribSize[VERT_ATTRIB_MAX];
+   GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4];
+   
+   GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX];
+   GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4];
+
+   GLubyte ActiveIndex;
+   GLfloat CurrentIndex;
+   
+   GLubyte ActiveEdgeFlag;
+   GLboolean CurrentEdgeFlag;
+};
+
 
 /**
  * Mesa context
@@ -2058,9 +2093,6 @@ struct __GLcontextRec {
    struct _glapi_table *CurrentDispatch;  /**< == Save or Exec !! */
    /*@}*/
 
-   GLboolean ExecPrefersFloat; /**< What preference for color conversion? */
-   GLboolean SavePrefersFloat;
-
    GLvisual Visual;
    GLframebuffer *DrawBuffer;  /**< buffer for writing */
    GLframebuffer *ReadBuffer;  /**< buffer for reading */
@@ -2090,15 +2122,10 @@ struct __GLcontextRec {
    GLmatrix _ModelProjectMatrix;
 
    /** \name Display lists */
-   /*@{*/
-   GLuint CallDepth;           /**< Current recursion calling depth */
+   struct mesa_list_state ListState;
+
    GLboolean ExecuteFlag;      /**< Execute GL commands? */
    GLboolean CompileFlag;      /**< Compile GL commands into display list? */
-   Node *CurrentListPtr;       /**< Head of list being compiled */
-   GLuint CurrentListNum;      /**< Number of the list being compiled */
-   Node *CurrentBlock;         /**< Pointer to current block of nodes */
-   GLuint CurrentPos;          /**< Index into current block of nodes */
-   /*@}*/
 
    /** Extensions */
    struct gl_extensions Extensions;
@@ -2250,9 +2277,11 @@ extern const char *_mesa_prim_name[GL_POLYGON+4];
 #ifdef MESA_DEBUG
 extern int MESA_VERBOSE;
 extern int MESA_DEBUG_FLAGS;
+# define MESA_FUNCTION __FUNCTION__
 #else
 # define MESA_VERBOSE 0
 # define MESA_DEBUG_FLAGS 0
+# define MESA_FUNCTION "a function"
 # ifndef NDEBUG
 #  define NDEBUG
 # endif