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
;
43 struct gl_renderbuffer
;
44 struct gl_renderbuffer_attachment
;
45 struct gl_texture_image
;
46 struct gl_texture_object
;
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.
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
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.
60 #define MESA_MAP_NOWAIT_BIT 0x0040
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.
70 * Vertex transformation/clipping/lighting is patched into the T&L module.
71 * Rasterization functions are patched into the swrast module.
73 * Note: when new functions are added here, the drivers/common/driverfuncs.c
74 * file should be updated too!!!
76 struct dd_function_table
{
78 * Return a string as needed by glGetString().
79 * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
82 const GLubyte
* (*GetString
)( struct gl_context
*ctx
, GLenum name
);
85 * Notify the driver after Mesa has made some internal state changes.
87 * This is in addition to any state change callbacks Mesa may already have
90 void (*UpdateState
)( struct gl_context
*ctx
, GLbitfield new_state
);
93 * Get the width and height of the named buffer/window.
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.
98 void (*GetBufferSize
)( struct gl_framebuffer
*buffer
,
99 GLuint
*width
, GLuint
*height
);
102 * Resize the given framebuffer to the given size.
103 * XXX OBSOLETE: this function will be removed in the future.
105 void (*ResizeBuffers
)( struct gl_context
*ctx
, struct gl_framebuffer
*fb
,
106 GLuint width
, GLuint height
);
109 * Called whenever an error is generated.
110 * __struct gl_contextRec::ErrorValue contains the error value.
112 void (*Error
)( struct gl_context
*ctx
);
115 * This is called whenever glFinish() is called.
117 void (*Finish
)( struct gl_context
*ctx
);
120 * This is called whenever glFlush() is called.
122 void (*Flush
)( struct gl_context
*ctx
);
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.
129 void (*Clear
)( struct gl_context
*ctx
, GLbitfield buffers
);
132 * Execute glAccum command.
134 void (*Accum
)( struct gl_context
*ctx
, GLenum op
, GLfloat value
);
138 * Execute glRasterPos, updating the ctx->Current.Raster fields
140 void (*RasterPos
)( struct gl_context
*ctx
, const GLfloat v
[4] );
143 * \name Image-related functions
148 * Called by glDrawPixels().
149 * \p unpack describes how to unpack the source image data.
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
);
158 * Called by glReadPixels().
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
,
167 * Called by glCopyPixels().
169 void (*CopyPixels
)( struct gl_context
*ctx
, GLint srcx
, GLint srcy
,
170 GLsizei width
, GLsizei height
,
171 GLint dstx
, GLint dsty
, GLenum type
);
174 * Called by glBitmap().
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
);
184 * \name Texture image functions
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.
194 gl_format (*ChooseTextureFormat
)( struct gl_context
*ctx
, GLint internalFormat
,
195 GLenum srcFormat
, GLenum srcType
);
198 * Called by glTexImage1D(). Simply copy the source texture data into the
199 * destination texture memory. The gl_texture_image fields, etc. will be
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.
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
);
213 * Called by glTexImage2D().
215 * \sa dd_function_table::TexImage1D.
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
);
225 * Called by glTexImage3D().
227 * \sa dd_function_table::TexImage1D.
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
);
237 * Called by glTexSubImage1D(). Replace a subset of the target texture
238 * with new texel data.
239 * \sa dd_function_table::TexImage1D.
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
);
249 * Called by glTexSubImage2D().
251 * \sa dd_function_table::TexSubImage1D.
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
);
262 * Called by glTexSubImage3D().
264 * \sa dd_function_table::TexSubImage1D.
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
);
276 * Called by glGetTexImage().
278 void (*GetTexImage
)( struct gl_context
*ctx
,
279 GLenum format
, GLenum type
, GLvoid
*pixels
,
280 struct gl_texture_image
*texImage
);
283 * Called by glCopyTexSubImage1D() and glCopyTexImage1D().
285 void (*CopyTexSubImage1D
)(struct gl_context
*ctx
,
286 struct gl_texture_image
*texImage
,
288 struct gl_renderbuffer
*rb
,
289 GLint x
, GLint y
, GLsizei width
);
292 * Called by glCopyTexSubImage2D() and glCopyTexImage2D().
294 void (*CopyTexSubImage2D
)(struct gl_context
*ctx
,
295 struct gl_texture_image
*texImage
,
296 GLint xoffset
, GLint yoffset
,
297 struct gl_renderbuffer
*rb
,
299 GLsizei width
, GLsizei height
);
302 * Called by glCopyTexSubImage3D() and glCopyTexImage3D().
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
,
309 GLsizei width
, GLsizei height
);
312 * Called by glTexImage[123]D when user specifies a proxy texture
315 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
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
);
326 * \name Compressed texture functions
331 * Called by glCompressedTexImage1D().
332 * The parameters are the same as for glCompressedTexImage1D(), plus a
333 * pointer to the destination texure image.
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
);
341 * Called by glCompressedTexImage2D().
343 * \sa dd_function_table::CompressedTexImage1D.
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
);
352 * Called by glCompressedTexImage3D().
354 * \sa dd_function_table::CompressedTexImage3D.
356 void (*CompressedTexImage3D
)(struct gl_context
*ctx
,
357 struct gl_texture_image
*texImage
,
358 GLint internalFormat
,
359 GLsizei width
, GLsizei height
, GLsizei depth
,
361 GLsizei imageSize
, const GLvoid
*data
);
364 * Called by glCompressedTexSubImage1D().
366 void (*CompressedTexSubImage1D
)(struct gl_context
*ctx
,
367 struct gl_texture_image
*texImage
,
368 GLint xoffset
, GLsizei width
,
370 GLsizei imageSize
, const GLvoid
*data
);
373 * Called by glCompressedTexSubImage2D().
375 void (*CompressedTexSubImage2D
)(struct gl_context
*ctx
,
376 struct gl_texture_image
*texImage
,
377 GLint xoffset
, GLint yoffset
,
378 GLsizei width
, GLint height
,
380 GLsizei imageSize
, const GLvoid
*data
);
383 * Called by glCompressedTexSubImage3D().
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
,
390 GLsizei imageSize
, const GLvoid
*data
);
394 * \name Texture object / image functions
399 * Called by glBindTexture().
401 void (*BindTexture
)( struct gl_context
*ctx
, GLenum target
,
402 struct gl_texture_object
*tObj
);
405 * Called to allocate a new texture object. Drivers will usually
406 * allocate/return a subclass of gl_texture_object.
408 struct gl_texture_object
* (*NewTextureObject
)(struct gl_context
*ctx
,
409 GLuint name
, GLenum target
);
411 * Called to delete/free a texture object. Drivers should free the
412 * object and any image data it contains.
414 void (*DeleteTexture
)(struct gl_context
*ctx
,
415 struct gl_texture_object
*texObj
);
417 /** Called to allocate a new texture image object. */
418 struct gl_texture_image
* (*NewTextureImage
)(struct gl_context
*ctx
);
420 /** Called to free a texture image object returned by NewTextureImage() */
421 void (*DeleteTextureImage
)(struct gl_context
*ctx
,
422 struct gl_texture_image
*);
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
);
430 /** Free the memory for a single texture image */
431 void (*FreeTextureImageBuffer
)(struct gl_context
*ctx
,
432 struct gl_texture_image
*texImage
);
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)
445 void (*MapTextureImage
)(struct gl_context
*ctx
,
446 struct gl_texture_image
*texImage
,
448 GLuint x
, GLuint y
, GLuint w
, GLuint h
,
450 GLubyte
**mapOut
, GLint
*rowStrideOut
);
452 void (*UnmapTextureImage
)(struct gl_context
*ctx
,
453 struct gl_texture_image
*texImage
,
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.
460 GLboolean (*AllocTextureStorage
)(struct gl_context
*ctx
,
461 struct gl_texture_object
*texObj
,
462 GLsizei levels
, GLsizei width
,
463 GLsizei height
, GLsizei depth
);
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)
470 void (*MapRenderbuffer
)(struct gl_context
*ctx
,
471 struct gl_renderbuffer
*rb
,
472 GLuint x
, GLuint y
, GLuint w
, GLuint h
,
474 GLubyte
**mapOut
, GLint
*rowStrideOut
);
476 void (*UnmapRenderbuffer
)(struct gl_context
*ctx
,
477 struct gl_renderbuffer
*rb
);
482 * \name State-changing functions.
484 * \note drawing functions are above.
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.
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.
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
);
594 * \name Vertex/pixel buffer object functions
597 void (*BindBuffer
)( struct gl_context
*ctx
, GLenum target
,
598 struct gl_buffer_object
*obj
);
600 struct gl_buffer_object
* (*NewBufferObject
)( struct gl_context
*ctx
, GLuint buffer
,
603 void (*DeleteBuffer
)( struct gl_context
*ctx
, struct gl_buffer_object
*obj
);
605 GLboolean (*BufferData
)( struct gl_context
*ctx
, GLenum target
, GLsizeiptrARB size
,
606 const GLvoid
*data
, GLenum usage
,
607 struct gl_buffer_object
*obj
);
609 void (*BufferSubData
)( struct gl_context
*ctx
, GLintptrARB offset
,
610 GLsizeiptrARB size
, const GLvoid
*data
,
611 struct gl_buffer_object
*obj
);
613 void (*GetBufferSubData
)( struct gl_context
*ctx
,
614 GLintptrARB offset
, GLsizeiptrARB size
,
615 GLvoid
*data
, struct gl_buffer_object
*obj
);
617 /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
619 void * (*MapBufferRange
)( struct gl_context
*ctx
, GLintptr offset
,
620 GLsizeiptr length
, GLbitfield access
,
621 struct gl_buffer_object
*obj
);
623 void (*FlushMappedBufferRange
)(struct gl_context
*ctx
,
624 GLintptr offset
, GLsizeiptr length
,
625 struct gl_buffer_object
*obj
);
627 GLboolean (*UnmapBuffer
)( struct gl_context
*ctx
,
628 struct gl_buffer_object
*obj
);
632 * \name Functions for GL_APPLE_object_purgeable
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
);
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
);
648 * \name Vertex Array objects
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
);
658 * \name Support for multiple T&L engines
663 * Set by the driver-supplied T&L engine.
665 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
667 GLuint CurrentExecPrimitive
;
670 * Current state of an in-progress compilation.
672 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
673 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
675 GLuint CurrentSavePrimitive
;
678 #define FLUSH_STORED_VERTICES 0x1
679 #define FLUSH_UPDATE_CURRENT 0x2
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
685 * The dd_function_table::FlushVertices call below may be used to resolve
689 GLuint SaveNeedFlush
;
692 /* Called prior to any of the GLvertexformat functions being
693 * called. Paired with Driver.FlushVertices().
695 void (*BeginVertices
)( struct gl_context
*ctx
);
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
703 * Note that the default T&L engine never clears the
704 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
706 void (*FlushVertices
)( struct gl_context
*ctx
, GLuint flags
);
707 void (*SaveFlushVertices
)( struct gl_context
*ctx
);
710 * \brief Hook for drivers to prepare for a glBegin/glEnd block
712 * This hook is called in vbo_exec_Begin() before any action, including
713 * state updates, occurs.
715 void (*PrepareExecBegin
)( struct gl_context
*ctx
);
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.
722 GLboolean (*NotifySaveBegin
)( struct gl_context
*ctx
, GLenum mode
);
725 * Notify driver that the special derived value _NeedEyeCoords has
728 void (*LightingSpaceChange
)( struct gl_context
*ctx
);
731 * Called by glNewList().
733 * Let the T&L component know what is going on with display lists
734 * in time to make changes to dispatch tables, etc.
736 void (*NewList
)( struct gl_context
*ctx
, GLuint list
, GLenum mode
);
738 * Called by glEndList().
740 * \sa dd_function_table::NewList.
742 void (*EndList
)( struct gl_context
*ctx
);
745 * Called by glCallList(s).
747 * Notify the T&L component before and after calling a display list.
749 void (*BeginCallList
)( struct gl_context
*ctx
,
750 struct gl_display_list
*dlist
);
752 * Called by glEndCallList().
754 * \sa dd_function_table::BeginCallList.
756 void (*EndCallList
)( struct gl_context
*ctx
);
761 * \name GL_NV_texture_barrier interface
763 void (*TextureBarrier
)(struct gl_context
*ctx
);
768 * Transform/Clip/Lighting interface
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.
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.
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.
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
);
849 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
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
);
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.
870 * Mesa will provide a set of helper functions to do eval within
871 * accelerated vertex formats, eventually...
874 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
875 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
881 #endif /* DD_INCLUDED */