3 * Device driver interfaces.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2004 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
;
39 * Device driver function table.
40 * Core Mesa uses these function pointers to call into device drivers.
41 * Most of these functions directly correspond to OpenGL state commands.
42 * Core Mesa will call these functions after error checking has been done
43 * so that the drivers don't have to worry about error testing.
45 * Vertex transformation/clipping/lighting is patched into the T&L module.
46 * Rasterization functions are patched into the swrast module.
48 * Note: when new functions are added here, the drivers/common/driverfuncs.c
49 * file should be updated too!!!
51 struct dd_function_table
{
53 * Return a string as needed by glGetString().
55 * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
58 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
61 * Notify the driver after Mesa has made some internal state changes.
63 * This is in addition to any state change callbacks Mesa may already have
66 void (*UpdateState
)( GLcontext
*ctx
, GLuint new_state
);
69 * Get the width and height of the named buffer/window.
71 * Mesa uses this to determine when the driver's window size has changed.
73 void (*GetBufferSize
)( GLframebuffer
*buffer
,
74 GLuint
*width
, GLuint
*height
);
77 * Resize the driver's depth/stencil/accum/back buffers to match the
78 * size given in the GLframebuffer struct.
80 * This is typically called when Mesa detects that a window size has changed.
82 void (*ResizeBuffers
)( GLframebuffer
*buffer
);
85 * Called whenever an error is generated.
87 * __GLcontextRec::ErrorValue contains the error value.
89 void (*Error
)( GLcontext
*ctx
);
92 * This is called whenever glFinish() is called.
94 void (*Finish
)( GLcontext
*ctx
);
97 * This is called whenever glFlush() is called.
99 void (*Flush
)( GLcontext
*ctx
);
102 * Clear the color/depth/stencil/accum buffer(s).
104 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
105 * which buffers need to be cleared.
106 * \param all if true then clear the whole buffer, else clear only the
107 * region defined by <tt>(x, y, width, height)</tt>.
109 * This function must obey the glColorMask(), glIndexMask() and
110 * glStencilMask() settings!
111 * Software Mesa can do masked clears if the device driver can't.
113 void (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
114 GLint x
, GLint y
, GLint width
, GLint height
);
118 * \name For hardware accumulation buffer
122 * Execute glAccum command within the given scissor region.
124 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
,
125 GLint xpos
, GLint ypos
, GLint width
, GLint height
);
130 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
135 * This is called by glDrawPixels().
137 * \p unpack describes how to unpack the source image data.
139 void (*DrawPixels
)( GLcontext
*ctx
,
140 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
141 GLenum format
, GLenum type
,
142 const struct gl_pixelstore_attrib
*unpack
,
143 const GLvoid
*pixels
);
146 * Called by glReadPixels().
148 void (*ReadPixels
)( GLcontext
*ctx
,
149 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
150 GLenum format
, GLenum type
,
151 const struct gl_pixelstore_attrib
*unpack
,
155 * Do a glCopyPixels().
157 * This function must respect all rasterization state, glPixelTransfer(),
158 * glPixelZoom(), etc.
160 void (*CopyPixels
)( GLcontext
*ctx
, GLint srcx
, GLint srcy
,
161 GLsizei width
, GLsizei height
,
162 GLint dstx
, GLint dsty
, GLenum type
);
165 * This is called by glBitmap().
167 * Works the same as dd_function_table::DrawPixels, above.
169 void (*Bitmap
)( GLcontext
*ctx
,
170 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
171 const struct gl_pixelstore_attrib
*unpack
,
172 const GLubyte
*bitmap
);
177 * \name Texture image functions
182 * Choose texture format.
184 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
185 * functions. The driver should examine \p internalFormat and return a
186 * pointer to an appropriate gl_texture_format.
188 const struct gl_texture_format
*(*ChooseTextureFormat
)( GLcontext
*ctx
,
189 GLint internalFormat
, GLenum srcFormat
, GLenum srcType
);
192 * Called by glTexImage1D().
194 * \param target user specified.
195 * \param format user specified.
196 * \param type user specified.
197 * \param pixels user specified.
198 * \param packing indicates the image packing of pixels.
199 * \param texObj is the target texture object.
200 * \param texImage is the target texture image. It will have the texture \p
201 * width, \p height, \p depth, \p border and \p internalFormat information.
203 * \p retainInternalCopy is returned by this function and indicates whether
204 * core Mesa should keep an internal copy of the texture image.
206 * Drivers should call a fallback routine from texstore.c if needed.
208 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
209 GLint internalFormat
,
210 GLint width
, GLint border
,
211 GLenum format
, GLenum type
, const GLvoid
*pixels
,
212 const struct gl_pixelstore_attrib
*packing
,
213 struct gl_texture_object
*texObj
,
214 struct gl_texture_image
*texImage
);
217 * Called by glTexImage2D().
219 * \sa dd_function_table::TexImage1D.
221 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
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
,
226 struct gl_texture_object
*texObj
,
227 struct gl_texture_image
*texImage
);
230 * Called by glTexImage3D().
232 * \sa dd_function_table::TexImage1D.
234 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
235 GLint internalFormat
,
236 GLint width
, GLint height
, GLint depth
, GLint border
,
237 GLenum format
, GLenum type
, const GLvoid
*pixels
,
238 const struct gl_pixelstore_attrib
*packing
,
239 struct gl_texture_object
*texObj
,
240 struct gl_texture_image
*texImage
);
243 * Called by glTexSubImage1D().
245 * \param target user specified.
246 * \param level user specified.
247 * \param xoffset user specified.
248 * \param yoffset user specified.
249 * \param zoffset user specified.
250 * \param width user specified.
251 * \param height user specified.
252 * \param depth user specified.
253 * \param format user specified.
254 * \param type user specified.
255 * \param pixels user specified.
256 * \param packing indicates the image packing of pixels.
257 * \param texObj is the target texture object.
258 * \param texImage is the target texture image. It will have the texture \p
259 * width, \p height, \p border and \p internalFormat information.
261 * The driver should use a fallback routine from texstore.c if needed.
263 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
264 GLint xoffset
, GLsizei width
,
265 GLenum format
, GLenum type
,
266 const GLvoid
*pixels
,
267 const struct gl_pixelstore_attrib
*packing
,
268 struct gl_texture_object
*texObj
,
269 struct gl_texture_image
*texImage
);
272 * Called by glTexSubImage2D().
274 * \sa dd_function_table::TexSubImage1D.
276 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
277 GLint xoffset
, GLint yoffset
,
278 GLsizei width
, GLsizei height
,
279 GLenum format
, GLenum type
,
280 const GLvoid
*pixels
,
281 const struct gl_pixelstore_attrib
*packing
,
282 struct gl_texture_object
*texObj
,
283 struct gl_texture_image
*texImage
);
286 * Called by glTexSubImage3D().
288 * \sa dd_function_table::TexSubImage1D.
290 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
291 GLint xoffset
, GLint yoffset
, GLint zoffset
,
292 GLsizei width
, GLsizei height
, GLint depth
,
293 GLenum format
, GLenum type
,
294 const GLvoid
*pixels
,
295 const struct gl_pixelstore_attrib
*packing
,
296 struct gl_texture_object
*texObj
,
297 struct gl_texture_image
*texImage
);
300 * Called by glGetTexImage().
302 void (*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
303 GLenum format
, GLenum type
, GLvoid
*pixels
,
304 const struct gl_texture_object
*texObj
,
305 const struct gl_texture_image
*texImage
);
308 * Called by glCopyTexImage1D().
310 * Drivers should use a fallback routine from texstore.c if needed.
312 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
313 GLenum internalFormat
, GLint x
, GLint y
,
314 GLsizei width
, GLint border
);
317 * Called by glCopyTexImage2D().
319 * Drivers should use a fallback routine from texstore.c if needed.
321 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
322 GLenum internalFormat
, GLint x
, GLint y
,
323 GLsizei width
, GLsizei height
, GLint border
);
326 * Called by glCopyTexSubImage1D().
328 * Drivers should use a fallback routine from texstore.c if needed.
330 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
332 GLint x
, GLint y
, GLsizei width
);
334 * Called by glCopyTexSubImage2D().
336 * Drivers should use a fallback routine from texstore.c if needed.
338 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
339 GLint xoffset
, GLint yoffset
,
341 GLsizei width
, GLsizei height
);
343 * Called by glCopyTexSubImage3D().
345 * Drivers should use a fallback routine from texstore.c if needed.
347 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
348 GLint xoffset
, GLint yoffset
, GLint zoffset
,
350 GLsizei width
, GLsizei height
);
353 * Called by glTexImage[123]D when user specifies a proxy texture
356 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
358 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
359 GLint level
, GLint internalFormat
,
360 GLenum format
, GLenum type
,
361 GLint width
, GLint height
,
362 GLint depth
, GLint border
);
367 * \name Compressed texture functions
372 * Called by glCompressedTexImage1D().
374 * \param target user specified.
375 * \param format user specified.
376 * \param type user specified.
377 * \param pixels user specified.
378 * \param packing indicates the image packing of pixels.
379 * \param texObj is the target texture object.
380 * \param texImage is the target texture image. It will have the texture \p
381 * width, \p height, \p depth, \p border and \p internalFormat information.
383 * \a retainInternalCopy is returned by this function and indicates whether
384 * core Mesa should keep an internal copy of the texture image.
386 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
387 GLint level
, GLint internalFormat
,
388 GLsizei width
, GLint border
,
389 GLsizei imageSize
, const GLvoid
*data
,
390 struct gl_texture_object
*texObj
,
391 struct gl_texture_image
*texImage
);
393 * Called by glCompressedTexImage2D().
395 * \sa dd_function_table::CompressedTexImage1D.
397 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
398 GLint level
, GLint internalFormat
,
399 GLsizei width
, GLsizei height
, GLint border
,
400 GLsizei imageSize
, const GLvoid
*data
,
401 struct gl_texture_object
*texObj
,
402 struct gl_texture_image
*texImage
);
404 * Called by glCompressedTexImage3D().
406 * \sa dd_function_table::CompressedTexImage3D.
408 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
409 GLint level
, GLint internalFormat
,
410 GLsizei width
, GLsizei height
, GLsizei depth
,
412 GLsizei imageSize
, const GLvoid
*data
,
413 struct gl_texture_object
*texObj
,
414 struct gl_texture_image
*texImage
);
417 * Called by glCompressedTexSubImage1D().
419 * \param target user specified.
420 * \param level user specified.
421 * \param xoffset user specified.
422 * \param yoffset user specified.
423 * \param zoffset user specified.
424 * \param width user specified.
425 * \param height user specified.
426 * \param depth user specified.
427 * \param imageSize user specified.
428 * \param data user specified.
429 * \param texObj is the target texture object.
430 * \param texImage is the target texture image. It will have the texture \p
431 * width, \p height, \p depth, \p border and \p internalFormat information.
433 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
434 GLint xoffset
, GLsizei width
,
436 GLsizei imageSize
, const GLvoid
*data
,
437 struct gl_texture_object
*texObj
,
438 struct gl_texture_image
*texImage
);
440 * Called by glCompressedTexSubImage2D().
442 * \sa dd_function_table::CompressedTexImage3D.
444 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
445 GLint xoffset
, GLint yoffset
,
446 GLsizei width
, GLint height
,
448 GLsizei imageSize
, const GLvoid
*data
,
449 struct gl_texture_object
*texObj
,
450 struct gl_texture_image
*texImage
);
452 * Called by glCompressedTexSubImage3D().
454 * \sa dd_function_table::CompressedTexImage3D.
456 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
457 GLint xoffset
, GLint yoffset
, GLint zoffset
,
458 GLsizei width
, GLint height
, GLint depth
,
460 GLsizei imageSize
, const GLvoid
*data
,
461 struct gl_texture_object
*texObj
,
462 struct gl_texture_image
*texImage
);
466 * Called by glGetCompressedTexImage.
468 void (*GetCompressedTexImage
)(GLcontext
*ctx
, GLenum target
, GLint level
,
470 const struct gl_texture_object
*texObj
,
471 const struct gl_texture_image
*texImage
);
474 * Called to query number of bytes of storage needed to store the
475 * specified compressed texture.
477 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
, GLsizei width
,
478 GLsizei height
, GLsizei depth
,
483 * \name Texture object functions
488 * Called by glBindTexture().
490 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
491 struct gl_texture_object
*tObj
);
494 * Called to allocate a new texture object.
495 * A new gl_texture_object should be returned. The driver should
496 * attach to it any device-specific info it needs.
498 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
501 * Called when a texture object is about to be deallocated.
503 * Driver should delete the gl_texture_object object and anything
506 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
509 * Called to allocate a new texture image object.
511 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
514 * Called by glAreTextureResident().
516 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
517 struct gl_texture_object
*t
);
520 * Called by glPrioritizeTextures().
522 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
526 * Called by glActiveTextureARB() to set current texture unit.
528 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
531 * Called when the texture's color lookup table is changed.
533 * If \p tObj is NULL then the shared texture palette
534 * gl_texture_object::Palette is to be updated.
536 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
537 struct gl_texture_object
*tObj
);
542 * \name Imaging functionality
545 void (*CopyColorTable
)( GLcontext
*ctx
,
546 GLenum target
, GLenum internalformat
,
547 GLint x
, GLint y
, GLsizei width
);
549 void (*CopyColorSubTable
)( GLcontext
*ctx
,
550 GLenum target
, GLsizei start
,
551 GLint x
, GLint y
, GLsizei width
);
553 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
554 GLenum internalFormat
,
555 GLint x
, GLint y
, GLsizei width
);
557 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
558 GLenum internalFormat
,
560 GLsizei width
, GLsizei height
);
565 * \name Vertex/fragment program functions
568 /** Bind a vertex/fragment program */
569 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct program
*prog
);
570 /** Allocate a new program */
571 struct program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
572 /** Delete a program */
573 void (*DeleteProgram
)(GLcontext
*ctx
, struct program
*prog
);
574 /** Notify driver that a program string has been specified. */
575 void (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
576 struct program
*prog
);
580 /** Query if program can be loaded onto hardware */
581 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
582 struct program
*prog
);
588 * \name State-changing functions.
590 * \note drawing functions are above.
592 * These functions are called by their corresponding OpenGL API functions.
593 * They are \e also called by the gl_PopAttrib() function!!!
594 * May add more functions like these to the device driver in the future.
597 /** Specify the alpha test function */
598 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
599 /** Set the blend color */
600 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
601 /** Set the blend equation */
602 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
603 /** Specify pixel arithmetic */
604 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
605 GLenum sfactorRGB
, GLenum dfactorRGB
,
606 GLenum sfactorA
, GLenum dfactorA
);
607 /** Specify clear values for the color buffers */
608 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
609 /** Specify the clear value for the depth buffer */
610 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
611 /** Specify the clear value for the color index buffers */
612 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
613 /** Specify the clear value for the stencil buffer */
614 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
615 /** Specify a plane against which all geometry is clipped */
616 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
617 /** Enable and disable writing of frame buffer color components */
618 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
619 GLboolean bmask
, GLboolean amask
);
620 /** Cause a material color to track the current color */
621 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
622 /** Specify whether front- or back-facing facets can be culled */
623 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
624 /** Define front- and back-facing polygons */
625 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
626 /** Specify the value used for depth buffer comparisons */
627 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
628 /** Enable or disable writing into the depth buffer */
629 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
630 /** Specify mapping of depth values from NDC to window coordinates */
631 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
632 /** Specify the current buffer for writing */
633 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
634 /** Specify the buffers for writing for fragment programs*/
635 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
636 /** Enable or disable server-side gl capabilities */
637 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
638 /** Specify fog parameters */
639 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
640 /** Specify implementation-specific hints */
641 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
642 /** Control the writing of individual bits in the color index buffers */
643 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
644 /** Set light source parameters */
645 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
646 GLenum pname
, const GLfloat
*params
);
647 /** Set the lighting model parameters */
648 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
649 /** Specify the line stipple pattern */
650 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
651 /** Specify the width of rasterized lines */
652 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
653 /** Specify a logical pixel operation for color index rendering */
654 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
655 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
656 const GLfloat
*params
);
657 /** Specify the diameter of rasterized points */
658 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
659 /** Select a polygon rasterization mode */
660 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
661 /** Set the scale and units used to calculate depth values */
662 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
663 /** Set the polygon stippling pattern */
664 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
665 /* Specifies the current buffer for reading */
666 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
667 /** Set rasterization mode */
668 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
669 /** Define the scissor box */
670 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
671 /** Select flat or smooth shading */
672 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
673 /** Set function and reference value for stencil testing */
674 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
675 /** Control the writing of individual bits in the stencil planes */
676 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
677 /** Set stencil test actions */
678 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
679 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
680 /** Control the generation of texture coordinates */
681 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
682 const GLfloat
*params
);
683 /** Set texture environment parameters */
684 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
685 const GLfloat
*param
);
686 /** Set texture parameters */
687 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
688 struct gl_texture_object
*texObj
,
689 GLenum pname
, const GLfloat
*params
);
690 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
691 /** Set the viewport */
692 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
697 * \name Vertex array functions
699 * Called by the corresponding OpenGL functions.
702 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
703 GLsizei stride
, const GLvoid
*ptr
);
704 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
705 GLsizei stride
, const GLvoid
*ptr
);
706 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
707 GLsizei stride
, const GLvoid
*ptr
);
708 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
709 GLsizei stride
, const GLvoid
*ptr
);
710 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
711 GLsizei stride
, const GLvoid
*ptr
);
712 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
713 GLsizei stride
, const GLvoid
*ptr
);
714 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
715 GLsizei stride
, const GLvoid
*ptr
);
716 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
717 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
718 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
719 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
720 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
725 * \name State-query functions
727 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
730 /** Return the value or values of a selected parameter */
731 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
732 /** Return the value or values of a selected parameter */
733 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
734 /** Return the value or values of a selected parameter */
735 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
736 /** Return the value or values of a selected parameter */
737 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
738 /** Return the value or values of a selected parameter */
739 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
744 * \name Vertex buffer object functions
746 #if FEATURE_ARB_vertex_buffer_object
748 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
749 struct gl_buffer_object
*obj
);
751 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
754 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
756 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
757 const GLvoid
*data
, GLenum usage
,
758 struct gl_buffer_object
*obj
);
760 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
761 GLsizeiptrARB size
, const GLvoid
*data
,
762 struct gl_buffer_object
*obj
);
764 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
765 GLintptrARB offset
, GLsizeiptrARB size
,
766 GLvoid
*data
, struct gl_buffer_object
*obj
);
768 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
769 struct gl_buffer_object
*obj
);
771 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
772 struct gl_buffer_object
*obj
);
777 * \name Support for multiple T&L engines
782 * Bitmask of state changes that require the current T&L module to be
783 * validated, using ValidateTnlModule() below.
788 * Validate the current T&L module.
790 * This is called directly after UpdateState() when a state change that has
791 * occurred matches the dd_function_table::NeedValidate bitmask above. This
792 * ensures all computed values are up to date, thus allowing the driver to
793 * decide if the current T&L module needs to be swapped out.
795 * This must be non-NULL if a driver installs a custom T&L module and sets
796 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
798 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
801 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
802 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
803 #define PRIM_UNKNOWN GL_POLYGON+3
806 * Set by the driver-supplied T&L engine.
808 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
810 GLuint CurrentExecPrimitive
;
813 * Current state of an in-progress compilation.
815 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
816 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
818 GLuint CurrentSavePrimitive
;
821 #define FLUSH_STORED_VERTICES 0x1
822 #define FLUSH_UPDATE_CURRENT 0x2
824 * Set by the driver-supplied T&L engine whenever vertices are buffered
825 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
828 * The dd_function_table::FlushVertices call below may be used to resolve
832 GLuint SaveNeedFlush
;
835 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
836 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
837 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
838 * __GLcontextRec::Current and gl_light_attrib::Material
840 * Note that the default T&L engine never clears the
841 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
843 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
844 void (*SaveFlushVertices
)( GLcontext
*ctx
);
847 * Give the driver the opportunity to hook in its own vtxfmt for
848 * compiling optimized display lists. This is called on each valid
849 * glBegin() during list compilation.
851 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
854 * Notify driver that the special derived value _NeedEyeCoords has
857 void (*LightingSpaceChange
)( GLcontext
*ctx
);
860 * Let the T&L component know when the context becomes current.
862 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
863 GLframebuffer
*readBuffer
);
866 * Called by glNewList().
868 * Let the T&L component know what is going on with display lists
869 * in time to make changes to dispatch tables, etc.
871 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
873 * Called by glEndList().
875 * \sa dd_function_table::NewList.
877 void (*EndList
)( GLcontext
*ctx
);
880 * Called by glCallList(s), but not recursively.
882 * Notify the T&L component before and after calling a display list.
883 * Called by glCallList(s), but not recursively.
885 void (*BeginCallList
)( GLcontext
*ctx
, GLuint list
);
887 * Called by glEndCallList().
889 * \sa dd_function_table::BeginCallList.
891 void (*EndCallList
)( GLcontext
*ctx
);
897 * Transform/Clip/Lighting interface
899 * Drivers present a reduced set of the functions possible in
900 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
901 * remaining functions to map down to these entry points.
903 * These are the initial values to be installed into dispatch by
904 * mesa. If the T&L driver wants to modify the dispatch table
905 * while installed, it must do so itself. It would be possible for
906 * the vertexformat to install it's own initial values for these
907 * functions, but this way there is an obvious list of what is
908 * expected of the driver.
910 * If the driver wants to hook in entry points other than those
911 * listed, it must restore them to their original values in
912 * the disable() callback, below.
919 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
920 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
921 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
922 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
923 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
924 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
925 void (GLAPIENTRYP EdgeFlagv
)( const GLboolean
* );
926 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
927 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
928 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
929 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
930 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
931 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
932 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
933 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
934 void (GLAPIENTRYP Indexf
)( GLfloat
);
935 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
936 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
937 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
938 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
939 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
940 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
941 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
942 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
943 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
944 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
945 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
946 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
947 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
948 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
949 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
950 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
951 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
952 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
953 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
954 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
955 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
956 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
957 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
958 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
959 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
960 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
961 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
962 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
963 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
964 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
965 void (GLAPIENTRYP Begin
)( GLenum
);
966 void (GLAPIENTRYP End
)( void );
967 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
968 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
969 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
970 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
971 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
972 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
973 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
974 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
975 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
976 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
977 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
978 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
979 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
980 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
981 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
982 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
987 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
993 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
994 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
995 const GLvoid
*indices
);
996 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
997 GLuint end
, GLsizei count
,
998 GLenum type
, const GLvoid
*indices
);
1004 * If you don't support eval, fallback to the default vertex format
1005 * on receiving an eval call and use the pipeline mechanism to
1006 * provide partial T&L acceleration.
1008 * Mesa will provide a set of helper functions to do eval within
1009 * accelerated vertex formats, eventually...
1012 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1013 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1019 #endif /* DD_INCLUDED */