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 actual hardware texture format given the user-provided source
193 * image format and type and the desired internal format. In some
194 * cases, srcFormat and srcType can be GL_NONE.
195 * Called by glTexImage(), etc.
197 gl_format (*ChooseTextureFormat
)( struct gl_context
*ctx
, GLint internalFormat
,
198 GLenum srcFormat
, GLenum srcType
);
201 * Called by glTexImage1D(). Simply copy the source texture data into the
202 * destination texture memory. The gl_texture_image fields, etc. will be
204 * The parameters are the same as glTexImage1D(), plus:
205 * \param packing describes how to unpack the source data.
206 * \param texImage is the destination texture image.
208 void (*TexImage1D
)(struct gl_context
*ctx
,
209 struct gl_texture_image
*texImage
,
210 GLint internalFormat
,
211 GLint width
, GLint border
,
212 GLenum format
, GLenum type
, const GLvoid
*pixels
,
213 const struct gl_pixelstore_attrib
*packing
);
216 * Called by glTexImage2D().
218 * \sa dd_function_table::TexImage1D.
220 void (*TexImage2D
)(struct gl_context
*ctx
,
221 struct gl_texture_image
*texImage
,
222 GLint internalFormat
,
223 GLint width
, GLint height
, GLint border
,
224 GLenum format
, GLenum type
, const GLvoid
*pixels
,
225 const struct gl_pixelstore_attrib
*packing
);
228 * Called by glTexImage3D().
230 * \sa dd_function_table::TexImage1D.
232 void (*TexImage3D
)(struct gl_context
*ctx
,
233 struct gl_texture_image
*texImage
,
234 GLint internalFormat
,
235 GLint width
, GLint height
, GLint depth
, GLint border
,
236 GLenum format
, GLenum type
, const GLvoid
*pixels
,
237 const struct gl_pixelstore_attrib
*packing
);
240 * Called by glTexSubImage1D(). Replace a subset of the target texture
241 * with new texel data.
242 * \sa dd_function_table::TexImage1D.
244 void (*TexSubImage1D
)(struct gl_context
*ctx
,
245 struct gl_texture_image
*texImage
,
246 GLint xoffset
, GLsizei width
,
247 GLenum format
, GLenum type
,
248 const GLvoid
*pixels
,
249 const struct gl_pixelstore_attrib
*packing
);
252 * Called by glTexSubImage2D().
254 * \sa dd_function_table::TexSubImage1D.
256 void (*TexSubImage2D
)(struct gl_context
*ctx
,
257 struct gl_texture_image
*texImage
,
258 GLint xoffset
, GLint yoffset
,
259 GLsizei width
, GLsizei height
,
260 GLenum format
, GLenum type
,
261 const GLvoid
*pixels
,
262 const struct gl_pixelstore_attrib
*packing
);
265 * Called by glTexSubImage3D().
267 * \sa dd_function_table::TexSubImage1D.
269 void (*TexSubImage3D
)(struct gl_context
*ctx
,
270 struct gl_texture_image
*texImage
,
271 GLint xoffset
, GLint yoffset
, GLint zoffset
,
272 GLsizei width
, GLsizei height
, GLint depth
,
273 GLenum format
, GLenum type
,
274 const GLvoid
*pixels
,
275 const struct gl_pixelstore_attrib
*packing
);
279 * Called by glGetTexImage().
281 void (*GetTexImage
)( struct gl_context
*ctx
,
282 GLenum format
, GLenum type
, GLvoid
*pixels
,
283 struct gl_texture_image
*texImage
);
286 * Called by glCopyTexSubImage1D() and glCopyTexImage1D().
288 void (*CopyTexSubImage1D
)(struct gl_context
*ctx
,
289 struct gl_texture_image
*texImage
,
291 struct gl_renderbuffer
*rb
,
292 GLint x
, GLint y
, GLsizei width
);
295 * Called by glCopyTexSubImage2D() and glCopyTexImage2D().
297 void (*CopyTexSubImage2D
)(struct gl_context
*ctx
,
298 struct gl_texture_image
*texImage
,
299 GLint xoffset
, GLint yoffset
,
300 struct gl_renderbuffer
*rb
,
302 GLsizei width
, GLsizei height
);
305 * Called by glCopyTexSubImage3D() and glCopyTexImage3D().
307 void (*CopyTexSubImage3D
)(struct gl_context
*ctx
,
308 struct gl_texture_image
*texImage
,
309 GLint xoffset
, GLint yoffset
, GLint zoffset
,
310 struct gl_renderbuffer
*rb
,
312 GLsizei width
, GLsizei height
);
315 * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
317 void (*GenerateMipmap
)(struct gl_context
*ctx
, GLenum target
,
318 struct gl_texture_object
*texObj
);
321 * Called by glTexImage[123]D when user specifies a proxy texture
324 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
326 GLboolean (*TestProxyTexImage
)(struct gl_context
*ctx
, GLenum target
,
327 GLint level
, GLint internalFormat
,
328 GLenum format
, GLenum type
,
329 GLint width
, GLint height
,
330 GLint depth
, GLint border
);
335 * \name Compressed texture functions
340 * Called by glCompressedTexImage1D().
341 * The parameters are the same as for glCompressedTexImage1D(), plus a
342 * pointer to the destination texure image.
344 void (*CompressedTexImage1D
)(struct gl_context
*ctx
,
345 struct gl_texture_image
*texImage
,
346 GLint internalFormat
,
347 GLsizei width
, GLint border
,
348 GLsizei imageSize
, const GLvoid
*data
);
350 * Called by glCompressedTexImage2D().
352 * \sa dd_function_table::CompressedTexImage1D.
354 void (*CompressedTexImage2D
)(struct gl_context
*ctx
,
355 struct gl_texture_image
*texImage
,
356 GLint internalFormat
,
357 GLsizei width
, GLsizei height
, GLint border
,
358 GLsizei imageSize
, const GLvoid
*data
);
361 * Called by glCompressedTexImage3D().
363 * \sa dd_function_table::CompressedTexImage3D.
365 void (*CompressedTexImage3D
)(struct gl_context
*ctx
,
366 struct gl_texture_image
*texImage
,
367 GLint internalFormat
,
368 GLsizei width
, GLsizei height
, GLsizei depth
,
370 GLsizei imageSize
, const GLvoid
*data
);
373 * Called by glCompressedTexSubImage1D().
375 void (*CompressedTexSubImage1D
)(struct gl_context
*ctx
,
376 struct gl_texture_image
*texImage
,
377 GLint xoffset
, GLsizei width
,
379 GLsizei imageSize
, const GLvoid
*data
);
382 * Called by glCompressedTexSubImage2D().
384 void (*CompressedTexSubImage2D
)(struct gl_context
*ctx
,
385 struct gl_texture_image
*texImage
,
386 GLint xoffset
, GLint yoffset
,
387 GLsizei width
, GLint height
,
389 GLsizei imageSize
, const GLvoid
*data
);
392 * Called by glCompressedTexSubImage3D().
394 void (*CompressedTexSubImage3D
)(struct gl_context
*ctx
,
395 struct gl_texture_image
*texImage
,
396 GLint xoffset
, GLint yoffset
, GLint zoffset
,
397 GLsizei width
, GLint height
, GLint depth
,
399 GLsizei imageSize
, const GLvoid
*data
);
402 * Called by glGetCompressedTexImage.
404 void (*GetCompressedTexImage
)(struct gl_context
*ctx
,
405 struct gl_texture_image
*texImage
,
410 * \name Texture object / image functions
415 * Called by glBindTexture().
417 void (*BindTexture
)( struct gl_context
*ctx
, GLenum target
,
418 struct gl_texture_object
*tObj
);
421 * Called to allocate a new texture object. Drivers will usually
422 * allocate/return a subclass of gl_texture_object.
424 struct gl_texture_object
* (*NewTextureObject
)(struct gl_context
*ctx
,
425 GLuint name
, GLenum target
);
427 * Called to delete/free a texture object. Drivers should free the
428 * object and any image data it contains.
430 void (*DeleteTexture
)(struct gl_context
*ctx
,
431 struct gl_texture_object
*texObj
);
433 /** Called to allocate a new texture image object. */
434 struct gl_texture_image
* (*NewTextureImage
)(struct gl_context
*ctx
);
436 /** Called to free a texture image object returned by NewTextureImage() */
437 void (*DeleteTextureImage
)(struct gl_context
*ctx
,
438 struct gl_texture_image
*);
440 /** Called to allocate memory for a single texture image */
441 GLboolean (*AllocTextureImageBuffer
)(struct gl_context
*ctx
,
442 struct gl_texture_image
*texImage
,
443 gl_format format
, GLsizei width
,
444 GLsizei height
, GLsizei depth
);
446 /** Free the memory for a single texture image */
447 void (*FreeTextureImageBuffer
)(struct gl_context
*ctx
,
448 struct gl_texture_image
*texImage
);
450 /** Map a slice of a texture image into user space.
451 * Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice
452 * indicates the 1D array index.
453 * \param texImage the texture image
454 * \param slice the 3D image slice or array texture slice
455 * \param x, y, w, h region of interest
456 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
457 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
458 * \param mapOut returns start of mapping of region of interest
459 * \param rowStrideOut returns row stride (in bytes)
461 void (*MapTextureImage
)(struct gl_context
*ctx
,
462 struct gl_texture_image
*texImage
,
464 GLuint x
, GLuint y
, GLuint w
, GLuint h
,
466 GLubyte
**mapOut
, GLint
*rowStrideOut
);
468 void (*UnmapTextureImage
)(struct gl_context
*ctx
,
469 struct gl_texture_image
*texImage
,
472 /** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack.
473 * All the gl_texture_images in the texture object will have their
474 * dimensions, format, etc. initialized already.
476 GLboolean (*AllocTextureStorage
)(struct gl_context
*ctx
,
477 struct gl_texture_object
*texObj
,
478 GLsizei levels
, GLsizei width
,
479 GLsizei height
, GLsizei depth
);
482 * Map a renderbuffer into user space.
483 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
484 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
486 void (*MapRenderbuffer
)(struct gl_context
*ctx
,
487 struct gl_renderbuffer
*rb
,
488 GLuint x
, GLuint y
, GLuint w
, GLuint h
,
490 GLubyte
**mapOut
, GLint
*rowStrideOut
);
492 void (*UnmapRenderbuffer
)(struct gl_context
*ctx
,
493 struct gl_renderbuffer
*rb
);
499 * \name Vertex/fragment program functions
502 /** Bind a vertex/fragment program */
503 void (*BindProgram
)(struct gl_context
*ctx
, GLenum target
, struct gl_program
*prog
);
504 /** Allocate a new program */
505 struct gl_program
* (*NewProgram
)(struct gl_context
*ctx
, GLenum target
, GLuint id
);
506 /** Delete a program */
507 void (*DeleteProgram
)(struct gl_context
*ctx
, struct gl_program
*prog
);
509 /** Query if program can be loaded onto hardware */
510 GLboolean (*IsProgramNative
)(struct gl_context
*ctx
, GLenum target
,
511 struct gl_program
*prog
);
516 * \name GLSL shader/program functions.
520 * Called when a shader program is linked.
522 * This gives drivers an opportunity to clone the IR and make their
523 * own transformations on it for the purposes of code generation.
525 GLboolean (*LinkShader
)(struct gl_context
*ctx
, struct gl_shader_program
*shader
);
529 * \name State-changing functions.
531 * \note drawing functions are above.
533 * These functions are called by their corresponding OpenGL API functions.
534 * They are \e also called by the gl_PopAttrib() function!!!
535 * May add more functions like these to the device driver in the future.
538 /** Specify the alpha test function */
539 void (*AlphaFunc
)(struct gl_context
*ctx
, GLenum func
, GLfloat ref
);
540 /** Set the blend color */
541 void (*BlendColor
)(struct gl_context
*ctx
, const GLfloat color
[4]);
542 /** Set the blend equation */
543 void (*BlendEquationSeparate
)(struct gl_context
*ctx
, GLenum modeRGB
, GLenum modeA
);
544 void (*BlendEquationSeparatei
)(struct gl_context
*ctx
, GLuint buffer
,
545 GLenum modeRGB
, GLenum modeA
);
546 /** Specify pixel arithmetic */
547 void (*BlendFuncSeparate
)(struct gl_context
*ctx
,
548 GLenum sfactorRGB
, GLenum dfactorRGB
,
549 GLenum sfactorA
, GLenum dfactorA
);
550 void (*BlendFuncSeparatei
)(struct gl_context
*ctx
, GLuint buffer
,
551 GLenum sfactorRGB
, GLenum dfactorRGB
,
552 GLenum sfactorA
, GLenum dfactorA
);
553 /** Specify clear values for the color buffers */
554 void (*ClearColor
)(struct gl_context
*ctx
,
555 const union gl_color_union color
);
556 /** Specify the clear value for the depth buffer */
557 void (*ClearDepth
)(struct gl_context
*ctx
, GLclampd d
);
558 /** Specify the clear value for the stencil buffer */
559 void (*ClearStencil
)(struct gl_context
*ctx
, GLint s
);
560 /** Specify a plane against which all geometry is clipped */
561 void (*ClipPlane
)(struct gl_context
*ctx
, GLenum plane
, const GLfloat
*equation
);
562 /** Enable and disable writing of frame buffer color components */
563 void (*ColorMask
)(struct gl_context
*ctx
, GLboolean rmask
, GLboolean gmask
,
564 GLboolean bmask
, GLboolean amask
);
565 void (*ColorMaskIndexed
)(struct gl_context
*ctx
, GLuint buf
, GLboolean rmask
,
566 GLboolean gmask
, GLboolean bmask
, GLboolean amask
);
567 /** Cause a material color to track the current color */
568 void (*ColorMaterial
)(struct gl_context
*ctx
, GLenum face
, GLenum mode
);
569 /** Specify whether front- or back-facing facets can be culled */
570 void (*CullFace
)(struct gl_context
*ctx
, GLenum mode
);
571 /** Define front- and back-facing polygons */
572 void (*FrontFace
)(struct gl_context
*ctx
, GLenum mode
);
573 /** Specify the value used for depth buffer comparisons */
574 void (*DepthFunc
)(struct gl_context
*ctx
, GLenum func
);
575 /** Enable or disable writing into the depth buffer */
576 void (*DepthMask
)(struct gl_context
*ctx
, GLboolean flag
);
577 /** Specify mapping of depth values from NDC to window coordinates */
578 void (*DepthRange
)(struct gl_context
*ctx
, GLclampd nearval
, GLclampd farval
);
579 /** Specify the current buffer for writing */
580 void (*DrawBuffer
)( struct gl_context
*ctx
, GLenum buffer
);
581 /** Specify the buffers for writing for fragment programs*/
582 void (*DrawBuffers
)( struct gl_context
*ctx
, GLsizei n
, const GLenum
*buffers
);
583 /** Enable or disable server-side gl capabilities */
584 void (*Enable
)(struct gl_context
*ctx
, GLenum cap
, GLboolean state
);
585 /** Specify fog parameters */
586 void (*Fogfv
)(struct gl_context
*ctx
, GLenum pname
, const GLfloat
*params
);
587 /** Specify implementation-specific hints */
588 void (*Hint
)(struct gl_context
*ctx
, GLenum target
, GLenum mode
);
589 /** Set light source parameters.
590 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
591 * been transformed to eye-space.
593 void (*Lightfv
)(struct gl_context
*ctx
, GLenum light
,
594 GLenum pname
, const GLfloat
*params
);
595 /** Set the lighting model parameters */
596 void (*LightModelfv
)(struct gl_context
*ctx
, GLenum pname
, const GLfloat
*params
);
597 /** Specify the line stipple pattern */
598 void (*LineStipple
)(struct gl_context
*ctx
, GLint factor
, GLushort pattern
);
599 /** Specify the width of rasterized lines */
600 void (*LineWidth
)(struct gl_context
*ctx
, GLfloat width
);
601 /** Specify a logical pixel operation for color index rendering */
602 void (*LogicOpcode
)(struct gl_context
*ctx
, GLenum opcode
);
603 void (*PointParameterfv
)(struct gl_context
*ctx
, GLenum pname
,
604 const GLfloat
*params
);
605 /** Specify the diameter of rasterized points */
606 void (*PointSize
)(struct gl_context
*ctx
, GLfloat size
);
607 /** Select a polygon rasterization mode */
608 void (*PolygonMode
)(struct gl_context
*ctx
, GLenum face
, GLenum mode
);
609 /** Set the scale and units used to calculate depth values */
610 void (*PolygonOffset
)(struct gl_context
*ctx
, GLfloat factor
, GLfloat units
);
611 /** Set the polygon stippling pattern */
612 void (*PolygonStipple
)(struct gl_context
*ctx
, const GLubyte
*mask
);
613 /* Specifies the current buffer for reading */
614 void (*ReadBuffer
)( struct gl_context
*ctx
, GLenum buffer
);
615 /** Set rasterization mode */
616 void (*RenderMode
)(struct gl_context
*ctx
, GLenum mode
);
617 /** Define the scissor box */
618 void (*Scissor
)(struct gl_context
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
619 /** Select flat or smooth shading */
620 void (*ShadeModel
)(struct gl_context
*ctx
, GLenum mode
);
621 /** OpenGL 2.0 two-sided StencilFunc */
622 void (*StencilFuncSeparate
)(struct gl_context
*ctx
, GLenum face
, GLenum func
,
623 GLint ref
, GLuint mask
);
624 /** OpenGL 2.0 two-sided StencilMask */
625 void (*StencilMaskSeparate
)(struct gl_context
*ctx
, GLenum face
, GLuint mask
);
626 /** OpenGL 2.0 two-sided StencilOp */
627 void (*StencilOpSeparate
)(struct gl_context
*ctx
, GLenum face
, GLenum fail
,
628 GLenum zfail
, GLenum zpass
);
629 /** Control the generation of texture coordinates */
630 void (*TexGen
)(struct gl_context
*ctx
, GLenum coord
, GLenum pname
,
631 const GLfloat
*params
);
632 /** Set texture environment parameters */
633 void (*TexEnv
)(struct gl_context
*ctx
, GLenum target
, GLenum pname
,
634 const GLfloat
*param
);
635 /** Set texture parameters */
636 void (*TexParameter
)(struct gl_context
*ctx
, GLenum target
,
637 struct gl_texture_object
*texObj
,
638 GLenum pname
, const GLfloat
*params
);
639 /** Set the viewport */
640 void (*Viewport
)(struct gl_context
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
645 * \name Vertex/pixel buffer object functions
648 void (*BindBuffer
)( struct gl_context
*ctx
, GLenum target
,
649 struct gl_buffer_object
*obj
);
651 struct gl_buffer_object
* (*NewBufferObject
)( struct gl_context
*ctx
, GLuint buffer
,
654 void (*DeleteBuffer
)( struct gl_context
*ctx
, struct gl_buffer_object
*obj
);
656 GLboolean (*BufferData
)( struct gl_context
*ctx
, GLenum target
, GLsizeiptrARB size
,
657 const GLvoid
*data
, GLenum usage
,
658 struct gl_buffer_object
*obj
);
660 void (*BufferSubData
)( struct gl_context
*ctx
, GLintptrARB offset
,
661 GLsizeiptrARB size
, const GLvoid
*data
,
662 struct gl_buffer_object
*obj
);
664 void (*GetBufferSubData
)( struct gl_context
*ctx
,
665 GLintptrARB offset
, GLsizeiptrARB size
,
666 GLvoid
*data
, struct gl_buffer_object
*obj
);
668 void (*CopyBufferSubData
)( struct gl_context
*ctx
,
669 struct gl_buffer_object
*src
,
670 struct gl_buffer_object
*dst
,
671 GLintptr readOffset
, GLintptr writeOffset
,
674 /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
676 void * (*MapBufferRange
)( struct gl_context
*ctx
, GLintptr offset
,
677 GLsizeiptr length
, GLbitfield access
,
678 struct gl_buffer_object
*obj
);
680 void (*FlushMappedBufferRange
)(struct gl_context
*ctx
,
681 GLintptr offset
, GLsizeiptr length
,
682 struct gl_buffer_object
*obj
);
684 GLboolean (*UnmapBuffer
)( struct gl_context
*ctx
,
685 struct gl_buffer_object
*obj
);
689 * \name Functions for GL_APPLE_object_purgeable
692 /* variations on ObjectPurgeable */
693 GLenum (*BufferObjectPurgeable
)( struct gl_context
*ctx
, struct gl_buffer_object
*obj
, GLenum option
);
694 GLenum (*RenderObjectPurgeable
)( struct gl_context
*ctx
, struct gl_renderbuffer
*obj
, GLenum option
);
695 GLenum (*TextureObjectPurgeable
)( struct gl_context
*ctx
, struct gl_texture_object
*obj
, GLenum option
);
697 /* variations on ObjectUnpurgeable */
698 GLenum (*BufferObjectUnpurgeable
)( struct gl_context
*ctx
, struct gl_buffer_object
*obj
, GLenum option
);
699 GLenum (*RenderObjectUnpurgeable
)( struct gl_context
*ctx
, struct gl_renderbuffer
*obj
, GLenum option
);
700 GLenum (*TextureObjectUnpurgeable
)( struct gl_context
*ctx
, struct gl_texture_object
*obj
, GLenum option
);
704 * \name Functions for GL_EXT_framebuffer_{object,blit}.
707 struct gl_framebuffer
* (*NewFramebuffer
)(struct gl_context
*ctx
, GLuint name
);
708 struct gl_renderbuffer
* (*NewRenderbuffer
)(struct gl_context
*ctx
, GLuint name
);
709 void (*BindFramebuffer
)(struct gl_context
*ctx
, GLenum target
,
710 struct gl_framebuffer
*drawFb
,
711 struct gl_framebuffer
*readFb
);
712 void (*FramebufferRenderbuffer
)(struct gl_context
*ctx
,
713 struct gl_framebuffer
*fb
,
715 struct gl_renderbuffer
*rb
);
716 void (*RenderTexture
)(struct gl_context
*ctx
,
717 struct gl_framebuffer
*fb
,
718 struct gl_renderbuffer_attachment
*att
);
719 void (*FinishRenderTexture
)(struct gl_context
*ctx
,
720 struct gl_renderbuffer_attachment
*att
);
721 void (*ValidateFramebuffer
)(struct gl_context
*ctx
,
722 struct gl_framebuffer
*fb
);
724 void (*BlitFramebuffer
)(struct gl_context
*ctx
,
725 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
726 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
727 GLbitfield mask
, GLenum filter
);
730 * \name Query objects
733 struct gl_query_object
* (*NewQueryObject
)(struct gl_context
*ctx
, GLuint id
);
734 void (*DeleteQuery
)(struct gl_context
*ctx
, struct gl_query_object
*q
);
735 void (*BeginQuery
)(struct gl_context
*ctx
, struct gl_query_object
*q
);
736 void (*EndQuery
)(struct gl_context
*ctx
, struct gl_query_object
*q
);
737 void (*CheckQuery
)(struct gl_context
*ctx
, struct gl_query_object
*q
);
738 void (*WaitQuery
)(struct gl_context
*ctx
, struct gl_query_object
*q
);
743 * \name Vertex Array objects
746 struct gl_array_object
* (*NewArrayObject
)(struct gl_context
*ctx
, GLuint id
);
747 void (*DeleteArrayObject
)(struct gl_context
*ctx
, struct gl_array_object
*obj
);
748 void (*BindArrayObject
)(struct gl_context
*ctx
, struct gl_array_object
*obj
);
752 * \name GLSL-related functions (ARB extensions and OpenGL 2.x)
755 struct gl_shader
*(*NewShader
)(struct gl_context
*ctx
, GLuint name
, GLenum type
);
756 void (*DeleteShader
)(struct gl_context
*ctx
, struct gl_shader
*shader
);
757 struct gl_shader_program
*(*NewShaderProgram
)(struct gl_context
*ctx
, GLuint name
);
758 void (*DeleteShaderProgram
)(struct gl_context
*ctx
,
759 struct gl_shader_program
*shProg
);
760 void (*UseProgram
)(struct gl_context
*ctx
, struct gl_shader_program
*shProg
);
765 * \name Support for multiple T&L engines
770 * Set by the driver-supplied T&L engine.
772 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
774 GLuint CurrentExecPrimitive
;
777 * Current state of an in-progress compilation.
779 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
780 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
782 GLuint CurrentSavePrimitive
;
785 #define FLUSH_STORED_VERTICES 0x1
786 #define FLUSH_UPDATE_CURRENT 0x2
788 * Set by the driver-supplied T&L engine whenever vertices are buffered
789 * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not
792 * The dd_function_table::FlushVertices call below may be used to resolve
796 GLuint SaveNeedFlush
;
799 /* Called prior to any of the GLvertexformat functions being
800 * called. Paired with Driver.FlushVertices().
802 void (*BeginVertices
)( struct gl_context
*ctx
);
805 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
806 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
807 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
808 * __struct gl_contextRec::Current and gl_light_attrib::Material
810 * Note that the default T&L engine never clears the
811 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
813 void (*FlushVertices
)( struct gl_context
*ctx
, GLuint flags
);
814 void (*SaveFlushVertices
)( struct gl_context
*ctx
);
817 * \brief Hook for drivers to prepare for a glBegin/glEnd block
819 * This hook is called in vbo_exec_Begin() before any action, including
820 * state updates, occurs.
822 void (*PrepareExecBegin
)( struct gl_context
*ctx
);
825 * Give the driver the opportunity to hook in its own vtxfmt for
826 * compiling optimized display lists. This is called on each valid
827 * glBegin() during list compilation.
829 GLboolean (*NotifySaveBegin
)( struct gl_context
*ctx
, GLenum mode
);
832 * Notify driver that the special derived value _NeedEyeCoords has
835 void (*LightingSpaceChange
)( struct gl_context
*ctx
);
838 * Called by glNewList().
840 * Let the T&L component know what is going on with display lists
841 * in time to make changes to dispatch tables, etc.
843 void (*NewList
)( struct gl_context
*ctx
, GLuint list
, GLenum mode
);
845 * Called by glEndList().
847 * \sa dd_function_table::NewList.
849 void (*EndList
)( struct gl_context
*ctx
);
852 * Called by glCallList(s).
854 * Notify the T&L component before and after calling a display list.
856 void (*BeginCallList
)( struct gl_context
*ctx
,
857 struct gl_display_list
*dlist
);
859 * Called by glEndCallList().
861 * \sa dd_function_table::BeginCallList.
863 void (*EndCallList
)( struct gl_context
*ctx
);
868 * \name GL_NV_texture_barrier interface
870 void (*TextureBarrier
)(struct gl_context
*ctx
);
875 * Transform/Clip/Lighting interface
877 * Drivers present a reduced set of the functions possible in
878 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
879 * remaining functions to map down to these entry points.
881 * These are the initial values to be installed into dispatch by
882 * mesa. If the T&L driver wants to modify the dispatch table
883 * while installed, it must do so itself. It would be possible for
884 * the vertexformat to install its own initial values for these
885 * functions, but this way there is an obvious list of what is
886 * expected of the driver.
888 * If the driver wants to hook in entry points other than those
889 * listed, it must restore them to their original values in
890 * the disable() callback, below.
897 void (GLAPIENTRYP ArrayElement
)( GLint
);
898 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
899 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
900 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
901 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
902 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
903 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
);
904 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* );
905 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
);
906 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* );
907 void (GLAPIENTRYP EvalPoint1
)( GLint
);
908 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
);
909 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
910 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
911 void (GLAPIENTRYP Indexf
)( GLfloat
);
912 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
913 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* );
914 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
915 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
916 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
917 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
918 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
919 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
920 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
921 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
922 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
923 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
924 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
925 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
926 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
927 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
928 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
929 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
930 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
931 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
932 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
933 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
934 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
935 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
936 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
937 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
938 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
939 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
940 void (GLAPIENTRYP CallList
)( GLuint
);
941 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* );
942 void (GLAPIENTRYP Begin
)( GLenum
);
943 void (GLAPIENTRYP End
)( void );
944 /* GL_NV_vertex_program */
945 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
946 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
947 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
948 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
949 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
950 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
951 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
952 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
953 /* GL_ARB_vertex_program */
954 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
955 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
956 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
957 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
958 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
959 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
960 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
961 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
963 /* GL_EXT_gpu_shader4 / GL 3.0 */
964 void (GLAPIENTRYP VertexAttribI1i
)( GLuint index
, GLint x
);
965 void (GLAPIENTRYP VertexAttribI2i
)( GLuint index
, GLint x
, GLint y
);
966 void (GLAPIENTRYP VertexAttribI3i
)( GLuint index
, GLint x
, GLint y
, GLint z
);
967 void (GLAPIENTRYP VertexAttribI4i
)( GLuint index
, GLint x
, GLint y
, GLint z
, GLint w
);
968 void (GLAPIENTRYP VertexAttribI2iv
)( GLuint index
, const GLint
*v
);
969 void (GLAPIENTRYP VertexAttribI3iv
)( GLuint index
, const GLint
*v
);
970 void (GLAPIENTRYP VertexAttribI4iv
)( GLuint index
, const GLint
*v
);
972 void (GLAPIENTRYP VertexAttribI1ui
)( GLuint index
, GLuint x
);
973 void (GLAPIENTRYP VertexAttribI2ui
)( GLuint index
, GLuint x
, GLuint y
);
974 void (GLAPIENTRYP VertexAttribI3ui
)( GLuint index
, GLuint x
, GLuint y
, GLuint z
);
975 void (GLAPIENTRYP VertexAttribI4ui
)( GLuint index
, GLuint x
, GLuint y
, GLuint z
, GLuint w
);
976 void (GLAPIENTRYP VertexAttribI2uiv
)( GLuint index
, const GLuint
*v
);
977 void (GLAPIENTRYP VertexAttribI3uiv
)( GLuint index
, const GLuint
*v
);
978 void (GLAPIENTRYP VertexAttribI4uiv
)( GLuint index
, const GLuint
*v
);
982 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
988 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
989 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
990 const GLvoid
*indices
);
991 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
992 GLuint end
, GLsizei count
,
993 GLenum type
, const GLvoid
*indices
);
994 void (GLAPIENTRYP MultiDrawElementsEXT
)( GLenum mode
, const GLsizei
*count
,
996 const GLvoid
**indices
,
998 void (GLAPIENTRYP DrawArraysInstanced
)(GLenum mode
, GLint first
,
999 GLsizei count
, GLsizei primcount
);
1000 void (GLAPIENTRYP DrawElementsInstanced
)(GLenum mode
, GLsizei count
,
1001 GLenum type
, const GLvoid
*indices
,
1008 * If you don't support eval, fallback to the default vertex format
1009 * on receiving an eval call and use the pipeline mechanism to
1010 * provide partial T&L acceleration.
1012 * Mesa will provide a set of helper functions to do eval within
1013 * accelerated vertex formats, eventually...
1016 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1017 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1023 #endif /* DD_INCLUDED */