mesa: Remove _Active and _UseTexEnvProgram flags from fragment programs.
[mesa.git] / src / mesa / main / mtypes.h
index 71a4ca55bc44785fd4fd3663e72a9f70a936cad6..25dee52ad07e080c9b5140491348aa6d72e2f738 100644 (file)
@@ -1,15 +1,9 @@
-/**
- * \file mtypes.h
- * Main Mesa data structures.
- *
- * Please try to mark derived values with a leading underscore ('_').
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.3
+ * Version:  7.3
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  VMware, Inc.  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"),
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-
+/**
+ * \file mtypes.h
+ * Main Mesa data structures.
+ *
+ * Please try to mark derived values with a leading underscore ('_').
+ */
 
 #ifndef TYPES_H
 #define TYPES_H
@@ -641,7 +640,7 @@ struct gl_current_attrib
    GLfloat RasterColor[4];
    GLfloat RasterSecondaryColor[4];
    GLfloat RasterIndex;
-   GLfloat RasterTexCoords[MAX_TEXTURE_COORD_UNITS][4];
+   GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];
    GLboolean RasterPosValid;
    /*@}*/
 };
@@ -725,10 +724,10 @@ struct gl_enable_attrib
    GLboolean SampleCoverage;          /* GL_ARB_multisample */
    GLboolean SampleCoverageInvert;    /* GL_ARB_multisample */
    GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */
-   GLuint Texture[MAX_TEXTURE_IMAGE_UNITS];
-   GLuint TexGen[MAX_TEXTURE_COORD_UNITS];
+   GLuint Texture[MAX_TEXTURE_UNITS];
+   GLuint TexGen[MAX_TEXTURE_UNITS];
    /* SGI_texture_color_table */
-   GLboolean TextureColorTable[MAX_TEXTURE_IMAGE_UNITS];
+   GLboolean TextureColorTable[MAX_TEXTURE_UNITS];
    /* GL_ARB_vertex_program / GL_NV_vertex_program */
    GLboolean VertexProgram;
    GLboolean VertexProgramPointSize;
@@ -1071,7 +1070,7 @@ struct gl_point_attrib
    GLfloat Threshold;          /**< GL_EXT_point_parameters */
    GLboolean _Attenuated;      /**< True if Params != [1, 0, 0] */
    GLboolean PointSprite;      /**< GL_NV/ARB_point_sprite */
-   GLboolean CoordReplace[MAX_TEXTURE_COORD_UNITS]; /**< GL_ARB_point_sprite */
+   GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_ARB_point_sprite */
    GLenum SpriteRMode;         /**< GL_NV_point_sprite (only!) */
    GLenum SpriteOrigin;                /**< GL_ARB_point_sprite */
 };
@@ -1369,7 +1368,7 @@ struct gl_texture_image
    GLboolean IsCompressed;     /**< GL_ARB_texture_compression */
    GLuint CompressedSize;      /**< GL_ARB_texture_compression */
 
-   GLuint RowStride;           /**< == Width unless IsClientData and padded */
+   GLuint RowStride;           /**< Padded width in units of texels */
    GLuint *ImageOffsets;        /**< if 3D texture: array [Depth] of offsets to
                                      each 2D slice in 'Data', in texels */
    GLvoid *Data;               /**< Image data, accessed via FetchTexel() */
@@ -1540,17 +1539,6 @@ struct gl_texture_unit
 
    struct gl_texture_object *_Current; /**< Points to really enabled tex obj */
 
-   /** These are used for glPush/PopAttrib */
-   /*@{*/
-   struct gl_texture_object Saved1D;
-   struct gl_texture_object Saved2D;
-   struct gl_texture_object Saved3D;
-   struct gl_texture_object SavedCubeMap;
-   struct gl_texture_object SavedRect;
-   struct gl_texture_object Saved1DArray;
-   struct gl_texture_object Saved2DArray;
-   /*@}*/
-
    /** GL_SGI_texture_color_table */
    /*@{*/
    struct gl_color_table ColorTable;
