Some initial RGB and RGBA floating point texture formats.
[mesa.git] / src / mesa / main / mtypes.h
index 2692cbb7e31f861b0f64efb6694daa72f6d3cd66..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"),
@@ -430,6 +430,7 @@ struct gl_colorbuffer_attrib {
    GLenum LogicOp;                     /**< Logic operator */
    GLboolean IndexLogicOpEnabled;      /**< Color index logic op enabled flag */
    GLboolean ColorLogicOpEnabled;      /**< RGBA logic op enabled flag */
+   GLboolean _LogicOpEnabled;          /**< RGBA logic op + EXT_blend_logic_op enabled flag */
    /*@}*/
 
    GLboolean DitherFlag;               /**< Dither enable flag */
@@ -446,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 */
    /*@}*/
@@ -954,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 
@@ -994,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;
    /*@}*/
 };
 
@@ -1032,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 */
@@ -1316,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 */
@@ -1329,6 +1344,7 @@ struct gl_array_attrib {
    struct gl_buffer_object *ArrayBufferObj;
    struct gl_buffer_object *ElementArrayBufferObj;
 #endif
+   GLuint _MaxElement;          /* Min of all enabled array's maxes */
 };
 
 
@@ -1444,7 +1460,8 @@ enum register_file
    PROGRAM_ENV_PARAM,
    PROGRAM_NAMED_PARAM,
    PROGRAM_STATE_VAR,
-   PROGRAM_WRITE_ONLY
+   PROGRAM_WRITE_ONLY,
+       PROGRAM_ADDRESS
 };
 
 
@@ -1483,6 +1500,7 @@ struct vertex_program
    GLboolean IsPositionInvariant;  /* GL_NV_vertex_program1_1 */
    GLuint InputsRead;     /* Bitmask of which input regs are read */
    GLuint OutputsWritten; /* Bitmask of which output regs are written to */
+   struct program_parameter_list *Parameters; /**< array [NumParameters] */
 };
 
 
@@ -1649,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 */
    /*@}*/
 
    /** 
@@ -1720,6 +1738,8 @@ struct gl_constants
    /* vertex or fragment program */
    GLuint MaxProgramMatrices;
    GLuint MaxProgramMatrixStackDepth;
+   /* vertex array / buffer object bounds checking */
+   GLboolean CheckArrayBounds;
 };
 
 
@@ -1809,6 +1829,7 @@ struct gl_extensions
    GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
    GLboolean TDFX_texture_compression_FXT1;
    GLboolean APPLE_client_storage;
+   GLboolean S3_s3tc;
    /*@}*/
    /* The extension string */
    const GLubyte *String;
@@ -1865,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 */
@@ -1922,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
 
 
@@ -1959,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
@@ -2020,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
@@ -2051,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 */
@@ -2083,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;
@@ -2243,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