home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mesa5.zip / mesa5src.zip / swrast / swrast.h < prev   
C/C++ Source or Header  |  2002-11-13  |  21KB  |  609 lines

  1. /* $Id: swrast.h,v 1.33 2002/11/13 16:47:18 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  5.1
  6.  *
  7.  * Copyright (C) 1999-2002  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.  * \file swrast/swrast.h
  30.  * \brief Defines basic structures for sw_rasterizer.
  31.  * \author Keith Whitwell <keith@tungstengraphics.com>
  32.  */
  33.  
  34. #ifndef SWRAST_H
  35. #define SWRAST_H
  36.  
  37. #include "mtypes.h"
  38.  
  39. /**
  40.  * \struct SWvertex
  41.  * \brief Data-structure to handle vertices in the software rasterizer.
  42.  * 
  43.  * The software rasterizer now uses this format for vertices.  Thus a
  44.  * 'RasterSetup' stage or other translation is required between the
  45.  * tnl module and the swrast rasterization functions.  This serves to
  46.  * isolate the swrast module from the internals of the tnl module, and
  47.  * improve its usefulness as a fallback mechanism for hardware
  48.  * drivers.
  49.  *
  50.  * Full software drivers:
  51.  *   - Register the rastersetup and triangle functions from
  52.  *     utils/software_helper.
  53.  *   - On statechange, update the rasterization pointers in that module.
  54.  *
  55.  * Rasterization hardware drivers:
  56.  *   - Keep native rastersetup.
  57.  *   - Implement native twoside,offset and unfilled triangle setup.
  58.  *   - Implement a translator from native vertices to swrast vertices.
  59.  *   - On partial fallback (mix of accelerated and unaccelerated
  60.  *   prims), call a pass-through function which translates native
  61.  *   vertices to SWvertices and calls the appropriate swrast function.
  62.  *   - On total fallback (vertex format insufficient for state or all
  63.  *     primitives unaccelerated), hook in swrast_setup instead.
  64.  */
  65. typedef struct {
  66.    /** win[0], win[1] are the screen-coords of SWvertex. win[2] is the
  67.     * z-coord. what is win[3]? */
  68.    GLfloat win[4];
  69.    GLfloat texcoord[MAX_TEXTURE_UNITS][4];
  70.    GLchan color[4];
  71.    GLchan specular[4];
  72.    GLfloat fog;
  73.    GLuint index;
  74.    GLfloat pointSize;
  75. } SWvertex;
  76.  
  77.  
  78. /**
  79.  * \struct sw_span
  80.  * \brief Contains data for either a horizontal line or a set of
  81.  * pixels that are passed through a pipeline of functions before being
  82.  * drawn.
  83.  *
  84.  * The sw_span structure describes the colors, Z, fogcoord, texcoords,
  85.  * etc for either a horizontal run or a set of independent pixels.  We
  86.  * can either specify a base/step to indicate interpolated values, or
  87.  * fill in arrays of values.  The interpMask and arrayMask bitfields
  88.  * indicate which are active.
  89.  *
  90.  * With this structure it's easy to hand-off span rasterization to
  91.  * subroutines instead of doing it all inline in the triangle functions
  92.  * like we used to do.
  93.  * It also cleans up the local variable namespace a great deal.
  94.  *
  95.  * It would be interesting to experiment with multiprocessor rasterization
  96.  * with this structure.  The triangle rasterizer could simply emit a
  97.  * stream of these structures which would be consumed by one or more
  98.  * span-processing threads which could run in parallel.
  99.  */
  100.  
  101.  
  102. /**
  103.  * \defgroup SpanFlags SPAN_XXX-flags
  104.  * Bitmasks to indicate which span_arrays need to be computed
  105.  * (sw_span::interpMask) or have already been filled
  106.  * (sw_span::arrayMask)
  107.  */
  108. /*@{*/
  109. #define SPAN_RGBA         0x001
  110. #define SPAN_SPEC         0x002
  111. #define SPAN_INDEX        0x004
  112. #define SPAN_Z            0x008
  113. #define SPAN_FOG          0x010
  114. #define SPAN_TEXTURE      0x020
  115. #define SPAN_INT_TEXTURE  0x040
  116. #define SPAN_LAMBDA       0x080
  117. #define SPAN_COVERAGE     0x100
  118. #define SPAN_FLAT         0x200  /**< flat shading? */
  119. /** sw_span::arrayMask only - for span_arrays::x, span_arrays::y */
  120. #define SPAN_XY           0x400
  121. #define SPAN_MASK         0x800  /**< sw_span::arrayMask only */
  122. /*@}*/
  123.  
  124.  
  125. /**
  126.  * \struct span_arrays 
  127.  * \brief Arrays of fragment values.
  128.  *
  129.  * These will either be computed from the x/xStep values above or
  130.  * filled in by glDraw/CopyPixels, etc.
  131.  */
  132. struct span_arrays {
  133.    GLchan  rgb[MAX_WIDTH][3];
  134.    GLchan  rgba[MAX_WIDTH][4];
  135.    GLuint  index[MAX_WIDTH];
  136.    GLchan  spec[MAX_WIDTH][4]; /* specular color */
  137.    GLint   x[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
  138.    GLint   y[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
  139.    GLdepth z[MAX_WIDTH];
  140.    GLfloat fog[MAX_WIDTH];
  141.    GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4];
  142.    GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];
  143.    GLfloat coverage[MAX_WIDTH];
  144.  
  145.    /** This mask indicates if fragment is alive or culled */
  146.    GLubyte mask[MAX_WIDTH];
  147. };
  148.  
  149.  
  150. struct sw_span {
  151.    GLint x, y;
  152.  
  153.    /** Only need to process pixels between start <= i < end */
  154.    /** At this time, start is always zero. */
  155.    GLuint start, end;
  156.  
  157.    /** This flag indicates that mask[] array is effectively filled with ones */
  158.    GLboolean writeAll;
  159.  
  160.    /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */
  161.    GLenum primitive;
  162.  
  163.    /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */
  164.    GLuint facing;
  165.  
  166.    /**
  167.     * This bitmask (of  \link SpanFlags SPAN_* flags\endlink) indicates
  168.     * which of the x/xStep variables are relevant.
  169.     */
  170.    GLuint interpMask;
  171.  
  172. #if CHAN_TYPE == GL_FLOAT
  173.    GLfloat red, redStep;
  174.    GLfloat green, greenStep;
  175.    GLfloat blue, blueStep;
  176.    GLfloat alpha, alphaStep;
  177.    GLfloat specRed, specRedStep;
  178.    GLfloat specGreen, specGreenStep;
  179.    GLfloat specBlue, specBlueStep;
  180. #else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED SHORT */
  181.    GLfixed red, redStep;
  182.    GLfixed green, greenStep;
  183.    GLfixed blue, blueStep;
  184.    GLfixed alpha, alphaStep;
  185.    GLfixed specRed, specRedStep;
  186.    GLfixed specGreen, specGreenStep;
  187.    GLfixed specBlue, specBlueStep;
  188. #endif
  189.    GLfixed index, indexStep;
  190.    GLfixed z, zStep;
  191.    GLfloat fog, fogStep;
  192.    GLfloat tex[MAX_TEXTURE_UNITS][4];
  193.    GLfloat texStepX[MAX_TEXTURE_UNITS][4];
  194.    GLfloat texStepY[MAX_TEXTURE_UNITS][4];
  195.    GLfixed intTex[2], intTexStep[2];
  196.  
  197.    /**
  198.     * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates
  199.     * which of the fragment arrays in the span_arrays struct are relevant.
  200.     */
  201.    GLuint arrayMask;
  202.  
  203.    /**
  204.     * We store the arrays of fragment values in a separate struct so
  205.     * that we can allocate sw_span structs on the stack without using
  206.     * a lot of memory.  The span_arrays struct is about 400KB while the
  207.     * sw_span struct is only about 512 bytes.
  208.     */
  209.    struct span_arrays *array;
  210. };
  211.  
  212.  
  213. #define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK)    \
  214. do {                                \
  215.    (S).primitive = (PRIMITIVE);                    \
  216.    (S).interpMask = (INTERP_MASK);                \
  217.    (S).arrayMask = (ARRAY_MASK);                \
  218.    (S).start = 0;                        \
  219.    (S).end = (END);                        \
  220.    (S).facing = 0;                        \
  221.    (S).array = SWRAST_CONTEXT(ctx)->SpanArrays;            \
  222. } while (0)
  223.  
  224.  
  225.  
  226. struct swrast_device_driver;
  227.  
  228.  
  229. /* These are the public-access functions exported from swrast.
  230.  */
  231. extern void
  232. _swrast_alloc_buffers( GLframebuffer *buffer );
  233.  
  234. extern void
  235. _swrast_use_read_buffer( GLcontext *ctx );
  236.  
  237. extern void
  238. _swrast_use_draw_buffer( GLcontext *ctx );
  239.  
  240. extern GLboolean
  241. _swrast_CreateContext( GLcontext *ctx );
  242.  
  243. extern void
  244. _swrast_DestroyContext( GLcontext *ctx );
  245.  
  246. /* Get a (non-const) reference to the device driver struct for swrast.
  247.  */
  248. extern struct swrast_device_driver *
  249. _swrast_GetDeviceDriverReference( GLcontext *ctx );
  250.  
  251. extern void
  252. _swrast_Bitmap( GLcontext *ctx,
  253.         GLint px, GLint py,
  254.         GLsizei width, GLsizei height,
  255.         const struct gl_pixelstore_attrib *unpack,
  256.         const GLubyte *bitmap );
  257.  
  258. extern void
  259. _swrast_CopyPixels( GLcontext *ctx,
  260.             GLint srcx, GLint srcy,
  261.             GLint destx, GLint desty,
  262.             GLsizei width, GLsizei height,
  263.             GLenum type );
  264.  
  265. extern void
  266. _swrast_DrawPixels( GLcontext *ctx,
  267.             GLint x, GLint y,
  268.             GLsizei width, GLsizei height,
  269.             GLenum format, GLenum type,
  270.             const struct gl_pixelstore_attrib *unpack,
  271.             const GLvoid *pixels );
  272.  
  273. extern void
  274. _swrast_ReadPixels( GLcontext *ctx,
  275.             GLint x, GLint y, GLsizei width, GLsizei height,
  276.             GLenum format, GLenum type,
  277.             const struct gl_pixelstore_attrib *unpack,
  278.             GLvoid *pixels );
  279.  
  280. extern void
  281. _swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
  282.            GLint x, GLint y, GLint width, GLint height );
  283.  
  284. extern void
  285. _swrast_Accum( GLcontext *ctx, GLenum op,
  286.            GLfloat value, GLint xpos, GLint ypos,
  287.            GLint width, GLint height );
  288.  
  289.  
  290. extern void
  291. _swrast_DrawBuffer( GLcontext *ctx, GLenum mode );
  292.  
  293.  
  294. /* Reset the stipple counter
  295.  */
  296. extern void
  297. _swrast_ResetLineStipple( GLcontext *ctx );
  298.  
  299. /* These will always render the correct point/line/triangle for the
  300.  * current state.
  301.  *
  302.  * For flatshaded primitives, the provoking vertex is the final one.
  303.  */
  304. extern void
  305. _swrast_Point( GLcontext *ctx, const SWvertex *v );
  306.  
  307. extern void
  308. _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 );
  309.  
  310. extern void
  311. _swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
  312.                   const SWvertex *v1, const SWvertex *v2 );
  313.  
  314. extern void
  315. _swrast_Quad( GLcontext *ctx,
  316.               const SWvertex *v0, const SWvertex *v1,
  317.           const SWvertex *v2,  const SWvertex *v3);
  318.  
  319. extern void
  320. _swrast_flush( GLcontext *ctx );
  321.  
  322. extern void
  323. _swrast_render_primitive( GLcontext *ctx, GLenum mode );
  324.  
  325. extern void
  326. _swrast_render_start( GLcontext *ctx );
  327.  
  328. extern void
  329. _swrast_render_finish( GLcontext *ctx );
  330.  
  331. /* Tell the software rasterizer about core state changes.
  332.  */
  333. extern void
  334. _swrast_InvalidateState( GLcontext *ctx, GLuint new_state );
  335.  
  336. /* Configure software rasterizer to match hardware rasterizer characteristics:
  337.  */
  338. extern void
  339. _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value );
  340.  
  341. extern void
  342. _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
  343.  
  344. /* Debug:
  345.  */
  346. extern void
  347. _swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
  348.  
  349.  
  350. /*
  351.  * Imaging fallbacks (a better solution should be found, perhaps
  352.  * moving all the imaging fallback code to a new module) 
  353.  */
  354. extern void
  355. _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, 
  356.                 GLenum internalFormat, 
  357.                 GLint x, GLint y, GLsizei width, 
  358.                 GLsizei height);
  359. extern void
  360. _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, 
  361.                 GLenum internalFormat, 
  362.                 GLint x, GLint y, GLsizei width);
  363. extern void
  364. _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
  365.                GLint x, GLint y, GLsizei width);
  366. extern void
  367. _swrast_CopyColorTable( GLcontext *ctx, 
  368.             GLenum target, GLenum internalformat,
  369.             GLint x, GLint y, GLsizei width);
  370.  
  371.  
  372. /*
  373.  * Texture fallbacks, Brian Paul.  Could also live in a new module
  374.  * with the rest of the texture store fallbacks?
  375.  */
  376. extern void
  377. _swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level,
  378.                         GLenum internalFormat,
  379.                         GLint x, GLint y, GLsizei width, GLint border);
  380.  
  381. extern void
  382. _swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level,
  383.                         GLenum internalFormat,
  384.                         GLint x, GLint y, GLsizei width, GLsizei height,
  385.                         GLint border);
  386.  
  387.  
  388. extern void
  389. _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
  390.                            GLint xoffset, GLint x, GLint y, GLsizei width);
  391.  
  392. extern void
  393. _swrast_copy_texsubimage2d(GLcontext *ctx,
  394.                            GLenum target, GLint level,
  395.                            GLint xoffset, GLint yoffset,
  396.                            GLint x, GLint y, GLsizei width, GLsizei height);
  397.  
  398. extern void
  399. _swrast_copy_texsubimage3d(GLcontext *ctx,
  400.                            GLenum target, GLint level,
  401.                            GLint xoffset, GLint yoffset, GLint zoffset,
  402.                            GLint x, GLint y, GLsizei width, GLsizei height);
  403.  
  404.  
  405.  
  406. /* The driver interface for the software rasterizer.
  407.  * Unless otherwise noted, all functions are mandatory.  
  408.  */
  409. struct swrast_device_driver {
  410.  
  411.    void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit);
  412.    /*
  413.     * Specifies the current buffer for span/pixel writing/reading.
  414.     * buffer indicates which window to write to / read from.  Normally,
  415.     * this'll be the buffer currently bound to the context, but it doesn't
  416.     * have to be!
  417.     * bufferBit indicates which color buffer, one of:
  418.     *    FRONT_LEFT_BIT - this buffer always exists
  419.     *    BACK_LEFT_BIT - when double buffering
  420.     *    FRONT_RIGHT_BIT - when using stereo
  421.     *    BACK_RIGHT_BIT - when using stereo and double buffering
  422.     *    AUXn_BIT - if aux buffers are implemented
  423.     */
  424.  
  425.  
  426.    /***
  427.     *** Functions for synchronizing access to the framebuffer:
  428.     ***/
  429.  
  430.    void (*SpanRenderStart)(GLcontext *ctx);
  431.    void (*SpanRenderFinish)(GLcontext *ctx);
  432.    /* OPTIONAL.
  433.     *
  434.     * Called before and after all rendering operations, including DrawPixels,
  435.     * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
  436.     * These are a suitable place for grabbing/releasing hardware locks.
  437.     *
  438.     * NOTE: The swrast triangle/line/point routines *DO NOT* call
  439.     * these functions.  Locking in that case must be organized by the
  440.     * driver by other mechanisms.
  441.     */
  442.  
  443.    /***
  444.     *** Functions for writing pixels to the frame buffer:
  445.     ***/
  446.  
  447.    void (*WriteRGBASpan)( const GLcontext *ctx,
  448.                           GLuint n, GLint x, GLint y,
  449.                           CONST GLchan rgba[][4], const GLubyte mask[] );
  450.    void (*WriteRGBSpan)( const GLcontext *ctx,
  451.                          GLuint n, GLint x, GLint y,
  452.                          CONST GLchan rgb[][3], const GLubyte mask[] );
  453.    /* Write a horizontal run of RGBA or RGB pixels.
  454.     * If mask is NULL, draw all pixels.
  455.     * If mask is not null, only draw pixel [i] when mask [i] is true.
  456.     */
  457.  
  458.    void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  459.                               const GLchan color[4], const GLubyte mask[] );
  460.    /* Write a horizontal run of RGBA pixels all with the same color.
  461.     * If mask is NULL, draw all pixels.
  462.     * If mask is not null, only draw pixel [i] when mask [i] is true.
  463.     */
  464.  
  465.    void (*WriteRGBAPixels)( const GLcontext *ctx,
  466.                             GLuint n, const GLint x[], const GLint y[],
  467.                             CONST GLchan rgba[][4], const GLubyte mask[] );
  468.    /* Write array of RGBA pixels at random locations.
  469.     */
  470.  
  471.    void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
  472.                                 GLuint n, const GLint x[], const GLint y[],
  473.                                 const GLchan color[4], const GLubyte mask[] );
  474.    /* Write an array of mono-RGBA pixels at random locations.
  475.     */
  476.  
  477.    void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  478.                           const GLuint index[], const GLubyte mask[] );
  479.    void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  480.                          const GLubyte index[], const GLubyte mask[] );
  481.    /* Write a horizontal run of CI pixels.  One function is for 32bpp
  482.     * indexes and the other for 8bpp pixels (the common case).  You mus
  483.     * implement both for color index mode.
  484.     * If mask is NULL, draw all pixels.
  485.     * If mask is not null, only draw pixel [i] when mask [i] is true.
  486.     */
  487.  
  488.    void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  489.                             GLuint colorIndex, const GLubyte mask[] );
  490.    /* Write a horizontal run of color index pixels using the color index
  491.     * last specified by the Index() function.
  492.     * If mask is NULL, draw all pixels.
  493.     * If mask is not null, only draw pixel [i] when mask [i] is true.
  494.     */
  495.  
  496.    void (*WriteCI32Pixels)( const GLcontext *ctx,
  497.                             GLuint n, const GLint x[], const GLint y[],
  498.                             const GLuint index[], const GLubyte mask[] );
  499.    /*
  500.     * Write a random array of CI pixels.
  501.     */
  502.  
  503.    void (*WriteMonoCIPixels)( const GLcontext *ctx,
  504.                               GLuint n, const GLint x[], const GLint y[],
  505.                               GLuint colorIndex, const GLubyte mask[] );
  506.    /* Write a random array of color index pixels using the color index
  507.     * last specified by the Index() function.
  508.     */
  509.  
  510.  
  511.    /***
  512.     *** Functions to read pixels from frame buffer:
  513.     ***/
  514.  
  515.    void (*ReadCI32Span)( const GLcontext *ctx,
  516.                          GLuint n, GLint x, GLint y, GLuint index[] );
  517.    /* Read a horizontal run of color index pixels.
  518.     */
  519.  
  520.    void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
  521.                          GLchan rgba[][4] );
  522.    /* Read a horizontal run of RGBA pixels.
  523.     */
  524.  
  525.    void (*ReadCI32Pixels)( const GLcontext *ctx,
  526.                            GLuint n, const GLint x[], const GLint y[],
  527.                            GLuint indx[], const GLubyte mask[] );
  528.    /* Read a random array of CI pixels.
  529.     */
  530.  
  531.    void (*ReadRGBAPixels)( const GLcontext *ctx,
  532.                            GLuint n, const GLint x[], const GLint y[],
  533.                            GLchan rgba[][4], const GLubyte mask[] );
  534.    /* Read a random array of RGBA pixels.
  535.     */
  536.  
  537.  
  538.  
  539.    /***
  540.     *** For supporting hardware Z buffers:
  541.     *** Either ALL or NONE of these functions must be implemented!
  542.     *** NOTE that Each depth value is a 32-bit GLuint.  If the depth
  543.     *** buffer is less than 32 bits deep then the extra upperbits are zero.
  544.     ***/
  545.  
  546.    void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
  547.                            const GLdepth depth[], const GLubyte mask[] );
  548.    /* Write a horizontal span of values into the depth buffer.  Only write
  549.     * depth[i] value if mask[i] is nonzero.
  550.     */
  551.  
  552.    void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
  553.                           GLdepth depth[] );
  554.    /* Read a horizontal span of values from the depth buffer.
  555.     */
  556.  
  557.  
  558.    void (*WriteDepthPixels)( GLcontext *ctx, GLuint n,
  559.                              const GLint x[], const GLint y[],
  560.                              const GLdepth depth[], const GLubyte mask[] );
  561.    /* Write an array of randomly positioned depth values into the
  562.     * depth buffer.  Only write depth[i] value if mask[i] is nonzero.
  563.     */
  564.  
  565.    void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
  566.                             const GLint x[], const GLint y[],
  567.                             GLdepth depth[] );
  568.    /* Read an array of randomly positioned depth values from the depth buffer.
  569.     */
  570.  
  571.  
  572.  
  573.    /***
  574.     *** For supporting hardware stencil buffers:
  575.     *** Either ALL or NONE of these functions must be implemented!
  576.     ***/
  577.  
  578.    void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
  579.                              const GLstencil stencil[], const GLubyte mask[] );
  580.    /* Write a horizontal span of stencil values into the stencil buffer.
  581.     * If mask is NULL, write all stencil values.
  582.     * Else, only write stencil[i] if mask[i] is non-zero.
  583.     */
  584.  
  585.    void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
  586.                             GLstencil stencil[] );
  587.    /* Read a horizontal span of stencil values from the stencil buffer.
  588.     */
  589.  
  590.    void (*WriteStencilPixels)( GLcontext *ctx, GLuint n,
  591.                                const GLint x[], const GLint y[],
  592.                                const GLstencil stencil[],
  593.                                const GLubyte mask[] );
  594.    /* Write an array of stencil values into the stencil buffer.
  595.     * If mask is NULL, write all stencil values.
  596.     * Else, only write stencil[i] if mask[i] is non-zero.
  597.     */
  598.  
  599.    void (*ReadStencilPixels)( GLcontext *ctx, GLuint n,
  600.                               const GLint x[], const GLint y[],
  601.                               GLstencil stencil[] );
  602.    /* Read an array of stencil values from the stencil buffer.
  603.     */
  604. };
  605.  
  606.  
  607.  
  608. #endif
  609.