Determine ahead of time whether a display list will include vertices
[mesa.git] / src / mesa / main / dd.h
1 /**
2 * \file dd.h
3 * Device driver interfaces.
4 */
5
6 /*
7 * Mesa 3-D graphics library
8 * Version: 6.3
9 *
10 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30
31 #ifndef DD_INCLUDED
32 #define DD_INCLUDED
33
34 /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
35
36 struct gl_pixelstore_attrib;
37 struct mesa_display_list;
38
39 /**
40 * Device driver function table.
41 * Core Mesa uses these function pointers to call into device drivers.
42 * Most of these functions directly correspond to OpenGL state commands.
43 * Core Mesa will call these functions after error checking has been done
44 * so that the drivers don't have to worry about error testing.
45 *
46 * Vertex transformation/clipping/lighting is patched into the T&L module.
47 * Rasterization functions are patched into the swrast module.
48 *
49 * Note: when new functions are added here, the drivers/common/driverfuncs.c
50 * file should be updated too!!!
51 */
52 struct dd_function_table {
53 /**
54 * Return a string as needed by glGetString().
55 *
56 * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
57 * returned.
58 */
59 const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
60
61 /**
62 * Notify the driver after Mesa has made some internal state changes.
63 *
64 * This is in addition to any state change callbacks Mesa may already have
65 * made.
66 */
67 void (*UpdateState)( GLcontext *ctx, GLuint new_state );
68
69 /**
70 * Get the width and height of the named buffer/window.
71 *
72 * Mesa uses this to determine when the driver's window size has changed.
73 */
74 void (*GetBufferSize)( GLframebuffer *buffer,
75 GLuint *width, GLuint *height );
76
77 /**
78 * Resize the driver's depth/stencil/accum/back buffers to match the
79 * size given in the GLframebuffer struct.
80 *
81 * This is typically called when Mesa detects that a window size has changed.
82 */
83 void (*ResizeBuffers)( GLframebuffer *buffer );
84
85 /**
86 * Called whenever an error is generated.
87 *
88 * __GLcontextRec::ErrorValue contains the error value.
89 */
90 void (*Error)( GLcontext *ctx );
91
92 /**
93 * This is called whenever glFinish() is called.
94 */
95 void (*Finish)( GLcontext *ctx );
96
97 /**
98 * This is called whenever glFlush() is called.
99 */
100 void (*Flush)( GLcontext *ctx );
101
102 /**
103 * Clear the color/depth/stencil/accum buffer(s).
104 *
105 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
106 * which buffers need to be cleared.
107 * \param all if true then clear the whole buffer, else clear only the
108 * region defined by <tt>(x, y, width, height)</tt>.
109 *
110 * This function must obey the glColorMask(), glIndexMask() and
111 * glStencilMask() settings!
112 * Software Mesa can do masked clears if the device driver can't.
113 */
114 void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
115 GLint x, GLint y, GLint width, GLint height );
116
117
118 /**
119 * \name For hardware accumulation buffer
120 */
121 /*@{*/
122 /**
123 * Execute glAccum command within the given scissor region.
124 */
125 void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
126 GLint xpos, GLint ypos, GLint width, GLint height );
127 /*@}*/
128
129
130 /**
131 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
132 */
133 /*@{*/
134
135 /**
136 * This is called by glDrawPixels().
137 *
138 * \p unpack describes how to unpack the source image data.
139 */
140 void (*DrawPixels)( GLcontext *ctx,
141 GLint x, GLint y, GLsizei width, GLsizei height,
142 GLenum format, GLenum type,
143 const struct gl_pixelstore_attrib *unpack,
144 const GLvoid *pixels );
145
146 /**
147 * Called by glReadPixels().
148 */
149 void (*ReadPixels)( GLcontext *ctx,
150 GLint x, GLint y, GLsizei width, GLsizei height,
151 GLenum format, GLenum type,
152 const struct gl_pixelstore_attrib *unpack,
153 GLvoid *dest );
154
155 /**
156 * Do a glCopyPixels().
157 *
158 * This function must respect all rasterization state, glPixelTransfer(),
159 * glPixelZoom(), etc.
160 */
161 void (*CopyPixels)( GLcontext *ctx, GLint srcx, GLint srcy,
162 GLsizei width, GLsizei height,
163 GLint dstx, GLint dsty, GLenum type );
164
165 /**
166 * This is called by glBitmap().
167 *
168 * Works the same as dd_function_table::DrawPixels, above.
169 */
170 void (*Bitmap)( GLcontext *ctx,
171 GLint x, GLint y, GLsizei width, GLsizei height,
172 const struct gl_pixelstore_attrib *unpack,
173 const GLubyte *bitmap );
174 /*@}*/
175
176
177 /**
178 * \name Texture image functions
179 */
180 /*@{*/
181
182 /**
183 * Choose texture format.
184 *
185 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
186 * functions. The driver should examine \p internalFormat and return a
187 * pointer to an appropriate gl_texture_format.
188 */
189 const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx,
190 GLint internalFormat, GLenum srcFormat, GLenum srcType );
191
192 /**
193 * Called by glTexImage1D().
194 *
195 * \param target user specified.
196 * \param format user specified.
197 * \param type user specified.
198 * \param pixels user specified.
199 * \param packing indicates the image packing of pixels.
200 * \param texObj is the target texture object.
201 * \param texImage is the target texture image. It will have the texture \p
202 * width, \p height, \p depth, \p border and \p internalFormat information.
203 *
204 * \p retainInternalCopy is returned by this function and indicates whether
205 * core Mesa should keep an internal copy of the texture image.
206 *
207 * Drivers should call a fallback routine from texstore.c if needed.
208 */
209 void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
210 GLint internalFormat,
211 GLint width, GLint border,
212 GLenum format, GLenum type, const GLvoid *pixels,
213 const struct gl_pixelstore_attrib *packing,
214 struct gl_texture_object *texObj,
215 struct gl_texture_image *texImage );
216
217 /**
218 * Called by glTexImage2D().
219 *
220 * \sa dd_function_table::TexImage1D.
221 */
222 void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
223 GLint internalFormat,
224 GLint width, GLint height, GLint border,
225 GLenum format, GLenum type, const GLvoid *pixels,
226 const struct gl_pixelstore_attrib *packing,
227 struct gl_texture_object *texObj,
228 struct gl_texture_image *texImage );
229
230 /**
231 * Called by glTexImage3D().
232 *
233 * \sa dd_function_table::TexImage1D.
234 */
235 void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
236 GLint internalFormat,
237 GLint width, GLint height, GLint depth, GLint border,
238 GLenum format, GLenum type, const GLvoid *pixels,
239 const struct gl_pixelstore_attrib *packing,
240 struct gl_texture_object *texObj,
241 struct gl_texture_image *texImage );
242
243 /**
244 * Called by glTexSubImage1D().
245 *
246 * \param target user specified.
247 * \param level user specified.
248 * \param xoffset user specified.
249 * \param yoffset user specified.
250 * \param zoffset user specified.
251 * \param width user specified.
252 * \param height user specified.
253 * \param depth user specified.
254 * \param format user specified.
255 * \param type user specified.
256 * \param pixels user specified.
257 * \param packing indicates the image packing of pixels.
258 * \param texObj is the target texture object.
259 * \param texImage is the target texture image. It will have the texture \p
260 * width, \p height, \p border and \p internalFormat information.
261 *
262 * The driver should use a fallback routine from texstore.c if needed.
263 */
264 void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
265 GLint xoffset, GLsizei width,
266 GLenum format, GLenum type,
267 const GLvoid *pixels,
268 const struct gl_pixelstore_attrib *packing,
269 struct gl_texture_object *texObj,
270 struct gl_texture_image *texImage );
271
272 /**
273 * Called by glTexSubImage2D().
274 *
275 * \sa dd_function_table::TexSubImage1D.
276 */
277 void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
278 GLint xoffset, GLint yoffset,
279 GLsizei width, GLsizei height,
280 GLenum format, GLenum type,
281 const GLvoid *pixels,
282 const struct gl_pixelstore_attrib *packing,
283 struct gl_texture_object *texObj,
284 struct gl_texture_image *texImage );
285
286 /**
287 * Called by glTexSubImage3D().
288 *
289 * \sa dd_function_table::TexSubImage1D.
290 */
291 void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
292 GLint xoffset, GLint yoffset, GLint zoffset,
293 GLsizei width, GLsizei height, GLint depth,
294 GLenum format, GLenum type,
295 const GLvoid *pixels,
296 const struct gl_pixelstore_attrib *packing,
297 struct gl_texture_object *texObj,
298 struct gl_texture_image *texImage );
299
300 /**
301 * Called by glGetTexImage().
302 */
303 void (*GetTexImage)( GLcontext *ctx, GLenum target, GLint level,
304 GLenum format, GLenum type, GLvoid *pixels,
305 const struct gl_texture_object *texObj,
306 const struct gl_texture_image *texImage );
307
308 /**
309 * Called by glCopyTexImage1D().
310 *
311 * Drivers should use a fallback routine from texstore.c if needed.
312 */
313 void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
314 GLenum internalFormat, GLint x, GLint y,
315 GLsizei width, GLint border );
316
317 /**
318 * Called by glCopyTexImage2D().
319 *
320 * Drivers should use a fallback routine from texstore.c if needed.
321 */
322 void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
323 GLenum internalFormat, GLint x, GLint y,
324 GLsizei width, GLsizei height, GLint border );
325
326 /**
327 * Called by glCopyTexSubImage1D().
328 *
329 * Drivers should use a fallback routine from texstore.c if needed.
330 */
331 void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
332 GLint xoffset,
333 GLint x, GLint y, GLsizei width );
334 /**
335 * Called by glCopyTexSubImage2D().
336 *
337 * Drivers should use a fallback routine from texstore.c if needed.
338 */
339 void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
340 GLint xoffset, GLint yoffset,
341 GLint x, GLint y,
342 GLsizei width, GLsizei height );
343 /**
344 * Called by glCopyTexSubImage3D().
345 *
346 * Drivers should use a fallback routine from texstore.c if needed.
347 */
348 void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
349 GLint xoffset, GLint yoffset, GLint zoffset,
350 GLint x, GLint y,
351 GLsizei width, GLsizei height );
352
353 /**
354 * Called by glTexImage[123]D when user specifies a proxy texture
355 * target.
356 *
357 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
358 */
359 GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
360 GLint level, GLint internalFormat,
361 GLenum format, GLenum type,
362 GLint width, GLint height,
363 GLint depth, GLint border);
364 /*@}*/
365
366
367 /**
368 * \name Compressed texture functions
369 */
370 /*@{*/
371
372 /**
373 * Called by glCompressedTexImage1D().
374 *
375 * \param target user specified.
376 * \param format user specified.
377 * \param type user specified.
378 * \param pixels user specified.
379 * \param packing indicates the image packing of pixels.
380 * \param texObj is the target texture object.
381 * \param texImage is the target texture image. It will have the texture \p
382 * width, \p height, \p depth, \p border and \p internalFormat information.
383 *
384 * \a retainInternalCopy is returned by this function and indicates whether
385 * core Mesa should keep an internal copy of the texture image.
386 */
387 void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
388 GLint level, GLint internalFormat,
389 GLsizei width, GLint border,
390 GLsizei imageSize, const GLvoid *data,
391 struct gl_texture_object *texObj,
392 struct gl_texture_image *texImage );
393 /**
394 * Called by glCompressedTexImage2D().
395 *
396 * \sa dd_function_table::CompressedTexImage1D.
397 */
398 void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
399 GLint level, GLint internalFormat,
400 GLsizei width, GLsizei height, GLint border,
401 GLsizei imageSize, const GLvoid *data,
402 struct gl_texture_object *texObj,
403 struct gl_texture_image *texImage );
404 /**
405 * Called by glCompressedTexImage3D().
406 *
407 * \sa dd_function_table::CompressedTexImage3D.
408 */
409 void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
410 GLint level, GLint internalFormat,
411 GLsizei width, GLsizei height, GLsizei depth,
412 GLint border,
413 GLsizei imageSize, const GLvoid *data,
414 struct gl_texture_object *texObj,
415 struct gl_texture_image *texImage );
416
417 /**
418 * Called by glCompressedTexSubImage1D().
419 *
420 * \param target user specified.
421 * \param level user specified.
422 * \param xoffset user specified.
423 * \param yoffset user specified.
424 * \param zoffset user specified.
425 * \param width user specified.
426 * \param height user specified.
427 * \param depth user specified.
428 * \param imageSize user specified.
429 * \param data user specified.
430 * \param texObj is the target texture object.
431 * \param texImage is the target texture image. It will have the texture \p
432 * width, \p height, \p depth, \p border and \p internalFormat information.
433 */
434 void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
435 GLint xoffset, GLsizei width,
436 GLenum format,
437 GLsizei imageSize, const GLvoid *data,
438 struct gl_texture_object *texObj,
439 struct gl_texture_image *texImage);
440 /**
441 * Called by glCompressedTexSubImage2D().
442 *
443 * \sa dd_function_table::CompressedTexImage3D.
444 */
445 void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
446 GLint xoffset, GLint yoffset,
447 GLsizei width, GLint height,
448 GLenum format,
449 GLsizei imageSize, const GLvoid *data,
450 struct gl_texture_object *texObj,
451 struct gl_texture_image *texImage);
452 /**
453 * Called by glCompressedTexSubImage3D().
454 *
455 * \sa dd_function_table::CompressedTexImage3D.
456 */
457 void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
458 GLint xoffset, GLint yoffset, GLint zoffset,
459 GLsizei width, GLint height, GLint depth,
460 GLenum format,
461 GLsizei imageSize, const GLvoid *data,
462 struct gl_texture_object *texObj,
463 struct gl_texture_image *texImage);
464
465
466 /**
467 * Called by glGetCompressedTexImage.
468 */
469 void (*GetCompressedTexImage)(GLcontext *ctx, GLenum target, GLint level,
470 GLvoid *img,
471 const struct gl_texture_object *texObj,
472 const struct gl_texture_image *texImage);
473
474 /**
475 * Called to query number of bytes of storage needed to store the
476 * specified compressed texture.
477 */
478 GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width,
479 GLsizei height, GLsizei depth,
480 GLenum format );
481 /*@}*/
482
483 /**
484 * \name Texture object functions
485 */
486 /*@{*/
487
488 /**
489 * Called by glBindTexture().
490 */
491 void (*BindTexture)( GLcontext *ctx, GLenum target,
492 struct gl_texture_object *tObj );
493
494 /**
495 * Called to allocate a new texture object.
496 * A new gl_texture_object should be returned. The driver should
497 * attach to it any device-specific info it needs.
498 */
499 struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name,
500 GLenum target );
501 /**
502 * Called when a texture object is about to be deallocated.
503 *
504 * Driver should delete the gl_texture_object object and anything
505 * hanging off of it.
506 */
507 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
508
509 /**
510 * Called to allocate a new texture image object.
511 */
512 struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx );
513
514 /**
515 * Called by glAreTextureResident().
516 */
517 GLboolean (*IsTextureResident)( GLcontext *ctx,
518 struct gl_texture_object *t );
519
520 /**
521 * Called by glPrioritizeTextures().
522 */
523 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
524 GLclampf priority );
525
526 /**
527 * Called by glActiveTextureARB() to set current texture unit.
528 */
529 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
530
531 /**
532 * Called when the texture's color lookup table is changed.
533 *
534 * If \p tObj is NULL then the shared texture palette
535 * gl_texture_object::Palette is to be updated.
536 */
537 void (*UpdateTexturePalette)( GLcontext *ctx,
538 struct gl_texture_object *tObj );
539 /*@}*/
540
541
542 /**
543 * \name Imaging functionality
544 */
545 /*@{*/
546 void (*CopyColorTable)( GLcontext *ctx,
547 GLenum target, GLenum internalformat,
548 GLint x, GLint y, GLsizei width );
549
550 void (*CopyColorSubTable)( GLcontext *ctx,
551 GLenum target, GLsizei start,
552 GLint x, GLint y, GLsizei width );
553
554 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
555 GLenum internalFormat,
556 GLint x, GLint y, GLsizei width );
557
558 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
559 GLenum internalFormat,
560 GLint x, GLint y,
561 GLsizei width, GLsizei height );
562 /*@}*/
563
564
565 /**
566 * \name Vertex/fragment program functions
567 */
568 /*@{*/
569 /** Bind a vertex/fragment program */
570 void (*BindProgram)(GLcontext *ctx, GLenum target, struct program *prog);
571 /** Allocate a new program */
572 struct program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id);
573 /** Delete a program */
574 void (*DeleteProgram)(GLcontext *ctx, struct program *prog);
575 /** Notify driver that a program string has been specified. */
576 void (*ProgramStringNotify)(GLcontext *ctx, GLenum target,
577 struct program *prog);
578
579
580
581 /** Query if program can be loaded onto hardware */
582 GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target,
583 struct program *prog);
584
585 /*@}*/
586
587
588 /**
589 * \name State-changing functions.
590 *
591 * \note drawing functions are above.
592 *
593 * These functions are called by their corresponding OpenGL API functions.
594 * They are \e also called by the gl_PopAttrib() function!!!
595 * May add more functions like these to the device driver in the future.
596 */
597 /*@{*/
598 /** Specify the alpha test function */
599 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref);
600 /** Set the blend color */
601 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
602 /** Set the blend equation */
603 void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA);
604 /** Specify pixel arithmetic */
605 void (*BlendFuncSeparate)(GLcontext *ctx,
606 GLenum sfactorRGB, GLenum dfactorRGB,
607 GLenum sfactorA, GLenum dfactorA);
608 /** Specify clear values for the color buffers */
609 void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]);
610 /** Specify the clear value for the depth buffer */
611 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
612 /** Specify the clear value for the color index buffers */
613 void (*ClearIndex)(GLcontext *ctx, GLuint index);
614 /** Specify the clear value for the stencil buffer */
615 void (*ClearStencil)(GLcontext *ctx, GLint s);
616 /** Specify a plane against which all geometry is clipped */
617 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
618 /** Enable and disable writing of frame buffer color components */
619 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
620 GLboolean bmask, GLboolean amask );
621 /** Cause a material color to track the current color */
622 void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
623 /** Specify whether front- or back-facing facets can be culled */
624 void (*CullFace)(GLcontext *ctx, GLenum mode);
625 /** Define front- and back-facing polygons */
626 void (*FrontFace)(GLcontext *ctx, GLenum mode);
627 /** Specify the value used for depth buffer comparisons */
628 void (*DepthFunc)(GLcontext *ctx, GLenum func);
629 /** Enable or disable writing into the depth buffer */
630 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
631 /** Specify mapping of depth values from NDC to window coordinates */
632 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
633 /** Specify the current buffer for writing */
634 void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
635 /** Specify the buffers for writing for fragment programs*/
636 void (*DrawBuffers)( GLcontext *ctx, GLsizei n, const GLenum *buffers );
637 /** Enable or disable server-side gl capabilities */
638 void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state);
639 /** Specify fog parameters */
640 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
641 /** Specify implementation-specific hints */
642 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
643 /** Control the writing of individual bits in the color index buffers */
644 void (*IndexMask)(GLcontext *ctx, GLuint mask);
645 /** Set light source parameters */
646 void (*Lightfv)(GLcontext *ctx, GLenum light,
647 GLenum pname, const GLfloat *params );
648 /** Set the lighting model parameters */
649 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
650 /** Specify the line stipple pattern */
651 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
652 /** Specify the width of rasterized lines */
653 void (*LineWidth)(GLcontext *ctx, GLfloat width);
654 /** Specify a logical pixel operation for color index rendering */
655 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
656 void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
657 const GLfloat *params);
658 /** Specify the diameter of rasterized points */
659 void (*PointSize)(GLcontext *ctx, GLfloat size);
660 /** Select a polygon rasterization mode */
661 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
662 /** Set the scale and units used to calculate depth values */
663 void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
664 /** Set the polygon stippling pattern */
665 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
666 /* Specifies the current buffer for reading */
667 void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
668 /** Set rasterization mode */
669 void (*RenderMode)(GLcontext *ctx, GLenum mode );
670 /** Define the scissor box */
671 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
672 /** Select flat or smooth shading */
673 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
674 /** Set function and reference value for stencil testing */
675 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
676 /** Control the writing of individual bits in the stencil planes */
677 void (*StencilMask)(GLcontext *ctx, GLuint mask);
678 /** Set stencil test actions */
679 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
680 /** Set active stencil face (GL_EXT_stencil_two_side) */
681 void (*ActiveStencilFace)(GLcontext *ctx, GLuint face);
682 /** OpenGL 2.0 two-sided StencilFunc */
683 void (*StencilFuncSeparate)(GLcontext *ctx, GLenum face, GLenum func,
684 GLint ref, GLuint mask);
685 /** OpenGL 2.0 two-sided StencilMask */
686 void (*StencilMaskSeparate)(GLcontext *ctx, GLenum face, GLuint mask);
687 /** OpenGL 2.0 two-sided StencilOp */
688 void (*StencilOpSeparate)(GLcontext *ctx, GLenum face, GLenum fail,
689 GLenum zfail, GLenum zpass);
690 /** Control the generation of texture coordinates */
691 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
692 const GLfloat *params);
693 /** Set texture environment parameters */
694 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
695 const GLfloat *param);
696 /** Set texture parameters */
697 void (*TexParameter)(GLcontext *ctx, GLenum target,
698 struct gl_texture_object *texObj,
699 GLenum pname, const GLfloat *params);
700 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
701 /** Set the viewport */
702 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
703 /*@}*/
704
705
706 /**
707 * \name Vertex array functions
708 *
709 * Called by the corresponding OpenGL functions.
710 */
711 /*@{*/
712 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
713 GLsizei stride, const GLvoid *ptr);
714 void (*NormalPointer)(GLcontext *ctx, GLenum type,
715 GLsizei stride, const GLvoid *ptr);
716 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
717 GLsizei stride, const GLvoid *ptr);
718 void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
719 GLsizei stride, const GLvoid *ptr);
720 void (*IndexPointer)(GLcontext *ctx, GLenum type,
721 GLsizei stride, const GLvoid *ptr);
722 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
723 GLsizei stride, const GLvoid *ptr);
724 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
725 GLsizei stride, const GLvoid *ptr);
726 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
727 void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
728 GLenum type, GLsizei stride, const GLvoid *ptr);
729 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
730 void (*UnlockArraysEXT)( GLcontext *ctx );
731 /*@}*/
732
733
734 /**
735 * \name State-query functions
736 *
737 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
738 */
739 /*@{*/
740 /** Return the value or values of a selected parameter */
741 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
742 /** Return the value or values of a selected parameter */
743 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
744 /** Return the value or values of a selected parameter */
745 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
746 /** Return the value or values of a selected parameter */
747 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
748 /** Return the value or values of a selected parameter */
749 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
750 /*@}*/
751
752
753 /**
754 * \name Vertex buffer object functions
755 */
756 #if FEATURE_ARB_vertex_buffer_object
757 /*@{*/
758 void (*BindBuffer)( GLcontext *ctx, GLenum target,
759 struct gl_buffer_object *obj );
760
761 struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer,
762 GLenum target );
763
764 void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj );
765
766 void (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
767 const GLvoid *data, GLenum usage,
768 struct gl_buffer_object *obj );
769
770 void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset,
771 GLsizeiptrARB size, const GLvoid *data,
772 struct gl_buffer_object *obj );
773
774 void (*GetBufferSubData)( GLcontext *ctx, GLenum target,
775 GLintptrARB offset, GLsizeiptrARB size,
776 GLvoid *data, struct gl_buffer_object *obj );
777
778 void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access,
779 struct gl_buffer_object *obj );
780
781 GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target,
782 struct gl_buffer_object *obj );
783 /*@}*/
784 #endif
785
786 /**
787 * \name Support for multiple T&L engines
788 */
789 /*@{*/
790
791 /**
792 * Bitmask of state changes that require the current T&L module to be
793 * validated, using ValidateTnlModule() below.
794 */
795 GLuint NeedValidate;
796
797 /**
798 * Validate the current T&L module.
799 *
800 * This is called directly after UpdateState() when a state change that has
801 * occurred matches the dd_function_table::NeedValidate bitmask above. This
802 * ensures all computed values are up to date, thus allowing the driver to
803 * decide if the current T&L module needs to be swapped out.
804 *
805 * This must be non-NULL if a driver installs a custom T&L module and sets
806 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
807 */
808 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
809
810
811 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
812 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
813 #define PRIM_UNKNOWN GL_POLYGON+3
814
815 /**
816 * Set by the driver-supplied T&L engine.
817 *
818 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
819 */
820 GLuint CurrentExecPrimitive;
821
822 /**
823 * Current state of an in-progress compilation.
824 *
825 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
826 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
827 */
828 GLuint CurrentSavePrimitive;
829
830
831 #define FLUSH_STORED_VERTICES 0x1
832 #define FLUSH_UPDATE_CURRENT 0x2
833 /**
834 * Set by the driver-supplied T&L engine whenever vertices are buffered
835 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
836 * updated.
837 *
838 * The dd_function_table::FlushVertices call below may be used to resolve
839 * these conditions.
840 */
841 GLuint NeedFlush;
842 GLuint SaveNeedFlush;
843
844 /**
845 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
846 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
847 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
848 * __GLcontextRec::Current and gl_light_attrib::Material
849 *
850 * Note that the default T&L engine never clears the
851 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
852 */
853 void (*FlushVertices)( GLcontext *ctx, GLuint flags );
854 void (*SaveFlushVertices)( GLcontext *ctx );
855
856 /**
857 * Give the driver the opportunity to hook in its own vtxfmt for
858 * compiling optimized display lists. This is called on each valid
859 * glBegin() during list compilation.
860 */
861 GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode );
862
863 /**
864 * Notify driver that the special derived value _NeedEyeCoords has
865 * changed.
866 */
867 void (*LightingSpaceChange)( GLcontext *ctx );
868
869 /**
870 * Let the T&L component know when the context becomes current.
871 */
872 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
873 GLframebuffer *readBuffer );
874
875 /**
876 * Called by glNewList().
877 *
878 * Let the T&L component know what is going on with display lists
879 * in time to make changes to dispatch tables, etc.
880 */
881 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
882 /**
883 * Called by glEndList().
884 *
885 * \sa dd_function_table::NewList.
886 */
887 void (*EndList)( GLcontext *ctx );
888
889 /**
890 * Called by glCallList(s).
891 *
892 * Notify the T&L component before and after calling a display list.
893 */
894 void (*BeginCallList)( GLcontext *ctx,
895 struct mesa_display_list *dlist );
896 /**
897 * Called by glEndCallList().
898 *
899 * \sa dd_function_table::BeginCallList.
900 */
901 void (*EndCallList)( GLcontext *ctx );
902
903 };
904
905
906 /**
907 * Transform/Clip/Lighting interface
908 *
909 * Drivers present a reduced set of the functions possible in
910 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
911 * remaining functions to map down to these entry points.
912 *
913 * These are the initial values to be installed into dispatch by
914 * mesa. If the T&L driver wants to modify the dispatch table
915 * while installed, it must do so itself. It would be possible for
916 * the vertexformat to install it's own initial values for these
917 * functions, but this way there is an obvious list of what is
918 * expected of the driver.
919 *
920 * If the driver wants to hook in entry points other than those
921 * listed, it must restore them to their original values in
922 * the disable() callback, below.
923 */
924 typedef struct {
925 /**
926 * \name Vertex
927 */
928 /*@{*/
929 void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */
930 void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
931 void (GLAPIENTRYP Color3fv)( const GLfloat * );
932 void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
933 void (GLAPIENTRYP Color4fv)( const GLfloat * );
934 void (GLAPIENTRYP EdgeFlag)( GLboolean );
935 void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
936 void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */
937 void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */
938 void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
939 void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */
940 void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */
941 void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */
942 void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
943 void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
944 void (GLAPIENTRYP Indexf)( GLfloat );
945 void (GLAPIENTRYP Indexfv)( const GLfloat * );
946 void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
947 void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
948 void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
949 void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
950 void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
951 void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
952 void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
953 void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
954 void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
955 void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
956 void (GLAPIENTRYP Normal3fv)( const GLfloat * );
957 void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
958 void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
959 void (GLAPIENTRYP TexCoord1f)( GLfloat );
960 void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
961 void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
962 void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
963 void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
964 void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
965 void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
966 void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
967 void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
968 void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
969 void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
970 void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
971 void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
972 void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
973 void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */
974 void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */
975 void (GLAPIENTRYP Begin)( GLenum );
976 void (GLAPIENTRYP End)( void );
977 void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
978 void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
979 void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
980 void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
981 void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
982 void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
983 void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
984 void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
985 void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
986 void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
987 void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
988 void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v );
989 void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
990 void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
991 void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
992 void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
993 /*@}*/
994
995 /*
996 */
997 void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
998
999 /**
1000 * \name Array
1001 */
1002 /*@{*/
1003 void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
1004 void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type,
1005 const GLvoid *indices );
1006 void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start,
1007 GLuint end, GLsizei count,
1008 GLenum type, const GLvoid *indices );
1009 /*@}*/
1010
1011 /**
1012 * \name Eval
1013 *
1014 * If you don't support eval, fallback to the default vertex format
1015 * on receiving an eval call and use the pipeline mechanism to
1016 * provide partial T&L acceleration.
1017 *
1018 * Mesa will provide a set of helper functions to do eval within
1019 * accelerated vertex formats, eventually...
1020 */
1021 /*@{*/
1022 void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
1023 void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
1024 /*@}*/
1025
1026 } GLvertexformat;
1027
1028
1029 #endif /* DD_INCLUDED */