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
,
161 GLint srcx
, GLint srcy
,
162 GLsizei width
, GLsizei height
,
163 GLint dstx
, GLint dsty
, GLenum type
);
166 * This is called by glBitmap().
168 * Works the same as dd_function_table::DrawPixels, above.
170 void (*Bitmap
)( GLcontext
*ctx
,
171 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
172 const struct gl_pixelstore_attrib
*unpack
,
173 const GLubyte
*bitmap
);
178 * \name Texture image functions
183 * Choose texture format.
185 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
186 * functions. The driver should examine \p internalFormat and return a
187 * pointer to an appropriate gl_texture_format.
189 const struct gl_texture_format
*(*ChooseTextureFormat
)( GLcontext
*ctx
,
190 GLint internalFormat
, GLenum srcFormat
, GLenum srcType
);
193 * Called by glTexImage1D().
195 * \param target user specified.
196 * \param format user specified.
197 * \param type user specified.
198 * \param pixels user specified.
199 * \param packing indicates the image packing of pixels.
200 * \param texObj is the target texture object.
201 * \param texImage is the target texture image. It will have the texture \p
202 * width, \p height, \p depth, \p border and \p internalFormat information.
204 * \p retainInternalCopy is returned by this function and indicates whether
205 * core Mesa should keep an internal copy of the texture image.
207 * Drivers should call a fallback routine from texstore.c if needed.
209 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
210 GLint internalFormat
,
211 GLint width
, GLint border
,
212 GLenum format
, GLenum type
, const GLvoid
*pixels
,
213 const struct gl_pixelstore_attrib
*packing
,
214 struct gl_texture_object
*texObj
,
215 struct gl_texture_image
*texImage
);
218 * Called by glTexImage2D().
220 * \sa dd_function_table::TexImage1D.
222 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
223 GLint internalFormat
,
224 GLint width
, GLint height
, GLint border
,
225 GLenum format
, GLenum type
, const GLvoid
*pixels
,
226 const struct gl_pixelstore_attrib
*packing
,
227 struct gl_texture_object
*texObj
,
228 struct gl_texture_image
*texImage
);
231 * Called by glTexImage3D().
233 * \sa dd_function_table::TexImage1D.
235 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
236 GLint internalFormat
,
237 GLint width
, GLint height
, GLint depth
, GLint border
,
238 GLenum format
, GLenum type
, const GLvoid
*pixels
,
239 const struct gl_pixelstore_attrib
*packing
,
240 struct gl_texture_object
*texObj
,
241 struct gl_texture_image
*texImage
);
244 * Called by glTexSubImage1D().
246 * \param target user specified.
247 * \param level user specified.
248 * \param xoffset user specified.
249 * \param yoffset user specified.
250 * \param zoffset user specified.
251 * \param width user specified.
252 * \param height user specified.
253 * \param depth user specified.
254 * \param format user specified.
255 * \param type user specified.
256 * \param pixels user specified.
257 * \param packing indicates the image packing of pixels.
258 * \param texObj is the target texture object.
259 * \param texImage is the target texture image. It will have the texture \p
260 * width, \p height, \p border and \p internalFormat information.
262 * The driver should use a fallback routine from texstore.c if needed.
264 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
265 GLint xoffset
, GLsizei width
,
266 GLenum format
, GLenum type
,
267 const GLvoid
*pixels
,
268 const struct gl_pixelstore_attrib
*packing
,
269 struct gl_texture_object
*texObj
,
270 struct gl_texture_image
*texImage
);
273 * Called by glTexSubImage2D().
275 * \sa dd_function_table::TexSubImage1D.
277 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
278 GLint xoffset
, GLint yoffset
,
279 GLsizei width
, GLsizei height
,
280 GLenum format
, GLenum type
,
281 const GLvoid
*pixels
,
282 const struct gl_pixelstore_attrib
*packing
,
283 struct gl_texture_object
*texObj
,
284 struct gl_texture_image
*texImage
);
287 * Called by glTexSubImage3D().
289 * \sa dd_function_table::TexSubImage1D.
291 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
292 GLint xoffset
, GLint yoffset
, GLint zoffset
,
293 GLsizei width
, GLsizei height
, GLint depth
,
294 GLenum format
, GLenum type
,
295 const GLvoid
*pixels
,
296 const struct gl_pixelstore_attrib
*packing
,
297 struct gl_texture_object
*texObj
,
298 struct gl_texture_image
*texImage
);
301 * Called by glCopyTexImage1D().
303 * Drivers should use a fallback routine from texstore.c if needed.
305 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
306 GLenum internalFormat
, GLint x
, GLint y
,
307 GLsizei width
, GLint border
);
310 * Called by glCopyTexImage2D().
312 * Drivers should use a fallback routine from texstore.c if needed.
314 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
315 GLenum internalFormat
, GLint x
, GLint y
,
316 GLsizei width
, GLsizei height
, GLint border
);
319 * Called by glCopyTexSubImage1D().
321 * Drivers should use a fallback routine from texstore.c if needed.
323 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
325 GLint x
, GLint y
, GLsizei width
);
327 * Called by glCopyTexSubImage2D().
329 * Drivers should use a fallback routine from texstore.c if needed.
331 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
332 GLint xoffset
, GLint yoffset
,
334 GLsizei width
, GLsizei height
);
336 * Called by glCopyTexSubImage3D().
338 * Drivers should use a fallback routine from texstore.c if needed.
340 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
341 GLint xoffset
, GLint yoffset
, GLint zoffset
,
343 GLsizei width
, GLsizei height
);
346 * Called by glTexImage[123]D when user specifies a proxy texture
349 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
351 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
352 GLint level
, GLint internalFormat
,
353 GLenum format
, GLenum type
,
354 GLint width
, GLint height
,
355 GLint depth
, GLint border
);
360 * \name Compressed texture functions
365 * Called by glCompressedTexImage1D().
367 * \param target user specified.
368 * \param format user specified.
369 * \param type user specified.
370 * \param pixels user specified.
371 * \param packing indicates the image packing of pixels.
372 * \param texObj is the target texture object.
373 * \param texImage is the target texture image. It will have the texture \p
374 * width, \p height, \p depth, \p border and \p internalFormat information.
376 * \a retainInternalCopy is returned by this function and indicates whether
377 * core Mesa should keep an internal copy of the texture image.
379 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
380 GLint level
, GLint internalFormat
,
381 GLsizei width
, GLint border
,
382 GLsizei imageSize
, const GLvoid
*data
,
383 struct gl_texture_object
*texObj
,
384 struct gl_texture_image
*texImage
);
386 * Called by glCompressedTexImage2D().
388 * \sa dd_function_table::CompressedTexImage1D.
390 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
391 GLint level
, GLint internalFormat
,
392 GLsizei width
, GLsizei height
, GLint border
,
393 GLsizei imageSize
, const GLvoid
*data
,
394 struct gl_texture_object
*texObj
,
395 struct gl_texture_image
*texImage
);
397 * Called by glCompressedTexImage3D().
399 * \sa dd_function_table::CompressedTexImage3D.
401 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
402 GLint level
, GLint internalFormat
,
403 GLsizei width
, GLsizei height
, GLsizei depth
,
405 GLsizei imageSize
, const GLvoid
*data
,
406 struct gl_texture_object
*texObj
,
407 struct gl_texture_image
*texImage
);
410 * Called by glCompressedTexSubImage1D().
412 * \param target user specified.
413 * \param level user specified.
414 * \param xoffset user specified.
415 * \param yoffset user specified.
416 * \param zoffset user specified.
417 * \param width user specified.
418 * \param height user specified.
419 * \param depth user specified.
420 * \param imageSize user specified.
421 * \param data user specified.
422 * \param texObj is the target texture object.
423 * \param texImage is the target texture image. It will have the texture \p
424 * width, \p height, \p depth, \p border and \p internalFormat information.
426 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
427 GLint xoffset
, GLsizei width
,
429 GLsizei imageSize
, const GLvoid
*data
,
430 struct gl_texture_object
*texObj
,
431 struct gl_texture_image
*texImage
);
433 * Called by glCompressedTexSubImage2D().
435 * \sa dd_function_table::CompressedTexImage3D.
437 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
438 GLint xoffset
, GLint yoffset
,
439 GLsizei width
, GLint height
,
441 GLsizei imageSize
, const GLvoid
*data
,
442 struct gl_texture_object
*texObj
,
443 struct gl_texture_image
*texImage
);
445 * Called by glCompressedTexSubImage3D().
447 * \sa dd_function_table::CompressedTexImage3D.
449 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
450 GLint xoffset
, GLint yoffset
, GLint zoffset
,
451 GLsizei width
, GLint height
, GLint depth
,
453 GLsizei imageSize
, const GLvoid
*data
,
454 struct gl_texture_object
*texObj
,
455 struct gl_texture_image
*texImage
);
458 * Called to query number of bytes of storage needed to store the
459 * specified compressed texture.
461 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
, GLsizei width
,
462 GLsizei height
, GLsizei depth
,
467 * \name Texture object functions
472 * Called by glBindTexture().
474 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
475 struct gl_texture_object
*tObj
);
478 * Called to allocate a new texture object.
479 * A new gl_texture_object should be returned. The driver should
480 * attach to it any device-specific info it needs.
482 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
485 * Called when a texture object is about to be deallocated.
487 * Driver should delete the gl_texture_object object and anything
490 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
493 * Called to allocate a new texture image object.
495 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
498 * Called by glAreTextureResident().
500 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
501 struct gl_texture_object
*t
);
504 * Called by glPrioritizeTextures().
506 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
510 * Called by glActiveTextureARB() to set current texture unit.
512 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
515 * Called when the texture's color lookup table is changed.
517 * If \p tObj is NULL then the shared texture palette
518 * gl_texture_object::Palette is to be updated.
520 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
521 struct gl_texture_object
*tObj
);
526 * \name Imaging functionality
529 void (*CopyColorTable
)( GLcontext
*ctx
,
530 GLenum target
, GLenum internalformat
,
531 GLint x
, GLint y
, GLsizei width
);
533 void (*CopyColorSubTable
)( GLcontext
*ctx
,
534 GLenum target
, GLsizei start
,
535 GLint x
, GLint y
, GLsizei width
);
537 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
538 GLenum internalFormat
,
539 GLint x
, GLint y
, GLsizei width
);
541 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
542 GLenum internalFormat
,
544 GLsizei width
, GLsizei height
);
549 * \name Vertex/fragment program functions
552 /** Bind a vertex/fragment program */
553 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct program
*prog
);
554 /** Allocate a new program */
555 struct program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
556 /** Delete a program */
557 void (*DeleteProgram
)(GLcontext
*ctx
, struct program
*prog
);
558 /** Notify driver that a program string has been specified. */
559 void (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
560 struct program
*prog
);
564 /** Query if program can be loaded onto hardware */
565 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
566 struct program
*prog
);
572 * \name State-changing functions.
574 * \note drawing functions are above.
576 * These functions are called by their corresponding OpenGL API functions.
577 * They are \e also called by the gl_PopAttrib() function!!!
578 * May add more functions like these to the device driver in the future.
581 /** Specify the alpha test function */
582 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
583 /** Set the blend color */
584 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
585 /** Set the blend equation */
586 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
587 /** Specify pixel arithmetic */
588 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
589 GLenum sfactorRGB
, GLenum dfactorRGB
,
590 GLenum sfactorA
, GLenum dfactorA
);
591 /** Specify clear values for the color buffers */
592 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
593 /** Specify the clear value for the depth buffer */
594 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
595 /** Specify the clear value for the color index buffers */
596 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
597 /** Specify the clear value for the stencil buffer */
598 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
599 /** Specify a plane against which all geometry is clipped */
600 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
601 /** Enable and disable writing of frame buffer color components */
602 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
603 GLboolean bmask
, GLboolean amask
);
604 /** Cause a material color to track the current color */
605 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
606 /** Specify whether front- or back-facing facets can be culled */
607 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
608 /** Define front- and back-facing polygons */
609 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
610 /** Specify the value used for depth buffer comparisons */
611 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
612 /** Enable or disable writing into the depth buffer */
613 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
614 /** Specify mapping of depth values from NDC to window coordinates */
615 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
616 /** Specify the current buffer for writing */
617 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
618 /** Specify the buffers for writing for fragment programs*/
619 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
620 /** Enable or disable server-side gl capabilities */
621 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
622 /** Specify fog parameters */
623 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
624 /** Specify implementation-specific hints */
625 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
626 /** Control the writing of individual bits in the color index buffers */
627 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
628 /** Set light source parameters */
629 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
630 GLenum pname
, const GLfloat
*params
);
631 /** Set the lighting model parameters */
632 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
633 /** Specify the line stipple pattern */
634 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
635 /** Specify the width of rasterized lines */
636 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
637 /** Specify a logical pixel operation for color index rendering */
638 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
639 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
640 const GLfloat
*params
);
641 /** Specify the diameter of rasterized points */
642 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
643 /** Select a polygon rasterization mode */
644 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
645 /** Set the scale and units used to calculate depth values */
646 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
647 /** Set the polygon stippling pattern */
648 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
649 /* Specifies the current buffer for reading */
650 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
651 /** Set rasterization mode */
652 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
653 /** Define the scissor box */
654 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
655 /** Select flat or smooth shading */
656 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
657 /** Set function and reference value for stencil testing */
658 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
659 /** Control the writing of individual bits in the stencil planes */
660 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
661 /** Set stencil test actions */
662 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
663 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
664 /** Control the generation of texture coordinates */
665 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
666 const GLfloat
*params
);
667 /** Set texture environment parameters */
668 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
669 const GLfloat
*param
);
670 /** Set texture parameters */
671 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
672 struct gl_texture_object
*texObj
,
673 GLenum pname
, const GLfloat
*params
);
674 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
675 /** Set the viewport */
676 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
681 * \name Vertex array functions
683 * Called by the corresponding OpenGL functions.
686 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
687 GLsizei stride
, const GLvoid
*ptr
);
688 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
689 GLsizei stride
, const GLvoid
*ptr
);
690 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
691 GLsizei stride
, const GLvoid
*ptr
);
692 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
693 GLsizei stride
, const GLvoid
*ptr
);
694 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
695 GLsizei stride
, const GLvoid
*ptr
);
696 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
697 GLsizei stride
, const GLvoid
*ptr
);
698 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
699 GLsizei stride
, const GLvoid
*ptr
);
700 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
701 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
702 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
703 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
704 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
709 * \name State-query functions
711 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
714 /** Return the value or values of a selected parameter */
715 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
716 /** Return the value or values of a selected parameter */
717 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
718 /** Return the value or values of a selected parameter */
719 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
720 /** Return the value or values of a selected parameter */
721 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
722 /** Return the value or values of a selected parameter */
723 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
728 * \name Vertex buffer object functions
730 #if FEATURE_ARB_vertex_buffer_object
732 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
733 struct gl_buffer_object
*obj
);
735 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
738 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
740 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
741 const GLvoid
*data
, GLenum usage
,
742 struct gl_buffer_object
*obj
);
744 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
745 GLsizeiptrARB size
, const GLvoid
*data
,
746 struct gl_buffer_object
*obj
);
748 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
749 GLintptrARB offset
, GLsizeiptrARB size
,
750 GLvoid
*data
, struct gl_buffer_object
*obj
);
752 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
753 struct gl_buffer_object
*obj
);
755 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
756 struct gl_buffer_object
*obj
);
761 * \name Support for multiple T&L engines
766 * Bitmask of state changes that require the current T&L module to be
767 * validated, using ValidateTnlModule() below.
772 * Validate the current T&L module.
774 * This is called directly after UpdateState() when a state change that has
775 * occurred matches the dd_function_table::NeedValidate bitmask above. This
776 * ensures all computed values are up to date, thus allowing the driver to
777 * decide if the current T&L module needs to be swapped out.
779 * This must be non-NULL if a driver installs a custom T&L module and sets
780 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
782 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
785 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
786 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
787 #define PRIM_UNKNOWN GL_POLYGON+3
790 * Set by the driver-supplied T&L engine.
792 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
794 GLuint CurrentExecPrimitive
;
797 * Current state of an in-progress compilation.
799 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
800 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
802 GLuint CurrentSavePrimitive
;
805 #define FLUSH_STORED_VERTICES 0x1
806 #define FLUSH_UPDATE_CURRENT 0x2
808 * Set by the driver-supplied T&L engine whenever vertices are buffered
809 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
812 * The dd_function_table::FlushVertices call below may be used to resolve
816 GLuint SaveNeedFlush
;
819 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
820 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
821 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
822 * __GLcontextRec::Current and gl_light_attrib::Material
824 * Note that the default T&L engine never clears the
825 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
827 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
828 void (*SaveFlushVertices
)( GLcontext
*ctx
);
831 * Give the driver the opportunity to hook in its own vtxfmt for
832 * compiling optimized display lists. This is called on each valid
833 * glBegin() during list compilation.
835 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
838 * Notify driver that the special derived value _NeedEyeCoords has
841 void (*LightingSpaceChange
)( GLcontext
*ctx
);
844 * Let the T&L component know when the context becomes current.
846 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
847 GLframebuffer
*readBuffer
);
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
);
881 * Transform/Clip/Lighting interface
883 * Drivers present a reduced set of the functions possible in
884 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
885 * remaining functions to map down to these entry points.
887 * These are the initial values to be installed into dispatch by
888 * mesa. If the T&L driver wants to modify the dispatch table
889 * while installed, it must do so itself. It would be possible for
890 * the vertexformat to install it's own initial values for these
891 * functions, but this way there is an obvious list of what is
892 * expected of the driver.
894 * If the driver wants to hook in entry points other than those
895 * listed, it must restore them to their original values in
896 * the disable() callback, below.
903 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
904 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
905 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
906 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
907 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
908 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
909 void (GLAPIENTRYP EdgeFlagv
)( const GLboolean
* );
910 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
911 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
912 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
913 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
914 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
915 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
916 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
917 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
918 void (GLAPIENTRYP Indexf
)( GLfloat
);
919 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
920 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
921 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
922 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
923 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
924 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
925 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
926 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
927 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
928 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
929 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
930 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
931 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
932 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
933 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
934 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
935 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
936 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
937 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
938 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
939 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
940 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
941 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
942 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
943 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
944 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
945 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
946 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
947 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
948 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
949 void (GLAPIENTRYP Begin
)( GLenum
);
950 void (GLAPIENTRYP End
)( void );
951 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
952 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
953 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
954 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
955 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
956 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
957 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
958 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
959 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
960 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
961 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
962 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
963 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
964 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
965 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
966 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
971 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
977 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
978 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
979 const GLvoid
*indices
);
980 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
981 GLuint end
, GLsizei count
,
982 GLenum type
, const GLvoid
*indices
);
988 * If you don't support eval, fallback to the default vertex format
989 * on receiving an eval call and use the pipeline mechanism to
990 * provide partial T&L acceleration.
992 * Mesa will provide a set of helper functions to do eval within
993 * accelerated vertex formats, eventually...
996 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
997 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1003 #endif /* DD_INCLUDED */