3 * Device driver interfaces.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2002 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
;
38 /* Mask bits sent to the driver Clear() function */
39 #define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
40 #define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
41 #define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */
42 #define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */
43 #define DD_AUX0 AUX0_BIT /* future use */
44 #define DD_AUX1 AUX1_BIT /* future use */
45 #define DD_AUX2 AUX2_BIT /* future use */
46 #define DD_AUX3 AUX3_BIT /* future use */
47 #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
48 #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
49 #define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
53 * Device driver function table.
54 * Core Mesa uses these function pointers to call into device drivers.
55 * Most of these functions directly correspond to OpenGL state commands.
56 * Core Mesa will call these functions after error checking has been done
57 * so that the drivers don't have to worry about error testing.
59 * Vertex transformation/clipping/lighting is patched into the T&L module.
60 * Rasterization functions are patched into the swrast module.
62 struct dd_function_table
{
64 * Return a string as needed by glGetString().
66 * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
69 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
72 * Notify the driver after Mesa has made some internal state changes.
74 * This is in addition to any state change callbacks Mesa may already have
77 void (*UpdateState
)( GLcontext
*ctx
, GLuint new_state
);
80 * Clear the color/depth/stencil/accum buffer(s).
82 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
83 * which buffers need to be cleared.
84 * \param all if true then clear the whole buffer, else clear only the
85 * region defined by <tt>(x, y, width, height)</tt>.
87 * This function must obey the glColorMask(), glIndexMask() and glStencilMask()
89 * Software Mesa can do masked clears if the device driver can't.
91 void (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
92 GLint x
, GLint y
, GLint width
, GLint height
);
95 * Specify the current buffer for writing.
97 * Called via glDrawBuffer(). Note the driver must organize fallbacks (e.g.
98 * with swrast) if it cannot implement the requested mode.
100 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
103 * Specifies the current buffer for reading.
105 * Called via glReadBuffer().
107 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
110 * Get the width and height of the named buffer/window.
112 * Mesa uses this to determine when the driver's window size has changed.
114 void (*GetBufferSize
)( GLframebuffer
*buffer
,
115 GLuint
*width
, GLuint
*height
);
118 * Resize the driver's depth/stencil/accum/back buffers to match the
119 * size given in the GLframebuffer struct.
121 * This is typically called when Mesa detects that a window size has changed.
123 void (*ResizeBuffers
)( GLframebuffer
*buffer
);
126 * This is called whenever glFinish() is called.
128 void (*Finish
)( GLcontext
*ctx
);
131 * This is called whenever glFlush() is called.
133 void (*Flush
)( GLcontext
*ctx
);
136 * Called whenever an error is generated.
138 * __GLcontextRec::ErrorValue contains the error value.
140 void (*Error
)( GLcontext
*ctx
);
144 * \name For hardware accumulation buffer
148 * Execute glAccum command within the given scissor region.
150 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
,
151 GLint xpos
, GLint ypos
, GLint width
, GLint height
);
156 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
161 * This is called by glDrawPixels().
163 * \p unpack describes how to unpack the source image data.
165 void (*DrawPixels
)( GLcontext
*ctx
,
166 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
167 GLenum format
, GLenum type
,
168 const struct gl_pixelstore_attrib
*unpack
,
169 const GLvoid
*pixels
);
172 * Called by glReadPixels().
174 void (*ReadPixels
)( GLcontext
*ctx
,
175 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
176 GLenum format
, GLenum type
,
177 const struct gl_pixelstore_attrib
*unpack
,
181 * Do a glCopyPixels().
183 * This function must respect all rasterization state, glPixelTransfer(),
184 * glPixelZoom(), etc.
186 void (*CopyPixels
)( GLcontext
*ctx
,
187 GLint srcx
, GLint srcy
,
188 GLsizei width
, GLsizei height
,
189 GLint dstx
, GLint dsty
, GLenum type
);
192 * This is called by glBitmap().
194 * Works the same as dd_function_table::DrawPixels, above.
196 void (*Bitmap
)( GLcontext
*ctx
,
197 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
198 const struct gl_pixelstore_attrib
*unpack
,
199 const GLubyte
*bitmap
);
204 * \name Texture image functions
209 * Choose texture format.
211 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
212 * functions. The driver should examine \p internalFormat and return a
213 * pointer to an appropriate gl_texture_format.
215 const struct gl_texture_format
*
216 (*ChooseTextureFormat
)( GLcontext
*ctx
, GLint internalFormat
,
217 GLenum srcFormat
, GLenum srcType
);
220 * Called by glTexImage1D().
222 * \param target user specified.
223 * \param format user specified.
224 * \param type user specified.
225 * \param pixels user specified.
226 * \param packing indicates the image packing of pixels.
227 * \param texObj is the target texture object.
228 * \param texImage is the target texture image. It will have the texture \p
229 * width, \p height, \p depth, \p border and \p internalFormat information.
231 * \p retainInternalCopy is returned by this function and indicates whether
232 * core Mesa should keep an internal copy of the texture image.
234 * Drivers should call a fallback routine from texstore.c if needed.
236 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
237 GLint internalFormat
,
238 GLint width
, GLint border
,
239 GLenum format
, GLenum type
, const GLvoid
*pixels
,
240 const struct gl_pixelstore_attrib
*packing
,
241 struct gl_texture_object
*texObj
,
242 struct gl_texture_image
*texImage
);
245 * Called by glTexImage2D().
247 * \sa dd_function_table::TexImage1D.
249 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
250 GLint internalFormat
,
251 GLint width
, GLint height
, GLint border
,
252 GLenum format
, GLenum type
, const GLvoid
*pixels
,
253 const struct gl_pixelstore_attrib
*packing
,
254 struct gl_texture_object
*texObj
,
255 struct gl_texture_image
*texImage
);
258 * Called by glTexImage3D().
260 * \sa dd_function_table::TexImage1D.
262 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
263 GLint internalFormat
,
264 GLint width
, GLint height
, GLint depth
, GLint border
,
265 GLenum format
, GLenum type
, const GLvoid
*pixels
,
266 const struct gl_pixelstore_attrib
*packing
,
267 struct gl_texture_object
*texObj
,
268 struct gl_texture_image
*texImage
);
271 * Called by glTexSubImage1D().
273 * \param target user specified.
274 * \param level user specified.
275 * \param xoffset user specified.
276 * \param yoffset user specified.
277 * \param zoffset user specified.
278 * \param width user specified.
279 * \param height user specified.
280 * \param depth user specified.
281 * \param format user specified.
282 * \param type user specified.
283 * \param pixels user specified.
284 * \param packing indicates the image packing of pixels.
285 * \param texObj is the target texture object.
286 * \param texImage is the target texture image. It will have the texture \p
287 * width, \p height, \p border and \p internalFormat information.
289 * The driver should use a fallback routine from texstore.c if needed.
291 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
292 GLint xoffset
, GLsizei width
,
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 glTexSubImage2D().
302 * \sa dd_function_table::TexSubImage1D.
304 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
305 GLint xoffset
, GLint yoffset
,
306 GLsizei width
, GLsizei height
,
307 GLenum format
, GLenum type
,
308 const GLvoid
*pixels
,
309 const struct gl_pixelstore_attrib
*packing
,
310 struct gl_texture_object
*texObj
,
311 struct gl_texture_image
*texImage
);
314 * Called by glTexSubImage3D().
316 * \sa dd_function_table::TexSubImage1D.
318 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
319 GLint xoffset
, GLint yoffset
, GLint zoffset
,
320 GLsizei width
, GLsizei height
, GLint depth
,
321 GLenum format
, GLenum type
,
322 const GLvoid
*pixels
,
323 const struct gl_pixelstore_attrib
*packing
,
324 struct gl_texture_object
*texObj
,
325 struct gl_texture_image
*texImage
);
328 * Called by glCopyTexImage1D().
330 * Drivers should use a fallback routine from texstore.c if needed.
332 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
333 GLenum internalFormat
, GLint x
, GLint y
,
334 GLsizei width
, GLint border
);
337 * Called by glCopyTexImage2D().
339 * Drivers should use a fallback routine from texstore.c if needed.
341 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
342 GLenum internalFormat
, GLint x
, GLint y
,
343 GLsizei width
, GLsizei height
, GLint border
);
346 * Called by glCopyTexSubImage1D().
348 * Drivers should use a fallback routine from texstore.c if needed.
350 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
352 GLint x
, GLint y
, GLsizei width
);
354 * Called by glCopyTexSubImage2D().
356 * Drivers should use a fallback routine from texstore.c if needed.
358 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
359 GLint xoffset
, GLint yoffset
,
361 GLsizei width
, GLsizei height
);
363 * Called by glCopyTexSubImage3D().
365 * Drivers should use a fallback routine from texstore.c if needed.
367 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
368 GLint xoffset
, GLint yoffset
, GLint zoffset
,
370 GLsizei width
, GLsizei height
);
373 * Called by glTexImage[123]D when user specifies a proxy texture
376 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
378 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
379 GLint level
, GLint internalFormat
,
380 GLenum format
, GLenum type
,
381 GLint width
, GLint height
,
382 GLint depth
, GLint border
);
387 * \name Compressed texture functions
392 * Called by glCompressedTexImage1D().
394 * \param target user specified.
395 * \param format user specified.
396 * \param type user specified.
397 * \param pixels user specified.
398 * \param packing indicates the image packing of pixels.
399 * \param texObj is the target texture object.
400 * \param texImage is the target texture image. It will have the texture \p
401 * width, \p height, \p depth, \p border and \p internalFormat information.
403 * \a retainInternalCopy is returned by this function and indicates whether
404 * core Mesa should keep an internal copy of the texture image.
406 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
407 GLint level
, GLint internalFormat
,
408 GLsizei width
, GLint border
,
409 GLsizei imageSize
, const GLvoid
*data
,
410 struct gl_texture_object
*texObj
,
411 struct gl_texture_image
*texImage
);
413 * Called by glCompressedTexImage2D().
415 * \sa dd_function_table::CompressedTexImage1D.
417 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
418 GLint level
, GLint internalFormat
,
419 GLsizei width
, GLsizei height
, GLint border
,
420 GLsizei imageSize
, const GLvoid
*data
,
421 struct gl_texture_object
*texObj
,
422 struct gl_texture_image
*texImage
);
424 * Called by glCompressedTexImage3D().
426 * \sa dd_function_table::CompressedTexImage3D.
428 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
429 GLint level
, GLint internalFormat
,
430 GLsizei width
, GLsizei height
, GLsizei depth
,
432 GLsizei imageSize
, const GLvoid
*data
,
433 struct gl_texture_object
*texObj
,
434 struct gl_texture_image
*texImage
);
437 * Called by glCompressedTexSubImage1D().
439 * \param target user specified.
440 * \param level user specified.
441 * \param xoffset user specified.
442 * \param yoffset user specified.
443 * \param zoffset user specified.
444 * \param width user specified.
445 * \param height user specified.
446 * \param depth user specified.
447 * \param imageSize user specified.
448 * \param data user specified.
449 * \param texObj is the target texture object.
450 * \param texImage is the target texture image. It will have the texture \p
451 * width, \p height, \p depth, \p border and \p internalFormat information.
453 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
454 GLint xoffset
, GLsizei width
,
456 GLsizei imageSize
, const GLvoid
*data
,
457 struct gl_texture_object
*texObj
,
458 struct gl_texture_image
*texImage
);
460 * Called by glCompressedTexSubImage2D().
462 * \sa dd_function_table::CompressedTexImage3D.
464 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
465 GLint xoffset
, GLint yoffset
,
466 GLsizei width
, GLint height
,
468 GLsizei imageSize
, const GLvoid
*data
,
469 struct gl_texture_object
*texObj
,
470 struct gl_texture_image
*texImage
);
472 * Called by glCompressedTexSubImage3D().
474 * \sa dd_function_table::CompressedTexImage3D.
476 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
477 GLint xoffset
, GLint yoffset
, GLint zoffset
,
478 GLsizei width
, GLint height
, GLint depth
,
480 GLsizei imageSize
, const GLvoid
*data
,
481 struct gl_texture_object
*texObj
,
482 struct gl_texture_image
*texImage
);
484 * Called to validate a certain compressed format.
486 GLboolean (*IsCompressedFormat
)( GLcontext
*ctx
, GLenum internalFormat
);
488 * Called to get bytes of storage needed for the given texture size and
491 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
,
492 GLsizei width
, GLsizei height
, GLsizei depth
,
497 * \name Texture object functions
502 * Called by glBindTexture().
504 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
505 struct gl_texture_object
*tObj
);
508 * Called when a texture object is created.
510 void (*CreateTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
513 * Called to allocate a new texture object.
515 * \note This function pointer should be initialized by drivers \e before
516 * calling _mesa_initialize_context() since context initialization involves
517 * allocating some texture objects!
519 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
522 * Called when a texture object is about to be deallocated.
524 * Driver should free anything attached to the DriverData pointers.
526 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
529 * Called to allocate a new texture image object.
531 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
534 * Called by glAreTextureResident().
536 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
537 struct gl_texture_object
*t
);
540 * Called by glPrioritizeTextures().
542 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
546 * Called by glActiveTextureARB() to set current texture unit.
548 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
551 * Called when the texture's color lookup table is changed.
553 * If \p tObj is NULL then the shared texture palette
554 * gl_texture_object::Palette is to be updated.
556 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
557 struct gl_texture_object
*tObj
);
562 * \name Imaging functionality
565 void (*CopyColorTable
)( GLcontext
*ctx
,
566 GLenum target
, GLenum internalformat
,
567 GLint x
, GLint y
, GLsizei width
);
569 void (*CopyColorSubTable
)( GLcontext
*ctx
,
570 GLenum target
, GLsizei start
,
571 GLint x
, GLint y
, GLsizei width
);
573 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
574 GLenum internalFormat
,
575 GLint x
, GLint y
, GLsizei width
);
577 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
578 GLenum internalFormat
,
580 GLsizei width
, GLsizei height
);
585 * \name State-changing functions.
587 * \note drawing functions are above.
589 * These functions are called by their corresponding OpenGL API functions.
590 * They are \e also called by the gl_PopAttrib() function!!!
591 * May add more functions like these to the device driver in the future.
594 /** Specify the alpha test function */
595 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
596 /** Set the blend color */
597 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
598 /** Set the blend equation */
599 void (*BlendEquation
)(GLcontext
*ctx
, GLenum mode
);
600 /** Specify pixel arithmetic */
601 void (*BlendFunc
)(GLcontext
*ctx
, GLenum sfactor
, GLenum dfactor
);
602 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
603 GLenum sfactorRGB
, GLenum dfactorRGB
,
604 GLenum sfactorA
, GLenum dfactorA
);
605 /** Specify clear values for the color buffers */
606 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
607 /** Specify the clear value for the depth buffer */
608 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
609 /** Specify the clear value for the color index buffers */
610 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
611 /** Specify the clear value for the stencil buffer */
612 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
613 /** Specify a plane against which all geometry is clipped */
614 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
615 /** Enable and disable writing of frame buffer color components */
616 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
617 GLboolean bmask
, GLboolean amask
);
618 /** Cause a material color to track the current color */
619 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
620 /** Specify whether front- or back-facing facets can be culled */
621 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
622 /** Define front- and back-facing polygons */
623 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
624 /** Specify the value used for depth buffer comparisons */
625 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
626 /** Enable or disable writing into the depth buffer */
627 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
628 /** Specify mapping of depth values from normalized device coordinates to window coordinates */
629 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
630 /** Enable or disable server-side gl capabilities */
631 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
632 /** Specify fog parameters */
633 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
634 /** Specify implementation-specific hints */
635 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
636 /** Control the writing of individual bits in the color index buffers */
637 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
638 /** Set light source parameters */
639 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
640 GLenum pname
, const GLfloat
*params
);
641 /** Set the lighting model parameters */
642 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
643 /** Specify the line stipple pattern */
644 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
645 /** Specify the width of rasterized lines */
646 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
647 /** Specify a logical pixel operation for color index rendering */
648 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
649 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
650 const GLfloat
*params
);
651 /** Specify the diameter of rasterized points */
652 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
653 /** Select a polygon rasterization mode */
654 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
655 /** Set the scale and units used to calculate depth values */
656 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
657 /** Set the polygon stippling pattern */
658 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
659 /** Set rasterization mode */
660 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
661 /** Define the scissor box */
662 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
663 /** Select flat or smooth shading */
664 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
665 /** Set function and reference value for stencil testing */
666 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
667 /** Control the writing of individual bits in the stencil planes */
668 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
669 /** Set stencil test actions */
670 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
671 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
672 /** Control the generation of texture coordinates */
673 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
674 const GLfloat
*params
);
675 /** Set texture environment parameters */
676 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
677 const GLfloat
*param
);
678 /** Set texture parameters */
679 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
680 struct gl_texture_object
*texObj
,
681 GLenum pname
, const GLfloat
*params
);
682 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
683 /** Set the viewport */
684 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
689 * \name Vertex array functions
691 * Called by the corresponding OpenGL functions.
694 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
695 GLsizei stride
, const GLvoid
*ptr
);
696 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
697 GLsizei stride
, const GLvoid
*ptr
);
698 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
699 GLsizei stride
, const GLvoid
*ptr
);
700 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
701 GLsizei stride
, const GLvoid
*ptr
);
702 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
703 GLsizei stride
, const GLvoid
*ptr
);
704 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
705 GLsizei stride
, const GLvoid
*ptr
);
706 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
707 GLsizei stride
, const GLvoid
*ptr
);
708 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
709 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
710 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
715 * \name State-query functions
717 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
720 /** Return the value or values of a selected parameter */
721 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
722 /** Return the value or values of a selected parameter */
723 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
724 /** Return the value or values of a selected parameter */
725 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
726 /** Return the value or values of a selected parameter */
727 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
728 /** Return the value or values of a selected parameter */
729 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
734 * \name Vertex buffer object functions
736 #if FEATURE_ARB_vertex_buffer_object
738 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
739 struct gl_buffer_object
*obj
);
741 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
744 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
746 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
747 const GLvoid
*data
, GLenum usage
,
748 struct gl_buffer_object
*obj
);
750 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
751 GLsizeiptrARB size
, const GLvoid
*data
,
752 struct gl_buffer_object
*obj
);
754 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
755 GLintptrARB offset
, GLsizeiptrARB size
,
756 GLvoid
*data
, struct gl_buffer_object
*obj
);
758 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
759 struct gl_buffer_object
*obj
);
761 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
762 struct gl_buffer_object
*obj
);
767 * \name Support for multiple T&L engines
772 * Bitmask of state changes that require the current T&L module to be
773 * validated, using ValidateTnlModule() below.
778 * Validate the current T&L module.
780 * This is called directly after UpdateState() when a state change that has
781 * occurred matches the dd_function_table::NeedValidate bitmask above. This
782 * ensures all computed values are up to date, thus allowing the driver to
783 * decide if the current T&L module needs to be swapped out.
785 * This must be non-NULL if a driver installs a custom T&L module and sets
786 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
788 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
791 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
792 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
793 #define PRIM_UNKNOWN GL_POLYGON+3
796 * Set by the driver-supplied T&L engine.
798 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
800 GLuint CurrentExecPrimitive
;
803 * Current state of an in-progress compilation.
805 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
806 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
808 GLuint CurrentSavePrimitive
;
811 #define FLUSH_STORED_VERTICES 0x1
812 #define FLUSH_UPDATE_CURRENT 0x2
814 * Set by the driver-supplied T&L engine whenever vertices are buffered
815 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
818 * The dd_function_table::FlushVertices call below may be used to resolve
822 GLuint SaveNeedFlush
;
825 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
826 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
827 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
828 * __GLcontextRec::Current and gl_light_attrib::Material
830 * Note that the default T&L engine never clears the
831 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
833 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
834 void (*SaveFlushVertices
)( GLcontext
*ctx
);
837 * Give the driver the opportunity to hook in its own vtxfmt for
838 * compiling optimized display lists. This is called on each valid
839 * glBegin() during list compilation.
841 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
844 * Notify driver that the special derived value _NeedEyeCoords has
847 void (*LightingSpaceChange
)( GLcontext
*ctx
);
850 * Called by glNewList().
852 * Let the T&L component know what is going on with display lists
853 * in time to make changes to dispatch tables, etc.
855 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
857 * Called by glEndList().
859 * \sa dd_function_table::NewList.
861 void (*EndList
)( GLcontext
*ctx
);
864 * Called by glCallList(s), but not recursively.
866 * Notify the T&L component before and after calling a display list.
867 * Called by glCallList(s), but not recursively.
869 void (*BeginCallList
)( GLcontext
*ctx
, GLuint list
);
871 * Called by glEndCallList().
873 * \sa dd_function_table::BeginCallList.
875 void (*EndCallList
)( GLcontext
*ctx
);
878 * Let the T&L component know when the context becomes current.
880 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
881 GLframebuffer
*readBuffer
);
884 * Called by glLockArraysEXT().
886 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
888 * Called by UnlockArraysEXT().
890 void (*UnlockArraysEXT
)( 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
);
979 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
985 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
986 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
987 const GLvoid
*indices
);
988 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
989 GLuint end
, GLsizei count
,
990 GLenum type
, const GLvoid
*indices
);
996 * If you don't support eval, fallback to the default vertex format
997 * on receiving an eval call and use the pipeline mechanism to
998 * provide partial T&L acceleration.
1000 * Mesa will provide a set of helper functions to do eval within
1001 * accelerated vertex formats, eventually...
1004 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1005 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1011 #endif /* DD_INCLUDED */