Subversion Repositories shark

Rev

Rev 55 | Details | Compare with Previous | Last modification | View Log | RSS feed

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