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