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