head	3.21;
access;
symbols
	merge-1:3.19.2.3
	autoconf:3.19.0.4
	experimental-1:3.19.0.2
	mesa-3-1-with-kw3:3.15
	mesa-3-1-prior-to-kw3:3.14;
locks; strict;
comment	@ * @;


3.21
date	99.07.12.12.05.23;	author keithw;	state Exp;
branches;
next	3.20;

3.20
date	99.07.08.01.38.11;	author brianp;	state Exp;
branches;
next	3.19;

3.19
date	99.05.06.01.34.16;	author brianp;	state Exp;
branches
	3.19.2.1;
next	3.18;

3.18
date	99.03.31.20.18.38;	author keithw;	state Exp;
branches;
next	3.17;

3.17
date	99.03.28.20.54.23;	author brianp;	state Exp;
branches;
next	3.16;

3.16
date	99.02.26.03.21.16;	author brianp;	state Exp;
branches;
next	3.15;

3.15
date	99.02.25.14.12.30;	author keithw;	state Exp;
branches;
next	3.14;

3.14
date	99.01.22.04.26.58;	author brianp;	state Exp;
branches;
next	3.13;

3.13
date	98.11.17.02.51.35;	author brianp;	state Exp;
branches;
next	3.12;

3.12
date	98.10.31.17.06.15;	author brianp;	state Exp;
branches;
next	3.11;

3.11
date	98.08.23.22.18.18;	author brianp;	state Exp;
branches;
next	3.10;

3.10
date	98.06.07.22.19.31;	author brianp;	state Exp;
branches;
next	3.9;

3.9
date	98.04.22.00.52.42;	author brianp;	state Exp;
branches;
next	3.8;

3.8
date	98.04.01.02.59.42;	author brianp;	state Exp;
branches;
next	3.7;

3.7
date	98.03.28.03.57.39;	author brianp;	state Exp;
branches;
next	3.6;

3.6
date	98.03.10.01.28.09;	author brianp;	state Exp;
branches;
next	3.5;

3.5
date	98.02.21.01.01.07;	author brianp;	state Exp;
branches;
next	3.4;

3.4
date	98.02.15.01.32.59;	author brianp;	state Exp;
branches;
next	3.3;

3.3
date	98.02.07.14.43.35;	author brianp;	state Exp;
branches;
next	3.2;

3.2
date	98.02.01.15.23.52;	author brianp;	state Exp;
branches;
next	3.1;

3.1
date	98.01.31.23.57.23;	author brianp;	state Exp;
branches;
next	3.0;

3.0
date	98.01.31.20.49.46;	author brianp;	state Exp;
branches;
next	;

3.19.2.1
date	99.05.21.21.29.25;	author keithw;	state Exp;
branches;
next	3.19.2.2;

3.19.2.2
date	99.05.27.20.52.32;	author keithw;	state Exp;
branches;
next	3.19.2.3;

3.19.2.3
date	99.05.30.13.30.34;	author keithw;	state Exp;
branches;
next	;


desc
@device driver interface
@


3.21
log
@merge from experimental branch upto merge-1 tag
@
text
@/* $Id: dd.h,v 3.20 1999/07/08 01:38:11 brianp Exp $ */

/*
 * Mesa 3-D graphics library
 * Version:  3.1
 * 
 * Copyright (C) 1999  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"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */



#ifndef DD_INCLUDED
#define DD_INCLUDED


#include "macros.h"


struct gl_pixelstore_attrib;


struct vertex_buffer;
struct immediate;
struct gl_pipeline_stage;


/* THIS FILE ONLY INCLUDED BY types.h !!!!! */


/*
 *                      Device Driver (DD) interface
 *
 *
 * All device driver functions are accessed through pointers in the
 * dd_function_table struct (defined below) which is stored in the GLcontext
 * struct.  Since the device driver is strictly accessed trough a table of
 * function pointers we can:
 *   1. switch between a number of different device drivers at runtime.
 *   2. use optimized functions dependant on current rendering state or
 *      frame buffer configuration.
 *
 * The function pointers in the dd_function_table struct are divided into
 * two groups:  mandatory and optional.
 * Mandatory functions have to be implemented by every device driver.
 * Optional functions may or may not be implemented by the device driver.
 * The optional functions provide ways to take advantage of special hardware
 * or optimized algorithms.
 *
 * The function pointers in the dd_function_table struct are first
 * initialized in the "MakeCurrent" function.  The "MakeCurrent" function
 * is a little different in each device driver.  See the X/Mesa, GLX, or
 * OS/Mesa drivers for examples.
 *
 * Later, Mesa may call the dd_function_table's UpdateState() function.
 * This function should initialize the dd_function_table's pointers again.
 * The UpdateState() function is called whenever the core (GL) rendering
 * state is changed in a way which may effect rasterization.  For example,
 * the TriangleFunc() pointer may have to point to different functions
 * depending on whether smooth or flat shading is enabled.
 *
 * Note that the first argument to every device driver function is a
 * GLcontext *.  In turn, the GLcontext->DriverCtx pointer points to
 * the driver-specific context struct.  See the X/Mesa or OS/Mesa interface
 * for an example.
 *
 * For more information about writing a device driver see the ddsample.c
 * file and other device drivers (xmesa[123].c, osmesa.c, etc) for examples.
 *
 *
 * Look below in the dd_function_table struct definition for descriptions
 * of each device driver function.
 * 
 *
 * In the future more function pointers may be added for glReadPixels
 * glCopyPixels, etc.
 *
 *
 * Notes:
 * ------
 *   RGBA = red/green/blue/alpha
 *   CI = color index (color mapped mode)
 *   mono = all pixels have the same color or index
 *
 *   The write_ functions all take an array of mask flags which indicate
 *   whether or not the pixel should be written.  One special case exists
 *   in the write_color_span function: if the mask array is NULL, then
 *   draw all pixels.  This is an optimization used for glDrawPixels().
 *
 * IN ALL CASES:
 *      X coordinates start at 0 at the left and increase to the right
 *      Y coordinates start at 0 at the bottom and increase upward
 *
 */




