dd.h revision 0cb28418d06c30e431bdff515c1d36a812d5950d
1/* $Id: dd.h,v 1.66 2002/02/13 00:53:19 keithw Exp $ */
2
3/*
4 * Mesa 3-D graphics library
5 * Version:  3.5
6 *
7 * Copyright (C) 1999-2001  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/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
33
34struct gl_pixelstore_attrib;
35
36/* Mask bits sent to the driver Clear() function */
37#define DD_FRONT_LEFT_BIT  FRONT_LEFT_BIT         /* 1 */
38#define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT        /* 2 */
39#define DD_BACK_LEFT_BIT   BACK_LEFT_BIT          /* 4 */
40#define DD_BACK_RIGHT_BIT  BACK_RIGHT_BIT         /* 8 */
41#define DD_DEPTH_BIT       GL_DEPTH_BUFFER_BIT    /* 0x00000100 */
42#define DD_STENCIL_BIT     GL_STENCIL_BUFFER_BIT  /* 0x00000400 */
43#define DD_ACCUM_BIT       GL_ACCUM_BUFFER_BIT    /* 0x00000200 */
44
45
46/*
47 * Device Driver function table.
48 */
49struct dd_function_table {
50
51   /**********************************************************************
52    *** Mandatory functions:  these functions must be implemented by   ***
53    *** every device driver.                                           ***
54    **********************************************************************/
55
56   const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
57   /* Return a string as needed by glGetString().
58    * Only the GL_RENDERER token must be implemented.  Otherwise,
59    * NULL can be returned.
60    */
61
62   void (*UpdateState)( GLcontext *ctx, GLuint new_state );
63   /*
64    * UpdateState() is called to notify the driver after Mesa has made
65    * some internal state changes.  This is in addition to any
66    * statechange callbacks Mesa may already have made.
67    */
68
69   void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
70		  GLint x, GLint y, GLint width, GLint height );
71   /* Clear the color/depth/stencil/accum buffer(s).
72    * 'mask' is a bitmask of the DD_*_BIT values defined above that indicates
73    * which buffers need to be cleared.
74    * If 'all' is true then the clear the whole buffer, else clear only the
75    * region defined by (x,y,width,height).
76    * This function must obey the glColorMask, glIndexMask and glStencilMask
77    * settings!  Software Mesa can do masked clears if the device driver can't.
78    */
79
80   GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
81   /*
82    * Specifies the current buffer for writing.
83    * The following values must be accepted when applicable:
84    *    GL_FRONT_LEFT - this buffer always exists
85    *    GL_BACK_LEFT - when double buffering
86    *    GL_FRONT_RIGHT - when using stereo
87    *    GL_BACK_RIGHT - when using stereo and double buffering
88    * The folowing values may optionally be accepted.  Return GL_TRUE
89    * if accepted, GL_FALSE if not accepted.  In practice, only drivers
90    * which can write to multiple color buffers at once should accept
91    * these values.
92    *    GL_FRONT - write to front left and front right if it exists
93    *    GL_BACK - write to back left and back right if it exists
94    *    GL_LEFT - write to front left and back left if it exists
95    *    GL_RIGHT - write to right left and back right if they exist
96    *    GL_FRONT_AND_BACK - write to all four buffers if they exist
97    *    GL_NONE - disable buffer write in device driver.
98    */
99
100   void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
101   /*
102    * Returns the width and height of the current color buffer.
103    */
104
105   void (*Finish)( GLcontext *ctx );
106   /*
107    * This is called whenever glFinish() is called.
108    */
109
110   void (*Flush)( GLcontext *ctx );
111   /*
112    * This is called whenever glFlush() is called.
113    */
114
115   void (*Error)( GLcontext *ctx );
116   /*
117    * Called whenever an error is generated.  ctx->ErrorValue contains
118    * the error value.
119    */
120
121
122   /***
123    *** For hardware accumulation buffer:
124    ***/
125   void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
126		  GLint xpos, GLint ypos, GLint width, GLint height );
127   /* Execute glAccum command within the given scissor region.
128    */
129
130
131   /***
132    *** glDraw/Read/CopyPixels and glBitmap functions:
133    ***/
134
135   void (*DrawPixels)( GLcontext *ctx,
136		       GLint x, GLint y, GLsizei width, GLsizei height,
137		       GLenum format, GLenum type,
138		       const struct gl_pixelstore_attrib *unpack,
139		       const GLvoid *pixels );
140   /* This is called by glDrawPixels.
141    * 'unpack' describes how to unpack the source image data.
142    */
143
144   void (*ReadPixels)( GLcontext *ctx,
145		       GLint x, GLint y, GLsizei width, GLsizei height,
146		       GLenum format, GLenum type,
147		       const struct gl_pixelstore_attrib *unpack,
148		       GLvoid *dest );
149   /* Called by glReadPixels.
150    */
151
152   void (*CopyPixels)( GLcontext *ctx,
153                            GLint srcx, GLint srcy,
154                            GLsizei width, GLsizei height,
155                            GLint dstx, GLint dsty, GLenum type );
156   /* Do a glCopyPixels.  This function must respect all rasterization
157    * state, glPixelTransfer, glPixelZoom, etc.
158    */
159
160   void (*Bitmap)( GLcontext *ctx,
161		   GLint x, GLint y, GLsizei width, GLsizei height,
162		   const struct gl_pixelstore_attrib *unpack,
163		   const GLubyte *bitmap );
164   /* This is called by glBitmap.  Works the same as DrawPixels, above.
165    */
166
167   void (*ResizeBuffersMESA)( GLcontext *ctx );
168
169
170   /***
171    *** Texture image functions:
172    ***/
173   const struct gl_texture_format *
174   (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
175                           GLenum srcFormat, GLenum srcType );
176   /* This is called by the _mesa_store_tex[sub]image[123]d() fallback
177    * functions.  The driver should examine <internalFormat> and return a
178    * pointer to an appropriate gl_texture_format.
179    */
180
181   void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
182                       GLint internalFormat,
183                       GLint width, GLint border,
184                       GLenum format, GLenum type, const GLvoid *pixels,
185                       const struct gl_pixelstore_attrib *packing,
186                       struct gl_texture_object *texObj,
187                       struct gl_texture_image *texImage );
188   void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
189                       GLint internalFormat,
190                       GLint width, GLint height, GLint border,
191                       GLenum format, GLenum type, const GLvoid *pixels,
192                       const struct gl_pixelstore_attrib *packing,
193                       struct gl_texture_object *texObj,
194                       struct gl_texture_image *texImage );
195   void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
196                       GLint internalFormat,
197                       GLint width, GLint height, GLint depth, GLint border,
198                       GLenum format, GLenum type, const GLvoid *pixels,
199                       const struct gl_pixelstore_attrib *packing,
200                       struct gl_texture_object *texObj,
201                       struct gl_texture_image *texImage );
202   /* Called by glTexImage1/2/3D.
203    * Arguments:
204    *   <target>, <level>, <format>, <type> and <pixels> are user specified.
205    *   <packing> indicates the image packing of pixels.
206    *   <texObj> is the target texture object.
207    *   <texImage> is the target texture image.  It will have the texture
208    *      width, height, depth, border and internalFormat information.
209    *   <retainInternalCopy> is returned by this function and indicates whether
210    *      core Mesa should keep an internal copy of the texture image.
211    * Drivers should call a fallback routine from texstore.c if needed.
212    */
213
214   void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
215                          GLint xoffset, GLsizei width,
216                          GLenum format, GLenum type,
217                          const GLvoid *pixels,
218                          const struct gl_pixelstore_attrib *packing,
219                          struct gl_texture_object *texObj,
220                          struct gl_texture_image *texImage );
221   void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
222                          GLint xoffset, GLint yoffset,
223                          GLsizei width, GLsizei height,
224                          GLenum format, GLenum type,
225                          const GLvoid *pixels,
226                          const struct gl_pixelstore_attrib *packing,
227                          struct gl_texture_object *texObj,
228                          struct gl_texture_image *texImage );
229   void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
230                          GLint xoffset, GLint yoffset, GLint zoffset,
231                          GLsizei width, GLsizei height, GLint depth,
232                          GLenum format, GLenum type,
233                          const GLvoid *pixels,
234                          const struct gl_pixelstore_attrib *packing,
235                          struct gl_texture_object *texObj,
236                          struct gl_texture_image *texImage );
237   /* Called by glTexSubImage1/2/3D.
238    * Arguments:
239    *   <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>,
240    *      <depth>, <format>, <type> and <pixels> are user specified.
241    *   <packing> indicates the image packing of pixels.
242    *   <texObj> is the target texture object.
243    *   <texImage> is the target texture image.  It will have the texture
244    *      width, height, border and internalFormat information.
245    * The driver should use a fallback routine from texstore.c if needed.
246    */
247
248   void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
249                           GLenum internalFormat, GLint x, GLint y,
250                           GLsizei width, GLint border );
251   void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
252                           GLenum internalFormat, GLint x, GLint y,
253                           GLsizei width, GLsizei height, GLint border );
254   /* Called by glCopyTexImage1D and glCopyTexImage2D.
255    * Drivers should use a fallback routine from texstore.c if needed.
256    */
257
258   void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
259                              GLint xoffset,
260                              GLint x, GLint y, GLsizei width );
261   void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
262                              GLint xoffset, GLint yoffset,
263                              GLint x, GLint y,
264                              GLsizei width, GLsizei height );
265   void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
266                              GLint xoffset, GLint yoffset, GLint zoffset,
267                              GLint x, GLint y,
268                              GLsizei width, GLsizei height );
269   /* Called by glCopyTexSubImage1/2/3D.
270    * Drivers should use a fallback routine from texstore.c if needed.
271    */
272
273   GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
274                                  GLint level, GLint internalFormat,
275                                  GLenum format, GLenum type,
276                                  GLint width, GLint height,
277                                  GLint depth, GLint border);
278   /* Called by glTexImage[123]D when user specifies a proxy texture
279    * target.  Return GL_TRUE if the proxy test passes, return GL_FALSE
280    * if the test fails.
281    */
282
283   /***
284    *** Compressed texture functions:
285    ***/
286
287   void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
288                                 GLint level, GLint internalFormat,
289                                 GLsizei width, GLint border,
290                                 GLsizei imageSize, const GLvoid *data,
291                                 struct gl_texture_object *texObj,
292                                 struct gl_texture_image *texImage );
293   void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
294                                 GLint level, GLint internalFormat,
295                                 GLsizei width, GLsizei height, GLint border,
296                                 GLsizei imageSize, const GLvoid *data,
297                                 struct gl_texture_object *texObj,
298                                 struct gl_texture_image *texImage );
299   void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
300                                 GLint level, GLint internalFormat,
301                                 GLsizei width, GLsizei height, GLsizei depth,
302                                 GLint border,
303                                 GLsizei imageSize, const GLvoid *data,
304                                 struct gl_texture_object *texObj,
305                                 struct gl_texture_image *texImage );
306   /* Called by glCompressedTexImage1/2/3D.
307    * Arguments:
308    *   <target>, <level>, <internalFormat>, <data> are user specified.
309    *   <texObj> is the target texture object.
310    *   <texImage> is the target texture image.  It will have the texture
311    *      width, height, depth, border and internalFormat information.
312    *   <retainInternalCopy> is returned by this function and indicates whether
313    *      core Mesa should keep an internal copy of the texture image.
314    * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
315    * should do the job.
316    */
317
318   void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
319                                   GLint xoffset, GLsizei width,
320                                   GLenum format,
321                                   GLsizei imageSize, const GLvoid *data,
322                                   struct gl_texture_object *texObj,
323                                   struct gl_texture_image *texImage);
324   void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
325                                   GLint xoffset, GLint yoffset,
326                                   GLsizei width, GLint height,
327                                   GLenum format,
328                                   GLsizei imageSize, const GLvoid *data,
329                                   struct gl_texture_object *texObj,
330                                   struct gl_texture_image *texImage);
331   void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
332                                   GLint xoffset, GLint yoffset, GLint zoffset,
333                                   GLsizei width, GLint height, GLint depth,
334                                   GLenum format,
335                                   GLsizei imageSize, const GLvoid *data,
336                                   struct gl_texture_object *texObj,
337                                   struct gl_texture_image *texImage);
338   /* Called by glCompressedTexSubImage1/2/3D.
339    * Arguments:
340    *   <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>,
341    *      <imageSize>, and <data> are user specified.
342    *   <texObj> is the target texture object.
343    *   <texImage> is the target texture image.  It will have the texture
344    *      width, height, depth, border and internalFormat information.
345    * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
346    * should do the job.
347    */
348
349   void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
350                                  GLint level, void *image,
351                                  const struct gl_texture_object *texObj,
352                                  struct gl_texture_image *texImage );
353   /* Called by glGetCompressedTexImageARB.
354    * <target>, <level>, <image> are specified by user.
355    * <texObj> is the source texture object.
356    * <texImage> is the source texture image.
357    */
358
359   GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
360                                    GLint internalFormat);
361   /* Called to compute the base format for a specific compressed
362    * format.  Return -1 if the internalFormat is not a specific
363    * compressed format that the driver recognizes.
364    * Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB.
365    */
366
367   GLint (*CompressedTextureSize)(GLcontext *ctx,
368                                  const struct gl_texture_image *texImage);
369
370#if 000
371   /* ... Note the
372    * return value differences between this function and
373    * SpecificCompressedTexFormat below.
374    */
375
376   GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
377                                        GLint      internalFormat,
378                                        GLint      numDimensions,
379                                        GLint     *levelp,
380                                        GLsizei   *widthp,
381                                        GLsizei   *heightp,
382                                        GLsizei   *depthp,
383                                        GLint     *borderp,
384                                        GLenum    *formatp,
385                                        GLenum    *typep);
386   /* Called to turn a generic texture format into a specific
387    * texture format.  For example, if a driver implements
388    * GL_3DFX_texture_compression_FXT1, this would map
389    * GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX.
390    *
391    * If the driver does not know how to handle the compressed
392    * format, then just return the generic format, and Mesa will
393    * do the right thing with it.
394    */
395
396#endif
397
398   /***
399    *** Texture object functions:
400    ***/
401
402   void (*BindTexture)( GLcontext *ctx, GLenum target,
403                        struct gl_texture_object *tObj );
404   /* Called by glBindTexture().
405    */
406
407   void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
408   /* Called when a texture object is created.
409    */
410
411   void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
412   /* Called when a texture object is about to be deallocated.  Driver
413    * should free anything attached to the DriverData pointers.
414    */
415
416   GLboolean (*IsTextureResident)( GLcontext *ctx,
417                                   struct gl_texture_object *t );
418   /* Called by glAreTextureResident().
419    */
420
421   void (*PrioritizeTexture)( GLcontext *ctx,  struct gl_texture_object *t,
422                              GLclampf priority );
423   /* Called by glPrioritizeTextures().
424    */
425
426   void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
427   /* Called by glActiveTextureARB to set current texture unit.
428    */
429
430   void (*UpdateTexturePalette)( GLcontext *ctx,
431                                 struct gl_texture_object *tObj );
432   /* Called when the texture's color lookup table is changed.
433    * If tObj is NULL then the shared texture palette ctx->Texture.Palette
434    * is to be updated.
435    */
436
437   /***
438    *** Imaging functionality:
439    ***/
440   void (*CopyColorTable)( GLcontext *ctx,
441			   GLenum target, GLenum internalformat,
442			   GLint x, GLint y, GLsizei width );
443
444   void (*CopyColorSubTable)( GLcontext *ctx,
445			      GLenum target, GLsizei start,
446			      GLint x, GLint y, GLsizei width );
447
448   void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
449				    GLenum internalFormat,
450				    GLint x, GLint y, GLsizei width );
451
452   void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
453				    GLenum internalFormat,
454				    GLint x, GLint y,
455				    GLsizei width, GLsizei height );
456
457
458
459   /***
460    *** State-changing functions (drawing functions are above)
461    ***
462    *** These functions are called by their corresponding OpenGL API functions.
463    *** They're ALSO called by the gl_PopAttrib() function!!!
464    *** May add more functions like these to the device driver in the future.
465    ***/
466   void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLchan ref);
467   void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
468   void (*BlendEquation)(GLcontext *ctx, GLenum mode);
469   void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
470   void (*BlendFuncSeparate)(GLcontext *ctx,
471                             GLenum sfactorRGB, GLenum dfactorRGB,
472                             GLenum sfactorA, GLenum dfactorA);
473   void (*ClearColor)(GLcontext *ctx, const GLchan color[4]);
474   void (*ClearDepth)(GLcontext *ctx, GLclampd d);
475   void (*ClearIndex)(GLcontext *ctx, GLuint index);
476   void (*ClearStencil)(GLcontext *ctx, GLint s);
477   void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
478   void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
479                     GLboolean bmask, GLboolean amask );
480   void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
481   void (*CullFace)(GLcontext *ctx, GLenum mode);
482   void (*FrontFace)(GLcontext *ctx, GLenum mode);
483   void (*DepthFunc)(GLcontext *ctx, GLenum func);
484   void (*DepthMask)(GLcontext *ctx, GLboolean flag);
485   void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
486   void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
487   void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
488   void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
489   void (*IndexMask)(GLcontext *ctx, GLuint mask);
490   void (*Lightfv)(GLcontext *ctx, GLenum light,
491		   GLenum pname, const GLfloat *params );
492   void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
493   void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
494   void (*LineWidth)(GLcontext *ctx, GLfloat width);
495   void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
496   void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
497                            const GLfloat *params);
498   void (*PointSize)(GLcontext *ctx, GLfloat size);
499   void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
500   void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
501   void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
502   void (*RenderMode)(GLcontext *ctx, GLenum mode );
503   void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
504   void (*ShadeModel)(GLcontext *ctx, GLenum mode);
505   void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
506   void (*StencilMask)(GLcontext *ctx, GLuint mask);
507   void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
508   void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
509		  const GLfloat *params);
510   void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
511                  const GLfloat *param);
512   void (*TexParameter)(GLcontext *ctx, GLenum target,
513                        struct gl_texture_object *texObj,
514                        GLenum pname, const GLfloat *params);
515   void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
516   void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
517
518
519   /***
520    *** Vertex array functions
521    ***
522    *** Called by the corresponding OpenGL functions.
523    ***/
524   void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
525			 GLsizei stride, const GLvoid *ptr);
526   void (*NormalPointer)(GLcontext *ctx, GLenum type,
527			 GLsizei stride, const GLvoid *ptr);
528   void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
529			GLsizei stride, const GLvoid *ptr);
530   void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
531			   GLsizei stride, const GLvoid *ptr);
532   void (*IndexPointer)(GLcontext *ctx, GLenum type,
533			GLsizei stride, const GLvoid *ptr);
534   void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
535				 GLsizei stride, const GLvoid *ptr);
536   void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
537			   GLsizei stride, const GLvoid *ptr);
538   void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
539
540
541   /*** State-query functions
542    ***
543    *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
544    ***/
545   GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
546   GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
547   GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
548   GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
549   GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
550
551
552
553   /***
554    *** Support for multiple t&l engines
555    ***/
556
557   GLuint NeedValidate;
558   /* Bitmask of state changes that require the current tnl module to be
559    * validated, using ValidateTnlModule() below.
560    */
561
562   void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
563   /* Validate the current tnl module.  This is called directly after
564    * UpdateState() when a state change that has occured matches the
565    * NeedValidate bitmask above.  This ensures all computed values are
566    * up to date, thus allowing the driver to decide if the current tnl
567    * module needs to be swapped out.
568    *
569    * This must be non-NULL if a driver installs a custom tnl module and
570    * sets the NeedValidate bitmask, but may be NULL otherwise.
571    */
572
573
574#define PRIM_OUTSIDE_BEGIN_END   GL_POLYGON+1
575#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
576#define PRIM_UNKNOWN             GL_POLYGON+3
577
578   GLuint CurrentExecPrimitive;
579   /* Set by the driver-supplied t&l engine.  Set to
580    * PRIM_OUTSIDE_BEGIN_END when outside begin/end.
581    */
582
583   GLuint CurrentSavePrimitive;
584   /* Current state of an in-progress compilation.  May take on any of
585    * the additional values defined above.
586    */
587
588
589#define FLUSH_STORED_VERTICES 0x1
590#define FLUSH_UPDATE_CURRENT  0x2
591   GLuint NeedFlush;
592   /* Set by the driver-supplied t&l engine whenever vertices are
593    * buffered between begin/end objects or ctx->Current is not uptodate.
594    *
595    * The FlushVertices() call below may be used to resolve
596    * these conditions.
597    */
598
599   void (*FlushVertices)( GLcontext *ctx, GLuint flags );
600   /* If inside begin/end, ASSERT(0).
601    * Otherwise,
602    *   if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
603    *   if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
604    *                                     and ctx->Light.Material
605    *
606    * Note that the default t&l engine never clears the
607    * FLUSH_UPDATE_CURRENT bit, even after performing the update.
608    */
609
610   void (*LightingSpaceChange)( GLcontext *ctx );
611   /* Notify driver that the special derived value _NeedEyeCoords has
612    * changed.
613    */
614
615   void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
616   void (*EndList)( GLcontext *ctx );
617   /* Let the t&l component know what is going on with display lists
618    * in time to make changes to dispatch tables, etc.
619    * Called by glNewList() and glEndList(), respectively.
620    */
621
622   void (*BeginCallList)( GLcontext *ctx, GLuint list );
623   void (*EndCallList)( GLcontext *ctx );
624   /* Notify the t&l component before and after calling a display list.
625    * Called by glCallList(s), but not recursively.
626    */
627
628   void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
629			GLframebuffer *readBuffer );
630   /* Let the t&l component know when the context becomes current.
631    */
632
633
634   void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
635   void (*UnlockArraysEXT)( GLcontext *ctx );
636   /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
637    */
638};
639
640
641
642/*
643 * Transform/Clip/Lighting interface
644 */
645typedef struct {
646   void (*ArrayElement)( GLint ); /* NOTE */
647   void (*Color3f)( GLfloat, GLfloat, GLfloat );
648   void (*Color3fv)( const GLfloat * );
649   void (*Color3ub)( GLubyte, GLubyte, GLubyte );
650   void (*Color3ubv)( const GLubyte * );
651   void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
652   void (*Color4fv)( const GLfloat * );
653   void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
654   void (*Color4ubv)( const GLubyte * );
655   void (*EdgeFlag)( GLboolean );
656   void (*EdgeFlagv)( const GLboolean * );
657   void (*EvalCoord1f)( GLfloat );          /* NOTE */
658   void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
659   void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
660   void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
661   void (*EvalPoint1)( GLint );             /* NOTE */
662   void (*EvalPoint2)( GLint, GLint );      /* NOTE */
663   void (*FogCoordfEXT)( GLfloat );
664   void (*FogCoordfvEXT)( const GLfloat * );
665   void (*Indexi)( GLint );
666   void (*Indexiv)( const GLint * );
667   void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
668   void (*MultiTexCoord1fARB)( GLenum, GLfloat );
669   void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * );
670   void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
671   void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * );
672   void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
673   void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * );
674   void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
675   void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * );
676   void (*Normal3f)( GLfloat, GLfloat, GLfloat );
677   void (*Normal3fv)( const GLfloat * );
678   void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
679   void (*SecondaryColor3fvEXT)( const GLfloat * );
680   void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
681   void (*SecondaryColor3ubvEXT)( const GLubyte * );
682   void (*TexCoord1f)( GLfloat );
683   void (*TexCoord1fv)( const GLfloat * );
684   void (*TexCoord2f)( GLfloat, GLfloat );
685   void (*TexCoord2fv)( const GLfloat * );
686   void (*TexCoord3f)( GLfloat, GLfloat, GLfloat );
687   void (*TexCoord3fv)( const GLfloat * );
688   void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
689   void (*TexCoord4fv)( const GLfloat * );
690   void (*Vertex2f)( GLfloat, GLfloat );
691   void (*Vertex2fv)( const GLfloat * );
692   void (*Vertex3f)( GLfloat, GLfloat, GLfloat );
693   void (*Vertex3fv)( const GLfloat * );
694   void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
695   void (*Vertex4fv)( const GLfloat * );
696   void (*CallList)( GLuint );	/* NOTE */
697   void (*Begin)( GLenum );
698   void (*End)( void );
699   void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
700   void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
701
702   /* Drivers present a reduced set of the functions possible in
703    * begin/end objects.  Core mesa provides translation stubs for the
704    * remaining functions to map down to these entrypoints.
705    *
706    * These are the initial values to be installed into dispatch by
707    * mesa.  If the t&l driver wants to modify the dispatch table
708    * while installed, it must do so itself.  It would be possible for
709    * the vertexformat to install it's own initial values for these
710    * functions, but this way there is an obvious list of what is
711    * expected of the driver.
712    *
713    * If the driver wants to hook in entrypoints other than those
714    * listed above, it must restore them to their original values in
715    * the disable() callback, below.
716    */
717
718   void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
719   /*
720    */
721
722   void (*DrawArrays)( GLenum mode, GLint start, GLsizei count );
723   void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
724			 const GLvoid *indices );
725   void (*DrawRangeElements)( GLenum mode, GLuint start,
726			      GLuint end, GLsizei count,
727			      GLenum type, const GLvoid *indices );
728   /* These may or may not belong here.  Heuristic: If an array is
729    * enabled, the installed vertex format should support that array and
730    * it's current size natively.
731    */
732
733   void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
734   void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
735   /* If you don't support eval, fallback to the default vertex format
736    * on receiving an eval call and use the pipeline mechanism to
737    * provide partial t&l acceleration.
738    *
739    * Mesa will provide a set of helper functions to do eval within
740    * accelerated vertex formats, eventually...
741    */
742
743   GLboolean prefer_float_colors;
744   /* Should core try to send colors to glColor4f or glColor4chan,
745    * where it has a choice?
746    */
747} GLvertexformat;
748
749
750#endif /* DD_INCLUDED */
751