Fix pow <small> and a very stypid bug with dummy srcs(0 equals to tmp0.x)</small...
[mesa.git] / src / mesa / main / mtypes.h
index 1a90583295c6906a9b31b9124f4a1198d60302ca..87e13f5e62c46d6348693273eebf6be53854d975 100644 (file)
@@ -536,6 +536,9 @@ struct gl_colorbuffer_attrib
    /*@}*/
 
    GLboolean DitherFlag;               /**< Dither enable flag */
+
+   GLenum ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
+   GLenum ClampReadColor;     /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */
 };
 
 
@@ -938,10 +941,6 @@ struct gl_pixel_attrib
    /** GL_EXT_histogram */
    GLboolean HistogramEnabled;
    GLboolean MinMaxEnabled;
-   /** GL_SGIS_pixel_texture */
-   GLboolean PixelTextureEnabled;
-   GLenum FragmentRgbSource;
-   GLenum FragmentAlphaSource;
    /** GL_SGI_color_matrix */
    GLfloat PostColorMatrixScale[4];  /**< RGBA */
    GLfloat PostColorMatrixBias[4];   /**< RGBA */
@@ -1696,7 +1695,7 @@ struct gl_evaluators
 
 
 /**
- * NV_fragment_program runtime state
+ * State used during execution of fragment programs.
  */
 struct fp_machine
 {
@@ -1706,21 +1705,6 @@ struct fp_machine
    GLuint CondCodes[4];
 };
 
-/**
- * ATI_fragment_shader runtime state
- */
-#define ATI_FS_INPUT_PRIMARY 0
-#define ATI_FS_INPUT_SECONDARY 1
-
-/* 6 register sets - 2 inputs (primary, secondary) */
-struct atifs_machine
-{
-   GLfloat Registers[6][4];
-   GLfloat PrevPassRegisters[6][4];
-   GLfloat Inputs[2][4];
-   GLuint pass;
-};
-
 
 /**
  * Names of the various vertex/fragment program register files, etc.
@@ -1745,8 +1729,6 @@ enum register_file
 
 /** Vertex and fragment instructions */
 struct prog_instruction;
-struct atifs_instruction;
-struct atifs_setupinst;
 struct program_parameter_list;
 
 
@@ -1816,22 +1798,6 @@ struct fragment_program
    GLboolean UsesKill;
 };
 
-struct ati_fragment_shader
-{
-   struct program Base;
-   struct atifs_instruction *Instructions[2];
-   struct atifs_setupinst *SetupInst[2];
-   GLfloat Constants[8][4];
-   GLuint localConstDef;
-   GLubyte numArithInstr[2];
-   GLubyte regsAssigned[2];
-   GLubyte NumPasses;
-   GLubyte cur_pass;
-   GLubyte last_optype;
-   GLboolean interpinp1;
-   GLboolean isValid;
-   GLuint swizzlerq;
-};
 
 /**
  * State common to vertex and fragment programs.
@@ -1849,7 +1815,7 @@ struct gl_program_state
 struct gl_vertex_program_state
 {
    GLboolean Enabled;                  /**< GL_VERTEX_PROGRAM_NV */
-   GLboolean _Enabled;                 /**< Really enabled? */
+   GLboolean _Enabled;                 /**< Enabled and valid program? */
    GLboolean PointSizeEnabled;         /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */
    GLboolean TwoSideEnabled;           /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */
    struct vertex_program *Current;     /**< ptr to currently bound program */