/* Used by the GetParameteri device driver function */
#define DD_HAVE_HARDWARE_FOG         3





/*
 * Device Driver function table.
 */
struct dd_function_table {

   /**********************************************************************
    *** Mandatory functions:  these functions must be implemented by   ***
    *** every device driver.                                           ***
    **********************************************************************/

   const char * (*RendererString)(void);
   /*
    * Return a string which uniquely identifies this device driver.
    * The string should contain no whitespace.  Examples: "X11" "OffScreen"
    * "MSWindows" "SVGA".
    * NOTE: This function will be obsolete in favor of GetString in the future!
    */

   void (*UpdateState)( GLcontext *ctx );
   /*
    * UpdateState() is called whenver Mesa thinks the device driver should
    * update its state and/or the other pointers (such as PointsFunc,
    * LineFunc, or TriangleFunc).
    */

   void (*ClearIndex)( GLcontext *ctx, GLuint index );
   /*
    * Called whenever glClearIndex() is called.  Set the index for clearing
    * the color buffer.
    */

   void (*ClearColor)( GLcontext *ctx, GLubyte red, GLubyte green,
                                        GLubyte blue, GLubyte alpha );
   /*
    * Called whenever glClearColor() is called.  Set the color for clearing
    * the color buffer.
    */

   GLbitfield (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
                        GLint x, GLint y, GLint width, GLint height );
   /* Clear the color/depth/stencil/accum buffer(s).
    * 'mask' indicates which buffers need to be cleared.  Return a bitmask
    *    indicating which buffers weren't cleared by the driver function.
    * If 'all' is true then the clear the whole buffer, else clear the
    *    region defined by (x,y,width,height).
    */

   void (*Index)( GLcontext *ctx, GLuint index );
   /*
    * Sets current color index for drawing flat-shaded primitives.
    */

   void (*Color)( GLcontext *ctx,
                  GLubyte red, GLubyte green, GLubyte glue, GLubyte alpha );
   /*
    * Sets current color for drawing flat-shaded primitives.
    */

   GLboolean (*SetBuffer)( GLcontext *ctx, GLenum buffer );
   /*
    * Selects the color buffer(s) for reading and writing.
    * The following values must be accepted when applicable:
    *    GL_FRONT_LEFT - this buffer always exists
    *    GL_BACK_LEFT - when double buffering
    *    GL_FRONT_RIGHT - when using stereo
    *    GL_BACK_RIGHT - when using stereo and double buffering
    * The folowing values may optionally be accepted.  Return GL_TRUE
    * if accepted, GL_FALSE if not accepted.  In practice, only drivers
    * which can write to multiple color buffers at once should accept
    * these values.
    *    GL_FRONT - write to front left and front right if it exists
    *    GL_BACK - write to back left and back right if it exists
    *    GL_LEFT - write to front left and back left if it exists
    *    GL_RIGHT - write to right left and back right if they exist
    *    GL_FRONT_AND_BACK - write to all four buffers if they exist
    *    GL_NONE - disable buffer write in device driver.
    */

   void (*GetBufferSize)( GLcontext *ctx,
                          GLuint *width, GLuint *height );
   /*
    * Returns the width and height of the current color buffer.
    */


   /***
    *** Functions for writing pixels to the frame buffer:
    ***/

   void (*WriteRGBASpan)( const GLcontext *ctx,
                          GLuint n, GLint x, GLint y,
                          CONST GLubyte rgba[][4], const GLubyte mask[] );
   void (*WriteRGBSpan)( const GLcontext *ctx,
                         GLuint n, GLint x, GLint y,
                         CONST GLubyte rgb[][3], const GLubyte mask[] );
   /* Write a horizontal run of RGB[A] pixels.  The later version is only
    * used to accelerate GL_RGB, GL_UNSIGNED_BYTE glDrawPixels() calls.
    */

