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