@@ -1878,13 +1844,13 @@ struct gl_vertex_program_state
 
 
 /**
- * State for GL_ARB/NV_fragment_program
+ * Context state for GL_ARB/NV_fragment_program
  */
 struct gl_fragment_program_state
 {
    GLboolean Enabled;                    /* GL_VERTEX_PROGRAM_NV */
-   GLboolean _Enabled;                   /* Really enabled? */
-   GLboolean _Active;                    /* Really really enabled? */
+   GLboolean _Enabled;                   /* Enabled and valid program? */
+   GLboolean _Active;
    struct fragment_program *Current;     /* ptr to currently bound program */
    struct fragment_program *_Current;    /* ptr to currently active program 
                                            (including internal programs) */
@@ -1901,28 +1867,75 @@ struct gl_fragment_program_state
 
 
 /**
- * State for GL_ATI_fragment_shader
+ * ATI_fragment_shader runtime state
+ */
+#define ATI_FS_INPUT_PRIMARY 0
+#define ATI_FS_INPUT_SECONDARY 1
+
+struct atifs_instruction;
+struct atifs_setupinst;
+
+/**
+ * State for executing ATI fragment shader.
+ */
+struct atifs_machine
+{
+   GLfloat Registers[6][4];         /** six temporary registers */
+   GLfloat PrevPassRegisters[6][4];
+   GLfloat Inputs[2][4];   /** Primary, secondary input colors */
+};
+
+
+/**
+ * ATI fragment shader
+ */
+struct ati_fragment_shader
+{
+   GLuint Id;
+   GLint RefCount;
+   struct atifs_instruction *Instructions[2];
+   struct atifs_setupinst *SetupInst[2];
+   GLfloat Constants[8][4];
+   GLbitfield LocalConstDef;  /** Indicates which constants have been set */
+   GLubyte numArithInstr[2];
+   GLubyte regsAssigned[2];
+   GLubyte NumPasses;         /** 1 or 2 */
+   GLubyte cur_pass;
+   GLubyte last_optype;
+   GLboolean interpinp1;
+   GLboolean isValid;
+   GLuint swizzlerq;
+};
+
+/**
+ * Context state for GL_ATI_fragment_shader
  */
 struct gl_ati_fragment_shader_state
 {
    GLboolean Enabled;
-   GLboolean _Enabled;
+   GLboolean _Enabled;                      /** enabled and valid shader? */
    GLboolean Compiling;
-   GLfloat globalConstants[8][4];
+   GLfloat GlobalConstants[8][4];
    struct atifs_machine Machine;            /* machine state */
    struct ati_fragment_shader *Current;
 };
 
 
+/**
+ * Occlusion/timer query object.
+ */
 struct gl_query_object
 {
    GLuint Id;
-   GLuint Result;      /* the counter */
+   GLuint64EXT Result; /* the counter */
    GLboolean Active;   /* inside Begin/EndQuery */
    GLboolean Ready;    /* result is ready */
 };
 
 
+/**
+ * Context state for query objects.
+ */
 struct gl_query_state
 {
    struct _mesa_HashTable *QueryObjects;
@@ -1932,86 +1945,8 @@ struct gl_query_state
 
 
 /**
- ** XXX do these gl2 structs really neeed to be here?
- **/
-
-/**
- * gl2 unique interface identifier.
- * Each gl2 interface has its own interface id used for object queries.
+ * Context state for vertex/fragment shaders.
  */
-enum gl2_uiid
-{
-   UIID_UNKNOWN,               /* supported by all objects */
-   UIID_GENERIC,               /* generic object */
-   UIID_CONTAINER,             /* contains generic objects */
-   UIID_SHADER,                        /* shader object */
-   UIID_FRAGMENT_SHADER,       /* fragment shader */
-   UIID_VERTEX_SHADER,         /* vertex shader */
-   UIID_PROGRAM,               /* program object */
-   UIID_3DLABS_SHHANDLE                /* encapsulates 3dlabs' ShHandle */
-};
-
-struct gl2_unknown_intf
-{
-   GLvoid (* AddRef) (struct gl2_unknown_intf **);
-   GLvoid (* Release) (struct gl2_unknown_intf **);
-   struct gl2_unknown_intf **(* QueryInterface) (struct gl2_unknown_intf **, enum gl2_uiid uiid);
-};
-
-struct gl2_generic_intf
-{
-   struct gl2_unknown_intf _unknown;
-   GLvoid (* Delete) (struct gl2_generic_intf **);
-   GLenum (* GetType) (struct gl2_generic_intf **);
-   GLhandleARB (* GetName) (struct gl2_generic_intf **);
-   GLboolean (* GetDeleteStatus) (struct gl2_generic_intf **);
-   const GLcharARB *(* GetInfoLog) (struct gl2_generic_intf **);
-};
-
-struct gl2_container_intf
-{
-   struct gl2_generic_intf _generic;
-   GLboolean (* Attach) (struct gl2_container_intf **, struct gl2_generic_intf **);
-   GLboolean (* Detach) (struct gl2_container_intf **, struct gl2_generic_intf **);
-   GLsizei (* GetAttachedCount) (struct gl2_container_intf **);
-   struct gl2_generic_intf **(* GetAttached) (struct gl2_container_intf **, GLuint);
-};
-
-struct gl2_shader_intf
-{
-   struct gl2_generic_intf _generic;
-   GLenum (* GetSubType) (struct gl2_shader_intf **);
-   GLboolean (* GetCompileStatus) (struct gl2_shader_intf **);
-   GLvoid (* SetSource) (struct gl2_shader_intf **, GLcharARB *, GLint *, GLsizei);
-   const GLcharARB *(* GetSource) (struct gl2_shader_intf **);
-   GLvoid (* Compile) (struct gl2_shader_intf **);
-};
-
-struct gl2_program_intf
-{
-   struct gl2_container_intf _container;
-   GLboolean (* GetLinkStatus) (struct gl2_program_intf **);
-   GLboolean (* GetValidateStatus) (struct gl2_program_intf **);
-   GLvoid (* Link) (struct gl2_program_intf **);
-   GLvoid (* Validate) (struct gl2_program_intf **);
-};
-
-struct gl2_fragment_shader_intf
-{
-   struct gl2_shader_intf _shader;
-};
-
-struct gl2_vertex_shader_intf
-{
-   struct gl2_shader_intf _shader;
-};
-
-struct gl2_3dlabs_shhandle_intf
-{
-   struct gl2_unknown_intf _unknown;
-   GLvoid *(* GetShHandle) (struct gl2_3dlabs_shhandle_intf **);
-};
-
 struct gl_shader_objects_state
 {
    struct gl2_program_intf **current_program;
@@ -2050,10 +1985,12 @@ struct gl_shared_state
 #if FEATURE_ARB_fragment_program
    struct program *DefaultFragmentProgram;
 #endif
+   /*@}*/
+
 #if FEATURE_ATI_fragment_shader
-   struct program *DefaultFragmentShader;
+   struct _mesa_HashTable *ATIShaders;
+   struct ati_fragment_shader *DefaultFragmentShader;
 #endif
-   /*@}*/
 
 #if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
    struct _mesa_HashTable *BufferObjects;
@@ -2240,6 +2177,11 @@ struct gl_framebuffer
    struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4];
    struct gl_renderbuffer *_ColorReadBuffer;
 
+   /** The Actual depth/stencil buffers to use.  May be wrappers around the
+    * depth/stencil buffers attached above. */
+   struct gl_renderbuffer *_DepthBuffer;
+   struct gl_renderbuffer *_StencilBuffer;
+
    /** Delete this framebuffer */
    void (*Delete)(struct gl_framebuffer *fb);
 };
@@ -2435,11 +2377,9 @@ struct gl_extensions
    GLboolean SGI_color_table;
    GLboolean SGI_texture_color_table;
    GLboolean SGIS_generate_mipmap;
-   GLboolean SGIS_pixel_texture;
    GLboolean SGIS_texture_edge_clamp;
    GLboolean SGIS_texture_lod;
    GLboolean SGIX_depth_texture;
-   GLboolean SGIX_pixel_texture;
    GLboolean SGIX_shadow;
    GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */
    GLboolean TDFX_texture_compression_FXT1;
@@ -2857,8 +2797,9 @@ struct __GLcontextRec
    struct fragment_program *_TexEnvProgram;     /**< Texture state as fragment program */
    struct vertex_program *_TnlProgram;          /**< Fixed func TNL state as vertex program */
 
-   GLboolean _MaintainTexEnvProgram;
    GLboolean _MaintainTnlProgram;
+   GLboolean _MaintainTexEnvProgram;
+   GLboolean _UseTexEnvProgram;
 
    struct gl_query_state Query;  /**< GL_ARB_occlusion_query */
 
@@ -2896,12 +2837,6 @@ struct __GLcontextRec
                    * We don't have a better way to communicate this value from
                    * swrast_setup to swrast. */
 
-   /** \name Color clamping (tentative part of GL_ARB_color_clamp_control) */
-   /*@{*/
-   GLboolean ClampFragmentColors;
-   GLboolean ClampVertexColors;
-   /*@}*/
-
    /** \name For debugging/development only */
    /*@{*/
    GLboolean FirstTimeCurrent;