   void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
                              const GLubyte mask[] );
   /* Write a horizontal run of mono-RGBA pixels.
    */

   void (*WriteRGBAPixels)( const GLcontext *ctx,
                            GLuint n, const GLint x[], const GLint y[],
                            CONST GLubyte rgba[][4], const GLubyte mask[] );
   /* Write array of RGBA pixels at random locations.
    */

   void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
                                GLuint n, const GLint x[], const GLint y[],
                                const GLubyte mask[] );
   /* Write an array of mono-RGBA pixels at random locations.
    */

   void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
                          const GLuint index[], const GLubyte mask[] );
   void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
                         const GLubyte index[], const GLubyte mask[] );
   /* Write a horizontal run of CI pixels.  32 or 8bpp.
    */

   void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
                            const GLubyte mask[] );
   /* Write a horizontal run of mono-CI pixels.
    */

   void (*WriteCI32Pixels)( const GLcontext *ctx,
                            GLuint n, const GLint x[], const GLint y[],
                            const GLuint index[], const GLubyte mask[] );
   /*
    * Write a random array of CI pixels.
    */

   void (*WriteMonoCIPixels)( const GLcontext *ctx,
                              GLuint n, const GLint x[], const GLint y[],
                              const GLubyte mask[] );
   /*
    * Write a random array of mono-CI pixels.
    */


   /***
    *** Functions to read pixels from frame buffer:
    ***/

   void (*ReadCI32Span)( const GLcontext *ctx,
                         GLuint n, GLint x, GLint y, GLuint index[] );
   /* Read a horizontal run of color index pixels.
    */

   void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
                         GLubyte rgba[][4] );
   /* Read a horizontal run of RGBA pixels.
    */

   void (*ReadCI32Pixels)( const GLcontext *ctx,
                           GLuint n, const GLint x[], const GLint y[],
                           GLuint indx[], const GLubyte mask[] );
   /* Read a random array of CI pixels.
    */

   void (*ReadRGBAPixels)( const GLcontext *ctx,
                           GLuint n, const GLint x[], const GLint y[],
                           GLubyte rgba[][4], const GLubyte mask[] );
   /* Read a random array of RGBA pixels.
    */


   /**********************************************************************
    *** Optional functions:  these functions may or may not be         ***
    *** implemented by the device driver.  If the device driver        ***
    *** doesn't implement them it should never touch these pointers    ***
    *** since Mesa will either set them to NULL or point them at a     ***
    *** fall-back function.                                            ***
    **********************************************************************/

   const char * (*ExtensionString)( GLcontext *ctx );
   /* Return a space-separated list of extensions for this driver.
    * NOTE: This function will be obsolete in favor of GetString in the future!
    */

   const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
   /* Return a string as needed by glGetString().
    * NOTE: This will replace the ExtensionString and RendererString
    * functions in the future!
    */

   void (*Finish)( GLcontext *ctx );
   /*
    * Called whenever glFinish() is called.
    */

   void (*Flush)( GLcontext *ctx );
   /*
    * Called whenever glFlush() is called.
    */

   GLboolean (*IndexMask)( GLcontext *ctx, GLuint mask );
   /*
    * Implements glIndexMask() if possible, else return GL_FALSE.
    */

   GLboolean (*ColorMask)( GLcontext *ctx,
                           GLboolean rmask, GLboolean gmask,
                           GLboolean bmask, GLboolean amask );
   /*
    * Implements glColorMask() if possible, else return GL_FALSE.
    */

   GLboolean (*LogicOp)( GLcontext *ctx, GLenum op );
   /*
    * Implements glLogicOp() if possible, else return GL_FALSE.
    */

   void (*Dither)( GLcontext *ctx, GLboolean enable );
   /*
    * Enable/disable dithering.
    * NOTE: This function will be removed in the future in favor
    * of the "Enable" driver function.
    */

   void (*Error)( GLcontext *ctx );
   /*
    * Called whenever an error is generated.  ctx->ErrorValue contains
    * the error value.
    */

   void (*NearFar)( GLcontext *ctx, GLfloat nearVal, GLfloat farVal );
   /*
    * Called from glFrustum and glOrtho to tell device driver the
    * near and far clipping plane Z values.  The 3Dfx driver, for example,
    * uses this.
    */

   GLint (*GetParameteri)( const GLcontext *ctx, GLint param );
   /* Query the device driver to get an integer parameter.
    * Current parameters:
    *     DD_MAX_TEXTURE_SIZE         return maximum texture size
    *
    *     DD_MAX_TEXTURES             number of texture sets/stages, usually 1
    *
    *     DD_HAVE_HARDWARE_FOG        the driver should return 1 (0 otherwise)
    *                                 when the hardware support per fragment
    *                                 fog for free (like the Voodoo Graphics)
    *                                 so the Mesa core will start to ever use
    *                                 per fragment fog
    */


   /***
    *** For supporting hardware Z buffers:
    ***/

   void (*AllocDepthBuffer)( GLcontext *ctx );
   /*
    * Called when the depth buffer must be allocated or possibly resized.
    */

   GLuint (*DepthTestSpan)( GLcontext *ctx,
                            GLuint n, GLint x, GLint y, const GLdepth z[],
                            GLubyte mask[] );
   void (*DepthTestPixels)( GLcontext *ctx,
                            GLuint n, const GLint x[], const GLint y[],
                            const GLdepth z[], GLubyte mask[] );
   /*
    * Apply the depth buffer test to an span/array of pixels and return
    * an updated pixel mask.  This function is not used when accelerated
    * point, line, polygon functions are used.
    */

   void (*ReadDepthSpanFloat)( GLcontext *ctx,
                               GLuint n, GLint x, GLint y, GLfloat depth[]);
   void (*ReadDepthSpanInt)( GLcontext *ctx,
                             GLuint n, GLint x, GLint y, GLdepth depth[] );
   /*
    * Return depth values as integers for glReadPixels.
    * Floats should be returned in the range [0,1].
    * Ints (GLdepth) values should be in the range [0,MAXDEPTH].
    */


   /***
    *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions:
    ***/

   points_func   PointsFunc;
   line_func     LineFunc;
   triangle_func TriangleFunc;
   quad_func     QuadFunc;
   rect_func     RectFunc;    
   

   GLboolean (*DrawPixels)( GLcontext *ctx,
                            GLint x, GLint y, GLsizei width, GLsizei height,
                            GLenum format, GLenum type,
                            const struct gl_pixelstore_attrib *unpack,
                            const GLvoid *pixels );
   /* Device driver hook for optimized glDrawPixels.  'unpack' describes how
    * to unpack the source image data.
    */

   GLboolean (*Bitmap)( GLcontext *ctx,
                        GLint x, GLint y, GLsizei width, GLsizei height,
                        const struct gl_pixelstore_attrib *unpack,
                        const GLubyte *bitmap );
   /* Device driver hook for optimized glBitmap.  'unpack' describes how
    * to unpack the source image data.
    */

   void (*RenderStart)( GLcontext *ctx );
   void (*RenderFinish)( GLcontext *ctx );
    /* KW: These replace Begin and End, and have more relaxed semantics.
     * They are called prior-to and after one or more vb flush, and are
     * thus decoupled from the gl_begin/gl_end pairs, which are possibly 
     * more frequent.  If a begin/end pair covers >1 vertex buffer, these
     * are called at most once for the pair. (a bit broken at present)
     */

   void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
   /* This function, if not NULL, is called whenever new window coordinates
    * are put in the vertex buffer.  The vertices in question are those n
    * such that start <= n < end.
    * The device driver can convert the window coords to its own specialized
    * format.  The 3Dfx driver uses this.
    *
    * Note: Deprecated in favour of RegisterPipelineStages, below.
    */


   render_func *RenderVBClippedTab;
   render_func *RenderVBCulledTab;
   render_func *RenderVBRawTab;
   /* These function tables allow the device driver to rasterize an
    * entire begin/end group of primitives at once.  See the
    * gl_render_vb() function in vbrender.c for more details.  
    */


   GLuint TriangleCaps;
   /* Holds a list of the reasons why we might normally want to call
    * render_triangle, but which are in fact implemented by the
    * driver.  The FX driver sets this to DD_TRI_CULL, and will soon
    * implement DD_TRI_OFFSET.
    */


   GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
   /* Driver may request additional render passes by returning GL_TRUE
    * when this function is called.  This function will be called
    * after the first pass, and passes will be made until the function
    * returns GL_FALSE.  If no function is registered, only one pass
    * is made.  
    * 
    * This function will be first invoked with passno == 1.
    */

   /***
    *** Texture mapping functions:
    ***/

   void (*TexEnv)( GLcontext *ctx, GLenum pname, const GLfloat *param );
   /*
    * Called whenever glTexEnv*() is called.
    * Pname will be one of GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR.
    * If pname is GL_TEXTURE_ENV_MODE then param will be one
    * of GL_MODULATE, GL_BLEND, GL_DECAL, or GL_REPLACE.
    */

   void (*TexImage)( GLcontext *ctx, GLenum target,
                     struct gl_texture_object *tObj, GLint level,
                     GLint internalFormat,
                     const struct gl_texture_image *image );
   /*
    * Called whenever a texture object's image is changed.
    *    texObject is the number of the texture object being changed.
    *    level indicates the mipmap level.
    *    internalFormat is the format in which the texture is to be stored.
    *    image is a pointer to a gl_texture_image struct which contains
    *       the actual image data.
    */

   void (*TexSubImage)( GLcontext *ctx, GLenum target,
                        struct gl_texture_object *tObj, GLint level,
                        GLint xoffset, GLint yoffset,
                        GLsizei width, GLsizei height,
                        GLint internalFormat,
                        const struct gl_texture_image *image );
   /*
    * Called from glTexSubImage() to define a sub-region of a texture.
    */

   void (*TexParameter)( GLcontext *ctx, GLenum target,
                         struct gl_texture_object *tObj,
                         GLenum pname, const GLfloat *params );
   /*
    * Called whenever glTexParameter*() is called.
    *    target is GL_TEXTURE_1D or GL_TEXTURE_2D
    *    texObject is the texture object to modify
    *    pname is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER,
    *       GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_BORDER_COLOR.
    *    params is dependant on pname.  See man glTexParameter.
    */

   void (*BindTexture)( GLcontext *ctx, GLenum target,
                        struct gl_texture_object *tObj );
   /*
    * Called whenever glBindTexture() is called.  This specifies which
    * texture is to be the current one.  No dirty flags will be set.
    */

   void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
   /*
    * Called when a texture object is about to be deallocated.  Driver
    * should free anything attached to the DriverData pointers.
    */

   void (*UpdateTexturePalette)( GLcontext *ctx,
                                 struct gl_texture_object *tObj );
   /*
    * Called when the texture's color lookup table is changed.
    * If tObj is NULL then the shared texture palette ctx->Texture.Palette
    * was changed.
    */

   void (*UseGlobalTexturePalette)( GLcontext *ctx, GLboolean state );
   /*
    * Called via glEnable/Disable(GL_SHARED_TEXTURE_PALETTE_EXT)
    */

   void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
   /*
    * Called by glActiveTextureARB to set current texture unit.
    */


   /***
    *** NEW in Mesa 3.x
    ***/

   void (*RegisterVB)( struct vertex_buffer *VB );
   void (*UnregisterVB)( struct vertex_buffer *VB );
   /* Do any processing (eg allocate memory) required to set up a new
    * vertex_buffer.  
    */


   void (*ResetVB)( struct vertex_buffer *VB );
   void (*ResetCvaVB)( struct vertex_buffer *VB, GLuint stages );
   /* Do any reset operations necessary to the driver data associated
    * with these vertex buffers.
    */

   GLuint RenderVectorFlags;
   /* What do the render tables require of the vectors they deal
    * with?  
    */

   GLuint (*RegisterPipelineStages)( struct gl_pipeline_stage *out,
				     const struct gl_pipeline_stage *in,
				     GLuint nr );
   /* Register new pipeline stages, or modify existing ones.  See also
    * the OptimizePipeline() functions.
    */


   GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
   GLboolean (*BuildEltPipeline)( GLcontext *ctx );
   /* Perform the full pipeline build, or return false.
    */


   void (*OptimizePrecalcPipeline)( GLcontext *ctx, struct gl_pipeline *pipe );
   void (*OptimizeImmediatePipeline)( GLcontext *ctx, struct gl_pipeline *pipe);
   /* Check to see if a fast path exists for this combination of stages 
    * in the precalc and immediate (elt) pipelines.
    */


   /*
    * State-changing functions (drawing functions are above)
    *
    * These functions are called by their corresponding OpenGL API functions.
    * They're ALSO called by the gl_PopAttrib() function!!!
    * May add more functions like these to the device driver in the future.
    * This should reduce the amount of state checking that
    * the driver's UpdateState() function must do.
    */
   void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLclampf ref);
   void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
   void (*ClearDepth)(GLcontext *ctx, GLclampd d);
   void (*CullFace)(GLcontext *ctx, GLenum mode);
   void (*FrontFace)(GLcontext *ctx, GLenum mode);
   void (*DepthFunc)(GLcontext *ctx, GLenum func);
   void (*DepthMask)(GLcontext *ctx, GLboolean flag);
   void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
   void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
   void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
   void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
   void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
   void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
   void (*ShadeModel)(GLcontext *ctx, GLenum mode);
   void (*ClearStencil)(GLcontext *ctx, GLint s);
   void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
   void (*StencilMask)(GLcontext *ctx, GLuint mask);
   void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
   void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
};



