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