3 * Device driver interfaces.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
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:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
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.
34 /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
38 struct gl_buffer_object;
40 struct gl_display_list;
41 struct gl_framebuffer;
42 struct gl_pixelstore_attrib;
44 struct gl_renderbuffer;
45 struct gl_renderbuffer_attachment;
47 struct gl_shader_program;
48 struct gl_texture_image;
49 struct gl_texture_object;
51 /* GL_ARB_vertex_buffer_object */
52 /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
53 * NULL) if buffer is unavailable for immediate mapping.
55 * Does GL_MAP_INVALIDATE_RANGE_BIT do this? It seems so, but it
56 * would require more book-keeping in the driver than seems necessary
59 * Does GL_MAP_INVALDIATE_BUFFER_BIT do this? Not really -- we don't
60 * want to provoke the driver to throw away the old storage, we will
61 * respect the contents of already referenced data.
63 #define MESA_MAP_NOWAIT_BIT 0x0040
67 * Device driver function table.
68 * Core Mesa uses these function pointers to call into device drivers.
69 * Most of these functions directly correspond to OpenGL state commands.
70 * Core Mesa will call these functions after error checking has been done
71 * so that the drivers don't have to worry about error testing.
73 * Vertex transformation/clipping/lighting is patched into the T&L module.
74 * Rasterization functions are patched into the swrast module.
76 * Note: when new functions are added here, the drivers/common/driverfuncs.c
77 * file should be updated too!!!
79 struct dd_function_table {
81 * Return a string as needed by glGetString().
82 * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
85 const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name );
88 * Notify the driver after Mesa has made some internal state changes.
90 * This is in addition to any state change callbacks Mesa may already have
93 void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
96 * Get the width and height of the named buffer/window.
98 * Mesa uses this to determine when the driver's window size has changed.
99 * XXX OBSOLETE: this function will be removed in the future.
101 void (*GetBufferSize)( struct gl_framebuffer *buffer,
102 GLuint *width, GLuint *height );
105 * Resize the given framebuffer to the given size.
106 * XXX OBSOLETE: this function will be removed in the future.
108 void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb,
109 GLuint width, GLuint height);
112 * Called whenever an error is generated.
113 * __struct gl_contextRec::ErrorValue contains the error value.
115 void (*Error)( struct gl_context *ctx );
118 * This is called whenever glFinish() is called.
120 void (*Finish)( struct gl_context *ctx );
123 * This is called whenever glFlush() is called.
125 void (*Flush)( struct gl_context *ctx );
128 * Clear the color/depth/stencil/accum buffer(s).
129 * \param buffers a bitmask of BUFFER_BIT_* flags indicating which
130 * renderbuffers need to be cleared.
132 void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
135 * Execute glAccum command.
137 void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value );
141 * Execute glRasterPos, updating the ctx->Current.Raster fields
143 void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
146 * \name Image-related functions
151 * Called by glDrawPixels().
152 * \p unpack describes how to unpack the source image data.
154 void (*DrawPixels)( struct gl_context *ctx,
155 GLint x, GLint y, GLsizei width, GLsizei height,
156 GLenum format, GLenum type,
157 const struct gl_pixelstore_attrib *unpack,
158 const GLvoid *pixels );
161 * Called by glReadPixels().
163 void (*ReadPixels)( struct gl_context *ctx,
164 GLint x, GLint y, GLsizei width, GLsizei height,
165 GLenum format, GLenum type,
166 const struct gl_pixelstore_attrib *unpack,
170 * Called by glCopyPixels().
172 void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
173 GLsizei width, GLsizei height,
174 GLint dstx, GLint dsty, GLenum type );
177 * Called by glBitmap().
179 void (*Bitmap)( struct gl_context *ctx,
180 GLint x, GLint y, GLsizei width, GLsizei height,
181 const struct gl_pixelstore_attrib *unpack,
182 const GLubyte *bitmap );
187 * \name Texture image functions
192 * Choose texture format.
194 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
195 * functions. The driver should examine \p internalFormat and return a
198 GLuint (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat,
199 GLenum srcFormat, GLenum srcType );
202 * Called by glTexImage1D().
204 * \param target user specified.
205 * \param format user specified.
206 * \param type user specified.
207 * \param pixels user specified.
208 * \param packing indicates the image packing of pixels.
209 * \param texObj is the target texture object.
210 * \param texImage is the target texture image. It will have the texture \p
211 * width, \p height, \p depth, \p border and \p internalFormat information.
213 * \p retainInternalCopy is returned by this function and indicates whether
214 * core Mesa should keep an internal copy of the texture image.
216 * Drivers should call a fallback routine from texstore.c if needed.
218 void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
219 GLint internalFormat,
220 GLint width, GLint border,
221 GLenum format, GLenum type, const GLvoid *pixels,
222 const struct gl_pixelstore_attrib *packing,
223 struct gl_texture_object *texObj,
224 struct gl_texture_image *texImage );
227 * Called by glTexImage2D().
229 * \sa dd_function_table::TexImage1D.
231 void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
232 GLint internalFormat,
233 GLint width, GLint height, GLint border,
234 GLenum format, GLenum type, const GLvoid *pixels,
235 const struct gl_pixelstore_attrib *packing,
236 struct gl_texture_object *texObj,
237 struct gl_texture_image *texImage );
240 * Called by glTexImage3D().
242 * \sa dd_function_table::TexImage1D.
244 void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level,
245 GLint internalFormat,
246 GLint width, GLint height, GLint depth, GLint border,
247 GLenum format, GLenum type, const GLvoid *pixels,
248 const struct gl_pixelstore_attrib *packing,
249 struct gl_texture_object *texObj,
250 struct gl_texture_image *texImage );
253 * Called by glTexSubImage1D().
255 * \param target user specified.
256 * \param level user specified.
257 * \param xoffset user specified.
258 * \param yoffset user specified.
259 * \param zoffset user specified.
260 * \param width user specified.
261 * \param height user specified.
262 * \param depth user specified.
263 * \param format user specified.
264 * \param type user specified.
265 * \param pixels user specified.
266 * \param packing indicates the image packing of pixels.
267 * \param texObj is the target texture object.
268 * \param texImage is the target texture image. It will have the texture \p
269 * width, \p height, \p border and \p internalFormat information.
271 * The driver should use a fallback routine from texstore.c if needed.
273 void (*TexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level,
274 GLint xoffset, GLsizei width,
275 GLenum format, GLenum type,
276 const GLvoid *pixels,
277 const struct gl_pixelstore_attrib *packing,
278 struct gl_texture_object *texObj,
279 struct gl_texture_image *texImage );
282 * Called by glTexSubImage2D().
284 * \sa dd_function_table::TexSubImage1D.
286 void (*TexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level,
287 GLint xoffset, GLint yoffset,
288 GLsizei width, GLsizei height,
289 GLenum format, GLenum type,
290 const GLvoid *pixels,
291 const struct gl_pixelstore_attrib *packing,
292 struct gl_texture_object *texObj,
293 struct gl_texture_image *texImage );
296 * Called by glTexSubImage3D().
298 * \sa dd_function_table::TexSubImage1D.
300 void (*TexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level,
301 GLint xoffset, GLint yoffset, GLint zoffset,
302 GLsizei width, GLsizei height, GLint depth,
303 GLenum format, GLenum type,
304 const GLvoid *pixels,
305 const struct gl_pixelstore_attrib *packing,
306 struct gl_texture_object *texObj,
307 struct gl_texture_image *texImage );
310 * Called by glGetTexImage().
312 void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level,
313 GLenum format, GLenum type, GLvoid *pixels,
314 struct gl_texture_object *texObj,
315 struct gl_texture_image *texImage );
318 * Called by glCopyTexImage1D().
320 * Drivers should use a fallback routine from texstore.c if needed.
322 void (*CopyTexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
323 GLenum internalFormat, GLint x, GLint y,
324 GLsizei width, GLint border );
327 * Called by glCopyTexImage2D().
329 * Drivers should use a fallback routine from texstore.c if needed.
331 void (*CopyTexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
332 GLenum internalFormat, GLint x, GLint y,
333 GLsizei width, GLsizei height, GLint border );
336 * Called by glCopyTexSubImage1D().
338 * Drivers should use a fallback routine from texstore.c if needed.
340 void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level,
342 GLint x, GLint y, GLsizei width );
344 * Called by glCopyTexSubImage2D().
346 * Drivers should use a fallback routine from texstore.c if needed.
348 void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level,
349 GLint xoffset, GLint yoffset,
351 GLsizei width, GLsizei height );
353 * Called by glCopyTexSubImage3D().
355 * Drivers should use a fallback routine from texstore.c if needed.
357 void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level,
358 GLint xoffset, GLint yoffset, GLint zoffset,
360 GLsizei width, GLsizei height );
363 * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
365 void (*GenerateMipmap)(struct gl_context *ctx, GLenum target,
366 struct gl_texture_object *texObj);
369 * Called by glTexImage[123]D when user specifies a proxy texture
372 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
374 GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target,
375 GLint level, GLint internalFormat,
376 GLenum format, GLenum type,
377 GLint width, GLint height,
378 GLint depth, GLint border);
383 * \name Compressed texture functions
388 * Called by glCompressedTexImage1D().
390 * \param target user specified.
391 * \param format user specified.
392 * \param type user specified.
393 * \param pixels user specified.
394 * \param packing indicates the image packing of pixels.
395 * \param texObj is the target texture object.
396 * \param texImage is the target texture image. It will have the texture \p
397 * width, \p height, \p depth, \p border and \p internalFormat information.
399 * \a retainInternalCopy is returned by this function and indicates whether
400 * core Mesa should keep an internal copy of the texture image.
402 void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target,
403 GLint level, GLint internalFormat,
404 GLsizei width, GLint border,
405 GLsizei imageSize, const GLvoid *data,
406 struct gl_texture_object *texObj,
407 struct gl_texture_image *texImage );
409 * Called by glCompressedTexImage2D().
411 * \sa dd_function_table::CompressedTexImage1D.
413 void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target,
414 GLint level, GLint internalFormat,
415 GLsizei width, GLsizei height, GLint border,
416 GLsizei imageSize, const GLvoid *data,
417 struct gl_texture_object *texObj,
418 struct gl_texture_image *texImage );
420 * Called by glCompressedTexImage3D().
422 * \sa dd_function_table::CompressedTexImage3D.
424 void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target,
425 GLint level, GLint internalFormat,
426 GLsizei width, GLsizei height, GLsizei depth,
428 GLsizei imageSize, const GLvoid *data,
429 struct gl_texture_object *texObj,
430 struct gl_texture_image *texImage );
433 * Called by glCompressedTexSubImage1D().
435 * \param target user specified.
436 * \param level user specified.
437 * \param xoffset user specified.
438 * \param yoffset user specified.
439 * \param zoffset user specified.
440 * \param width user specified.
441 * \param height user specified.
442 * \param depth user specified.
443 * \param imageSize user specified.
444 * \param data user specified.
445 * \param texObj is the target texture object.
446 * \param texImage is the target texture image. It will have the texture \p
447 * width, \p height, \p depth, \p border and \p internalFormat information.
449 void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level,
450 GLint xoffset, GLsizei width,
452 GLsizei imageSize, const GLvoid *data,
453 struct gl_texture_object *texObj,
454 struct gl_texture_image *texImage);
456 * Called by glCompressedTexSubImage2D().
458 * \sa dd_function_table::CompressedTexImage3D.
460 void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level,
461 GLint xoffset, GLint yoffset,
462 GLsizei width, GLint height,
464 GLsizei imageSize, const GLvoid *data,
465 struct gl_texture_object *texObj,
466 struct gl_texture_image *texImage);
468 * Called by glCompressedTexSubImage3D().
470 * \sa dd_function_table::CompressedTexImage3D.
472 void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level,
473 GLint xoffset, GLint yoffset, GLint zoffset,
474 GLsizei width, GLint height, GLint depth,
476 GLsizei imageSize, const GLvoid *data,
477 struct gl_texture_object *texObj,
478 struct gl_texture_image *texImage);
482 * Called by glGetCompressedTexImage.
484 void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint level,
486 struct gl_texture_object *texObj,
487 struct gl_texture_image *texImage);
492 * \name Texture object functions
497 * Called by glBindTexture().
499 void (*BindTexture)( struct gl_context *ctx, GLenum target,
500 struct gl_texture_object *tObj );
503 * Called to allocate a new texture object.
504 * A new gl_texture_object should be returned. The driver should
505 * attach to it any device-specific info it needs.
507 struct gl_texture_object * (*NewTextureObject)( struct gl_context *ctx, GLuint name,
510 * Called when a texture object is about to be deallocated.
512 * Driver should delete the gl_texture_object object and anything
515 void (*DeleteTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
518 * Called to allocate a new texture image object.
520 struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx );
523 * Called to free tImage->Data.
525 void (*FreeTexImageData)( struct gl_context *ctx, struct gl_texture_image *tImage );
527 /** Map texture image data into user space */
528 void (*MapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
529 /** Unmap texture images from user space */
530 void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
533 * Note: no context argument. This function doesn't initially look
534 * like it belongs here, except that the driver is the only entity
535 * that knows for sure how the texture memory is allocated - via
536 * the above callbacks. There is then an argument that the driver
537 * knows what memcpy paths might be fast. Typically this is invoked with
539 * to -- a pointer into texture memory allocated by NewTextureImage() above.
540 * from -- a pointer into client memory or a mesa temporary.
541 * sz -- nr bytes to copy.
543 void* (*TextureMemCpy)( void *to, const void *from, size_t sz );
546 * Called by glAreTextureResident().
548 GLboolean (*IsTextureResident)( struct gl_context *ctx,
549 struct gl_texture_object *t );
552 * Called when the texture's color lookup table is changed.
554 * If \p tObj is NULL then the shared texture palette
555 * gl_texture_object::Palette is to be updated.
557 void (*UpdateTexturePalette)( struct gl_context *ctx,
558 struct gl_texture_object *tObj );
563 * \name Imaging functionality
566 void (*CopyColorTable)( struct gl_context *ctx,
567 GLenum target, GLenum internalformat,
568 GLint x, GLint y, GLsizei width );
570 void (*CopyColorSubTable)( struct gl_context *ctx,
571 GLenum target, GLsizei start,
572 GLint x, GLint y, GLsizei width );
577 * \name Vertex/fragment program functions
580 /** Bind a vertex/fragment program */
581 void (*BindProgram)(struct gl_context *ctx, GLenum target, struct gl_program *prog);
582 /** Allocate a new program */
583 struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id);
584 /** Delete a program */
585 void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);
587 * Notify driver that a program string (and GPU code) has been specified
588 * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is
589 * supported by the driver.
591 GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target,
592 struct gl_program *prog);
594 /** Query if program can be loaded onto hardware */
595 GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target,
596 struct gl_program *prog);
601 * \name GLSL shader/program functions.
605 * Called when a shader program is linked.
607 * This gives drivers an opportunity to clone the IR and make their
608 * own transformations on it for the purposes of code generation.
610 GLboolean (*LinkShader)(struct gl_context *ctx, struct gl_shader_program *shader);
614 * \name State-changing functions.
616 * \note drawing functions are above.
618 * These functions are called by their corresponding OpenGL API functions.
619 * They are \e also called by the gl_PopAttrib() function!!!
620 * May add more functions like these to the device driver in the future.
623 /** Specify the alpha test function */
624 void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
625 /** Set the blend color */
626 void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
627 /** Set the blend equation */
628 void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA);
629 void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer,
630 GLenum modeRGB, GLenum modeA);
631 /** Specify pixel arithmetic */
632 void (*BlendFuncSeparate)(struct gl_context *ctx,
633 GLenum sfactorRGB, GLenum dfactorRGB,
634 GLenum sfactorA, GLenum dfactorA);
635 void (*BlendFuncSeparatei)(struct gl_context *ctx, GLuint buffer,
636 GLenum sfactorRGB, GLenum dfactorRGB,
637 GLenum sfactorA, GLenum dfactorA);
638 /** Specify clear values for the color buffers */
639 void (*ClearColor)(struct gl_context *ctx, const GLfloat color[4]);
640 /** Specify the clear value for the depth buffer */
641 void (*ClearDepth)(struct gl_context *ctx, GLclampd d);
642 /** Specify the clear value for the stencil buffer */
643 void (*ClearStencil)(struct gl_context *ctx, GLint s);
644 /** Specify a plane against which all geometry is clipped */
645 void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation );
646 /** Enable and disable writing of frame buffer color components */
647 void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
648 GLboolean bmask, GLboolean amask );
649 void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask,
650 GLboolean gmask, GLboolean bmask, GLboolean amask);
651 /** Cause a material color to track the current color */
652 void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
653 /** Specify whether front- or back-facing facets can be culled */
654 void (*CullFace)(struct gl_context *ctx, GLenum mode);
655 /** Define front- and back-facing polygons */
656 void (*FrontFace)(struct gl_context *ctx, GLenum mode);
657 /** Specify the value used for depth buffer comparisons */
658 void (*DepthFunc)(struct gl_context *ctx, GLenum func);
659 /** Enable or disable writing into the depth buffer */
660 void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
661 /** Specify mapping of depth values from NDC to window coordinates */
662 void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
663 /** Specify the current buffer for writing */
664 void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );
665 /** Specify the buffers for writing for fragment programs*/
666 void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers );
667 /** Enable or disable server-side gl capabilities */
668 void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
669 /** Specify fog parameters */
670 void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
671 /** Specify implementation-specific hints */
672 void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode);
673 /** Set light source parameters.
674 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
675 * been transformed to eye-space.
677 void (*Lightfv)(struct gl_context *ctx, GLenum light,
678 GLenum pname, const GLfloat *params );
679 /** Set the lighting model parameters */
680 void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
681 /** Specify the line stipple pattern */
682 void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern );
683 /** Specify the width of rasterized lines */
684 void (*LineWidth)(struct gl_context *ctx, GLfloat width);
685 /** Specify a logical pixel operation for color index rendering */
686 void (*LogicOpcode)(struct gl_context *ctx, GLenum opcode);
687 void (*PointParameterfv)(struct gl_context *ctx, GLenum pname,
688 const GLfloat *params);
689 /** Specify the diameter of rasterized points */
690 void (*PointSize)(struct gl_context *ctx, GLfloat size);
691 /** Select a polygon rasterization mode */
692 void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode);
693 /** Set the scale and units used to calculate depth values */
694 void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units);
695 /** Set the polygon stippling pattern */
696 void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask );
697 /* Specifies the current buffer for reading */
698 void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
699 /** Set rasterization mode */
700 void (*RenderMode)(struct gl_context *ctx, GLenum mode );
701 /** Define the scissor box */
702 void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
703 /** Select flat or smooth shading */
704 void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
705 /** OpenGL 2.0 two-sided StencilFunc */
706 void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func,
707 GLint ref, GLuint mask);
708 /** OpenGL 2.0 two-sided StencilMask */
709 void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask);
710 /** OpenGL 2.0 two-sided StencilOp */
711 void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail,
712 GLenum zfail, GLenum zpass);
713 /** Control the generation of texture coordinates */
714 void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname,
715 const GLfloat *params);
716 /** Set texture environment parameters */
717 void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
718 const GLfloat *param);
719 /** Set texture parameters */
720 void (*TexParameter)(struct gl_context *ctx, GLenum target,
721 struct gl_texture_object *texObj,
722 GLenum pname, const GLfloat *params);
723 /** Set the viewport */
724 void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
729 * \name Vertex/pixel buffer object functions
732 void (*BindBuffer)( struct gl_context *ctx, GLenum target,
733 struct gl_buffer_object *obj );
735 struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer,
738 void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
740 GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
741 const GLvoid *data, GLenum usage,
742 struct gl_buffer_object *obj );
744 void (*BufferSubData)( struct gl_context *ctx, GLenum target, GLintptrARB offset,
745 GLsizeiptrARB size, const GLvoid *data,
746 struct gl_buffer_object *obj );
748 void (*GetBufferSubData)( struct gl_context *ctx, GLenum target,
749 GLintptrARB offset, GLsizeiptrARB size,
750 GLvoid *data, struct gl_buffer_object *obj );
752 void * (*MapBuffer)( struct gl_context *ctx, GLenum target, GLenum access,
753 struct gl_buffer_object *obj );
755 void (*CopyBufferSubData)( struct gl_context *ctx,
756 struct gl_buffer_object *src,
757 struct gl_buffer_object *dst,
758 GLintptr readOffset, GLintptr writeOffset,
761 /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
763 void * (*MapBufferRange)( struct gl_context *ctx, GLenum target, GLintptr offset,
764 GLsizeiptr length, GLbitfield access,
765 struct gl_buffer_object *obj);
767 void (*FlushMappedBufferRange)(struct gl_context *ctx, GLenum target,
768 GLintptr offset, GLsizeiptr length,
769 struct gl_buffer_object *obj);
771 GLboolean (*UnmapBuffer)( struct gl_context *ctx, GLenum target,
772 struct gl_buffer_object *obj );
776 * \name Functions for GL_APPLE_object_purgeable
779 /* variations on ObjectPurgeable */
780 GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
781 GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
782 GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
784 /* variations on ObjectUnpurgeable */
785 GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
786 GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
787 GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
791 * \name Functions for GL_EXT_framebuffer_{object,blit}.
794 struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name);
795 struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, GLuint name);
796 void (*BindFramebuffer)(struct gl_context *ctx, GLenum target,
797 struct gl_framebuffer *drawFb,
798 struct gl_framebuffer *readFb);
799 void (*FramebufferRenderbuffer)(struct gl_context *ctx,
800 struct gl_framebuffer *fb,
802 struct gl_renderbuffer *rb);
803 void (*RenderTexture)(struct gl_context *ctx,
804 struct gl_framebuffer *fb,
805 struct gl_renderbuffer_attachment *att);
806 void (*FinishRenderTexture)(struct gl_context *ctx,
807 struct gl_renderbuffer_attachment *att);
808 void (*ValidateFramebuffer)(struct gl_context *ctx,
809 struct gl_framebuffer *fb);
811 void (*BlitFramebuffer)(struct gl_context *ctx,
812 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
813 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
814 GLbitfield mask, GLenum filter);
817 * \name Query objects
820 struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id);
821 void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q);
822 void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q);
823 void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q);
824 void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q);
825 void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q);
830 * \name Vertex Array objects
833 struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id);
834 void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
835 void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
839 * \name GLSL-related functions (ARB extensions and OpenGL 2.x)
842 struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type);
843 void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
844 struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, GLuint name);
845 void (*DeleteShaderProgram)(struct gl_context *ctx,
846 struct gl_shader_program *shProg);
847 void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
852 * \name Support for multiple T&L engines
857 * Bitmask of state changes that require the current T&L module to be
858 * validated, using ValidateTnlModule() below.
863 * Validate the current T&L module.
865 * This is called directly after UpdateState() when a state change that has
866 * occurred matches the dd_function_table::NeedValidate bitmask above. This
867 * ensures all computed values are up to date, thus allowing the driver to
868 * decide if the current T&L module needs to be swapped out.
870 * This must be non-NULL if a driver installs a custom T&L module and sets
871 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
873 void (*ValidateTnlModule)( struct gl_context *ctx, GLuint new_state );
876 * Set by the driver-supplied T&L engine.
878 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
880 GLuint CurrentExecPrimitive;
883 * Current state of an in-progress compilation.
885 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
886 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
888 GLuint CurrentSavePrimitive;
891 #define FLUSH_STORED_VERTICES 0x1
892 #define FLUSH_UPDATE_CURRENT 0x2
894 * Set by the driver-supplied T&L engine whenever vertices are buffered
895 * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not
898 * The dd_function_table::FlushVertices call below may be used to resolve
902 GLuint SaveNeedFlush;
905 /* Called prior to any of the GLvertexformat functions being
906 * called. Paired with Driver.FlushVertices().
908 void (*BeginVertices)( struct gl_context *ctx );
911 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
912 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
913 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
914 * __struct gl_contextRec::Current and gl_light_attrib::Material
916 * Note that the default T&L engine never clears the
917 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
919 void (*FlushVertices)( struct gl_context *ctx, GLuint flags );
920 void (*SaveFlushVertices)( struct gl_context *ctx );
923 * Give the driver the opportunity to hook in its own vtxfmt for
924 * compiling optimized display lists. This is called on each valid
925 * glBegin() during list compilation.
927 GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode );
930 * Notify driver that the special derived value _NeedEyeCoords has
933 void (*LightingSpaceChange)( struct gl_context *ctx );
936 * Called by glNewList().
938 * Let the T&L component know what is going on with display lists
939 * in time to make changes to dispatch tables, etc.
941 void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode );
943 * Called by glEndList().
945 * \sa dd_function_table::NewList.
947 void (*EndList)( struct gl_context *ctx );
950 * Called by glCallList(s).
952 * Notify the T&L component before and after calling a display list.
954 void (*BeginCallList)( struct gl_context *ctx,
955 struct gl_display_list *dlist );
957 * Called by glEndCallList().
959 * \sa dd_function_table::BeginCallList.
961 void (*EndCallList)( struct gl_context *ctx );
965 * \name GL_ARB_sync interfaces
968 struct gl_sync_object * (*NewSyncObject)(struct gl_context *, GLenum);
969 void (*FenceSync)(struct gl_context *, struct gl_sync_object *, GLenum, GLbitfield);
970 void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *);
971 void (*CheckSync)(struct gl_context *, struct gl_sync_object *);
972 void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *,
973 GLbitfield, GLuint64);
974 void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *,
975 GLbitfield, GLuint64);
978 /** GL_NV_conditional_render */
979 void (*BeginConditionalRender)(struct gl_context *ctx, struct gl_query_object *q,
981 void (*EndConditionalRender)(struct gl_context *ctx, struct gl_query_object *q);
984 * \name GL_OES_draw_texture interface
987 void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
988 GLfloat width, GLfloat height);
992 * \name GL_OES_EGL_image interface
994 void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target,
995 struct gl_texture_object *texObj,
996 struct gl_texture_image *texImage,
997 GLeglImageOES image_handle);
998 void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx,
999 struct gl_renderbuffer *rb,
1000 void *image_handle);
1003 * \name GL_EXT_transform_feedback interface
1005 struct gl_transform_feedback_object *
1006 (*NewTransformFeedback)(struct gl_context *ctx, GLuint name);
1007 void (*DeleteTransformFeedback)(struct gl_context *ctx,
1008 struct gl_transform_feedback_object *obj);
1009 void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode,
1010 struct gl_transform_feedback_object *obj);
1011 void (*EndTransformFeedback)(struct gl_context *ctx,
1012 struct gl_transform_feedback_object *obj);
1013 void (*PauseTransformFeedback)(struct gl_context *ctx,
1014 struct gl_transform_feedback_object *obj);
1015 void (*ResumeTransformFeedback)(struct gl_context *ctx,
1016 struct gl_transform_feedback_object *obj);
1017 void (*DrawTransformFeedback)(struct gl_context *ctx, GLenum mode,
1018 struct gl_transform_feedback_object *obj);
1021 * \name GL_NV_texture_barrier interface
1023 void (*TextureBarrier)(struct gl_context *ctx);
1026 * \name GL_ARB_sampler_objects
1028 struct gl_sampler_object * (*NewSamplerObject)(struct gl_context *ctx,
1030 void (*DeleteSamplerObject)(struct gl_context *ctx,
1031 struct gl_sampler_object *samp);
1036 * Transform/Clip/Lighting interface
1038 * Drivers present a reduced set of the functions possible in
1039 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
1040 * remaining functions to map down to these entry points.
1042 * These are the initial values to be installed into dispatch by
1043 * mesa. If the T&L driver wants to modify the dispatch table
1044 * while installed, it must do so itself. It would be possible for
1045 * the vertexformat to install its own initial values for these
1046 * functions, but this way there is an obvious list of what is
1047 * expected of the driver.
1049 * If the driver wants to hook in entry points other than those
1050 * listed, it must restore them to their original values in
1051 * the disable() callback, below.
1058 void (GLAPIENTRYP ArrayElement)( GLint );
1059 void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
1060 void (GLAPIENTRYP Color3fv)( const GLfloat * );
1061 void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1062 void (GLAPIENTRYP Color4fv)( const GLfloat * );
1063 void (GLAPIENTRYP EdgeFlag)( GLboolean );
1064 void (GLAPIENTRYP EvalCoord1f)( GLfloat );
1065 void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * );
1066 void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat );
1067 void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * );
1068 void (GLAPIENTRYP EvalPoint1)( GLint );
1069 void (GLAPIENTRYP EvalPoint2)( GLint, GLint );
1070 void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
1071 void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
1072 void (GLAPIENTRYP Indexf)( GLfloat );
1073 void (GLAPIENTRYP Indexfv)( const GLfloat * );
1074 void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * );
1075 void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
1076 void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
1077 void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
1078 void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
1079 void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
1080 void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
1081 void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
1082 void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
1083 void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
1084 void (GLAPIENTRYP Normal3fv)( const GLfloat * );
1085 void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
1086 void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
1087 void (GLAPIENTRYP TexCoord1f)( GLfloat );
1088 void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
1089 void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
1090 void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
1091 void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
1092 void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
1093 void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1094 void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
1095 void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
1096 void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
1097 void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
1098 void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
1099 void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1100 void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
1101 void (GLAPIENTRYP CallList)( GLuint );
1102 void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );
1103 void (GLAPIENTRYP Begin)( GLenum );
1104 void (GLAPIENTRYP End)( void );
1105 void (GLAPIENTRYP PrimitiveRestartNV)( void );
1106 /* GL_NV_vertex_program */
1107 void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
1108 void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
1109 void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
1110 void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
1111 void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1112 void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
1113 void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1114 void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
1115 /* GL_ARB_vertex_program */
1116 void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
1117 void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
1118 void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
1119 void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v );
1120 void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1121 void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
1122 void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1123 void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
1125 /* GL_EXT_gpu_shader4 / GL 3.0 */
1126 void (GLAPIENTRYP VertexAttribI1i)( GLuint index, GLint x);
1127 void (GLAPIENTRYP VertexAttribI2i)( GLuint index, GLint x, GLint y);
1128 void (GLAPIENTRYP VertexAttribI3i)( GLuint index, GLint x, GLint y, GLint z);
1129 void (GLAPIENTRYP VertexAttribI4i)( GLuint index, GLint x, GLint y, GLint z, GLint w);
1130 void (GLAPIENTRYP VertexAttribI2iv)( GLuint index, const GLint *v);
1131 void (GLAPIENTRYP VertexAttribI3iv)( GLuint index, const GLint *v);
1132 void (GLAPIENTRYP VertexAttribI4iv)( GLuint index, const GLint *v);
1134 void (GLAPIENTRYP VertexAttribI1ui)( GLuint index, GLuint x);
1135 void (GLAPIENTRYP VertexAttribI2ui)( GLuint index, GLuint x, GLuint y);
1136 void (GLAPIENTRYP VertexAttribI3ui)( GLuint index, GLuint x, GLuint y, GLuint z);
1137 void (GLAPIENTRYP VertexAttribI4ui)( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1138 void (GLAPIENTRYP VertexAttribI2uiv)( GLuint index, const GLuint *v);
1139 void (GLAPIENTRYP VertexAttribI3uiv)( GLuint index, const GLuint *v);
1140 void (GLAPIENTRYP VertexAttribI4uiv)( GLuint index, const GLuint *v);
1144 void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
1150 void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
1151 void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type,
1152 const GLvoid *indices );
1153 void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start,
1154 GLuint end, GLsizei count,
1155 GLenum type, const GLvoid *indices );
1156 void (GLAPIENTRYP MultiDrawElementsEXT)( GLenum mode, const GLsizei *count,
1158 const GLvoid **indices,
1160 void (GLAPIENTRYP DrawElementsBaseVertex)( GLenum mode, GLsizei count,
1162 const GLvoid *indices,
1164 void (GLAPIENTRYP DrawRangeElementsBaseVertex)( GLenum mode, GLuint start,
1165 GLuint end, GLsizei count,
1167 const GLvoid *indices,
1169 void (GLAPIENTRYP MultiDrawElementsBaseVertex)( GLenum mode,
1170 const GLsizei *count,
1172 const GLvoid **indices,
1174 const GLint *basevertex);
1175 void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first,
1176 GLsizei count, GLsizei primcount);
1177 void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count,
1178 GLenum type, const GLvoid *indices,
1180 void (GLAPIENTRYP DrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count,
1181 GLenum type, const GLvoid *indices,
1182 GLsizei primcount, GLint basevertex);
1188 * If you don't support eval, fallback to the default vertex format
1189 * on receiving an eval call and use the pipeline mechanism to
1190 * provide partial T&L acceleration.
1192 * Mesa will provide a set of helper functions to do eval within
1193 * accelerated vertex formats, eventually...
1196 void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
1197 void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
1203 #endif /* DD_INCLUDED */