#endif

@


3.20
log
@added ClearStencil function to device driver interface
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.19 1999/05/06 01:34:16 brianp Exp $ */
d433 2
d439 1
a439 1
     * are called at most once for the pair.
a440 2
   void (*RenderStart)( GLcontext *ctx );
   void (*RenderFinish)( GLcontext *ctx );
d448 2
d453 1
a453 6
   /* First step towards binary compatible drivers.  Still have to fix
    * *everything* else.
    */
   struct dd_extension *Extensions;


d465 2
a466 1
    * driver.  The FX driver sets this to DD_TRI_CULL.
d470 10
d563 2
a567 2
   void (*RegisterVB)( struct vertex_buffer *VB );
   void (*UnregisterVB)( struct vertex_buffer *VB );
d570 5
a574 5
   void (*CheckPartialRasterSetupCVA)( GLcontext *ctx, 
				    struct gl_pipeline_stage *d );

   void (*CheckMergeAndRenderCVA)( GLcontext *ctx,
				   struct gl_pipeline_stage *d );
d576 3
a578 3
   /* Do RasterSetup on the static part, allocating data to hold 
    * the results, if necessary.  The valid_inputs flag indicates
    * which buffers hold new, valid values.
a579 2
   void (*PartialRasterSetupCVA)( struct vertex_buffer *VB, 
				  GLuint newPos, GLuint available );
d581 5
a585 2
   /* Notifies that a precalc pipeline with no raster setup is in
    * use - ie. all cached RasterSetup results must be dropped.
a586 1
   void (*InvalidateRasterSetupCVA)( struct vertex_buffer *VB );
a587 5
   /* Merge in dynamic state from an immediate struct and render the
    * results. 
    */
   void (*MergeAndRenderCVA)( struct vertex_buffer *VB,
			      struct vertex_buffer *cvaVB );  