@@ -1560,6 +1548,7 @@ struct gl_texture_unit
 };
 
 
+
 /**
  * Texture attribute group (GL_TEXTURE_BIT).
  */
@@ -1569,7 +1558,7 @@ struct gl_texture_attrib
     * name multitexture 
     */
    /**@{*/
-   GLuint CurrentUnit;        /**< Active texture unit */
+   GLuint CurrentUnit;   /**< Active texture unit [0, MaxTextureImageUnits-1] */
    GLbitfield _EnabledUnits;  /**< one bit set for each really-enabled unit */
    GLbitfield _EnabledCoordUnits;   /**< one bit per enabled coordinate unit */
    GLbitfield _GenFlags;            /**< for texgen */
@@ -1579,17 +1568,7 @@ struct gl_texture_attrib
 
    struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
 
-#if 0
-   struct gl_texture_object *Proxy1D;
-   struct gl_texture_object *Proxy2D;
-   struct gl_texture_object *Proxy3D;
-   struct gl_texture_object *ProxyCubeMap;
-   struct gl_texture_object *ProxyRect;
-   struct gl_texture_object *Proxy1DArray;
-   struct gl_texture_object *Proxy2DArray;
-#else
    struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS];
-#endif
 
    /** GL_EXT_shared_texture_palette */
    GLboolean SharedPalette;
@@ -1894,10 +1873,13 @@ struct gl_program
 
    GLbitfield InputsRead;     /**< Bitmask of which input regs are read */
    GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */
-   GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS];  /**< TEXTURE_x_BIT bitmask */
+   GLbitfield InputFlags[MAX_PROGRAM_INPUTS];   /**< PROG_PARAM_BIT_x flags */
+   GLbitfield OutputFlags[MAX_PROGRAM_OUTPUTS]; /**< PROG_PARAM_BIT_x flags */
+   GLbitfield TexturesUsed[MAX_TEXTURE_UNITS];  /**< TEXTURE_x_BIT bitmask */
    GLbitfield SamplersUsed;   /**< Bitfield of which samplers are used */
    GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */
 
+
    /** Named parameters, constants, etc. from program text */
    struct gl_program_parameter_list *Parameters;
    /** Numbered local parameters */
@@ -1953,7 +1935,10 @@ struct gl_fragment_program
 {
    struct gl_program Base;   /**< base class */
    GLenum FogOption;
-   GLboolean UsesKill;
+   GLboolean UsesKill;          /**< shader uses KIL instruction */
+   GLboolean UsesPointCoord;    /**< shader uses gl_PointCoord */
+   GLboolean UsesFrontFacing;   /**< shader used gl_FrontFacing */
+   GLboolean UsesFogFragCoord;  /**< shader used gl_FogFragCoord */
 };
 
 
@@ -1972,14 +1957,15 @@ struct gl_program_state
  */
 struct gl_vertex_program_state
 {
-   GLboolean Enabled;               /**< GL_VERTEX_PROGRAM_ARB/NV */
-   GLboolean _Enabled;              /**< Enabled and valid program? */
+   GLboolean Enabled;               /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */
+   GLboolean _Enabled;              /**< Enabled and _valid_ user program? */
    GLboolean PointSizeEnabled;      /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
    GLboolean TwoSideEnabled;        /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
-   struct gl_vertex_program *Current;  /**< user-bound vertex program */
+   struct gl_vertex_program *Current;  /**< User-bound vertex program */
 
-   /** Currently enabled and valid program (including internal programs
-    * and compiled shader programs).
+   /** Currently enabled and valid vertex program (including internal programs,
+    * user-defined vertex programs and GLSL vertex shaders).
+    * This is the program we must use when rendering.
     */
    struct gl_vertex_program *_Current;
 
@@ -2004,6 +1990,8 @@ struct gl_vertex_program_state
    GLboolean CallbackEnabled;
    GLuint CurrentPosition;
 #endif
+
+   GLboolean _Overriden;
 };
 
 
