547b64d51bbd03a9f347c82c7f8ff208922cc6f3
[reactos.git] / reactos / dll / opengl / 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.5.2
9 *
10 * Copyright (C) 1999-2006 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 #include "glheader.h"
37
38 struct gl_buffer_object;
39 struct gl_context;
40 struct gl_display_list;
41 struct gl_framebuffer;
42 struct gl_pixelstore_attrib;
43 struct gl_renderbuffer;
44 struct gl_renderbuffer_attachment;
45 struct gl_texture_image;
46 struct gl_texture_object;
47
48 /* GL_ARB_vertex_buffer_object */
49 /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
50 * NULL) if buffer is unavailable for immediate mapping.
51 *
52 * Does GL_MAP_INVALIDATE_RANGE_BIT do this? It seems so, but it
53 * would require more book-keeping in the driver than seems necessary
54 * at this point.
55 *
56 * Does GL_MAP_INVALDIATE_BUFFER_BIT do this? Not really -- we don't
57 * want to provoke the driver to throw away the old storage, we will
58 * respect the contents of already referenced data.
59 */
60 #define MESA_MAP_NOWAIT_BIT 0x0040
61
62
63 /**
64 * Device driver function table.
65 * Core Mesa uses these function pointers to call into device drivers.
66 * Most of these functions directly correspond to OpenGL state commands.
67 * Core Mesa will call these functions after error checking has been done
68 * so that the drivers don't have to worry about error testing.
69 *
70 * Vertex transformation/clipping/lighting is patched into the T&L module.
71 * Rasterization functions are patched into the swrast module.
72 *
73 * Note: when new functions are added here, the drivers/common/driverfuncs.c
74 * file should be updated too!!!
75 */
76 struct dd_function_table {
77 /**
78 * Return a string as needed by glGetString().
79 * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
80 * returned.
81 */
82 const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name );
83
84 /**
85 * Notify the driver after Mesa has made some internal state changes.
86 *
87 * This is in addition to any state change callbacks Mesa may already have
88 * made.
89 */
90 void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
91
92 /**
93 * Get the width and height of the named buffer/window.
94 *
95 * Mesa uses this to determine when the driver's window size has changed.
96 * XXX OBSOLETE: this function will be removed in the future.
97 */
98 void (*GetBufferSize)( struct gl_framebuffer *buffer,
99 GLuint *width, GLuint *height );
100
101 /**
102 * Resize the given framebuffer to the given size.
103 * XXX OBSOLETE: this function will be removed in the future.
104 */
105 void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb,
106 GLuint width, GLuint height);
107
108 /**
109 * Called whenever an error is generated.
110 * __struct gl_contextRec::ErrorValue contains the error value.
111 */
112 void (*Error)( struct gl_context *ctx );
113
114 /**
115 * This is called whenever glFinish() is called.
116 */
117 void (*Finish)( struct gl_context *ctx );
118
119 /**
120 * This is called whenever glFlush() is called.
121 */
122 void (*Flush)( struct gl_context *ctx );
123
124 /**
125 * Clear the color/depth/stencil/accum buffer(s).
126 * \param buffers a bitmask of BUFFER_BIT_* flags indicating which
127 * renderbuffers need to be cleared.
128 */
129 void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
130
131 /**
132 * Execute glAccum command.
133 */
134 void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value );
135
136
137 /**
138 * Execute glRasterPos, updating the ctx->Current.Raster fields
139 */
140 void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
141
142 /**
143 * \name Image-related functions
144 */
145 /*@{*/
146
147 /**
148 * Called by glDrawPixels().
149 * \p unpack describes how to unpack the source image data.
150 */
151 void (*DrawPixels)( struct gl_context *ctx,
152 GLint x, GLint y, GLsizei width, GLsizei height,
153 GLenum format, GLenum type,
154 const struct gl_pixelstore_attrib *unpack,
155 const GLvoid *pixels );
156
157 /**
158 * Called by glReadPixels().
159 */
160 void (*ReadPixels)( struct gl_context *ctx,
161 GLint x, GLint y, GLsizei width, GLsizei height,
162 GLenum format, GLenum type,
163 const struct gl_pixelstore_attrib *unpack,
164 GLvoid *dest );
165
166 /**
167 * Called by glCopyPixels().
168 */
169 void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
170 GLsizei width, GLsizei height,
171 GLint dstx, GLint dsty, GLenum type );
172
173 /**
174 * Called by glBitmap().
175 */
176 void (*Bitmap)( struct gl_context *ctx,
177 GLint x, GLint y, GLsizei width, GLsizei height,
178 const struct gl_pixelstore_attrib *unpack,
179 const GLubyte *bitmap );
180 /*@}*/
181
182
183 /**
184 * \name Texture image functions
185 */
186 /*@{*/
187
188 /**
189 * Choose actual hardware texture format given the user-provided source
190 * image format and type and the desired internal format. In some
191 * cases, srcFormat and srcType can be GL_NONE.
192 * Called by glTexImage(), etc.
193 */
194 gl_format (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat,
195 GLenum srcFormat, GLenum srcType );
196
197 /**
198 * Called by glTexImage1D(). Simply copy the source texture data into the
199 * destination texture memory. The gl_texture_image fields, etc. will be
200 * fully initialized.
201 * The parameters are the same as glTexImage1D(), plus:
202 * \param packing describes how to unpack the source data.
203 * \param texImage is the destination texture image.
204 */
205 void (*TexImage1D)(struct gl_context *ctx,
206 struct gl_texture_image *texImage,
207 GLint internalFormat,
208 GLint width, GLint border,
209 GLenum format, GLenum type, const GLvoid *pixels,
210 const struct gl_pixelstore_attrib *packing);
211
212 /**
213 * Called by glTexImage2D().
214 *
215 * \sa dd_function_table::TexImage1D.
216 */
217 void (*TexImage2D)(struct gl_context *ctx,
218 struct gl_texture_image *texImage,
219 GLint internalFormat,
220 GLint width, GLint height, GLint border,
221 GLenum format, GLenum type, const GLvoid *pixels,
222 const struct gl_pixelstore_attrib *packing);
223
224 /**
225 * Called by glTexImage3D().
226 *
227 * \sa dd_function_table::TexImage1D.
228 */
229 void (*TexImage3D)(struct gl_context *ctx,
230 struct gl_texture_image *texImage,
231 GLint internalFormat,
232 GLint width, GLint height, GLint depth, GLint border,
233 GLenum format, GLenum type, const GLvoid *pixels,
234 const struct gl_pixelstore_attrib *packing);
235
236 /**
237 * Called by glTexSubImage1D(). Replace a subset of the target texture
238 * with new texel data.
239 * \sa dd_function_table::TexImage1D.
240 */
241 void (*TexSubImage1D)(struct gl_context *ctx,
242 struct gl_texture_image *texImage,
243 GLint xoffset, GLsizei width,
244 GLenum format, GLenum type,
245 const GLvoid *pixels,
246 const struct gl_pixelstore_attrib *packing);
247
248 /**
249 * Called by glTexSubImage2D().
250 *
251 * \sa dd_function_table::TexSubImage1D.
252 */
253 void (*TexSubImage2D)(struct gl_context *ctx,
254 struct gl_texture_image *texImage,
255 GLint xoffset, GLint yoffset,
256 GLsizei width, GLsizei height,
257 GLenum format, GLenum type,
258 const GLvoid *pixels,
259 const struct gl_pixelstore_attrib *packing);
260
261 /**
262 * Called by glTexSubImage3D().
263 *
264 * \sa dd_function_table::TexSubImage1D.
265 */
266 void (*TexSubImage3D)(struct gl_context *ctx,
267 struct gl_texture_image *texImage,
268 GLint xoffset, GLint yoffset, GLint zoffset,
269 GLsizei width, GLsizei height, GLint depth,
270 GLenum format, GLenum type,
271 const GLvoid *pixels,
272 const struct gl_pixelstore_attrib *packing);
273
274
275 /**
276 * Called by glGetTexImage().
277 */
278 void (*GetTexImage)( struct gl_context *ctx,
279 GLenum format, GLenum type, GLvoid *pixels,
280 struct gl_texture_image *texImage );
281
282 /**
283 * Called by glCopyTexSubImage1D() and glCopyTexImage1D().
284 */
285 void (*CopyTexSubImage1D)(struct gl_context *ctx,
286 struct gl_texture_image *texImage,
287 GLint xoffset,
288 struct gl_renderbuffer *rb,
289 GLint x, GLint y, GLsizei width);
290
291 /**
292 * Called by glCopyTexSubImage2D() and glCopyTexImage2D().
293 */
294 void (*CopyTexSubImage2D)(struct gl_context *ctx,
295 struct gl_texture_image *texImage,
296 GLint xoffset, GLint yoffset,
297 struct gl_renderbuffer *rb,
298 GLint x, GLint y,
299 GLsizei width, GLsizei height);
300
301 /**
302 * Called by glCopyTexSubImage3D() and glCopyTexImage3D().
303 */
304 void (*CopyTexSubImage3D)(struct gl_context *ctx,
305 struct gl_texture_image *texImage,
306 GLint xoffset, GLint yoffset, GLint zoffset,
307 struct gl_renderbuffer *rb,
308 GLint x, GLint y,
309 GLsizei width, GLsizei height);
310
311 /**
312 * Called by glTexImage[123]D when user specifies a proxy texture
313 * target.
314 *
315 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
316 */
317 GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target,
318 GLint level, GLint internalFormat,
319 GLenum format, GLenum type,
320 GLint width, GLint height,
321 GLint depth, GLint border);
322 /*@}*/
323
324
325 /**
326 * \name Compressed texture functions
327 */
328 /*@{*/
329
330 /**
331 * Called by glCompressedTexImage1D().
332 * The parameters are the same as for glCompressedTexImage1D(), plus a
333 * pointer to the destination texure image.
334 */
335 void (*CompressedTexImage1D)(struct gl_context *ctx,
336 struct gl_texture_image *texImage,
337 GLint internalFormat,
338 GLsizei width, GLint border,
339 GLsizei imageSize, const GLvoid *data);
340 /**
341 * Called by glCompressedTexImage2D().
342 *
343 * \sa dd_function_table::CompressedTexImage1D.
344 */
345 void (*CompressedTexImage2D)(struct gl_context *ctx,
346 struct gl_texture_image *texImage,
347 GLint internalFormat,
348 GLsizei width, GLsizei height, GLint border,
349 GLsizei imageSize, const GLvoid *data);
350
351 /**
352 * Called by glCompressedTexImage3D().
353 *
354 * \sa dd_function_table::CompressedTexImage3D.
355 */
356 void (*CompressedTexImage3D)(struct gl_context *ctx,
357 struct gl_texture_image *texImage,
358 GLint internalFormat,
359 GLsizei width, GLsizei height, GLsizei depth,
360 GLint border,
361 GLsizei imageSize, const GLvoid *data);
362
363 /**
364 * Called by glCompressedTexSubImage1D().
365 */
366 void (*CompressedTexSubImage1D)(struct gl_context *ctx,
367 struct gl_texture_image *texImage,
368 GLint xoffset, GLsizei width,
369 GLenum format,
370 GLsizei imageSize, const GLvoid *data);
371
372 /**
373 * Called by glCompressedTexSubImage2D().
374 */
375 void (*CompressedTexSubImage2D)(struct gl_context *ctx,
376 struct gl_texture_image *texImage,
377 GLint xoffset, GLint yoffset,
378 GLsizei width, GLint height,
379 GLenum format,
380 GLsizei imageSize, const GLvoid *data);
381
382 /**
383 * Called by glCompressedTexSubImage3D().
384 */
385 void (*CompressedTexSubImage3D)(struct gl_context *ctx,
386 struct gl_texture_image *texImage,
387 GLint xoffset, GLint yoffset, GLint zoffset,
388 GLsizei width, GLint height, GLint depth,
389 GLenum format,
390 GLsizei imageSize, const GLvoid *data);
391 /*@}*/
392
393 /**
394 * \name Texture object / image functions
395 */
396 /*@{*/
397
398 /**
399 * Called by glBindTexture().
400 */
401 void (*BindTexture)( struct gl_context *ctx, GLenum target,
402 struct gl_texture_object *tObj );
403
404 /**
405 * Called to allocate a new texture object. Drivers will usually
406 * allocate/return a subclass of gl_texture_object.
407 */
408 struct gl_texture_object * (*NewTextureObject)(struct gl_context *ctx,
409 GLuint name, GLenum target);
410 /**
411 * Called to delete/free a texture object. Drivers should free the
412 * object and any image data it contains.
413 */
414 void (*DeleteTexture)(struct gl_context *ctx,
415 struct gl_texture_object *texObj);
416
417 /** Called to allocate a new texture image object. */
418 struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx);
419
420 /** Called to free a texture image object returned by NewTextureImage() */
421 void (*DeleteTextureImage)(struct gl_context *ctx,
422 struct gl_texture_image *);
423
424 /** Called to allocate memory for a single texture image */
425 GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
426 struct gl_texture_image *texImage,
427 gl_format format, GLsizei width,
428 GLsizei height, GLsizei depth);
429
430 /** Free the memory for a single texture image */
431 void (*FreeTextureImageBuffer)(struct gl_context *ctx,
432 struct gl_texture_image *texImage);
433
434 /** Map a slice of a texture image into user space.
435 * Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice
436 * indicates the 1D array index.
437 * \param texImage the texture image
438 * \param slice the 3D image slice or array texture slice
439 * \param x, y, w, h region of interest
440 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
441 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
442 * \param mapOut returns start of mapping of region of interest
443 * \param rowStrideOut returns row stride (in bytes)
444 */
445 void (*MapTextureImage)(struct gl_context *ctx,
446 struct gl_texture_image *texImage,
447 GLuint slice,
448 GLuint x, GLuint y, GLuint w, GLuint h,
449 GLbitfield mode,
450 GLubyte **mapOut, GLint *rowStrideOut);
451
452 void (*UnmapTextureImage)(struct gl_context *ctx,
453 struct gl_texture_image *texImage,
454 GLuint slice);
455
456 /** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack.
457 * All the gl_texture_images in the texture object will have their
458 * dimensions, format, etc. initialized already.
459 */
460 GLboolean (*AllocTextureStorage)(struct gl_context *ctx,
461 struct gl_texture_object *texObj,
462 GLsizei levels, GLsizei width,
463 GLsizei height, GLsizei depth);
464
465 /**
466 * Map a renderbuffer into user space.
467 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
468 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
469 */
470 void (*MapRenderbuffer)(struct gl_context *ctx,
471 struct gl_renderbuffer *rb,
472 GLuint x, GLuint y, GLuint w, GLuint h,
473 GLbitfield mode,
474 GLubyte **mapOut, GLint *rowStrideOut);
475
476 void (*UnmapRenderbuffer)(struct gl_context *ctx,
477 struct gl_renderbuffer *rb);
478
479 /*@}*/
480
481 /**
482 * \name State-changing functions.
483 *
484 * \note drawing functions are above.
485 *
486 * These functions are called by their corresponding OpenGL API functions.
487 * They are \e also called by the gl_PopAttrib() function!!!
488 * May add more functions like these to the device driver in the future.
489 */
490 /*@{*/
491 /** Specify the alpha test function */
492 void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
493 /** Set the blend color */
494 void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
495 /** Set the blend equation */
496 void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA);
497 void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer,
498 GLenum modeRGB, GLenum modeA);
499 /** Specify pixel arithmetic */
500 void (*BlendFuncSeparate)(struct gl_context *ctx,
501 GLenum sfactorRGB, GLenum dfactorRGB,
502 GLenum sfactorA, GLenum dfactorA);
503 void (*BlendFuncSeparatei)(struct gl_context *ctx, GLuint buffer,
504 GLenum sfactorRGB, GLenum dfactorRGB,
505 GLenum sfactorA, GLenum dfactorA);
506 /** Specify clear values for the color buffers */
507 void (*ClearColor)(struct gl_context *ctx,
508 const union gl_color_union color);
509 /** Specify the clear value for the depth buffer */
510 void (*ClearDepth)(struct gl_context *ctx, GLclampd d);
511 /** Specify the clear value for the stencil buffer */
512 void (*ClearStencil)(struct gl_context *ctx, GLint s);
513 /** Specify a plane against which all geometry is clipped */
514 void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation );
515 /** Enable and disable writing of frame buffer color components */
516 void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
517 GLboolean bmask, GLboolean amask );
518 /** Cause a material color to track the current color */
519 void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
520 /** Specify whether front- or back-facing facets can be culled */
521 void (*CullFace)(struct gl_context *ctx, GLenum mode);
522 /** Define front- and back-facing polygons */
523 void (*FrontFace)(struct gl_context *ctx, GLenum mode);
524 /** Specify the value used for depth buffer comparisons */
525 void (*DepthFunc)(struct gl_context *ctx, GLenum func);
526 /** Enable or disable writing into the depth buffer */
527 void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
528 /** Specify mapping of depth values from NDC to window coordinates */
529 void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
530 /** Specify the current buffer for writing */
531 void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );
532 /** Enable or disable server-side gl capabilities */
533 void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
534 /** Specify fog parameters */
535 void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
536 /** Specify implementation-specific hints */
537 void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode);
538 /** Set light source parameters.
539 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
540 * been transformed to eye-space.
541 */
542 void (*Lightfv)(struct gl_context *ctx, GLenum light,
543 GLenum pname, const GLfloat *params );
544 /** Set the lighting model parameters */
545 void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
546 /** Specify the line stipple pattern */
547 void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern );
548 /** Specify the width of rasterized lines */
549 void (*LineWidth)(struct gl_context *ctx, GLfloat width);
550 /** Specify a logical pixel operation for color index rendering */
551 void (*LogicOpcode)(struct gl_context *ctx, GLenum opcode);
552 void (*PointParameterfv)(struct gl_context *ctx, GLenum pname,
553 const GLfloat *params);
554 /** Specify the diameter of rasterized points */
555 void (*PointSize)(struct gl_context *ctx, GLfloat size);
556 /** Select a polygon rasterization mode */
557 void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode);
558 /** Set the scale and units used to calculate depth values */
559 void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units);
560 /** Set the polygon stippling pattern */
561 void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask );
562 /* Specifies the current buffer for reading */
563 void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
564 /** Set rasterization mode */
565 void (*RenderMode)(struct gl_context *ctx, GLenum mode );
566 /** Define the scissor box */
567 void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
568 /** Select flat or smooth shading */
569 void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
570 /** OpenGL 2.0 two-sided StencilFunc */
571 void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func,
572 GLint ref, GLuint mask);
573 /** OpenGL 2.0 two-sided StencilMask */
574 void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask);
575 /** OpenGL 2.0 two-sided StencilOp */
576 void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail,
577 GLenum zfail, GLenum zpass);
578 /** Control the generation of texture coordinates */
579 void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname,
580 const GLfloat *params);
581 /** Set texture environment parameters */
582 void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
583 const GLfloat *param);
584 /** Set texture parameters */
585 void (*TexParameter)(struct gl_context *ctx, GLenum target,
586 struct gl_texture_object *texObj,
587 GLenum pname, const GLfloat *params);
588 /** Set the viewport */
589 void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
590 /*@}*/
591
592
593 /**
594 * \name Vertex/pixel buffer object functions
595 */
596 /*@{*/
597 void (*BindBuffer)( struct gl_context *ctx, GLenum target,
598 struct gl_buffer_object *obj );
599
600 struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer,
601 GLenum target );
602
603 void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
604
605 GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
606 const GLvoid *data, GLenum usage,
607 struct gl_buffer_object *obj );
608
609 void (*BufferSubData)( struct gl_context *ctx, GLintptrARB offset,
610 GLsizeiptrARB size, const GLvoid *data,
611 struct gl_buffer_object *obj );
612
613 void (*GetBufferSubData)( struct gl_context *ctx,
614 GLintptrARB offset, GLsizeiptrARB size,
615 GLvoid *data, struct gl_buffer_object *obj );
616
617 /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
618 */
619 void * (*MapBufferRange)( struct gl_context *ctx, GLintptr offset,
620 GLsizeiptr length, GLbitfield access,
621 struct gl_buffer_object *obj);
622
623 void (*FlushMappedBufferRange)(struct gl_context *ctx,
624 GLintptr offset, GLsizeiptr length,
625 struct gl_buffer_object *obj);
626
627 GLboolean (*UnmapBuffer)( struct gl_context *ctx,
628 struct gl_buffer_object *obj );
629 /*@}*/
630
631 /**
632 * \name Functions for GL_APPLE_object_purgeable
633 */
634 /*@{*/
635 /* variations on ObjectPurgeable */
636 GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
637 GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
638 GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
639
640 /* variations on ObjectUnpurgeable */
641 GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
642 GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
643 GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
644 /*@}*/
645
646
647 /**
648 * \name Vertex Array objects
649 */
650 /*@{*/
651 struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id);
652 void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
653 void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
654 /*@}*/
655
656
657 /**
658 * \name Support for multiple T&L engines
659 */
660 /*@{*/
661
662 /**
663 * Set by the driver-supplied T&L engine.
664 *
665 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
666 */
667 GLuint CurrentExecPrimitive;
668
669 /**
670 * Current state of an in-progress compilation.
671 *
672 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
673 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
674 */
675 GLuint CurrentSavePrimitive;
676
677
678 #define FLUSH_STORED_VERTICES 0x1
679 #define FLUSH_UPDATE_CURRENT 0x2
680 /**
681 * Set by the driver-supplied T&L engine whenever vertices are buffered
682 * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not
683 * updated.
684 *
685 * The dd_function_table::FlushVertices call below may be used to resolve
686 * these conditions.
687 */
688 GLuint NeedFlush;
689 GLuint SaveNeedFlush;
690
691
692 /* Called prior to any of the GLvertexformat functions being
693 * called. Paired with Driver.FlushVertices().
694 */
695 void (*BeginVertices)( struct gl_context *ctx );
696
697 /**
698 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
699 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
700 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
701 * __struct gl_contextRec::Current and gl_light_attrib::Material
702 *
703 * Note that the default T&L engine never clears the
704 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
705 */
706 void (*FlushVertices)( struct gl_context *ctx, GLuint flags );
707 void (*SaveFlushVertices)( struct gl_context *ctx );
708
709 /**
710 * \brief Hook for drivers to prepare for a glBegin/glEnd block
711 *
712 * This hook is called in vbo_exec_Begin() before any action, including
713 * state updates, occurs.
714 */
715 void (*PrepareExecBegin)( struct gl_context *ctx );
716
717 /**
718 * Give the driver the opportunity to hook in its own vtxfmt for
719 * compiling optimized display lists. This is called on each valid
720 * glBegin() during list compilation.
721 */
722 GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode );
723
724 /**
725 * Notify driver that the special derived value _NeedEyeCoords has
726 * changed.
727 */
728 void (*LightingSpaceChange)( struct gl_context *ctx );
729
730 /**
731 * Called by glNewList().
732 *
733 * Let the T&L component know what is going on with display lists
734 * in time to make changes to dispatch tables, etc.
735 */
736 void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode );
737 /**
738 * Called by glEndList().
739 *
740 * \sa dd_function_table::NewList.
741 */
742 void (*EndList)( struct gl_context *ctx );
743
744 /**
745 * Called by glCallList(s).
746 *
747 * Notify the T&L component before and after calling a display list.
748 */
749 void (*BeginCallList)( struct gl_context *ctx,
750 struct gl_display_list *dlist );
751 /**
752 * Called by glEndCallList().
753 *
754 * \sa dd_function_table::BeginCallList.
755 */
756 void (*EndCallList)( struct gl_context *ctx );
757
758 /**@}*/
759
760 /**
761 * \name GL_NV_texture_barrier interface
762 */
763 void (*TextureBarrier)(struct gl_context *ctx);
764 };
765
766
767 /**
768 * Transform/Clip/Lighting interface
769 *
770 * Drivers present a reduced set of the functions possible in
771 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
772 * remaining functions to map down to these entry points.
773 *
774 * These are the initial values to be installed into dispatch by
775 * mesa. If the T&L driver wants to modify the dispatch table
776 * while installed, it must do so itself. It would be possible for
777 * the vertexformat to install its own initial values for these
778 * functions, but this way there is an obvious list of what is
779 * expected of the driver.
780 *
781 * If the driver wants to hook in entry points other than those
782 * listed, it must restore them to their original values in
783 * the disable() callback, below.
784 */
785 typedef struct {
786 /**
787 * \name Vertex
788 */
789 /*@{*/
790 void (GLAPIENTRYP ArrayElement)( GLint );
791 void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
792 void (GLAPIENTRYP Color3fv)( const GLfloat * );
793 void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
794 void (GLAPIENTRYP Color4fv)( const GLfloat * );
795 void (GLAPIENTRYP EdgeFlag)( GLboolean );
796 void (GLAPIENTRYP EvalCoord1f)( GLfloat );
797 void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * );
798 void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat );
799 void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * );
800 void (GLAPIENTRYP EvalPoint1)( GLint );
801 void (GLAPIENTRYP EvalPoint2)( GLint, GLint );
802 void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
803 void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
804 void (GLAPIENTRYP Indexf)( GLfloat );
805 void (GLAPIENTRYP Indexfv)( const GLfloat * );
806 void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * );
807 void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
808 void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
809 void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
810 void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
811 void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
812 void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
813 void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
814 void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
815 void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
816 void (GLAPIENTRYP Normal3fv)( const GLfloat * );
817 void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
818 void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
819 void (GLAPIENTRYP TexCoord1f)( GLfloat );
820 void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
821 void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
822 void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
823 void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
824 void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
825 void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
826 void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
827 void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
828 void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
829 void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
830 void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
831 void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
832 void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
833 void (GLAPIENTRYP CallList)( GLuint );
834 void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );
835 void (GLAPIENTRYP Begin)( GLenum );
836 void (GLAPIENTRYP End)( void );
837 /* GL_NV_vertex_program */
838 void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
839 void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
840 void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
841 void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
842 void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
843 void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
844 void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
845 void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
846
847 /*@}*/
848
849 void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
850
851 /**
852 * \name Array
853 */
854 /*@{*/
855 void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
856 void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type,
857 const GLvoid *indices );
858 void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start,
859 GLuint end, GLsizei count,
860 GLenum type, const GLvoid *indices );
861 /*@}*/
862
863 /**
864 * \name Eval
865 *
866 * If you don't support eval, fallback to the default vertex format
867 * on receiving an eval call and use the pipeline mechanism to
868 * provide partial T&L acceleration.
869 *
870 * Mesa will provide a set of helper functions to do eval within
871 * accelerated vertex formats, eventually...
872 */
873 /*@{*/
874 void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
875 void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
876 /*@}*/
877
878 } GLvertexformat;
879
880
881 #endif /* DD_INCLUDED */