d589 3
a591 3
   /* Replacement for gl_render_vb_indirect.  Will ususally be
    * implemented by the same function as MergeAndRenderCVA, skipping
    * the merge part.
a592 2
   void (*RenderVBIndirect)( struct vertex_buffer *VB,
			     struct vertex_buffer *cvaVB );  
d595 4
a598 2
   /* Perform drawElements/drawRangeElements on precalculated
    * data. (Ie - no merge) 
a599 5
   void (*RenderElementsCVA)( struct vertex_buffer *cvaVB,
			      GLenum mode, 
			      GLuint *elts,
			      GLuint n );

d614 2
d623 2
@


3.19
log
@don't use variables named new
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.18 1999/03/31 20:18:38 keithw Exp $ */
d623 1
@


3.19.2.1
log
@Quake3 inspired optimizations
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.19 1999/05/06 01:34:16 brianp Exp $ */
a432 2
   void (*RenderStart)( GLcontext *ctx );
   void (*RenderFinish)( GLcontext *ctx );
d437 1
a437 1
     * are called at most once for the pair. (a bit broken at present)
d439 2
a447 2
    *
    * Note: Deprecated in favour of RegisterPipelineStages, below.
d451 6
a456 1
   render_func *RenderVBClippedTab;
d468 1
a468 2
    * driver.  The FX driver sets this to DD_TRI_CULL, and will soon
    * implement DD_TRI_OFFSET.