@@ -2013,12 +2001,12 @@ struct gl_vertex_program_state
 struct gl_fragment_program_state
 {
    GLboolean Enabled;     /**< User-set fragment program enable flag */
-   GLboolean _Enabled;    /**< Fragment program enabled and valid? */
-   GLboolean _Active;
+   GLboolean _Enabled;    /**< Enabled and _valid_ user program? */
    struct gl_fragment_program *Current;  /**< User-bound fragment program */
 
-   /** Currently enabled and valid program (including internal programs
-    * and compiled shader programs).
+   /** Currently enabled and valid fragment program (including internal programs,
+    * user-defined fragment programs and GLSL fragment shaders).
+    * This is the program we must use when rendering.
     */
    struct gl_fragment_program *_Current;
 
@@ -2026,7 +2014,6 @@ struct gl_fragment_program_state
 
    /** Should fixed-function texturing be implemented with a fragment prog? */
    GLboolean _MaintainTexEnvProgram;
-   GLboolean _UseTexEnvProgram;
 
    /** Program to emulate fixed-function texture env/combine (see above) */
    struct gl_fragment_program *_TexEnvProgram;
@@ -2143,12 +2130,14 @@ struct gl_shader_program
    GLuint NumShaders;          /**< number of attached shaders */
    struct gl_shader **Shaders; /**< List of attached the shaders */
 
+   /** User-defined attribute bindings (glBindAttribLocation) */
+   struct gl_program_parameter_list *Attributes;
+
    /* post-link info: */
    struct gl_vertex_program *VertexProgram;     /**< Linked vertex program */
    struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
    struct gl_uniform_list *Uniforms;
    struct gl_program_parameter_list *Varying;
-   struct gl_program_parameter_list *Attributes; /**< Vertex attributes */
    GLboolean LinkStatus;   /**< GL_LINK_STATUS */
    GLboolean Validated;
    GLchar *InfoLog;
@@ -2421,13 +2410,11 @@ struct gl_framebuffer
    GLenum ColorDrawBuffer[MAX_DRAW_BUFFERS];
    GLenum ColorReadBuffer;
 
-   /* These are computed from ColorDrawBuffer and ColorReadBuffer */
-   GLbitfield _ColorDrawBufferMask[MAX_DRAW_BUFFERS]; /* Mask of BUFFER_BIT_* flags */
+   /** Computed from ColorDraw/ReadBuffer above */
+   GLuint _NumColorDrawBuffers;
+   GLint _ColorDrawBufferIndexes[MAX_DRAW_BUFFERS]; /**< BUFFER_x or -1 */
    GLint _ColorReadBufferIndex; /* -1 = None */
-
-   /* These are computed from _ColorDrawBufferMask and _ColorReadBufferIndex */
-   GLuint _NumColorDrawBuffers[MAX_DRAW_BUFFERS];
-   struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4];
+   struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS];
    struct gl_renderbuffer *_ColorReadBuffer;
 
    /** The Actual depth/stencil buffers to use.  May be wrappers around the
@@ -2483,9 +2470,9 @@ struct gl_constants
    GLint MaxTextureRectSize;            /* GL_NV_texture_rectangle */
    GLuint MaxTextureCoordUnits;
    GLuint MaxTextureImageUnits;
-   GLuint MaxTextureUnits;              /* = MIN(CoordUnits, ImageUnits) */
-   GLfloat MaxTextureMaxAnisotropy;    /* GL_EXT_texture_filter_anisotropic */
-   GLfloat MaxTextureLodBias;           /* GL_EXT_texture_lod_bias */
+   GLuint MaxTextureUnits;              /**< = MIN(CoordUnits, ImageUnits) */
+   GLfloat MaxTextureMaxAnisotropy;     /**< GL_EXT_texture_filter_anisotropic */
+   GLfloat MaxTextureLodBias;           /**< GL_EXT_texture_lod_bias */
    GLuint MaxArrayLockSize;
    GLint SubPixelBits;
    GLfloat MinPointSize, MaxPointSize;         /* aliased */
