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 !!!!! */
36 struct gl_pixelstore_attrib
;
37 struct gl_display_list
;
39 /* GL_ARB_vertex_buffer_object */
40 /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
41 * NULL) if buffer is unavailable for immediate mapping.
43 * Does GL_MAP_INVALIDATE_RANGE_BIT do this? It seems so, but it
44 * would require more book-keeping in the driver than seems necessary
47 * Does GL_MAP_INVALDIATE_BUFFER_BIT do this? Not really -- we don't
48 * want to provoke the driver to throw away the old storage, we will
49 * respect the contents of already referenced data.
51 #define MESA_MAP_NOWAIT_BIT 0x0040
55 * Device driver function table.
56 * Core Mesa uses these function pointers to call into device drivers.
57 * Most of these functions directly correspond to OpenGL state commands.
58 * Core Mesa will call these functions after error checking has been done
59 * so that the drivers don't have to worry about error testing.
61 * Vertex transformation/clipping/lighting is patched into the T&L module.
62 * Rasterization functions are patched into the swrast module.
64 * Note: when new functions are added here, the drivers/common/driverfuncs.c
65 * file should be updated too!!!
67 struct dd_function_table
{
69 * Return a string as needed by glGetString().
70 * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
73 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
76 * Notify the driver after Mesa has made some internal state changes.
78 * This is in addition to any state change callbacks Mesa may already have
81 void (*UpdateState
)( GLcontext
*ctx
, GLbitfield new_state
);
84 * Get the width and height of the named buffer/window.
86 * Mesa uses this to determine when the driver's window size has changed.
87 * XXX OBSOLETE: this function will be removed in the future.
89 void (*GetBufferSize
)( GLframebuffer
*buffer
,
90 GLuint
*width
, GLuint
*height
);
93 * Resize the given framebuffer to the given size.
94 * XXX OBSOLETE: this function will be removed in the future.
96 void (*ResizeBuffers
)( GLcontext
*ctx
, GLframebuffer
*fb
,
97 GLuint width
, GLuint height
);
100 * Called whenever an error is generated.
101 * __GLcontextRec::ErrorValue contains the error value.
103 void (*Error
)( GLcontext
*ctx
);
106 * This is called whenever glFinish() is called.
108 void (*Finish
)( GLcontext
*ctx
);
111 * This is called whenever glFlush() is called.
113 void (*Flush
)( GLcontext
*ctx
);
116 * Clear the color/depth/stencil/accum buffer(s).
117 * \param buffers a bitmask of BUFFER_BIT_* flags indicating which
118 * renderbuffers need to be cleared.
120 void (*Clear
)( GLcontext
*ctx
, GLbitfield buffers
);
123 * Execute glAccum command.
125 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
);
129 * Execute glRasterPos, updating the ctx->Current.Raster fields
131 void (*RasterPos
)( GLcontext
*ctx
, const GLfloat v
[4] );
134 * \name Image-related functions
139 * Called by glDrawPixels().
140 * \p unpack describes how to unpack the source image data.
142 void (*DrawPixels
)( GLcontext
*ctx
,
143 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
144 GLenum format
, GLenum type
,
145 const struct gl_pixelstore_attrib
*unpack
,
146 const GLvoid
*pixels
);
149 * Called by glReadPixels().
151 void (*ReadPixels
)( GLcontext
*ctx
,
152 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
153 GLenum format
, GLenum type
,
154 const struct gl_pixelstore_attrib
*unpack
,
158 * Called by glCopyPixels().
160 void (*CopyPixels
)( GLcontext
*ctx
, GLint srcx
, GLint srcy
,
161 GLsizei width
, GLsizei height
,
162 GLint dstx
, GLint dsty
, GLenum type
);
165 * Called by glBitmap().
167 void (*Bitmap
)( GLcontext
*ctx
,
168 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
169 const struct gl_pixelstore_attrib
*unpack
,
170 const GLubyte
*bitmap
);
175 * \name Texture image functions
180 * Choose texture format.
182 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
183 * functions. The driver should examine \p internalFormat and return a
186 GLuint (*ChooseTextureFormat
)( GLcontext
*ctx
, GLint internalFormat
,
187 GLenum srcFormat
, GLenum srcType
);
190 * Called by glTexImage1D().
192 * \param target user specified.
193 * \param format user specified.
194 * \param type user specified.
195 * \param pixels user specified.
196 * \param packing indicates the image packing of pixels.
197 * \param texObj is the target texture object.
198 * \param texImage is the target texture image. It will have the texture \p
199 * width, \p height, \p depth, \p border and \p internalFormat information.
201 * \p retainInternalCopy is returned by this function and indicates whether
202 * core Mesa should keep an internal copy of the texture image.
204 * Drivers should call a fallback routine from texstore.c if needed.
206 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
207 GLint internalFormat
,
208 GLint width
, GLint border
,
209 GLenum format
, GLenum type
, const GLvoid
*pixels
,
210 const struct gl_pixelstore_attrib
*packing
,
211 struct gl_texture_object
*texObj
,
212 struct gl_texture_image
*texImage
);
215 * Called by glTexImage2D().
217 * \sa dd_function_table::TexImage1D.
219 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
220 GLint internalFormat
,
221 GLint width
, GLint height
, GLint border
,
222 GLenum format
, GLenum type
, const GLvoid
*pixels
,
223 const struct gl_pixelstore_attrib
*packing
,
224 struct gl_texture_object
*texObj
,
225 struct gl_texture_image
*texImage
);
228 * Called by glTexImage3D().
230 * \sa dd_function_table::TexImage1D.
232 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
233 GLint internalFormat
,
234 GLint width
, GLint height
, GLint depth
, GLint border
,
235 GLenum format
, GLenum type
, const GLvoid
*pixels
,
236 const struct gl_pixelstore_attrib
*packing
,
237 struct gl_texture_object
*texObj
,
238 struct gl_texture_image
*texImage
);
241 * Called by glTexSubImage1D().
243 * \param target user specified.
244 * \param level user specified.
245 * \param xoffset user specified.
246 * \param yoffset user specified.
247 * \param zoffset user specified.
248 * \param width user specified.
249 * \param height user specified.
250 * \param depth user specified.
251 * \param format user specified.
252 * \param type user specified.
253 * \param pixels user specified.
254 * \param packing indicates the image packing of pixels.
255 * \param texObj is the target texture object.
256 * \param texImage is the target texture image. It will have the texture \p
257 * width, \p height, \p border and \p internalFormat information.
259 * The driver should use a fallback routine from texstore.c if needed.
261 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
262 GLint xoffset
, GLsizei width
,
263 GLenum format
, GLenum type
,
264 const GLvoid
*pixels
,
265 const struct gl_pixelstore_attrib
*packing
,
266 struct gl_texture_object
*texObj
,
267 struct gl_texture_image
*texImage
);
270 * Called by glTexSubImage2D().
272 * \sa dd_function_table::TexSubImage1D.
274 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
275 GLint xoffset
, GLint yoffset
,
276 GLsizei width
, GLsizei height
,
277 GLenum format
, GLenum type
,
278 const GLvoid
*pixels
,
279 const struct gl_pixelstore_attrib
*packing
,
280 struct gl_texture_object
*texObj
,
281 struct gl_texture_image
*texImage
);
284 * Called by glTexSubImage3D().
286 * \sa dd_function_table::TexSubImage1D.
288 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
289 GLint xoffset
, GLint yoffset
, GLint zoffset
,
290 GLsizei width
, GLsizei height
, GLint depth
,
291 GLenum format
, GLenum type
,
292 const GLvoid
*pixels
,
293 const struct gl_pixelstore_attrib
*packing
,
294 struct gl_texture_object
*texObj
,
295 struct gl_texture_image
*texImage
);
298 * Called by glGetTexImage().
300 void (*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
301 GLenum format
, GLenum type
, GLvoid
*pixels
,
302 struct gl_texture_object
*texObj
,
303 struct gl_texture_image
*texImage
);
306 * Called by glCopyTexImage1D().
308 * Drivers should use a fallback routine from texstore.c if needed.
310 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
311 GLenum internalFormat
, GLint x
, GLint y
,
312 GLsizei width
, GLint border
);
315 * Called by glCopyTexImage2D().
317 * Drivers should use a fallback routine from texstore.c if needed.
319 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
320 GLenum internalFormat
, GLint x
, GLint y
,
321 GLsizei width
, GLsizei height
, GLint border
);
324 * Called by glCopyTexSubImage1D().
326 * Drivers should use a fallback routine from texstore.c if needed.
328 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
330 GLint x
, GLint y
, GLsizei width
);
332 * Called by glCopyTexSubImage2D().
334 * Drivers should use a fallback routine from texstore.c if needed.
336 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
337 GLint xoffset
, GLint yoffset
,
339 GLsizei width
, GLsizei height
);
341 * Called by glCopyTexSubImage3D().
343 * Drivers should use a fallback routine from texstore.c if needed.
345 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
346 GLint xoffset
, GLint yoffset
, GLint zoffset
,
348 GLsizei width
, GLsizei height
);
351 * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
353 void (*GenerateMipmap
)(GLcontext
*ctx
, GLenum target
,
354 struct gl_texture_object
*texObj
);
357 * Called by glTexImage[123]D when user specifies a proxy texture
360 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
362 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
363 GLint level
, GLint internalFormat
,
364 GLenum format
, GLenum type
,
365 GLint width
, GLint height
,
366 GLint depth
, GLint border
);
371 * \name Compressed texture functions
376 * Called by glCompressedTexImage1D().
378 * \param target user specified.
379 * \param format user specified.
380 * \param type user specified.
381 * \param pixels user specified.
382 * \param packing indicates the image packing of pixels.
383 * \param texObj is the target texture object.
384 * \param texImage is the target texture image. It will have the texture \p
385 * width, \p height, \p depth, \p border and \p internalFormat information.
387 * \a retainInternalCopy is returned by this function and indicates whether
388 * core Mesa should keep an internal copy of the texture image.
390 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
391 GLint level
, GLint internalFormat
,
392 GLsizei width
, GLint border
,
393 GLsizei imageSize
, const GLvoid
*data
,
394 struct gl_texture_object
*texObj
,
395 struct gl_texture_image
*texImage
);
397 * Called by glCompressedTexImage2D().
399 * \sa dd_function_table::CompressedTexImage1D.
401 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
402 GLint level
, GLint internalFormat
,
403 GLsizei width
, GLsizei height
, GLint border
,
404 GLsizei imageSize
, const GLvoid
*data
,
405 struct gl_texture_object
*texObj
,
406 struct gl_texture_image
*texImage
);
408 * Called by glCompressedTexImage3D().
410 * \sa dd_function_table::CompressedTexImage3D.
412 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
413 GLint level
, GLint internalFormat
,
414 GLsizei width
, GLsizei height
, GLsizei depth
,
416 GLsizei imageSize
, const GLvoid
*data
,
417 struct gl_texture_object
*texObj
,
418 struct gl_texture_image
*texImage
);
421 * Called by glCompressedTexSubImage1D().
423 * \param target user specified.
424 * \param level user specified.
425 * \param xoffset user specified.
426 * \param yoffset user specified.
427 * \param zoffset user specified.
428 * \param width user specified.
429 * \param height user specified.
430 * \param depth user specified.
431 * \param imageSize user specified.
432 * \param data user specified.
433 * \param texObj is the target texture object.
434 * \param texImage is the target texture image. It will have the texture \p
435 * width, \p height, \p depth, \p border and \p internalFormat information.
437 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
438 GLint xoffset
, GLsizei width
,
440 GLsizei imageSize
, const GLvoid
*data
,
441 struct gl_texture_object
*texObj
,
442 struct gl_texture_image
*texImage
);
444 * Called by glCompressedTexSubImage2D().
446 * \sa dd_function_table::CompressedTexImage3D.
448 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
449 GLint xoffset
, GLint yoffset
,
450 GLsizei width
, GLint height
,
452 GLsizei imageSize
, const GLvoid
*data
,
453 struct gl_texture_object
*texObj
,
454 struct gl_texture_image
*texImage
);
456 * Called by glCompressedTexSubImage3D().
458 * \sa dd_function_table::CompressedTexImage3D.
460 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
461 GLint xoffset
, GLint yoffset
, GLint zoffset
,
462 GLsizei width
, GLint height
, GLint depth
,
464 GLsizei imageSize
, const GLvoid
*data
,
465 struct gl_texture_object
*texObj
,
466 struct gl_texture_image
*texImage
);
470 * Called by glGetCompressedTexImage.
472 void (*GetCompressedTexImage
)(GLcontext
*ctx
, GLenum target
, GLint level
,
474 struct gl_texture_object
*texObj
,
475 struct gl_texture_image
*texImage
);
480 * \name Texture object functions
485 * Called by glBindTexture().
487 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
488 struct gl_texture_object
*tObj
);
491 * Called to allocate a new texture object.
492 * A new gl_texture_object should be returned. The driver should
493 * attach to it any device-specific info it needs.
495 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
498 * Called when a texture object is about to be deallocated.
500 * Driver should delete the gl_texture_object object and anything
503 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
506 * Called to allocate a new texture image object.
508 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
511 * Called to free tImage->Data.
513 void (*FreeTexImageData
)( GLcontext
*ctx
, struct gl_texture_image
*tImage
);
515 /** Map texture image data into user space */
516 void (*MapTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
517 /** Unmap texture images from user space */
518 void (*UnmapTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
521 * Note: no context argument. This function doesn't initially look
522 * like it belongs here, except that the driver is the only entity
523 * that knows for sure how the texture memory is allocated - via
524 * the above callbacks. There is then an argument that the driver
525 * knows what memcpy paths might be fast. Typically this is invoked with
527 * to -- a pointer into texture memory allocated by NewTextureImage() above.
528 * from -- a pointer into client memory or a mesa temporary.
529 * sz -- nr bytes to copy.
531 void* (*TextureMemCpy
)( void *to
, const void *from
, size_t sz
);
534 * Called by glAreTextureResident().
536 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
537 struct gl_texture_object
*t
);
540 * Called when the texture's color lookup table is changed.
542 * If \p tObj is NULL then the shared texture palette
543 * gl_texture_object::Palette is to be updated.
545 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
546 struct gl_texture_object
*tObj
);
551 * \name Imaging functionality
554 void (*CopyColorTable
)( GLcontext
*ctx
,
555 GLenum target
, GLenum internalformat
,
556 GLint x
, GLint y
, GLsizei width
);
558 void (*CopyColorSubTable
)( GLcontext
*ctx
,
559 GLenum target
, GLsizei start
,
560 GLint x
, GLint y
, GLsizei width
);
565 * \name Vertex/fragment program functions
568 /** Bind a vertex/fragment program */
569 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct gl_program
*prog
);
570 /** Allocate a new program */
571 struct gl_program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
572 /** Delete a program */
573 void (*DeleteProgram
)(GLcontext
*ctx
, struct gl_program
*prog
);
575 * Notify driver that a program string (and GPU code) has been specified
576 * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is
577 * supported by the driver.
579 GLboolean (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
580 struct gl_program
*prog
);
582 /** Query if program can be loaded onto hardware */
583 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
584 struct gl_program
*prog
);
589 * \name GLSL shader/program functions.
593 * Called when a shader is compiled.
595 * Note that not all shader objects get ShaderCompile called on
596 * them. Notably, the shaders containing builtin functions do not
597 * have CompileShader() called, so if lowering passes are done they
598 * need to also be performed in LinkShader().
600 GLboolean (*CompileShader
)(GLcontext
*ctx
, struct gl_shader
*shader
);
602 * Called when a shader program is linked.
604 * This gives drivers an opportunity to clone the IR and make their
605 * own transformations on it for the purposes of code generation.
607 GLboolean (*LinkShader
)(GLcontext
*ctx
, struct gl_shader_program
*shader
);
611 * \name State-changing functions.
613 * \note drawing functions are above.
615 * These functions are called by their corresponding OpenGL API functions.
616 * They are \e also called by the gl_PopAttrib() function!!!
617 * May add more functions like these to the device driver in the future.
620 /** Specify the alpha test function */
621 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
622 /** Set the blend color */
623 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
624 /** Set the blend equation */
625 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
626 /** Specify pixel arithmetic */
627 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
628 GLenum sfactorRGB
, GLenum dfactorRGB
,
629 GLenum sfactorA
, GLenum dfactorA
);
630 /** Specify clear values for the color buffers */
631 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
632 /** Specify the clear value for the depth buffer */
633 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
634 /** Specify the clear value for the stencil buffer */
635 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
636 /** Specify a plane against which all geometry is clipped */
637 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
638 /** Enable and disable writing of frame buffer color components */
639 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
640 GLboolean bmask
, GLboolean amask
);
641 void (*ColorMaskIndexed
)(GLcontext
*ctx
, GLuint buf
, GLboolean rmask
,
642 GLboolean gmask
, GLboolean bmask
, GLboolean amask
);
643 /** Cause a material color to track the current color */
644 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
645 /** Specify whether front- or back-facing facets can be culled */
646 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
647 /** Define front- and back-facing polygons */
648 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
649 /** Specify the value used for depth buffer comparisons */
650 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
651 /** Enable or disable writing into the depth buffer */
652 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
653 /** Specify mapping of depth values from NDC to window coordinates */
654 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
655 /** Specify the current buffer for writing */
656 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
657 /** Specify the buffers for writing for fragment programs*/
658 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
659 /** Enable or disable server-side gl capabilities */
660 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
661 /** Specify fog parameters */
662 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
663 /** Specify implementation-specific hints */
664 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
665 /** Set light source parameters.
666 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
667 * been transformed to eye-space.
669 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
670 GLenum pname
, const GLfloat
*params
);
671 /** Set the lighting model parameters */
672 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
673 /** Specify the line stipple pattern */
674 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
675 /** Specify the width of rasterized lines */
676 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
677 /** Specify a logical pixel operation for color index rendering */
678 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
679 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
680 const GLfloat
*params
);
681 /** Specify the diameter of rasterized points */
682 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
683 /** Select a polygon rasterization mode */
684 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
685 /** Set the scale and units used to calculate depth values */
686 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
687 /** Set the polygon stippling pattern */
688 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
689 /* Specifies the current buffer for reading */
690 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
691 /** Set rasterization mode */
692 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
693 /** Define the scissor box */
694 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
695 /** Select flat or smooth shading */
696 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
697 /** OpenGL 2.0 two-sided StencilFunc */
698 void (*StencilFuncSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum func
,
699 GLint ref
, GLuint mask
);
700 /** OpenGL 2.0 two-sided StencilMask */
701 void (*StencilMaskSeparate
)(GLcontext
*ctx
, GLenum face
, GLuint mask
);
702 /** OpenGL 2.0 two-sided StencilOp */
703 void (*StencilOpSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum fail
,
704 GLenum zfail
, GLenum zpass
);
705 /** Control the generation of texture coordinates */
706 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
707 const GLfloat
*params
);
708 /** Set texture environment parameters */
709 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
710 const GLfloat
*param
);
711 /** Set texture parameters */
712 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
713 struct gl_texture_object
*texObj
,
714 GLenum pname
, const GLfloat
*params
);
715 /** Set the viewport */
716 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
721 * \name Vertex/pixel buffer object functions
724 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
725 struct gl_buffer_object
*obj
);
727 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
730 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
732 GLboolean (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
733 const GLvoid
*data
, GLenum usage
,
734 struct gl_buffer_object
*obj
);
736 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
737 GLsizeiptrARB size
, const GLvoid
*data
,
738 struct gl_buffer_object
*obj
);
740 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
741 GLintptrARB offset
, GLsizeiptrARB size
,
742 GLvoid
*data
, struct gl_buffer_object
*obj
);
744 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
745 struct gl_buffer_object
*obj
);
747 void (*CopyBufferSubData
)( GLcontext
*ctx
,
748 struct gl_buffer_object
*src
,
749 struct gl_buffer_object
*dst
,
750 GLintptr readOffset
, GLintptr writeOffset
,
753 /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
755 void * (*MapBufferRange
)( GLcontext
*ctx
, GLenum target
, GLintptr offset
,
756 GLsizeiptr length
, GLbitfield access
,
757 struct gl_buffer_object
*obj
);
759 void (*FlushMappedBufferRange
)(GLcontext
*ctx
, GLenum target
,
760 GLintptr offset
, GLsizeiptr length
,
761 struct gl_buffer_object
*obj
);
763 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
764 struct gl_buffer_object
*obj
);
768 * \name Functions for GL_APPLE_object_purgeable
771 /* variations on ObjectPurgeable */
772 GLenum (*BufferObjectPurgeable
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
, GLenum option
);
773 GLenum (*RenderObjectPurgeable
)( GLcontext
*ctx
, struct gl_renderbuffer
*obj
, GLenum option
);
774 GLenum (*TextureObjectPurgeable
)( GLcontext
*ctx
, struct gl_texture_object
*obj
, GLenum option
);
776 /* variations on ObjectUnpurgeable */
777 GLenum (*BufferObjectUnpurgeable
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
, GLenum option
);
778 GLenum (*RenderObjectUnpurgeable
)( GLcontext
*ctx
, struct gl_renderbuffer
*obj
, GLenum option
);
779 GLenum (*TextureObjectUnpurgeable
)( GLcontext
*ctx
, struct gl_texture_object
*obj
, GLenum option
);
783 * \name Functions for GL_EXT_framebuffer_{object,blit}.
786 struct gl_framebuffer
* (*NewFramebuffer
)(GLcontext
*ctx
, GLuint name
);
787 struct gl_renderbuffer
* (*NewRenderbuffer
)(GLcontext
*ctx
, GLuint name
);
788 void (*BindFramebuffer
)(GLcontext
*ctx
, GLenum target
,
789 struct gl_framebuffer
*drawFb
,
790 struct gl_framebuffer
*readFb
);
791 void (*FramebufferRenderbuffer
)(GLcontext
*ctx
,
792 struct gl_framebuffer
*fb
,
794 struct gl_renderbuffer
*rb
);
795 void (*RenderTexture
)(GLcontext
*ctx
,
796 struct gl_framebuffer
*fb
,
797 struct gl_renderbuffer_attachment
*att
);
798 void (*FinishRenderTexture
)(GLcontext
*ctx
,
799 struct gl_renderbuffer_attachment
*att
);
800 void (*ValidateFramebuffer
)(GLcontext
*ctx
,
801 struct gl_framebuffer
*fb
);
803 void (*BlitFramebuffer
)(GLcontext
*ctx
,
804 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
805 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
806 GLbitfield mask
, GLenum filter
);
809 * \name Query objects
812 struct gl_query_object
* (*NewQueryObject
)(GLcontext
*ctx
, GLuint id
);
813 void (*DeleteQuery
)(GLcontext
*ctx
, struct gl_query_object
*q
);
814 void (*BeginQuery
)(GLcontext
*ctx
, struct gl_query_object
*q
);
815 void (*EndQuery
)(GLcontext
*ctx
, struct gl_query_object
*q
);
816 void (*CheckQuery
)(GLcontext
*ctx
, struct gl_query_object
*q
);
817 void (*WaitQuery
)(GLcontext
*ctx
, struct gl_query_object
*q
);
822 * \name Vertex Array objects
825 struct gl_array_object
* (*NewArrayObject
)(GLcontext
*ctx
, GLuint id
);
826 void (*DeleteArrayObject
)(GLcontext
*ctx
, struct gl_array_object
*obj
);
827 void (*BindArrayObject
)(GLcontext
*ctx
, struct gl_array_object
*obj
);
831 * \name GLSL-related functions (ARB extensions and OpenGL 2.x)
834 struct gl_shader
*(*NewShader
)(GLcontext
*ctx
, GLuint name
, GLenum type
);
835 void (*DeleteShader
)(GLcontext
*ctx
, struct gl_shader
*shader
);
836 struct gl_shader_program
*(*NewShaderProgram
)(GLcontext
*ctx
, GLuint name
);
837 void (*DeleteShaderProgram
)(GLcontext
*ctx
,
838 struct gl_shader_program
*shProg
);
839 void (*UseProgram
)(GLcontext
*ctx
, struct gl_shader_program
*shProg
);
844 * \name Support for multiple T&L engines
849 * Bitmask of state changes that require the current T&L module to be
850 * validated, using ValidateTnlModule() below.
855 * Validate the current T&L module.
857 * This is called directly after UpdateState() when a state change that has
858 * occurred matches the dd_function_table::NeedValidate bitmask above. This
859 * ensures all computed values are up to date, thus allowing the driver to
860 * decide if the current T&L module needs to be swapped out.
862 * This must be non-NULL if a driver installs a custom T&L module and sets
863 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
865 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
868 #define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1)
869 #define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2)
870 #define PRIM_UNKNOWN (GL_POLYGON+3)
873 * Set by the driver-supplied T&L engine.
875 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
877 GLuint CurrentExecPrimitive
;
880 * Current state of an in-progress compilation.
882 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
883 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
885 GLuint CurrentSavePrimitive
;
888 #define FLUSH_STORED_VERTICES 0x1
889 #define FLUSH_UPDATE_CURRENT 0x2
891 * Set by the driver-supplied T&L engine whenever vertices are buffered
892 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
895 * The dd_function_table::FlushVertices call below may be used to resolve
899 GLuint SaveNeedFlush
;
902 /* Called prior to any of the GLvertexformat functions being
903 * called. Paired with Driver.FlushVertices().
905 void (*BeginVertices
)( GLcontext
*ctx
);
908 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
909 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
910 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
911 * __GLcontextRec::Current and gl_light_attrib::Material
913 * Note that the default T&L engine never clears the
914 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
916 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
917 void (*SaveFlushVertices
)( GLcontext
*ctx
);
920 * Give the driver the opportunity to hook in its own vtxfmt for
921 * compiling optimized display lists. This is called on each valid
922 * glBegin() during list compilation.
924 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
927 * Notify driver that the special derived value _NeedEyeCoords has
930 void (*LightingSpaceChange
)( GLcontext
*ctx
);
933 * Called by glNewList().
935 * Let the T&L component know what is going on with display lists
936 * in time to make changes to dispatch tables, etc.
938 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
940 * Called by glEndList().
942 * \sa dd_function_table::NewList.
944 void (*EndList
)( GLcontext
*ctx
);
947 * Called by glCallList(s).
949 * Notify the T&L component before and after calling a display list.
951 void (*BeginCallList
)( GLcontext
*ctx
,
952 struct gl_display_list
*dlist
);
954 * Called by glEndCallList().
956 * \sa dd_function_table::BeginCallList.
958 void (*EndCallList
)( GLcontext
*ctx
);
962 * \name GL_ARB_sync interfaces
965 struct gl_sync_object
* (*NewSyncObject
)(GLcontext
*, GLenum
);
966 void (*FenceSync
)(GLcontext
*, struct gl_sync_object
*, GLenum
, GLbitfield
);
967 void (*DeleteSyncObject
)(GLcontext
*, struct gl_sync_object
*);
968 void (*CheckSync
)(GLcontext
*, struct gl_sync_object
*);
969 void (*ClientWaitSync
)(GLcontext
*, struct gl_sync_object
*,
970 GLbitfield
, GLuint64
);
971 void (*ServerWaitSync
)(GLcontext
*, struct gl_sync_object
*,
972 GLbitfield
, GLuint64
);
975 /** GL_NV_conditional_render */
976 void (*BeginConditionalRender
)(GLcontext
*ctx
, struct gl_query_object
*q
,
978 void (*EndConditionalRender
)(GLcontext
*ctx
, struct gl_query_object
*q
);
981 * \name GL_OES_draw_texture interface
984 void (*DrawTex
)(GLcontext
*ctx
, GLfloat x
, GLfloat y
, GLfloat z
,
985 GLfloat width
, GLfloat height
);
989 * \name GL_OES_EGL_image interface
991 void (*EGLImageTargetTexture2D
)(GLcontext
*ctx
, GLenum target
,
992 struct gl_texture_object
*texObj
,
993 struct gl_texture_image
*texImage
,
994 GLeglImageOES image_handle
);
995 void (*EGLImageTargetRenderbufferStorage
)(GLcontext
*ctx
,
996 struct gl_renderbuffer
*rb
,
1000 * \name GL_EXT_transform_feedback interface
1002 struct gl_transform_feedback_object
*
1003 (*NewTransformFeedback
)(GLcontext
*ctx
, GLuint name
);
1004 void (*DeleteTransformFeedback
)(GLcontext
*ctx
,
1005 struct gl_transform_feedback_object
*obj
);
1006 void (*BeginTransformFeedback
)(GLcontext
*ctx
, GLenum mode
,
1007 struct gl_transform_feedback_object
*obj
);
1008 void (*EndTransformFeedback
)(GLcontext
*ctx
,
1009 struct gl_transform_feedback_object
*obj
);
1010 void (*PauseTransformFeedback
)(GLcontext
*ctx
,
1011 struct gl_transform_feedback_object
*obj
);
1012 void (*ResumeTransformFeedback
)(GLcontext
*ctx
,
1013 struct gl_transform_feedback_object
*obj
);
1014 void (*DrawTransformFeedback
)(GLcontext
*ctx
, GLenum mode
,
1015 struct gl_transform_feedback_object
*obj
);
1020 * Transform/Clip/Lighting interface
1022 * Drivers present a reduced set of the functions possible in
1023 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
1024 * remaining functions to map down to these entry points.
1026 * These are the initial values to be installed into dispatch by
1027 * mesa. If the T&L driver wants to modify the dispatch table
1028 * while installed, it must do so itself. It would be possible for
1029 * the vertexformat to install its own initial values for these
1030 * functions, but this way there is an obvious list of what is
1031 * expected of the driver.
1033 * If the driver wants to hook in entry points other than those
1034 * listed, it must restore them to their original values in
1035 * the disable() callback, below.
1042 void (GLAPIENTRYP ArrayElement
)( GLint
);
1043 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
1044 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
1045 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1046 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
1047 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
1048 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
);
1049 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* );
1050 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
);
1051 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* );
1052 void (GLAPIENTRYP EvalPoint1
)( GLint
);
1053 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
);
1054 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
1055 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
1056 void (GLAPIENTRYP Indexf
)( GLfloat
);
1057 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
1058 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* );
1059 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
1060 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
1061 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
1062 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
1063 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
1064 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
1065 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1066 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
1067 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
1068 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
1069 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
1070 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
1071 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
1072 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
1073 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
1074 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
1075 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
1076 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
1077 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1078 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
1079 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
1080 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
1081 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
1082 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
1083 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1084 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
1085 void (GLAPIENTRYP CallList
)( GLuint
);
1086 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* );
1087 void (GLAPIENTRYP Begin
)( GLenum
);
1088 void (GLAPIENTRYP End
)( void );
1089 /* GL_NV_vertex_program */
1090 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
1091 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
1092 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
1093 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
1094 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1095 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
1096 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1097 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
1098 /* GL_ARB_vertex_program */
1099 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
1100 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
1101 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
1102 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
1103 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1104 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
1105 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1106 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
1109 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1115 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
1116 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
1117 const GLvoid
*indices
);
1118 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
1119 GLuint end
, GLsizei count
,
1120 GLenum type
, const GLvoid
*indices
);
1121 void (GLAPIENTRYP MultiDrawElementsEXT
)( GLenum mode
, const GLsizei
*count
,
1123 const GLvoid
**indices
,
1125 void (GLAPIENTRYP DrawElementsBaseVertex
)( GLenum mode
, GLsizei count
,
1127 const GLvoid
*indices
,
1129 void (GLAPIENTRYP DrawRangeElementsBaseVertex
)( GLenum mode
, GLuint start
,
1130 GLuint end
, GLsizei count
,
1132 const GLvoid
*indices
,
1134 void (GLAPIENTRYP MultiDrawElementsBaseVertex
)( GLenum mode
,
1135 const GLsizei
*count
,
1137 const GLvoid
**indices
,
1139 const GLint
*basevertex
);
1140 void (GLAPIENTRYP DrawArraysInstanced
)(GLenum mode
, GLint first
,
1141 GLsizei count
, GLsizei primcount
);
1142 void (GLAPIENTRYP DrawElementsInstanced
)(GLenum mode
, GLsizei count
,
1143 GLenum type
, const GLvoid
*indices
,
1150 * If you don't support eval, fallback to the default vertex format
1151 * on receiving an eval call and use the pipeline mechanism to
1152 * provide partial T&L acceleration.
1154 * Mesa will provide a set of helper functions to do eval within
1155 * accelerated vertex formats, eventually...
1158 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1159 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1165 #endif /* DD_INCLUDED */