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
);
486 * \name Texture object functions
491 * Called by glBindTexture().
493 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
494 struct gl_texture_object
*tObj
);
497 * Called when a texture object is created.
499 void (*CreateTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
502 * Called to allocate a new texture object.
504 * \note This function pointer should be initialized by drivers \e before
505 * calling _mesa_initialize_context() since context initialization involves
506 * allocating some texture objects!
508 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
511 * Called when a texture object is about to be deallocated.
513 * Driver should free anything attached to the DriverData pointers.
515 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
518 * Called to allocate a new texture image object.
520 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
523 * Called by glAreTextureResident().
525 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
526 struct gl_texture_object
*t
);
529 * Called by glPrioritizeTextures().
531 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
535 * Called by glActiveTextureARB() to set current texture unit.
537 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
540 * Called when the texture's color lookup table is changed.
542 * If \p tObj is NULL then the shared texture palette
543 * gl_texture_object::Palette is to be updated.
545 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
546 struct gl_texture_object
*tObj
);
551 * \name Imaging functionality
554 void (*CopyColorTable
)( GLcontext
*ctx
,
555 GLenum target
, GLenum internalformat
,
556 GLint x
, GLint y
, GLsizei width
);
558 void (*CopyColorSubTable
)( GLcontext
*ctx
,
559 GLenum target
, GLsizei start
,
560 GLint x
, GLint y
, GLsizei width
);
562 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
563 GLenum internalFormat
,
564 GLint x
, GLint y
, GLsizei width
);
566 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
567 GLenum internalFormat
,
569 GLsizei width
, GLsizei height
);
574 * \name State-changing functions.
576 * \note drawing functions are above.
578 * These functions are called by their corresponding OpenGL API functions.
579 * They are \e also called by the gl_PopAttrib() function!!!
580 * May add more functions like these to the device driver in the future.
583 /** Specify the alpha test function */
584 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
585 /** Set the blend color */
586 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
587 /** Set the blend equation */
588 void (*BlendEquation
)(GLcontext
*ctx
, GLenum mode
);
589 /** Specify pixel arithmetic */
590 void (*BlendFunc
)(GLcontext
*ctx
, GLenum sfactor
, GLenum dfactor
);
591 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
592 GLenum sfactorRGB
, GLenum dfactorRGB
,
593 GLenum sfactorA
, GLenum dfactorA
);
594 /** Specify clear values for the color buffers */
595 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
596 /** Specify the clear value for the depth buffer */
597 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
598 /** Specify the clear value for the color index buffers */
599 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
600 /** Specify the clear value for the stencil buffer */
601 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
602 /** Specify a plane against which all geometry is clipped */
603 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
604 /** Enable and disable writing of frame buffer color components */
605 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
606 GLboolean bmask
, GLboolean amask
);
607 /** Cause a material color to track the current color */
608 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
609 /** Specify whether front- or back-facing facets can be culled */
610 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
611 /** Define front- and back-facing polygons */
612 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
613 /** Specify the value used for depth buffer comparisons */
614 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
615 /** Enable or disable writing into the depth buffer */
616 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
617 /** Specify mapping of depth values from normalized device coordinates to window coordinates */
618 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
619 /** Enable or disable server-side gl capabilities */
620 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
621 /** Specify fog parameters */
622 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
623 /** Specify implementation-specific hints */
624 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
625 /** Control the writing of individual bits in the color index buffers */
626 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
627 /** Set light source parameters */
628 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
629 GLenum pname
, const GLfloat
*params
);
630 /** Set the lighting model parameters */
631 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
632 /** Specify the line stipple pattern */
633 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
634 /** Specify the width of rasterized lines */
635 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
636 /** Specify a logical pixel operation for color index rendering */
637 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
638 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
639 const GLfloat
*params
);
640 /** Specify the diameter of rasterized points */
641 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
642 /** Select a polygon rasterization mode */
643 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
644 /** Set the scale and units used to calculate depth values */
645 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
646 /** Set the polygon stippling pattern */
647 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
648 /** Set rasterization mode */
649 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
650 /** Define the scissor box */
651 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
652 /** Select flat or smooth shading */
653 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
654 /** Set function and reference value for stencil testing */
655 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
656 /** Control the writing of individual bits in the stencil planes */
657 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
658 /** Set stencil test actions */
659 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
660 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
661 /** Control the generation of texture coordinates */
662 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
663 const GLfloat
*params
);
664 /** Set texture environment parameters */
665 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
666 const GLfloat
*param
);
667 /** Set texture parameters */
668 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
669 struct gl_texture_object
*texObj
,
670 GLenum pname
, const GLfloat
*params
);
671 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
672 /** Set the viewport */
673 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
678 * \name Vertex array functions
680 * Called by the corresponding OpenGL functions.
683 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
684 GLsizei stride
, const GLvoid
*ptr
);
685 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
686 GLsizei stride
, const GLvoid
*ptr
);
687 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
688 GLsizei stride
, const GLvoid
*ptr
);
689 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
690 GLsizei stride
, const GLvoid
*ptr
);
691 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
692 GLsizei stride
, const GLvoid
*ptr
);
693 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
694 GLsizei stride
, const GLvoid
*ptr
);
695 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
696 GLsizei stride
, const GLvoid
*ptr
);
697 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
698 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
699 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
704 * \name State-query functions
706 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
709 /** Return the value or values of a selected parameter */
710 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
711 /** Return the value or values of a selected parameter */
712 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
713 /** Return the value or values of a selected parameter */
714 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
715 /** Return the value or values of a selected parameter */
716 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
717 /** Return the value or values of a selected parameter */
718 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
723 * \name Vertex buffer object functions
725 #if FEATURE_ARB_vertex_buffer_object
727 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
728 struct gl_buffer_object
*obj
);
730 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
733 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
735 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
736 const GLvoid
*data
, GLenum usage
,
737 struct gl_buffer_object
*obj
);
739 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
740 GLsizeiptrARB size
, const GLvoid
*data
,
741 struct gl_buffer_object
*obj
);
743 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
744 GLintptrARB offset
, GLsizeiptrARB size
,
745 GLvoid
*data
, struct gl_buffer_object
*obj
);
747 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
748 struct gl_buffer_object
*obj
);
750 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
751 struct gl_buffer_object
*obj
);
756 * \name Support for multiple T&L engines
761 * Bitmask of state changes that require the current T&L module to be
762 * validated, using ValidateTnlModule() below.
767 * Validate the current T&L module.
769 * This is called directly after UpdateState() when a state change that has
770 * occurred matches the dd_function_table::NeedValidate bitmask above. This
771 * ensures all computed values are up to date, thus allowing the driver to
772 * decide if the current T&L module needs to be swapped out.
774 * This must be non-NULL if a driver installs a custom T&L module and sets
775 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
777 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
780 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
781 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
782 #define PRIM_UNKNOWN GL_POLYGON+3
785 * Set by the driver-supplied T&L engine.
787 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
789 GLuint CurrentExecPrimitive
;
792 * Current state of an in-progress compilation.
794 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
795 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
797 GLuint CurrentSavePrimitive
;
800 #define FLUSH_STORED_VERTICES 0x1
801 #define FLUSH_UPDATE_CURRENT 0x2
803 * Set by the driver-supplied T&L engine whenever vertices are buffered
804 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
807 * The dd_function_table::FlushVertices call below may be used to resolve
813 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
814 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
815 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
816 * __GLcontextRec::Current and gl_light_attrib::Material
818 * Note that the default T&L engine never clears the
819 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
821 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
824 * Notify driver that the special derived value _NeedEyeCoords has
827 void (*LightingSpaceChange
)( GLcontext
*ctx
);
830 * Called by glNewList().
832 * Let the T&L component know what is going on with display lists
833 * in time to make changes to dispatch tables, etc.
835 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
837 * Called by glEndList().
839 * \sa dd_function_table::NewList.
841 void (*EndList
)( GLcontext
*ctx
);
844 * Called by glCallList(s), but not recursively.
846 * Notify the T&L component before and after calling a display list.
847 * Called by glCallList(s), but not recursively.
849 void (*BeginCallList
)( GLcontext
*ctx
, GLuint list
);
851 * Called by glEndCallList().
853 * \sa dd_function_table::BeginCallList.
855 void (*EndCallList
)( GLcontext
*ctx
);
858 * Let the T&L component know when the context becomes current.
860 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
861 GLframebuffer
*readBuffer
);
864 * Called by glLockArraysEXT().
866 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
868 * Called by UnlockArraysEXT().
870 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
877 * Transform/Clip/Lighting interface
879 * Drivers present a reduced set of the functions possible in
880 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
881 * remaining functions to map down to these entry points.
883 * These are the initial values to be installed into dispatch by
884 * mesa. If the T&L driver wants to modify the dispatch table
885 * while installed, it must do so itself. It would be possible for
886 * the vertexformat to install it's own initial values for these
887 * functions, but this way there is an obvious list of what is
888 * expected of the driver.
890 * If the driver wants to hook in entry points other than those
891 * listed, it must restore them to their original values in
892 * the disable() callback, below.
899 void (*ArrayElement
)( GLint
); /* NOTE */
900 void (*Color3f
)( GLfloat
, GLfloat
, GLfloat
);
901 void (*Color3fv
)( const GLfloat
* );
902 void (*Color3ub
)( GLubyte
, GLubyte
, GLubyte
);
903 void (*Color3ubv
)( const GLubyte
* );
904 void (*Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
905 void (*Color4fv
)( const GLfloat
* );
906 void (*Color4ub
)( GLubyte
, GLubyte
, GLubyte
, GLubyte
);
907 void (*Color4ubv
)( const GLubyte
* );
908 void (*EdgeFlag
)( GLboolean
);
909 void (*EdgeFlagv
)( const GLboolean
* );
910 void (*EvalCoord1f
)( GLfloat
); /* NOTE */
911 void (*EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
912 void (*EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
913 void (*EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
914 void (*EvalPoint1
)( GLint
); /* NOTE */
915 void (*EvalPoint2
)( GLint
, GLint
); /* NOTE */
916 void (*FogCoordfEXT
)( GLfloat
);
917 void (*FogCoordfvEXT
)( const GLfloat
* );
918 void (*Indexi
)( GLint
);
919 void (*Indexiv
)( const GLint
* );
920 void (*Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
921 void (*MultiTexCoord1fARB
)( GLenum
, GLfloat
);
922 void (*MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
923 void (*MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
924 void (*MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
925 void (*MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
926 void (*MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
927 void (*MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
928 void (*MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
929 void (*Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
930 void (*Normal3fv
)( const GLfloat
* );
931 void (*SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
932 void (*SecondaryColor3fvEXT
)( const GLfloat
* );
933 void (*SecondaryColor3ubEXT
)( GLubyte
, GLubyte
, GLubyte
);
934 void (*SecondaryColor3ubvEXT
)( const GLubyte
* );
935 void (*TexCoord1f
)( GLfloat
);
936 void (*TexCoord1fv
)( const GLfloat
* );
937 void (*TexCoord2f
)( GLfloat
, GLfloat
);
938 void (*TexCoord2fv
)( const GLfloat
* );
939 void (*TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
940 void (*TexCoord3fv
)( const GLfloat
* );
941 void (*TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
942 void (*TexCoord4fv
)( const GLfloat
* );
943 void (*Vertex2f
)( GLfloat
, GLfloat
);
944 void (*Vertex2fv
)( const GLfloat
* );
945 void (*Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
946 void (*Vertex3fv
)( const GLfloat
* );
947 void (*Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
948 void (*Vertex4fv
)( const GLfloat
* );
949 void (*CallList
)( GLuint
); /* NOTE */
950 void (*Begin
)( GLenum
);
952 void (*VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
953 void (*VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
958 void (*Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
963 * These may or may not belong here. Heuristic: if an array is
964 * enabled, the installed vertex format should support that array and
965 * its current size natively.
968 void (*DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
969 void (*DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
970 const GLvoid
*indices
);
971 void (*DrawRangeElements
)( GLenum mode
, GLuint start
,
972 GLuint end
, GLsizei count
,
973 GLenum type
, const GLvoid
*indices
);
979 * If you don't support eval, fallback to the default vertex format
980 * on receiving an eval call and use the pipeline mechanism to
981 * provide partial T&L acceleration.
983 * Mesa will provide a set of helper functions to do eval within
984 * accelerated vertex formats, eventually...
987 void (*EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
988 void (*EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
992 * Should core try to send colors to glColor4f or glColor4chan,
993 * where it has a choice?
995 GLboolean prefer_float_colors
;
999 #endif /* DD_INCLUDED */