set table size to 1023 and use new HASH_FUNC() macro
[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 to free tImage->Data.
516 */
517 void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage );
518
519 /**
520 * Called by glAreTextureResident().
521 */
522 GLboolean (*IsTextureResident)( GLcontext *ctx,
523 struct gl_texture_object *t );
524
525 /**
526 * Called by glPrioritizeTextures().
527 */
528 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
529 GLclampf priority );
530
531 /**
532 * Called by glActiveTextureARB() to set current texture unit.
533 */
534 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
535
536 /**
537 * Called when the texture's color lookup table is changed.
538 *
539 * If \p tObj is NULL then the shared texture palette
540 * gl_texture_object::Palette is to be updated.
541 */
542 void (*UpdateTexturePalette)( GLcontext *ctx,
543 struct gl_texture_object *tObj );
544 /*@}*/
545
546
547 /**
548 * \name Imaging functionality
549 */
550 /*@{*/
551 void (*CopyColorTable)( GLcontext *ctx,
552 GLenum target, GLenum internalformat,
553 GLint x, GLint y, GLsizei width );
554
555 void (*CopyColorSubTable)( GLcontext *ctx,
556 GLenum target, GLsizei start,
557 GLint x, GLint y, GLsizei width );
558
559 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
560 GLenum internalFormat,
561 GLint x, GLint y, GLsizei width );
562
563 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
564 GLenum internalFormat,
565 GLint x, GLint y,
566 GLsizei width, GLsizei height );
567 /*@}*/
568
569
570 /**
571 * \name Vertex/fragment program functions
572 */
573 /*@{*/
574 /** Bind a vertex/fragment program */
575 void (*BindProgram)(GLcontext *ctx, GLenum target, struct program *prog);
576 /** Allocate a new program */
577 struct program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id);
578 /** Delete a program */
579 void (*DeleteProgram)(GLcontext *ctx, struct program *prog);
580 /** Notify driver that a program string has been specified. */
581 void (*ProgramStringNotify)(GLcontext *ctx, GLenum target,
582 struct program *prog);
583
584
585
586 /** Query if program can be loaded onto hardware */
587 GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target,
588 struct program *prog);
589
590 /*@}*/
591
592
593 /**
594 * \name State-changing functions.
595 *
596 * \note drawing functions are above.
597 *
598 * These functions are called by their corresponding OpenGL API functions.
599 * They are \e also called by the gl_PopAttrib() function!!!
600 * May add more functions like these to the device driver in the future.
601 */
602 /*@{*/
603 /** Specify the alpha test function */
604 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref);
605 /** Set the blend color */
606 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
607 /** Set the blend equation */
608 void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA);
609 /** Specify pixel arithmetic */
610 void (*BlendFuncSeparate)(GLcontext *ctx,
611 GLenum sfactorRGB, GLenum dfactorRGB,
612 GLenum sfactorA, GLenum dfactorA);
613 /** Specify clear values for the color buffers */
614 void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]);
615 /** Specify the clear value for the depth buffer */
616 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
617 /** Specify the clear value for the color index buffers */
618 void (*ClearIndex)(GLcontext *ctx, GLuint index);
619 /** Specify the clear value for the stencil buffer */
620 void (*ClearStencil)(GLcontext *ctx, GLint s);
621 /** Specify a plane against which all geometry is clipped */
622 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
623 /** Enable and disable writing of frame buffer color components */
624 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
625 GLboolean bmask, GLboolean amask );
626 /** Cause a material color to track the current color */
627 void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
628 /** Specify whether front- or back-facing facets can be culled */
629 void (*CullFace)(GLcontext *ctx, GLenum mode);
630 /** Define front- and back-facing polygons */
631 void (*FrontFace)(GLcontext *ctx, GLenum mode);
632 /** Specify the value used for depth buffer comparisons */
633 void (*DepthFunc)(GLcontext *ctx, GLenum func);
634 /** Enable or disable writing into the depth buffer */
635 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
636 /** Specify mapping of depth values from NDC to window coordinates */
637 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
638 /** Specify the current buffer for writing */
639 void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
640 /** Specify the buffers for writing for fragment programs*/
641 void (*DrawBuffers)( GLcontext *ctx, GLsizei n, const GLenum *buffers );
642 /** Enable or disable server-side gl capabilities */
643 void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state);
644 /** Specify fog parameters */
645 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
646 /** Specify implementation-specific hints */
647 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
648 /** Control the writing of individual bits in the color index buffers */
649 void (*IndexMask)(GLcontext *ctx, GLuint mask);
650 /** Set light source parameters */
651 void (*Lightfv)(GLcontext *ctx, GLenum light,
652 GLenum pname, const GLfloat *params );
653 /** Set the lighting model parameters */
654 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
655 /** Specify the line stipple pattern */
656 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
657 /** Specify the width of rasterized lines */
658 void (*LineWidth)(GLcontext *ctx, GLfloat width);
659 /** Specify a logical pixel operation for color index rendering */
660 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
661 void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
662 const GLfloat *params);
663 /** Specify the diameter of rasterized points */
664 void (*PointSize)(GLcontext *ctx, GLfloat size);
665 /** Select a polygon rasterization mode */
666 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
667 /** Set the scale and units used to calculate depth values */
668 void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
669 /** Set the polygon stippling pattern */
670 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
671 /* Specifies the current buffer for reading */
672 void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
673 /** Set rasterization mode */
674 void (*RenderMode)(GLcontext *ctx, GLenum mode );
675 /** Define the scissor box */
676 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
677 /** Select flat or smooth shading */
678 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
679 /** Set function and reference value for stencil testing */
680 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
681 /** Control the writing of individual bits in the stencil planes */
682 void (*StencilMask)(GLcontext *ctx, GLuint mask);
683 /** Set stencil test actions */
684 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
685 /** Set active stencil face (GL_EXT_stencil_two_side) */
686 void (*ActiveStencilFace)(GLcontext *ctx, GLuint face);
687 /** OpenGL 2.0 two-sided StencilFunc */
688 void (*StencilFuncSeparate)(GLcontext *ctx, GLenum face, GLenum func,
689 GLint ref, GLuint mask);
690 /** OpenGL 2.0 two-sided StencilMask */
691 void (*StencilMaskSeparate)(GLcontext *ctx, GLenum face, GLuint mask);
692 /** OpenGL 2.0 two-sided StencilOp */
693 void (*StencilOpSeparate)(GLcontext *ctx, GLenum face, GLenum fail,
694 GLenum zfail, GLenum zpass);
695 /** Control the generation of texture coordinates */
696 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
697 const GLfloat *params);
698 /** Set texture environment parameters */
699 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
700 const GLfloat *param);
701 /** Set texture parameters */
702 void (*TexParameter)(GLcontext *ctx, GLenum target,
703 struct gl_texture_object *texObj,
704 GLenum pname, const GLfloat *params);
705 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
706 /** Set the viewport */
707 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
708 /*@}*/
709
710
711 /**
712 * \name Vertex array functions
713 *
714 * Called by the corresponding OpenGL functions.
715 */
716 /*@{*/
717 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
718 GLsizei stride, const GLvoid *ptr);
719 void (*NormalPointer)(GLcontext *ctx, GLenum type,
720 GLsizei stride, const GLvoid *ptr);
721 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
722 GLsizei stride, const GLvoid *ptr);
723 void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
724 GLsizei stride, const GLvoid *ptr);
725 void (*IndexPointer)(GLcontext *ctx, GLenum type,
726 GLsizei stride, const GLvoid *ptr);
727 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
728 GLsizei stride, const GLvoid *ptr);
729 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
730 GLsizei stride, const GLvoid *ptr);
731 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
732 void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
733 GLenum type, GLsizei stride, const GLvoid *ptr);
734 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
735 void (*UnlockArraysEXT)( GLcontext *ctx );
736 /*@}*/
737
738
739 /**
740 * \name State-query functions
741 *
742 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
743 */
744 /*@{*/
745 /** Return the value or values of a selected parameter */
746 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
747 /** Return the value or values of a selected parameter */
748 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
749 /** Return the value or values of a selected parameter */
750 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
751 /** Return the value or values of a selected parameter */
752 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
753 /** Return the value or values of a selected parameter */
754 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
755 /*@}*/
756
757
758 /**
759 * \name Vertex/pixel buffer object functions
760 */
761 #if FEATURE_ARB_vertex_buffer_object
762 /*@{*/
763 void (*BindBuffer)( GLcontext *ctx, GLenum target,
764 struct gl_buffer_object *obj );
765
766 struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer,
767 GLenum target );
768
769 void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj );
770
771 void (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
772 const GLvoid *data, GLenum usage,
773 struct gl_buffer_object *obj );
774
775 void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset,
776 GLsizeiptrARB size, const GLvoid *data,
777 struct gl_buffer_object *obj );
778
779 void (*GetBufferSubData)( GLcontext *ctx, GLenum target,
780 GLintptrARB offset, GLsizeiptrARB size,
781 GLvoid *data, struct gl_buffer_object *obj );
782
783 void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access,
784 struct gl_buffer_object *obj );
785
786 GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target,
787 struct gl_buffer_object *obj );
788 /*@}*/
789 #endif
790
791 /**
792 * \name Functions for GL_EXT_framebuffer_object
793 */
794 #if FEATURE_EXT_framebuffer_object
795 /*@{*/
796 struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name);
797 struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name);
798 /*@}*/
799 #endif
800
801
802 /**
803 * \name Support for multiple T&L engines
804 */
805 /*@{*/
806
807 /**
808 * Bitmask of state changes that require the current T&L module to be
809 * validated, using ValidateTnlModule() below.
810 */
811 GLuint NeedValidate;
812
813 /**
814 * Validate the current T&L module.
815 *
816 * This is called directly after UpdateState() when a state change that has
817 * occurred matches the dd_function_table::NeedValidate bitmask above. This
818 * ensures all computed values are up to date, thus allowing the driver to
819 * decide if the current T&L module needs to be swapped out.
820 *
821 * This must be non-NULL if a driver installs a custom T&L module and sets
822 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
823 */
824 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
825
826
827 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
828 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
829 #define PRIM_UNKNOWN GL_POLYGON+3
830
831 /**
832 * Set by the driver-supplied T&L engine.
833 *
834 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
835 */
836 GLuint CurrentExecPrimitive;
837
838 /**
839 * Current state of an in-progress compilation.
840 *
841 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
842 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
843 */
844 GLuint CurrentSavePrimitive;
845
846
847 #define FLUSH_STORED_VERTICES 0x1
848 #define FLUSH_UPDATE_CURRENT 0x2
849 /**
850 * Set by the driver-supplied T&L engine whenever vertices are buffered
851 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
852 * updated.
853 *
854 * The dd_function_table::FlushVertices call below may be used to resolve
855 * these conditions.
856 */
857 GLuint NeedFlush;
858 GLuint SaveNeedFlush;
859
860 /**
861 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
862 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
863 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
864 * __GLcontextRec::Current and gl_light_attrib::Material
865 *
866 * Note that the default T&L engine never clears the
867 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
868 */
869 void (*FlushVertices)( GLcontext *ctx, GLuint flags );
870 void (*SaveFlushVertices)( GLcontext *ctx );
871
872 /**
873 * Give the driver the opportunity to hook in its own vtxfmt for
874 * compiling optimized display lists. This is called on each valid
875 * glBegin() during list compilation.
876 */
877 GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode );
878
879 /**
880 * Notify driver that the special derived value _NeedEyeCoords has
881 * changed.
882 */
883 void (*LightingSpaceChange)( GLcontext *ctx );
884
885 /**
886 * Let the T&L component know when the context becomes current.
887 */
888 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
889 GLframebuffer *readBuffer );
890
891 /**
892 * Called by glNewList().
893 *
894 * Let the T&L component know what is going on with display lists
895 * in time to make changes to dispatch tables, etc.
896 */
897 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
898 /**
899 * Called by glEndList().
900 *
901 * \sa dd_function_table::NewList.
902 */
903 void (*EndList)( GLcontext *ctx );
904
905 /**
906 * Called by glCallList(s).
907 *
908 * Notify the T&L component before and after calling a display list.
909 */
910 void (*BeginCallList)( GLcontext *ctx,
911 struct mesa_display_list *dlist );
912 /**
913 * Called by glEndCallList().
914 *
915 * \sa dd_function_table::BeginCallList.
916 */
917 void (*EndCallList)( GLcontext *ctx );
918
919 };
920
921
922 /**
923 * Transform/Clip/Lighting interface
924 *
925 * Drivers present a reduced set of the functions possible in
926 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
927 * remaining functions to map down to these entry points.
928 *
929 * These are the initial values to be installed into dispatch by
930 * mesa. If the T&L driver wants to modify the dispatch table
931 * while installed, it must do so itself. It would be possible for
932 * the vertexformat to install it's own initial values for these
933 * functions, but this way there is an obvious list of what is
934 * expected of the driver.
935 *
936 * If the driver wants to hook in entry points other than those
937 * listed, it must restore them to their original values in
938 * the disable() callback, below.
939 */
940 typedef struct {
941 /**
942 * \name Vertex
943 */
944 /*@{*/
945 void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */
946 void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
947 void (GLAPIENTRYP Color3fv)( const GLfloat * );
948 void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
949 void (GLAPIENTRYP Color4fv)( const GLfloat * );
950 void (GLAPIENTRYP EdgeFlag)( GLboolean );
951 void (GLAPIENTRYP EdgeFlagv)( const GLboolean * );
952 void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */
953 void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */
954 void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
955 void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */
956 void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */
957 void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */
958 void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
959 void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
960 void (GLAPIENTRYP Indexf)( GLfloat );
961 void (GLAPIENTRYP Indexfv)( const GLfloat * );
962 void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
963 void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
964 void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
965 void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
966 void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
967 void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
968 void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
969 void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
970 void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
971 void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
972 void (GLAPIENTRYP Normal3fv)( const GLfloat * );
973 void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
974 void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
975 void (GLAPIENTRYP TexCoord1f)( GLfloat );
976 void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
977 void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
978 void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
979 void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
980 void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
981 void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
982 void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
983 void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
984 void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
985 void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
986 void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
987 void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
988 void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
989 void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */
990 void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */
991 void (GLAPIENTRYP Begin)( GLenum );
992 void (GLAPIENTRYP End)( void );
993 void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
994 void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
995 void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
996 void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
997 void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
998 void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
999 void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1000 void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
1001 void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
1002 void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
1003 void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
1004 void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v );
1005 void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1006 void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
1007 void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1008 void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
1009 /*@}*/
1010
1011 /*
1012 */
1013 void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
1014
1015 /**
1016 * \name Array
1017 */
1018 /*@{*/
1019 void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
1020 void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type,
1021 const GLvoid *indices );
1022 void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start,
1023 GLuint end, GLsizei count,
1024 GLenum type, const GLvoid *indices );
1025 /*@}*/
1026
1027 /**
1028 * \name Eval
1029 *
1030 * If you don't support eval, fallback to the default vertex format
1031 * on receiving an eval call and use the pipeline mechanism to
1032 * provide partial T&L acceleration.
1033 *
1034 * Mesa will provide a set of helper functions to do eval within
1035 * accelerated vertex formats, eventually...
1036 */
1037 /*@{*/
1038 void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
1039 void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
1040 /*@}*/
1041
1042 } GLvertexformat;
1043
1044
1045 #endif /* DD_INCLUDED */