a554 2
   void (*RegisterVB)( struct vertex_buffer *VB );
   void (*UnregisterVB)( struct vertex_buffer *VB );
d558 6
d565 2
d568 3
a570 4
   void (*ResetVB)( struct vertex_buffer *VB );
   void (*ResetCvaVB)( struct vertex_buffer *VB, GLuint stages );
   /* Do any reset operations necessary to the driver data associated
    * with these vertex buffers.
d572 2
d575 2
a576 3
   GLuint RenderVectorFlags;
   /* What do the render tables require of the vectors they deal
    * with?  
d578 1
d580 2
a581 5
   GLuint (*RegisterPipelineStages)( struct gl_pipeline_stage *out,
				     const struct gl_pipeline_stage *in,
				     GLuint nr );
   /* Register new pipeline stages, or modify existing ones.  See also
    * the OptimizePipeline() functions.
d583 2
d586 3
a588 4
   void (*OptimizePrecalcPipeline)( GLcontext *ctx, struct gl_pipeline *pipe );
   void (*OptimizeImmediatePipeline)( GLcontext *ctx, struct gl_pipeline *pipe);
   /* Check to see if a fast path exists for this combination of stages 
    * in the precalc and immediate (elt) pipelines.
d590 12
@


3.19.2.2
log
@Faux multitexturing for voodoo-1
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.19.2.1 1999/05/21 21:29:25 keithw Exp $ */
a603 1
   void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
@


3.19.2.3
log
@Broadened FX fast path, added support for multipass multitexture.
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.19.2.2 1999/05/27 20:52:32 keithw Exp $ */
a469 10
   GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
   /* Driver may request additional render passes by returning GL_TRUE
    * when this function is called.  This function will be called
    * after the first pass, and passes will be made until the function
    * returns GL_FALSE.  If no function is registered, only one pass
    * is made.  
    * 
    * This function will be first invoked with passno == 1.
    */

a577 7

   GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
   GLboolean (*BuildEltPipeline)( GLcontext *ctx );
   /* Perform the full pipeline build, or return false.
    */


a596 2
   void (*CullFace)(GLcontext *ctx, GLenum mode);
   void (*FrontFace)(GLcontext *ctx, GLenum mode);
@


3.18
log
@Compiled vertex arrays
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.17 1999/03/28 20:54:23 brianp Exp $ */
d573 1
a573 1
				  GLuint new, GLuint available );
@


3.17
log
@better docs for SetBuffer
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.16 1999/02/26 03:21:16 brianp Exp $ */
d39 4
d120 2
d409 2
a410 8
   points_func PointsFunc;
   /* Called to draw an array of points.
    */

   line_func LineFunc;
   /*Called to draw a line segment.
    */

d412 3
a414 10
   /* Called to draw a filled triangle.
    */

   quad_func QuadFunc;
   /* Called to draw a filled quadrilateral.
    */

   rect_func RectFunc;
   /* Called to draw a filled, screen-aligned 2-D rectangle.
    */
d442 1
a442 1
   void (*RasterSetup)( GLcontext *ctx, GLuint start, GLuint end );
d451 6
a456 1
   render_func *RenderVBIndirectTab;
d465 6
d554 49
@


3.16
log
@fixed copyright
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.15 1999/02/25 14:12:30 keithw Exp $ */
d174 1
a174 1
   GLboolean (*SetBuffer)( GLcontext *ctx, GLenum mode );
d176 16
a191 2
    * Selects either the front or back color buffer for reading and writing.
    * mode is either GL_FRONT or GL_BACK.
@