@@ -2645,7 +2632,6 @@ struct gl_extensions
    GLboolean SGIS_generate_mipmap;
    GLboolean SGIS_texture_edge_clamp;
    GLboolean SGIS_texture_lod;
-   GLboolean SGIX_depth_texture;
    GLboolean SGIX_shadow;
    GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
    GLboolean TDFX_texture_compression_FXT1;
@@ -2739,6 +2725,7 @@ struct gl_matrix_stack
 #define _NEW_MULTISAMPLE        0x2000000  /**< __GLcontextRec::Multisample */
 #define _NEW_TRACK_MATRIX       0x4000000  /**< __GLcontextRec::VertexProgram */
 #define _NEW_PROGRAM            0x8000000  /**< __GLcontextRec::VertexProgram */
+#define _NEW_CURRENT_ATTRIB     0x10000000  /**< __GLcontextRec::Current */
 #define _NEW_ALL ~0
 /*@}*/
 
@@ -2894,7 +2881,6 @@ struct mesa_display_list
  */
 struct gl_dlist_state
 {
-   struct mesa_display_list *CallStack[MAX_LIST_NESTING];
    GLuint CallDepth;           /**< Current recursion calling depth */
 
    struct mesa_display_list *CurrentList;
@@ -2962,7 +2948,7 @@ struct __GLcontextRec
    struct gl_matrix_stack ModelviewMatrixStack;
    struct gl_matrix_stack ProjectionMatrixStack;
    struct gl_matrix_stack ColorMatrixStack;
-   struct gl_matrix_stack TextureMatrixStack[MAX_TEXTURE_COORD_UNITS];
+   struct gl_matrix_stack TextureMatrixStack[MAX_TEXTURE_UNITS];
    struct gl_matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES];
    struct gl_matrix_stack *CurrentStack; /**< Points to one of the above stacks */
    /*@}*/
@@ -3067,9 +3053,14 @@ struct __GLcontextRec
    GLenum RenderMode;        /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
    GLbitfield NewState;      /**< bitwise-or of _NEW_* flags */
 
+   GLbitfield varying_vp_inputs;  /**< mask of VERT_BIT_* flags */
+
    /** \name Derived state */
    /*@{*/
-   GLbitfield _TriangleCaps;      /**< bitwise-or of DD_* flags */
+   /** Bitwise-or of DD_* flags.  Note that this bitfield may be used before
+    * state validation so they need to always be current.
+    */
+   GLbitfield _TriangleCaps;
    GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */
    GLfloat _EyeZDir[3];
    GLfloat _ModelViewInvScale;
@@ -3085,12 +3076,6 @@ struct __GLcontextRec
 
    struct gl_list_extensions ListExt; /**< driver dlist extensions */
 
-
-   GLuint _Facing; /**< This is a hack for 2-sided stencil test.
-                   *
-                   * We don't have a better way to communicate this value from
-                   * swrast_setup to swrast. */
-
    /** \name For debugging/development only */
    /*@{*/
    GLboolean FirstTimeCurrent;
@@ -3152,7 +3137,9 @@ enum _verbose
    VERBOSE_LIGHTING            = 0x0200,
    VERBOSE_PRIMS               = 0x0400,
    VERBOSE_VERTS               = 0x0800,
-   VERBOSE_DISASSEM            = 0x1000
+   VERBOSE_DISASSEM            = 0x1000,
+   VERBOSE_GLSL                        = 0x2000,
+   VERBOSE_GLSL_DUMP           = 0x4000
 };