e69ad2d740f6c8dd7e1b083d01d14b1757a24d64
[mesa.git] / src / mesa / main / dd.h
1 /* $Id: dd.h,v 1.61 2001/04/04 21:54:20 brianp 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
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 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 GLboolean (*IsCompressedFormat)(GLcontext *ctx, GLint internalFormat);
350 /* Called to tell if a format is a compressed format.
351 */
352
353 void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
354 GLint lod, void *image,
355 const struct gl_texture_object *texObj,
356 struct gl_texture_image *texImage );
357 /* Called by glGetCompressedTexImageARB.
358 * <target>, <lod>, <image> are specified by user.
359 * <texObj> is the source texture object.
360 * <texImage> is the source texture image.
361 */
362
363 GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
364 GLint internalFormat);
365 /* Called to compute the base format for a specific compressed
366 * format. Return -1 if the internalFormat is not a specific
367 * compressed format that the driver recognizes.
368 * Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB.
369 */
370
371 #if 000
372 /* ... Note the
373 * return value differences between this function and
374 * SpecificCompressedTexFormat below.
375 */
376
377 GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
378 GLint internalFormat,
379 GLint numDimensions,
380 GLint *levelp,
381 GLsizei *widthp,
382 GLsizei *heightp,
383 GLsizei *depthp,
384 GLint *borderp,
385 GLenum *formatp,
386 GLenum *typep);
387 /* Called to turn a generic texture format into a specific
388 * texture format. For example, if a driver implements
389 * GL_3DFX_texture_compression_FXT1, this would map
390 * GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX.
391 *
392 * If the driver does not know how to handle the compressed
393 * format, then just return the generic format, and Mesa will
394 * do the right thing with it.
395 */
396
397 GLsizei (*CompressedImageSize)(GLcontext *ctx,
398 GLenum internalFormat,
399 GLuint numDimensions,
400 GLuint width,
401 GLuint height,
402 GLuint depth);
403 /* Calculate the size of a compressed image, given the image's
404 * format and dimensions.
405 */
406 #endif
407
408 /***
409 *** Texture object functions:
410 ***/
411
412 void (*BindTexture)( GLcontext *ctx, GLenum target,
413 struct gl_texture_object *tObj );
414 /* Called by glBindTexture().
415 */
416
417 void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
418 /* Called when a texture object is created.
419 */
420
421 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
422 /* Called when a texture object is about to be deallocated. Driver
423 * should free anything attached to the DriverData pointers.
424 */
425
426 GLboolean (*IsTextureResident)( GLcontext *ctx,
427 struct gl_texture_object *t );
428 /* Called by glAreTextureResident().
429 */
430
431 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
432 GLclampf priority );
433 /* Called by glPrioritizeTextures().
434 */
435
436 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
437 /* Called by glActiveTextureARB to set current texture unit.
438 */
439
440 void (*UpdateTexturePalette)( GLcontext *ctx,
441 struct gl_texture_object *tObj );
442 /* Called when the texture's color lookup table is changed.
443 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
444 * is to be updated.
445 */
446
447 /***
448 *** Imaging functionality:
449 ***/
450 void (*CopyColorTable)( GLcontext *ctx,
451 GLenum target, GLenum internalformat,
452 GLint x, GLint y, GLsizei width );
453
454 void (*CopyColorSubTable)( GLcontext *ctx,
455 GLenum target, GLsizei start,
456 GLint x, GLint y, GLsizei width );
457
458 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
459 GLenum internalFormat,
460 GLint x, GLint y, GLsizei width );
461
462 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
463 GLenum internalFormat,
464 GLint x, GLint y,
465 GLsizei width, GLsizei height );
466
467
468
469 /***
470 *** State-changing functions (drawing functions are above)
471 ***
472 *** These functions are called by their corresponding OpenGL API functions.
473 *** They're ALSO called by the gl_PopAttrib() function!!!
474 *** May add more functions like these to the device driver in the future.
475 ***/
476 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLchan ref);
477 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
478 void (*BlendEquation)(GLcontext *ctx, GLenum mode);
479 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
480 void (*BlendFuncSeparate)(GLcontext *ctx,
481 GLenum sfactorRGB, GLenum dfactorRGB,
482 GLenum sfactorA, GLenum dfactorA);
483 void (*ClearColor)(GLcontext *ctx, const GLchan color[4]);
484 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
485 void (*ClearIndex)(GLcontext *ctx, GLuint index);
486 void (*ClearStencil)(GLcontext *ctx, GLint s);
487 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
488 GLboolean bmask, GLboolean amask );
489 void (*CullFace)(GLcontext *ctx, GLenum mode);
490 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
491 void (*FrontFace)(GLcontext *ctx, GLenum mode);
492 void (*DepthFunc)(GLcontext *ctx, GLenum func);
493 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
494 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
495 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
496 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
497 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
498 void (*IndexMask)(GLcontext *ctx, GLuint mask);
499 void (*Lightfv)(GLcontext *ctx, GLenum light,
500 GLenum pname, const GLfloat *params );
501 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
502 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
503 void (*LineWidth)(GLcontext *ctx, GLfloat width);
504 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
505 void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
506 const GLfloat *params);
507 void (*PointSize)(GLcontext *ctx, GLfloat size);
508 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
509 void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
510 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
511 void (*RenderMode)(GLcontext *ctx, GLenum mode );
512 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
513 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
514 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
515 void (*StencilMask)(GLcontext *ctx, GLuint mask);
516 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
517 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
518 const GLfloat *params);
519 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
520 const GLfloat *param);
521 void (*TexParameter)(GLcontext *ctx, GLenum target,
522 struct gl_texture_object *texObj,
523 GLenum pname, const GLfloat *params);
524 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
525 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
526
527
528 /***
529 *** Vertex array functions
530 ***
531 *** Called by the corresponding OpenGL functions.
532 ***/
533 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
534 GLsizei stride, const GLvoid *ptr);
535 void (*NormalPointer)(GLcontext *ctx, GLenum type,
536 GLsizei stride, const GLvoid *ptr);
537 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
538 GLsizei stride, const GLvoid *ptr);
539 void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
540 GLsizei stride, const GLvoid *ptr);
541 void (*IndexPointer)(GLcontext *ctx, GLenum type,
542 GLsizei stride, const GLvoid *ptr);
543 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
544 GLsizei stride, const GLvoid *ptr);
545 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
546 GLsizei stride, const GLvoid *ptr);
547 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
548
549
550 /*** State-query functions
551 ***
552 *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
553 ***/
554 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
555 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
556 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
557 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
558 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
559
560
561
562 /***
563 *** Support for multiple t&l engines
564 ***/
565
566 GLuint NeedValidate;
567 /* Bitmask of state changes that require the current tnl module to be
568 * validated, using ValidateTnlModule() below.
569 */
570
571 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
572 /* Validate the current tnl module. This is called directly after
573 * UpdateState() when a state change that has occured matches the
574 * NeedValidate bitmask above. This ensures all computed values are
575 * up to date, thus allowing the driver to decide if the current tnl
576 * module needs to be swapped out.
577 *
578 * This must be non-NULL if a driver installs a custom tnl module and
579 * sets the NeedValidate bitmask, but may be NULL otherwise.
580 */
581
582
583 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
584 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
585 #define PRIM_UNKNOWN GL_POLYGON+3
586
587 GLuint CurrentExecPrimitive;
588 /* Set by the driver-supplied t&l engine. Set to
589 * PRIM_OUTSIDE_BEGIN_END when outside begin/end.
590 */
591
592 GLuint CurrentSavePrimitive;
593 /* Current state of an in-progress compilation. May take on any of
594 * the additional values defined above.
595 */
596
597
598 #define FLUSH_STORED_VERTICES 0x1
599 #define FLUSH_UPDATE_CURRENT 0x2
600 GLuint NeedFlush;
601 /* Set by the driver-supplied t&l engine whenever vertices are
602 * buffered between begin/end objects or ctx->Current is not uptodate.
603 *
604 * The FlushVertices() call below may be used to resolve
605 * these conditions.
606 */
607
608 void (*FlushVertices)( GLcontext *ctx, GLuint flags );
609 /* If inside begin/end, ASSERT(0).
610 * Otherwise,
611 * if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
612 * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
613 * and ctx->Light.Material
614 *
615 * Note that the default t&l engine never clears the
616 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
617 */
618
619 void (*LightingSpaceChange)( GLcontext *ctx );
620 /* Notify driver that the special derived value _NeedEyeCoords has
621 * changed.
622 */
623
624 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
625 void (*EndList)( GLcontext *ctx );
626 /* Let the t&l component know what is going on with display lists
627 * in time to make changes to dispatch tables, etc.
628 * Called by glNewList() and glEndList(), respectively.
629 */
630
631 void (*BeginCallList)( GLcontext *ctx, GLuint list );
632 void (*EndCallList)( GLcontext *ctx );
633 /* Notify the t&l component before and after calling a display list.
634 * Called by glCallList(s), but not recursively.
635 */
636
637 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
638 GLframebuffer *readBuffer );
639 /* Let the t&l component know when the context becomes current.
640 */
641
642
643 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
644 void (*UnlockArraysEXT)( GLcontext *ctx );
645 /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
646 */
647
648 };
649
650
651
652 /*
653 * Transform/Clip/Lighting interface
654 */
655 typedef struct {
656 void (*ArrayElement)( GLint ); /* NOTE */
657 void (*Color3f)( GLfloat, GLfloat, GLfloat );
658 void (*Color3fv)( const GLfloat * );
659 void (*Color3ub)( GLubyte, GLubyte, GLubyte );
660 void (*Color3ubv)( const GLubyte * );
661 void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
662 void (*Color4fv)( const GLfloat * );
663 void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
664 void (*Color4ubv)( const GLubyte * );
665 void (*EdgeFlag)( GLboolean );
666 void (*EdgeFlagv)( const GLboolean * );
667 void (*EvalCoord1f)( GLfloat ); /* NOTE */
668 void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
669 void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
670 void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
671 void (*EvalPoint1)( GLint ); /* NOTE */
672 void (*EvalPoint2)( GLint, GLint ); /* NOTE */
673 void (*FogCoordfEXT)( GLfloat );
674 void (*FogCoordfvEXT)( const GLfloat * );
675 void (*Indexi)( GLint );
676 void (*Indexiv)( const GLint * );
677 void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
678 void (*MultiTexCoord1fARB)( GLenum, GLfloat );
679 void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * );
680 void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
681 void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * );
682 void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
683 void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * );
684 void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
685 void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * );
686 void (*Normal3f)( GLfloat, GLfloat, GLfloat );
687 void (*Normal3fv)( const GLfloat * );
688 void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
689 void (*SecondaryColor3fvEXT)( const GLfloat * );
690 void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
691 void (*SecondaryColor3ubvEXT)( const GLubyte * );
692 void (*TexCoord1f)( GLfloat );
693 void (*TexCoord1fv)( const GLfloat * );
694 void (*TexCoord2f)( GLfloat, GLfloat );
695 void (*TexCoord2fv)( const GLfloat * );
696 void (*TexCoord3f)( GLfloat, GLfloat, GLfloat );
697 void (*TexCoord3fv)( const GLfloat * );
698 void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
699 void (*TexCoord4fv)( const GLfloat * );
700 void (*Vertex2f)( GLfloat, GLfloat );
701 void (*Vertex2fv)( const GLfloat * );
702 void (*Vertex3f)( GLfloat, GLfloat, GLfloat );
703 void (*Vertex3fv)( const GLfloat * );
704 void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
705 void (*Vertex4fv)( const GLfloat * );
706 void (*CallList)( GLuint ); /* NOTE */
707 void (*Begin)( GLenum );
708 void (*End)( void );
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 */