3.15
log
@Merged in kw3 patch
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.14 1999/01/22 04:26:58 brianp Exp $ */
d6 19
a24 15
 * Copyright (C) 1995-1999  Brian Paul
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@


3.14
log
@clean-up and added ClearDepth(), GetString() functions
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.13 1998/11/17 02:51:35 brianp Exp brianp $ */
a23 46
/*
 * $Log: dd.h,v $
 * Revision 3.13  1998/11/17 02:51:35  brianp
 * added a bunch of new device driver functions (Keith Harrison)
 *
 * Revision 3.12  1998/10/31 17:06:15  brianp
 * variety of multi-texture changes
 *
 * Revision 3.11  1998/08/23 22:18:18  brianp
 * added Driver.Viewport and Driver.DepthRange function pointers
 *
 * Revision 3.10  1998/06/07 22:19:31  brianp
 * implemented GL_EXT_multitexture extension
 *
 * Revision 3.9  1998/04/22 00:52:42  brianp
 * added GLcontext parameter to driver ExtensionString()
 *
 * Revision 3.8  1998/04/01 02:59:42  brianp
 * updated for v0.24 of 3Dfx/Glide driver
 *
 * Revision 3.7  1998/03/28 03:57:39  brianp
 * added CONST macro to fix IRIX compilation problems
 *
 * Revision 3.6  1998/03/10 01:28:09  brianp
 * added a const keyword
 *
 * Revision 3.5  1998/02/21 01:01:07  brianp
 * added GL_MAX_TEXTURES to GetParameteri() documentation
 *
 * Revision 3.4  1998/02/15 01:32:59  brianp
 * updated driver bitmap function
 *
 * Revision 3.3  1998/02/07 14:43:35  brianp
 * added GetParameteri() function
 *
 * Revision 3.2  1998/02/01 15:23:52  brianp
 * added ExtensionString() function to device driver
 *
 * Revision 3.1  1998/01/31 23:57:23  brianp
 * removed ClearDepthBuffer and ClearColorAndDepth functions
 *
 * Revision 3.0  1998/01/31 20:49:46  brianp
 * initial rev
 *
 */

d422 8
a429 6
   void (*Begin)( GLcontext *ctx, GLenum mode );
   void (*End)( GLcontext *ctx );
   /* These are called whenever glBegin() or glEnd() are called.
    * The device driver may do some sort of window locking/unlocking here.
    */

d439 7
a445 6
   GLboolean (*RenderVB)( GLcontext *ctx, GLboolean allDone );
   /* This function allows the device driver to rasterize an entire
    * buffer of primitives at once.  See the gl_render_vb() function
    * in vbrender.c for more details.
    * Return GL_TRUE if vertex buffer successfully rendered.
    * Return GL_FALSE if failure, let core Mesa render the vertex buffer.
d447 2
@


3.13
log
@added a bunch of new device driver functions (Keith Harrison)
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.12 1998/10/31 17:06:15 brianp Exp brianp $ */
d6 1
a6 1
 * Copyright (C) 1995-1998  Brian Paul
d26 3
d173 1
d324 7
d363 2
d564 1
a564 6

   /***
    *** NEW
    ***/

   void (*Viewport)( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h );
d566 1
a566 6
    * Called when viewport parameters are changed.
    */

   void (*DepthRange)( GLcontext *ctx, GLclampd nearval, GLclampd farval );
   /*
    * Called when depth range parameters are changed.
d571 1
a571 1
    *** Added by Keith Harrison.
d573 9
a581 4
   /*  These functions map onto the OpenGL equivalents
    * (i.e. Fogfv maps onto glFogfv).
    * Mesa's driver may have a lot more of these GL-corresponding driver
    * functions in the future. (-Brian)
d585 1
d588 3
a592 1
   void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
d596 1
a596 1
   void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
@


3.12
log
@variety of multi-texture changes
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.11 1998/08/23 22:18:18 brianp Exp brianp $ */
d26 3
d566 20
@


3.11
log
@added Driver.Viewport and Driver.DepthRange function pointers
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.10 1998/06/07 22:19:31 brianp Exp brianp $ */
d5 1
a5 1
 * Version:  3.0
d26 3
a147 3
#define DD_MAX_TEXTURE_SIZE          0
#define DD_MAX_TEXTURES              1
#define DD_MAX_TEXTURE_COORD_SETS    2
@


3.10
log
@implemented GL_EXT_multitexture extension
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.9 1998/04/22 00:52:42 brianp Exp brianp $ */
d26 3
d546 15
@


3.9
log
@added GLcontext parameter to driver ExtensionString()
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.8 1998/04/01 02:59:42 brianp Exp brianp $ */
d26 3
d142 4
a145 3
#define DD_MAX_TEXTURE_SIZE     0
#define DD_MAX_TEXTURES         1
#define DD_HAVE_HARDWARE_FOG    2
@


3.8
log
@updated for v0.24 of 3Dfx/Glide driver
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.7 1998/03/28 03:57:39 brianp Exp brianp $ */
d26 3
a141 1
#define DD_IS_EXT_SUPPORTED     3
d308 1
a308 1
   const char * (*ExtensionString)( void );
@


