home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / src / dd.h < prev    next >
C/C++ Source or Header  |  2000-01-07  |  26KB  |  677 lines

  1. /* $Id: dd.h,v 1.4.2.1 1999/12/12 18:30:47 keithw Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.1
  6.  * 
  7.  * Copyright (C) 1999  Brian Paul   All Rights Reserved.
  8.  * 
  9.  * Permission is hereby granted, free of charge, to any person obtaining a
  10.  * copy of this software and associated documentation files (the "Software"),
  11.  * to deal in the Software without restriction, including without limitation
  12.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  13.  * and/or sell copies of the Software, and to permit persons to whom the
  14.  * Software is furnished to do so, subject to the following conditions:
  15.  * 
  16.  * The above copyright notice and this permission notice shall be included
  17.  * in all copies or substantial portions of the Software.
  18.  * 
  19.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  22.  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  23.  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24.  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  */
  26.  
  27.  
  28.  
  29. #ifndef DD_INCLUDED
  30. #define DD_INCLUDED
  31.  
  32.  
  33. #include "macros.h"
  34.  
  35.  
  36. struct gl_pixelstore_attrib;
  37.  
  38.  
  39. struct vertex_buffer;
  40. struct immediate;
  41. struct gl_pipeline_stage;
  42.  
  43.  
  44. /* THIS FILE ONLY INCLUDED BY types.h !!!!! */
  45.  
  46.  
  47. /*
  48.  *                      Device Driver (DD) interface
  49.  *
  50.  *
  51.  * All device driver functions are accessed through pointers in the
  52.  * dd_function_table struct (defined below) which is stored in the GLcontext
  53.  * struct.  Since the device driver is strictly accessed trough a table of
  54.  * function pointers we can:
  55.  *   1. switch between a number of different device drivers at runtime.
  56.  *   2. use optimized functions dependant on current rendering state or
  57.  *      frame buffer configuration.
  58.  *
  59.  * The function pointers in the dd_function_table struct are divided into
  60.  * two groups:  mandatory and optional.
  61.  * Mandatory functions have to be implemented by every device driver.
  62.  * Optional functions may or may not be implemented by the device driver.
  63.  * The optional functions provide ways to take advantage of special hardware
  64.  * or optimized algorithms.
  65.  *
  66.  * The function pointers in the dd_function_table struct should first be
  67.  * initialized in the driver's "MakeCurrent" function.  The "MakeCurrent"
  68.  * function is a little different in each device driver.  See the X/Mesa,
  69.  * GLX, or OS/Mesa drivers for examples.
  70.  *
  71.  * Later, Mesa may call the dd_function_table's UpdateState() function.
  72.  * This function should initialize the dd_function_table's pointers again.
  73.  * The UpdateState() function is called whenever the core (GL) rendering
  74.  * state is changed in a way which may effect rasterization.  For example,
  75.  * the TriangleFunc() pointer may have to point to different functions
  76.  * depending on whether smooth or flat shading is enabled.
  77.  *
  78.  * Note that the first argument to every device driver function is a
  79.  * GLcontext *.  In turn, the GLcontext->DriverCtx pointer points to
  80.  * the driver-specific context struct.  See the X/Mesa or OS/Mesa interface
  81.  * for an example.
  82.  *
  83.  * For more information about writing a device driver see the ddsample.c
  84.  * file and other device drivers (X/xmesa[1234].c, OSMesa/osmesa.c, etc)
  85.  * for examples.
  86.  *
  87.  *
  88.  * Look below in the dd_function_table struct definition for descriptions
  89.  * of each device driver function.
  90.  * 
  91.  *
  92.  * In the future more function pointers may be added for glReadPixels
  93.  * glCopyPixels, etc.
  94.  *
  95.  *
  96.  * Notes:
  97.  * ------
  98.  *   RGBA = red/green/blue/alpha
  99.  *   CI = color index (color mapped mode)
  100.  *   mono = all pixels have the same color or index
  101.  *
  102.  *   The write_ functions all take an array of mask flags which indicate
  103.  *   whether or not the pixel should be written.  One special case exists
  104.  *   in the write_color_span function: if the mask array is NULL, then
  105.  *   draw all pixels.  This is an optimization used for glDrawPixels().
  106.  *
  107.  * IN ALL CASES:
  108.  *      X coordinates start at 0 at the left and increase to the right
  109.  *      Y coordinates start at 0 at the bottom and increase upward
  110.  *
  111.  */
  112.  
  113.  
  114.  
  115.  
  116. /* Used by the GetParameteri device driver function */
  117. #define DD_HAVE_HARDWARE_FOG         3
  118.  
  119.  
  120.  
  121.  
  122.  
  123. /*
  124.  * Device Driver function table.
  125.  */
  126. struct dd_function_table {
  127.  
  128.    /**********************************************************************
  129.     *** Mandatory functions:  these functions must be implemented by   ***
  130.     *** every device driver.                                           ***
  131.     **********************************************************************/
  132.  
  133.    const char * (*RendererString)(void);
  134.    /*
  135.     * Return a string which uniquely identifies this device driver.
  136.     * The string should contain no whitespace.  Examples: "X11", "OffScreen",
  137.     * "MSWindows", "SVGA".
  138.     * NOTE: This function will be obsolete in favor of GetString in the future!
  139.     */
  140.  
  141.    void (*UpdateState)( GLcontext *ctx );
  142.    /*
  143.     * UpdateState() is called whenver Mesa thinks the device driver should
  144.     * update its state and/or the other pointers (such as PointsFunc,
  145.     * LineFunc, or TriangleFunc).
  146.     */
  147.  
  148.    void (*ClearIndex)( GLcontext *ctx, GLuint index );
  149.    /*
  150.     * Called whenever glClearIndex() is called.  Set the index for clearing
  151.     * the color buffer when in color index mode.
  152.     */
  153.  
  154.    void (*ClearColor)( GLcontext *ctx, GLubyte red, GLubyte green,
  155.                                         GLubyte blue, GLubyte alpha );
  156.    /*
  157.     * Called whenever glClearColor() is called.  Set the color for clearing
  158.     * the color buffer when in RGBA mode.
  159.     */
  160.  
  161.    GLbitfield (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
  162.                         GLint x, GLint y, GLint width, GLint height );
  163.    /* Clear the color/depth/stencil/accum buffer(s).
  164.     * 'mask' indicates which buffers need to be cleared.  Return a bitmask
  165.     *    indicating which buffers weren't cleared by the driver function.
  166.     * If 'all' is true then the clear the whole buffer, else clear the
  167.     *    region defined by (x,y,width,height).
  168.     */
  169.  
  170.    void (*Index)( GLcontext *ctx, GLuint index );
  171.    /*
  172.     * Sets current color index for drawing flat-shaded primitives.
  173.     * This index should also be used in the "mono" drawing functions.
  174.     */
  175.  
  176.    void (*Color)( GLcontext *ctx,
  177.                   GLubyte red, GLubyte green, GLubyte glue, GLubyte alpha );
  178.    /*
  179.     * Sets current color for drawing flat-shaded primitives.
  180.     * This color should also be used in the "mono" drawing functions.
  181.     */
  182.  
  183.    GLboolean (*SetBuffer)( GLcontext *ctx, GLenum buffer );
  184.    /*
  185.     * Selects the color buffer(s) for reading and writing.
  186.     * The following values must be accepted when applicable:
  187.     *    GL_FRONT_LEFT - this buffer always exists
  188.     *    GL_BACK_LEFT - when double buffering
  189.     *    GL_FRONT_RIGHT - when using stereo
  190.     *    GL_BACK_RIGHT - when using stereo and double buffering
  191.     * The folowing values may optionally be accepted.  Return GL_TRUE
  192.     * if accepted, GL_FALSE if not accepted.  In practice, only drivers
  193.     * which can write to multiple color buffers at once should accept
  194.     * these values.
  195.     *    GL_FRONT - write to front left and front right if it exists
  196.     *    GL_BACK - write to back left and back right if it exists
  197.     *    GL_LEFT - write to front left and back left if it exists
  198.     *    GL_RIGHT - write to right left and back right if they exist
  199.     *    GL_FRONT_AND_BACK - write to all four buffers if they exist
  200.     *    GL_NONE - disable buffer write in device driver.
  201.     */
  202.  
  203.    void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
  204.    /*
  205.     * Returns the width and height of the current color buffer.
  206.     */
  207.  
  208.  
  209.    /***
  210.     *** Functions for writing pixels to the frame buffer:
  211.     ***/
  212.  
  213.    void (*WriteRGBASpan)( const GLcontext *ctx,
  214.                           GLuint n, GLint x, GLint y,
  215.                           CONST GLubyte rgba[][4], const GLubyte mask[] );
  216.    void (*WriteRGBSpan)( const GLcontext *ctx,
  217.                          GLuint n, GLint x, GLint y,
  218.                          CONST GLubyte rgb[][3], const GLubyte mask[] );
  219.    /* Write a horizontal run of RGB[A] pixels.  The later version is only
  220.     * used to accelerate GL_RGB, GL_UNSIGNED_BYTE glDrawPixels() calls.
  221.     * If mask is NULL, draw all pixels.
  222.     * If mask is not null, only draw pixel [i] when mask [i] is true.
  223.     */
  224.  
  225.    void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  226.                               const GLubyte mask[] );
  227.    /* Write a horizontal run of RGBA pixels all with the color last
  228.     * specified by the Color function.
  229.     */
  230.  
  231.    void (*WriteRGBAPixels)( const GLcontext *ctx,
  232.                             GLuint n, const GLint x[], const GLint y[],
  233.                             CONST GLubyte rgba[][4], const GLubyte mask[] );
  234.    /* Write array of RGBA pixels at random locations.
  235.     */
  236.  
  237.    void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
  238.                                 GLuint n, const GLint x[], const GLint y[],
  239.                                 const GLubyte mask[] );
  240.    /* Write an array of mono-RGBA pixels at random locations.
  241.     */
  242.  
  243.    void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  244.                           const GLuint index[], const GLubyte mask[] );
  245.    void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  246.                          const GLubyte index[], const GLubyte mask[] );
  247.    /* Write a horizontal run of CI pixels.  One function is for 32bpp
  248.     * indexes and the other for 8bpp pixels (the common case).  You mus
  249.     * implement both for color index mode.
  250.     */
  251.  
  252.    void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  253.                             const GLubyte mask[] );
  254.    /* Write a horizontal run of color index pixels using the color index
  255.     * last specified by the Index() function.
  256.     */
  257.  
  258.    void (*WriteCI32Pixels)( const GLcontext *ctx,
  259.                             GLuint n, const GLint x[], const GLint y[],
  260.                             const GLuint index[], const GLubyte mask[] );
  261.    /*
  262.     * Write a random array of CI pixels.
  263.     */
  264.  
  265.    void (*WriteMonoCIPixels)( const GLcontext *ctx,
  266.                               GLuint n, const GLint x[], const GLint y[],
  267.                               const GLubyte mask[] );
  268.    /* Write a random array of color index pixels using the color index
  269.     * last specified by the Index() function.
  270.     */
  271.  
  272.  
  273.    /***
  274.     *** Functions to read pixels from frame buffer:
  275.     ***/
  276.  
  277.    void (*ReadCI32Span)( const GLcontext *ctx,
  278.                          GLuint n, GLint x, GLint y, GLuint index[] );
  279.    /* Read a horizontal run of color index pixels.
  280.     */
  281.  
  282.    void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  283.                          GLubyte rgba[][4] );
  284.    /* Read a horizontal run of RGBA pixels.
  285.     */
  286.  
  287.    void (*ReadCI32Pixels)( const GLcontext *ctx,
  288.                            GLuint n, const GLint x[], const GLint y[],
  289.                            GLuint indx[], const GLubyte mask[] );
  290.    /* Read a random array of CI pixels.
  291.     */
  292.  
  293.    void (*ReadRGBAPixels)( const GLcontext *ctx,
  294.                            GLuint n, const GLint x[], const GLint y[],
  295.                            GLubyte rgba[][4], const GLubyte mask[] );
  296.    /* Read a random array of RGBA pixels.
  297.     */
  298.  
  299.  
  300.    /**********************************************************************
  301.     *** Optional functions:  these functions may or may not be         ***
  302.     *** implemented by the device driver.  If the device driver        ***
  303.     *** doesn't implement them it should never touch these pointers    ***
  304.     *** since Mesa will either set them to NULL or point them at a     ***
  305.     *** fall-back function.                                            ***
  306.     **********************************************************************/
  307.  
  308.    const char * (*ExtensionString)( GLcontext *ctx );
  309.    /* Return a space-separated list of extensions for this driver.
  310.     * NOTE: This function will be obsolete in favor of GetString in the future!
  311.     */
  312.  
  313.    const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
  314.    /* Return a string as needed by glGetString().
  315.     * NOTE: This will replace the ExtensionString and RendererString
  316.     * functions in the future!
  317.     */
  318.  
  319.    void (*Finish)( GLcontext *ctx );
  320.    /*
  321.     * This is called whenever glFinish() is called.
  322.     */
  323.  
  324.    void (*Flush)( GLcontext *ctx );
  325.    /*
  326.     * This is called whenever glFlush() is called.
  327.     */
  328.  
  329.    GLboolean (*IndexMask)( GLcontext *ctx, GLuint mask );
  330.    /*
  331.     * Implements glIndexMask() if possible, else return GL_FALSE.
  332.     */
  333.  
  334.    GLboolean (*ColorMask)( GLcontext *ctx,
  335.                            GLboolean rmask, GLboolean gmask,
  336.                            GLboolean bmask, GLboolean amask );
  337.    /*
  338.     * Implements glColorMask() if possible, else return GL_FALSE.
  339.     */
  340.  
  341.    GLboolean (*LogicOp)( GLcontext *ctx, GLenum op );
  342.    /*
  343.     * Implements glLogicOp() if possible, else return GL_FALSE.
  344.     */
  345.  
  346.    void (*Dither)( GLcontext *ctx, GLboolean enable );
  347.    /*
  348.     * Enable/disable dithering.
  349.     * NOTE: This function will be removed in the future in favor
  350.     * of the "Enable" driver function.
  351.     */
  352.  
  353.    void (*Error)( GLcontext *ctx );
  354.    /*
  355.     * Called whenever an error is generated.  ctx->ErrorValue contains
  356.     * the error value.
  357.     */
  358.  
  359.    void (*NearFar)( GLcontext *ctx, GLfloat nearVal, GLfloat farVal );
  360.    /*
  361.     * Called from glFrustum and glOrtho to tell device driver the
  362.     * near and far clipping plane Z values.  The 3Dfx driver, for example,
  363.     * uses this.
  364.     */
  365.  
  366.    GLint (*GetParameteri)( const GLcontext *ctx, GLint param );
  367.    /* Query the device driver to get an integer parameter.
  368.     * Current parameters:
  369.     *     DD_MAX_TEXTURE_SIZE         return maximum texture size
  370.     *
  371.     *     DD_MAX_TEXTURES             number of texture sets/stages, usually 1
  372.     *
  373.     *     DD_HAVE_HARDWARE_FOG        the driver should return 1 (0 otherwise)
  374.     *                                 when the hardware support per fragment
  375.     *                                 fog for free (like the Voodoo Graphics)
  376.     *                                 so the Mesa core will start to ever use
  377.     *                                 per fragment fog
  378.     */
  379.  
  380.  
  381.    /***
  382.     *** For supporting hardware Z buffers:
  383.     ***/
  384.  
  385.    void (*AllocDepthBuffer)( GLcontext *ctx );
  386.    /*
  387.     * Called when the depth buffer must be allocated or possibly resized.
  388.     */
  389.  
  390.    GLuint (*DepthTestSpan)( GLcontext *ctx,
  391.                             GLuint n, GLint x, GLint y, const GLdepth z[],
  392.                             GLubyte mask[] );
  393.    void (*DepthTestPixels)( GLcontext *ctx,
  394.                             GLuint n, const GLint x[], const GLint y[],
  395.                             const GLdepth z[], GLubyte mask[] );
  396.    /*
  397.     * Apply the depth buffer test to an span/array of pixels and return
  398.     * an updated pixel mask.  This function is not used when accelerated
  399.     * point, line, polygon functions are used.
  400.     */
  401.  
  402.    void (*ReadDepthSpanFloat)( GLcontext *ctx,
  403.                                GLuint n, GLint x, GLint y, GLfloat depth[]);
  404.    void (*ReadDepthSpanInt)( GLcontext *ctx,
  405.                              GLuint n, GLint x, GLint y, GLdepth depth[] );
  406.    /*
  407.     * Return depth values as integers for glReadPixels.
  408.     * Floats should be returned in the range [0,1].
  409.     * Ints (GLdepth) values should be in the range [0,MAXDEPTH].
  410.     */
  411.  
  412.  
  413.    /***
  414.     *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions:
  415.     ***/
  416.  
  417.    points_func   PointsFunc;
  418.    line_func     LineFunc;
  419.    triangle_func TriangleFunc;
  420.    quad_func     QuadFunc;
  421.    rect_func     RectFunc;    
  422.    
  423.  
  424.    GLboolean (*DrawPixels)( GLcontext *ctx,
  425.                             GLint x, GLint y, GLsizei width, GLsizei height,
  426.                             GLenum format, GLenum type,
  427.                             const struct gl_pixelstore_attrib *unpack,
  428.                             const GLvoid *pixels );
  429.    /* This is called by glDrawPixels.
  430.     * 'unpack' describes how to unpack the source image data.
  431.     * Return GL_TRUE if the driver succeeds, return GL_FALSE if core Mesa
  432.     * must do the job.
  433.     */
  434.  
  435.    GLboolean (*Bitmap)( GLcontext *ctx,
  436.                         GLint x, GLint y, GLsizei width, GLsizei height,
  437.                         const struct gl_pixelstore_attrib *unpack,
  438.                         const GLubyte *bitmap );
  439.    /* This is called by glBitmap.  Works the same as DrawPixels, above.
  440.     */
  441.  
  442.    void (*RenderStart)( GLcontext *ctx );
  443.    void (*RenderFinish)( GLcontext *ctx );
  444.     /* KW: These replace Begin and End, and have more relaxed semantics.
  445.      * They are called prior-to and after one or more vb flush, and are
  446.      * thus decoupled from the gl_begin/gl_end pairs, which are possibly 
  447.      * more frequent.  If a begin/end pair covers >1 vertex buffer, these
  448.      * are called at most once for the pair. (a bit broken at present)
  449.      */
  450.  
  451.    void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
  452.    /* This function, if not NULL, is called whenever new window coordinates
  453.     * are put in the vertex buffer.  The vertices in question are those n
  454.     * such that start <= n < end.
  455.     * The device driver can convert the window coords to its own specialized
  456.     * format.  The 3Dfx driver uses this.
  457.     *
  458.     * Note: Deprecated in favour of RegisterPipelineStages, below.
  459.     */
  460.  
  461.  
  462.    render_func *RenderVBClippedTab;
  463.    render_func *RenderVBCulledTab;
  464.    render_func *RenderVBRawTab;
  465.    /* These function tables allow the device driver to rasterize an
  466.     * entire begin/end group of primitives at once.  See the
  467.     * gl_render_vb() function in vbrender.c for more details.  
  468.     */
  469.  
  470.  
  471.    void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive );
  472.    /* If registered, this will be called when rendering transitions between
  473.     * points, lines and triangles.  It is not called on transitions between 
  474.     * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between
  475.     * triangles and quads or triangles and polygons.
  476.     */
  477.  
  478.    GLuint TriangleCaps;
  479.    /* Holds a list of the reasons why we might normally want to call
  480.     * render_triangle, but which are in fact implemented by the
  481.     * driver.  The FX driver sets this to DD_TRI_CULL, and will soon
  482.     * implement DD_TRI_OFFSET.
  483.     */
  484.  
  485.  
  486.    GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
  487.    /* Driver may request additional render passes by returning GL_TRUE
  488.     * when this function is called.  This function will be called
  489.     * after the first pass, and passes will be made until the function
  490.     * returns GL_FALSE.  If no function is registered, only one pass
  491.     * is made.  
  492.     * 
  493.     * This function will be first invoked with passno == 1.
  494.     */
  495.  
  496.    /***
  497.     *** Texture mapping functions:
  498.     ***/
  499.  
  500.    void (*TexEnv)( GLcontext *ctx, GLenum pname, const GLfloat *param );
  501.    /*
  502.     * Called whenever glTexEnv*() is called.
  503.     * Pname will be one of GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR.
  504.     * If pname is GL_TEXTURE_ENV_MODE then param will be one
  505.     * of GL_MODULATE, GL_BLEND, GL_DECAL, or GL_REPLACE.
  506.     */
  507.  
  508.    void (*TexImage)( GLcontext *ctx, GLenum target,
  509.                      struct gl_texture_object *tObj, GLint level,
  510.                      GLint internalFormat,
  511.                      const struct gl_texture_image *image );
  512.    /*
  513.     * Called whenever a texture object's image is changed.
  514.     *    texObject is the number of the texture object being changed.
  515.     *    level indicates the mipmap level.
  516.     *    internalFormat is the format in which the texture is to be stored.
  517.     *    image is a pointer to a gl_texture_image struct which contains
  518.     *       the actual image data.
  519.     */
  520.  
  521.    void (*TexSubImage)( GLcontext *ctx, GLenum target,
  522.                         struct gl_texture_object *tObj, GLint level,
  523.                         GLint xoffset, GLint yoffset,
  524.                         GLsizei width, GLsizei height,
  525.                         GLint internalFormat,
  526.                         const struct gl_texture_image *image );
  527.    /*
  528.     * Called from glTexSubImage() to define a sub-region of a texture.
  529.     */
  530.  
  531.    void (*TexParameter)( GLcontext *ctx, GLenum target,
  532.                          struct gl_texture_object *tObj,
  533.                          GLenum pname, const GLfloat *params );
  534.    /*
  535.     * Called whenever glTexParameter*() is called.
  536.     *    target is GL_TEXTURE_1D or GL_TEXTURE_2D
  537.     *    texObject is the texture object to modify
  538.     *    pname is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER,
  539.     *       GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_BORDER_COLOR.
  540.     *    params is dependant on pname.  See man glTexParameter.
  541.     */
  542.  
  543.    void (*BindTexture)( GLcontext *ctx, GLenum target,
  544.                         struct gl_texture_object *tObj );
  545.    /*
  546.     * Called whenever glBindTexture() is called.  This specifies which
  547.     * texture is to be the current one.  No dirty flags will be set.
  548.     */
  549.  
  550.    void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
  551.    /*
  552.     * Called when a texture object is about to be deallocated.  Driver
  553.     * should free anything attached to the DriverData pointers.
  554.     */
  555.  
  556.    void (*UpdateTexturePalette)( GLcontext *ctx,
  557.                                  struct gl_texture_object *tObj );
  558.    /*
  559.     * Called when the texture's color lookup table is changed.
  560.     * If tObj is NULL then the shared texture palette ctx->Texture.Palette
  561.     * was changed.
  562.     */
  563.  
  564.    void (*UseGlobalTexturePalette)( GLcontext *ctx, GLboolean state );
  565.    /*
  566.     * Called via glEnable/Disable(GL_SHARED_TEXTURE_PALETTE_EXT)
  567.     */
  568.  
  569.    void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
  570.    /*
  571.     * Called by glActiveTextureARB to set current texture unit.
  572.     */
  573.  
  574.  
  575.    GLboolean (*IsTextureResident)( GLcontext *ctx, 
  576.                    struct gl_texture_object *t );
  577.    /*
  578.     * Allows the driver to implement the AreTexturesResident tests without
  579.     * knowing about Mesa's internal hash tables for textures.
  580.     */
  581.  
  582.    void (*PrioritizeTexture)( GLcontext *ctx, 
  583.                   struct gl_texture_object *t,
  584.                   GLclampf priority );
  585.    /*
  586.     * Notify driver of priority change for a texture.
  587.     */
  588.  
  589.  
  590.  
  591.  
  592.    /***
  593.     *** NEW in Mesa 3.x
  594.     ***/
  595.  
  596.    void (*RegisterVB)( struct vertex_buffer *VB );
  597.    void (*UnregisterVB)( struct vertex_buffer *VB );
  598.    /* Do any processing (eg allocate memory) required to set up a new
  599.     * vertex_buffer.  
  600.     */
  601.  
  602.  
  603.    void (*ResetVB)( struct vertex_buffer *VB );
  604.    void (*ResetCvaVB)( struct vertex_buffer *VB, GLuint stages );
  605.    /* Do any reset operations necessary to the driver data associated
  606.     * with these vertex buffers.
  607.     */
  608.  
  609.    GLuint RenderVectorFlags;
  610.    /* What do the render tables require of the vectors they deal
  611.     * with?  
  612.     */
  613.  
  614.    GLuint (*RegisterPipelineStages)( struct gl_pipeline_stage *out,
  615.                      const struct gl_pipeline_stage *in,
  616.                      GLuint nr );
  617.    /* Register new pipeline stages, or modify existing ones.  See also
  618.     * the OptimizePipeline() functions.
  619.     */
  620.  
  621.  
  622.    GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
  623.    GLboolean (*BuildEltPipeline)( GLcontext *ctx );
  624.    /* Perform the full pipeline build, or return false.
  625.     */
  626.  
  627.  
  628.    void (*OptimizePrecalcPipeline)( GLcontext *ctx, struct gl_pipeline *pipe );
  629.    void (*OptimizeImmediatePipeline)( GLcontext *ctx, struct gl_pipeline *pipe);
  630.    /* Check to see if a fast path exists for this combination of stages 
  631.     * in the precalc and immediate (elt) pipelines.
  632.     */
  633.  
  634.  
  635.    /*
  636.     * State-changing functions (drawing functions are above)
  637.     *
  638.     * These functions are called by their corresponding OpenGL API functions.
  639.     * They're ALSO called by the gl_PopAttrib() function!!!
  640.     * May add more functions like these to the device driver in the future.
  641.     * This should reduce the amount of state checking that
  642.     * the driver's UpdateState() function must do.
  643.     */
  644.    void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLclampf ref);
  645.    void (*BlendEquation)(GLcontext *ctx, GLenum mode);
  646.    void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
  647.    void (*BlendFuncSeparate)( GLcontext *ctx, GLenum sfactorRGB, 
  648.                   GLenum dfactorRGB, GLenum sfactorA,
  649.                   GLenum dfactorA );
  650.    void (*ClearDepth)(GLcontext *ctx, GLclampd d);
  651.    void (*CullFace)(GLcontext *ctx, GLenum mode);
  652.    void (*FrontFace)(GLcontext *ctx, GLenum mode);
  653.    void (*DepthFunc)(GLcontext *ctx, GLenum func);
  654.    void (*DepthMask)(GLcontext *ctx, GLboolean flag);
  655.    void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
  656.    void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
  657.    void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
  658.    void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
  659.    void (*Lightfv)(GLcontext *ctx, GLenum light,
  660.            GLenum pname, const GLfloat *params, GLint nparams );
  661.    void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
  662.    void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
  663.    void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
  664.    void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
  665.    void (*ShadeModel)(GLcontext *ctx, GLenum mode);
  666.    void (*ClearStencil)(GLcontext *ctx, GLint s);
  667.    void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
  668.    void (*StencilMask)(GLcontext *ctx, GLuint mask);
  669.    void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
  670.    void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
  671. };
  672.  
  673.  
  674.  
  675. #endif
  676.  
  677.