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