3.7
log
@added CONST macro to fix IRIX compilation problems
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.6 1998/03/10 01:28:09 brianp Exp brianp $ */
d26 3
d135 7
d355 1
a355 1
   GLint (*GetParameteri)(const GLcontext *ctx, GLint param);
d358 9
a366 2
    *     GL_MAX_TEXTURE_SIZE         return maximum texture size
    *     GL_MAX_TEXTURES             number of texture sets/stages, usually 1
@


3.6
log
@added a const keyword
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.5 1998/02/21 01:01:07 brianp Exp brianp $ */
d26 3
d54 3
d209 1
a209 1
                          const GLubyte rgba[][4], const GLubyte mask[] );
d212 1
a212 1
                         const GLubyte rgb[][3], const GLubyte mask[] );
d224 1
a224 1
                            const GLubyte rgba[][4], const GLubyte mask[] );
@


3.5
log
@added GL_MAX_TEXTURES to GetParameteri() documentation
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.4 1998/02/15 01:32:59 brianp Exp brianp $ */
d26 3
d339 1
a339 1
   GLint (*GetParameteri)(GLcontext *ctx, GLint param);
@


3.4
log
@updated driver bitmap function
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.3 1998/02/07 14:43:35 brianp Exp brianp $ */
d26 3
d336 1
a336 1
   int (*GetParameteri)(GLcontext *ctx, GLint param);
d340 1
@


3.3
log
@added GetParameteri() function
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.2 1998/02/01 15:23:52 brianp Exp brianp $ */
d26 3
d45 4
d377 1
a377 2
   /*
    * Called to draw an array of points.
d381 1
a381 2
   /*
    * Called to draw a line segment.
d385 1
a385 2
   /* 
    * Called to draw a filled triangle.
d389 1
a389 2
   /* 
    * Called to draw a filled quadrilateral.
d393 1
a393 2
   /* 
    * Called to draw a filled, screen-aligned 2-D rectangle.
d398 2
a399 1
                            GLenum format, GLenum type, GLboolean packed,
d401 2
a402 2
   /*
    * Called from glDrawPixels().
d405 6
a410 6
   GLboolean (*Bitmap)( GLcontext *ctx, GLsizei width, GLsizei height,
                        GLfloat xorig, GLfloat yorig,
                        GLfloat xmove, GLfloat ymove,
                        const struct gl_image *bitmap );
   /*
    * Called from glBitmap().
d415 1
a415 2
   /*
    * These are called whenever glBegin() or glEnd() are called.
d421 1
a421 2
   /*
    * This function, if not NULL, is called whenever new window coordinates
d429 1
a429 2
   /*
    * This function allows the device driver to rasterize an entire
@


3.2
log
@added ExtensionString() function to device driver
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.1 1998/01/31 23:57:23 brianp Exp brianp $ */
d26 3
d326 6
a508 4
   void (*MaxTextureSize)(GLcontext *ctx, int *width, int *height, int *depth);
   /*
    * Mesa calls this to ask the driver what the max texture size is.
    */
@


3.1
log
@removed ClearDepthBuffer and ClearColorAndDepth functions
@
text
@d1 1
a1 1
/* $Id: dd.h,v 3.0 1998/01/31 20:49:46 brianp Exp brianp $ */
d26 3
d273 4
@


3.0
log
@initial rev
@
text
@d1 1
a1 1
/* $Id$ */
d25 4
a28 1
 * $Log$
d145 7
a151 5
   void (*Clear)( GLcontext *ctx,
                  GLboolean all, GLint x, GLint y, GLint width, GLint height );
   /*
    * Clear the current color buffer.  If 'all' is set the clear the whole
    * buffer, else clear the region defined by (x,y,width,height).
d181 1
d187 2
a188 3
                         const GLubyte rgba[][3], const GLubyte mask[] );
   /*
    * Write a horizontal run of RGB[A] pixels.  The later version is only
d194 1
a194 2
   /*
    * Write a horizontal run of mono-RGBA pixels.
d200 1
a200 2
   /*
    * Write array of RGBA pixels at random locations.
d206 1
a206 2
   /*
    * Write an array of mono-RGBA pixels at random locations.
d213 1
a213 2
   /*
    * Write a horizontal run of CI pixels.  32 or 8bpp.
d218 1
a218 2
   /*
    * Write a horizontal run of mono-CI pixels.
d235 1
d239 1
d242 1
a242 2
   /*
    * Read a horizontal run of color index pixels.
d247 1
a247 2
   /*
    * Read a horizontal run of RGBA pixels.
d253 1
a253 2
   /*
    * Read a random array of CI pixels.
d259 1
a259 2
   /*
    * Read a random array of RGBA pixels.
a325 5
   void (*ClearDepthBuffer)( GLcontext *ctx );
   /*
    * Clear the depth buffer to depth specified by CC.Depth.Clear value.
    */

a345 9
    */


   void (*ClearColorAndDepth)( GLcontext *ctx,
                               GLboolean all, GLint x, GLint y,
                               GLint width, GLint height );
   /*
    * If this function is implemented then it will be called when both the
    * color and depth buffers are to be cleared.
@
