replace color table FloatTable boolean with Type enum
[mesa.git] / src / mesa / main / dd.h
index a4aa534510ddf636a9316a31939d925437561319..f1b49b7a300e80eecef9837c24a16dc0d08a9dbe 100644 (file)
@@ -58,6 +58,9 @@ struct gl_pixelstore_attrib;
  *
  * Vertex transformation/clipping/lighting is patched into the T&L module.
  * Rasterization functions are patched into the swrast module.
+ *
+ * Note: when new functions are added here, the drivers/common/driverfuncs.c
+ * file should be updated too!!!
  */
 struct dd_function_table {
    /**
@@ -76,36 +79,6 @@ struct dd_function_table {
     */
    void (*UpdateState)( GLcontext *ctx, GLuint new_state );
 
-   /**
-    * Clear the color/depth/stencil/accum buffer(s).
-    *
-    * \param mask a bitmask of the DD_*_BIT values defined above that indicates
-    * which buffers need to be cleared.
-    * \param all if true then clear the whole buffer, else clear only the
-    * region defined by <tt>(x, y, width, height)</tt>.
-    * 
-    * This function must obey the glColorMask(), glIndexMask() and glStencilMask()
-    * settings!
-    * Software Mesa can do masked clears if the device driver can't.
-    */
-   void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
-                 GLint x, GLint y, GLint width, GLint height );
-
-   /**
-    * Specify the current buffer for writing.  
-    *
-    * Called via glDrawBuffer().  Note the driver must organize fallbacks (e.g.
-    * with swrast) if it cannot implement the requested mode.
-    */
-   void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
-
-   /**
-    * Specifies the current buffer for reading.  
-    *
-    * Called via glReadBuffer().
-    */
-   void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
-
    /**
     * Get the width and height of the named buffer/window.
     *
@@ -122,6 +95,13 @@ struct dd_function_table {
     */
    void (*ResizeBuffers)( GLframebuffer *buffer );
 
+   /**
+    * Called whenever an error is generated.  
+    *
+    * __GLcontextRec::ErrorValue contains the error value.
+    */
+   void (*Error)( GLcontext *ctx );
+
    /**
     * This is called whenever glFinish() is called.
     */
@@ -133,11 +113,19 @@ struct dd_function_table {
    void (*Flush)( GLcontext *ctx );
 
    /**
-    * Called whenever an error is generated.  
+    * Clear the color/depth/stencil/accum buffer(s).
     *
-    * __GLcontextRec::ErrorValue contains the error value.
+    * \param mask a bitmask of the DD_*_BIT values defined above that indicates
+    * which buffers need to be cleared.
+    * \param all if true then clear the whole buffer, else clear only the
+    * region defined by <tt>(x, y, width, height)</tt>.
+    * 
+    * This function must obey the glColorMask(), glIndexMask() and
+    * glStencilMask() settings!
+    * Software Mesa can do masked clears if the device driver can't.
     */
-   void (*Error)( GLcontext *ctx );
+   void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
+                 GLint x, GLint y, GLint width, GLint height );
 
 
    /**
@@ -480,6 +468,17 @@ struct dd_function_table {
                                    GLsizei imageSize, const GLvoid *data,
                                    struct gl_texture_object *texObj,
                                    struct gl_texture_image *texImage);
+   /**
+    * Called to validate a certain compressed format.
+    */
+   GLboolean (*IsCompressedFormat)( GLcontext *ctx, GLenum internalFormat );
+   /**
+    * Called to get bytes of storage needed for the given texture size and
+    * compressed format.
+    */
+   GLuint (*CompressedTextureSize)( GLcontext *ctx,
+                                    GLsizei width, GLsizei height, GLsizei depth,
+                                    GLenum format );
    /*@}*/
 
    /**
@@ -493,24 +492,18 @@ struct dd_function_table {
    void (*BindTexture)( GLcontext *ctx, GLenum target,
                         struct gl_texture_object *tObj );
 
-   /**
-    * Called when a texture object is created.
-    */
-   void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
-
    /**
     * Called to allocate a new texture object.
-    * 
-    * \note This function pointer should be initialized by drivers \e before
-    * calling _mesa_initialize_context() since context initialization involves
-    * allocating some texture objects!
+    * A new gl_texture_object should be returned.  The driver should
+    * attach to it any device-specific info it needs.
     */
    struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name,
                                                    GLenum target );
    /**
     * Called when a texture object is about to be deallocated.  
     *
-    * Driver should free anything attached to the DriverData pointers.
+    * Driver should delete the gl_texture_object object and anything
+    * hanging off of it.
     */
    void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
 
@@ -570,6 +563,29 @@ struct dd_function_table {
    /*@}*/
 
 
+   /**
+    * \name Vertex/fragment program functions
+    */
+   /*@{*/
+   /** Bind a vertex/fragment program */
+   void (*BindProgram)(GLcontext *ctx, GLenum target, struct program *prog);
+   /** Allocate a new program */
+   struct program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id);
+   /** Delete a program */
+   void (*DeleteProgram)(GLcontext *ctx, struct program *prog);   
+   /** Notify driver that a program string has been specified. */
+   void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, 
+                              struct program *prog);
+   
+
+
+   /** Query if program can be loaded onto hardware */
+   GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, 
+                               struct program *prog);
+   
+   /*@}*/
+
+
    /**
     * \name State-changing functions.
     *
@@ -585,9 +601,8 @@ struct dd_function_table {
    /** Set the blend color */
    void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
    /** Set the blend equation */
-   void (*BlendEquation)(GLcontext *ctx, GLenum mode);
+   void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA);
    /** Specify pixel arithmetic */
-   void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
    void (*BlendFuncSeparate)(GLcontext *ctx,
                              GLenum sfactorRGB, GLenum dfactorRGB,
                              GLenum sfactorA, GLenum dfactorA);
@@ -616,6 +631,8 @@ struct dd_function_table {
    void (*DepthMask)(GLcontext *ctx, GLboolean flag);
    /** Specify mapping of depth values from normalized device coordinates to window coordinates */
    void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
+   /** Specify the current buffer for writing */
+   void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
    /** Enable or disable server-side gl capabilities */
    void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state);
    /** Specify fog parameters */
@@ -645,6 +662,8 @@ struct dd_function_table {
    void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
    /** Set the polygon stippling pattern */
    void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
+   /* Specifies the current buffer for reading */
+   void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
    /** Set rasterization mode */
    void (*RenderMode)(GLcontext *ctx, GLenum mode );
    /** Define the scissor box */
@@ -697,6 +716,11 @@ struct dd_function_table {
    void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
    void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
                                GLenum type, GLsizei stride, const GLvoid *ptr);
+   void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
+   void (*UnlockArraysEXT)( GLcontext *ctx );
+   /*@}*/
+
+
    /*@}*/
 
 
@@ -808,6 +832,7 @@ struct dd_function_table {
     * these conditions.
     */
    GLuint NeedFlush;
+   GLuint SaveNeedFlush;
 
    /**
     * If inside glBegin()/glEnd(), it should ASSERT(0).  Otherwise, if
@@ -819,6 +844,14 @@ struct dd_function_table {
     * FLUSH_UPDATE_CURRENT bit, even after performing the update.
     */
    void (*FlushVertices)( GLcontext *ctx, GLuint flags );
+   void (*SaveFlushVertices)( GLcontext *ctx );
+
+   /**
+    * Give the driver the opportunity to hook in its own vtxfmt for
+    * compiling optimized display lists.  This is called on each valid
+    * glBegin() during list compilation.
+    */
+   GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode );
 
    /**
     * Notify driver that the special derived value _NeedEyeCoords has
@@ -826,6 +859,12 @@ struct dd_function_table {
     */
    void (*LightingSpaceChange)( GLcontext *ctx );
 
+   /**
+    * Let the T&L component know when the context becomes current.
+    */
+   void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
+                       GLframebuffer *readBuffer );
+
    /**
     * Called by glNewList().
     *
@@ -854,22 +893,6 @@ struct dd_function_table {
     */
    void (*EndCallList)( GLcontext *ctx );
 
-   /**
-    * Let the T&L component know when the context becomes current.
-    */
-   void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
-                       GLframebuffer *readBuffer );
-
-   /**
-    * Called by glLockArraysEXT().
-    */
-   void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
-   /**
-    * Called by UnlockArraysEXT().
-    */
-   void (*UnlockArraysEXT)( GLcontext *ctx );
-   /*@}*/
-
 };
 
 
@@ -899,12 +922,8 @@ typedef struct {
    void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */
    void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
    void (GLAPIENTRYP Color3fv)( const GLfloat * );
-   void (GLAPIENTRYP Color3ub)( GLubyte, GLubyte, GLubyte );
-   void (GLAPIENTRYP Color3ubv)( const GLubyte * );
    void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
    void (GLAPIENTRYP Color4fv)( const GLfloat * );
-   void (GLAPIENTRYP Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
-   void (GLAPIENTRYP Color4ubv)( const GLubyte * );
    void (GLAPIENTRYP EdgeFlag)( GLboolean );
    void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
    void (GLAPIENTRYP EvalCoord1f)( GLfloat );          /* NOTE */
@@ -915,8 +934,8 @@ typedef struct {
    void (GLAPIENTRYP EvalPoint2)( GLint, GLint );      /* NOTE */
    void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
    void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
-   void (GLAPIENTRYP Indexi)( GLint );
-   void (GLAPIENTRYP Indexiv)( const GLint * );
+   void (GLAPIENTRYP Indexf)( GLfloat );
+   void (GLAPIENTRYP Indexfv)( const GLfloat * );
    void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
    void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
    void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
@@ -930,8 +949,6 @@ typedef struct {
    void (GLAPIENTRYP Normal3fv)( const GLfloat * );
    void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
    void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
-   void (GLAPIENTRYP SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
-   void (GLAPIENTRYP SecondaryColor3ubvEXT)( const GLubyte * );
    void (GLAPIENTRYP TexCoord1f)( GLfloat );
    void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
    void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
@@ -947,8 +964,15 @@ typedef struct {
    void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
    void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
    void (GLAPIENTRYP CallList)( GLuint );      /* NOTE */
+   void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );    /* NOTE */
    void (GLAPIENTRYP Begin)( GLenum );
    void (GLAPIENTRYP End)( void );
+   void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
+   void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
+   void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
+   void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
+   void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
+   void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
    void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
    void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
    /*@}*/
@@ -959,10 +983,6 @@ typedef struct {
 
    /**
     * \name Array
-    *
-    * These may or may not belong here.  Heuristic: if an array is
-    * enabled, the installed vertex format should support that array and
-    * its current size natively.
     */
    /*@{*/
    void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
@@ -988,11 +1008,6 @@ typedef struct {
    void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
    /*@}*/
 
-   /**
-    * Should core try to send colors to glColor4f or glColor4chan,
-    * where it has a choice?
-    */
-   GLboolean prefer_float_colors;
 } GLvertexformat;