3 * Device driver interfaces.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2005 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
;
37 struct mesa_display_list
;
40 * Device driver function table.
41 * Core Mesa uses these function pointers to call into device drivers.
42 * Most of these functions directly correspond to OpenGL state commands.
43 * Core Mesa will call these functions after error checking has been done
44 * so that the drivers don't have to worry about error testing.
46 * Vertex transformation/clipping/lighting is patched into the T&L module.
47 * Rasterization functions are patched into the swrast module.
49 * Note: when new functions are added here, the drivers/common/driverfuncs.c
50 * file should be updated too!!!
52 struct dd_function_table
{
54 * Return a string as needed by glGetString().
56 * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
59 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
62 * Notify the driver after Mesa has made some internal state changes.
64 * This is in addition to any state change callbacks Mesa may already have
67 void (*UpdateState
)( GLcontext
*ctx
, GLuint new_state
);
70 * Get the width and height of the named buffer/window.
72 * Mesa uses this to determine when the driver's window size has changed.
74 void (*GetBufferSize
)( GLframebuffer
*buffer
,
75 GLuint
*width
, GLuint
*height
);
78 * Resize the driver's depth/stencil/accum/back buffers to match the
79 * size given in the GLframebuffer struct.
81 * This is typically called when Mesa detects that a window size has changed.
83 void (*ResizeBuffers
)( GLframebuffer
*buffer
);
86 * Called whenever an error is generated.
88 * __GLcontextRec::ErrorValue contains the error value.
90 void (*Error
)( GLcontext
*ctx
);
93 * This is called whenever glFinish() is called.
95 void (*Finish
)( GLcontext
*ctx
);
98 * This is called whenever glFlush() is called.
100 void (*Flush
)( GLcontext
*ctx
);
103 * Clear the color/depth/stencil/accum buffer(s).
105 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
106 * which buffers need to be cleared.
107 * \param all if true then clear the whole buffer, else clear only the
108 * region defined by <tt>(x, y, width, height)</tt>.
110 * This function must obey the glColorMask(), glIndexMask() and
111 * glStencilMask() settings!
112 * Software Mesa can do masked clears if the device driver can't.
114 void (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
115 GLint x
, GLint y
, GLint width
, GLint height
);
119 * \name For hardware accumulation buffer
123 * Execute glAccum command within the given scissor region.
125 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
,
126 GLint xpos
, GLint ypos
, GLint width
, GLint height
);
131 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
136 * This is called by glDrawPixels().
138 * \p unpack describes how to unpack the source image data.
140 void (*DrawPixels
)( GLcontext
*ctx
,
141 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
142 GLenum format
, GLenum type
,
143 const struct gl_pixelstore_attrib
*unpack
,
144 const GLvoid
*pixels
);
147 * Called by glReadPixels().
149 void (*ReadPixels
)( GLcontext
*ctx
,
150 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
151 GLenum format
, GLenum type
,
152 const struct gl_pixelstore_attrib
*unpack
,
156 * Do a glCopyPixels().
158 * This function must respect all rasterization state, glPixelTransfer(),
159 * glPixelZoom(), etc.
161 void (*CopyPixels
)( GLcontext
*ctx
, 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 glGetTexImage().
303 void (*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
304 GLenum format
, GLenum type
, GLvoid
*pixels
,
305 const struct gl_texture_object
*texObj
,
306 const struct gl_texture_image
*texImage
);
309 * Called by glCopyTexImage1D().
311 * Drivers should use a fallback routine from texstore.c if needed.
313 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
314 GLenum internalFormat
, GLint x
, GLint y
,
315 GLsizei width
, GLint border
);
318 * Called by glCopyTexImage2D().
320 * Drivers should use a fallback routine from texstore.c if needed.
322 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
323 GLenum internalFormat
, GLint x
, GLint y
,
324 GLsizei width
, GLsizei height
, GLint border
);
327 * Called by glCopyTexSubImage1D().
329 * Drivers should use a fallback routine from texstore.c if needed.
331 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
333 GLint x
, GLint y
, GLsizei width
);
335 * Called by glCopyTexSubImage2D().
337 * Drivers should use a fallback routine from texstore.c if needed.
339 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
340 GLint xoffset
, GLint yoffset
,
342 GLsizei width
, GLsizei height
);
344 * Called by glCopyTexSubImage3D().
346 * Drivers should use a fallback routine from texstore.c if needed.
348 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
349 GLint xoffset
, GLint yoffset
, GLint zoffset
,
351 GLsizei width
, GLsizei height
);
354 * Called by glTexImage[123]D when user specifies a proxy texture
357 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
359 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
360 GLint level
, GLint internalFormat
,
361 GLenum format
, GLenum type
,
362 GLint width
, GLint height
,
363 GLint depth
, GLint border
);
368 * \name Compressed texture functions
373 * Called by glCompressedTexImage1D().
375 * \param target user specified.
376 * \param format user specified.
377 * \param type user specified.
378 * \param pixels user specified.
379 * \param packing indicates the image packing of pixels.
380 * \param texObj is the target texture object.
381 * \param texImage is the target texture image. It will have the texture \p
382 * width, \p height, \p depth, \p border and \p internalFormat information.
384 * \a retainInternalCopy is returned by this function and indicates whether
385 * core Mesa should keep an internal copy of the texture image.
387 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
388 GLint level
, GLint internalFormat
,
389 GLsizei width
, GLint border
,
390 GLsizei imageSize
, const GLvoid
*data
,
391 struct gl_texture_object
*texObj
,
392 struct gl_texture_image
*texImage
);
394 * Called by glCompressedTexImage2D().
396 * \sa dd_function_table::CompressedTexImage1D.
398 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
399 GLint level
, GLint internalFormat
,
400 GLsizei width
, GLsizei height
, GLint border
,
401 GLsizei imageSize
, const GLvoid
*data
,
402 struct gl_texture_object
*texObj
,
403 struct gl_texture_image
*texImage
);
405 * Called by glCompressedTexImage3D().
407 * \sa dd_function_table::CompressedTexImage3D.
409 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
410 GLint level
, GLint internalFormat
,
411 GLsizei width
, GLsizei height
, GLsizei depth
,
413 GLsizei imageSize
, const GLvoid
*data
,
414 struct gl_texture_object
*texObj
,
415 struct gl_texture_image
*texImage
);
418 * Called by glCompressedTexSubImage1D().
420 * \param target user specified.
421 * \param level user specified.
422 * \param xoffset user specified.
423 * \param yoffset user specified.
424 * \param zoffset user specified.
425 * \param width user specified.
426 * \param height user specified.
427 * \param depth user specified.
428 * \param imageSize user specified.
429 * \param data user specified.
430 * \param texObj is the target texture object.
431 * \param texImage is the target texture image. It will have the texture \p
432 * width, \p height, \p depth, \p border and \p internalFormat information.
434 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
435 GLint xoffset
, GLsizei width
,
437 GLsizei imageSize
, const GLvoid
*data
,
438 struct gl_texture_object
*texObj
,
439 struct gl_texture_image
*texImage
);
441 * Called by glCompressedTexSubImage2D().
443 * \sa dd_function_table::CompressedTexImage3D.
445 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
446 GLint xoffset
, GLint yoffset
,
447 GLsizei width
, GLint height
,
449 GLsizei imageSize
, const GLvoid
*data
,
450 struct gl_texture_object
*texObj
,
451 struct gl_texture_image
*texImage
);
453 * Called by glCompressedTexSubImage3D().
455 * \sa dd_function_table::CompressedTexImage3D.
457 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
458 GLint xoffset
, GLint yoffset
, GLint zoffset
,
459 GLsizei width
, GLint height
, GLint depth
,
461 GLsizei imageSize
, const GLvoid
*data
,
462 struct gl_texture_object
*texObj
,
463 struct gl_texture_image
*texImage
);
467 * Called by glGetCompressedTexImage.
469 void (*GetCompressedTexImage
)(GLcontext
*ctx
, GLenum target
, GLint level
,
471 const struct gl_texture_object
*texObj
,
472 const struct gl_texture_image
*texImage
);
475 * Called to query number of bytes of storage needed to store the
476 * specified compressed texture.
478 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
, GLsizei width
,
479 GLsizei height
, GLsizei depth
,
484 * \name Texture object functions
489 * Called by glBindTexture().
491 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
492 struct gl_texture_object
*tObj
);
495 * Called to allocate a new texture object.
496 * A new gl_texture_object should be returned. The driver should
497 * attach to it any device-specific info it needs.
499 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
502 * Called when a texture object is about to be deallocated.
504 * Driver should delete the gl_texture_object object and anything
507 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
510 * Called to allocate a new texture image object.
512 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
515 * Called by glAreTextureResident().
517 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
518 struct gl_texture_object
*t
);
521 * Called by glPrioritizeTextures().
523 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
527 * Called by glActiveTextureARB() to set current texture unit.
529 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
532 * Called when the texture's color lookup table is changed.
534 * If \p tObj is NULL then the shared texture palette
535 * gl_texture_object::Palette is to be updated.
537 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
538 struct gl_texture_object
*tObj
);
543 * \name Imaging functionality
546 void (*CopyColorTable
)( GLcontext
*ctx
,
547 GLenum target
, GLenum internalformat
,
548 GLint x
, GLint y
, GLsizei width
);
550 void (*CopyColorSubTable
)( GLcontext
*ctx
,
551 GLenum target
, GLsizei start
,
552 GLint x
, GLint y
, GLsizei width
);
554 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
555 GLenum internalFormat
,
556 GLint x
, GLint y
, GLsizei width
);
558 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
559 GLenum internalFormat
,
561 GLsizei width
, GLsizei height
);
566 * \name Vertex/fragment program functions
569 /** Bind a vertex/fragment program */
570 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct program
*prog
);
571 /** Allocate a new program */
572 struct program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
573 /** Delete a program */
574 void (*DeleteProgram
)(GLcontext
*ctx
, struct program
*prog
);
575 /** Notify driver that a program string has been specified. */
576 void (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
577 struct program
*prog
);
581 /** Query if program can be loaded onto hardware */
582 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
583 struct program
*prog
);
589 * \name State-changing functions.
591 * \note drawing functions are above.
593 * These functions are called by their corresponding OpenGL API functions.
594 * They are \e also called by the gl_PopAttrib() function!!!
595 * May add more functions like these to the device driver in the future.
598 /** Specify the alpha test function */
599 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
600 /** Set the blend color */
601 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
602 /** Set the blend equation */
603 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
604 /** Specify pixel arithmetic */
605 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
606 GLenum sfactorRGB
, GLenum dfactorRGB
,
607 GLenum sfactorA
, GLenum dfactorA
);
608 /** Specify clear values for the color buffers */
609 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
610 /** Specify the clear value for the depth buffer */
611 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
612 /** Specify the clear value for the color index buffers */
613 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
614 /** Specify the clear value for the stencil buffer */
615 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
616 /** Specify a plane against which all geometry is clipped */
617 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
618 /** Enable and disable writing of frame buffer color components */
619 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
620 GLboolean bmask
, GLboolean amask
);
621 /** Cause a material color to track the current color */
622 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
623 /** Specify whether front- or back-facing facets can be culled */
624 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
625 /** Define front- and back-facing polygons */
626 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
627 /** Specify the value used for depth buffer comparisons */
628 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
629 /** Enable or disable writing into the depth buffer */
630 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
631 /** Specify mapping of depth values from NDC to window coordinates */
632 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
633 /** Specify the current buffer for writing */
634 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
635 /** Specify the buffers for writing for fragment programs*/
636 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
637 /** Enable or disable server-side gl capabilities */
638 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
639 /** Specify fog parameters */
640 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
641 /** Specify implementation-specific hints */
642 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
643 /** Control the writing of individual bits in the color index buffers */
644 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
645 /** Set light source parameters */
646 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
647 GLenum pname
, const GLfloat
*params
);
648 /** Set the lighting model parameters */
649 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
650 /** Specify the line stipple pattern */
651 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
652 /** Specify the width of rasterized lines */
653 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
654 /** Specify a logical pixel operation for color index rendering */
655 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
656 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
657 const GLfloat
*params
);
658 /** Specify the diameter of rasterized points */
659 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
660 /** Select a polygon rasterization mode */
661 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
662 /** Set the scale and units used to calculate depth values */
663 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
664 /** Set the polygon stippling pattern */
665 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
666 /* Specifies the current buffer for reading */
667 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
668 /** Set rasterization mode */
669 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
670 /** Define the scissor box */
671 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
672 /** Select flat or smooth shading */
673 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
674 /** Set function and reference value for stencil testing */
675 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
676 /** Control the writing of individual bits in the stencil planes */
677 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
678 /** Set stencil test actions */
679 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
680 /** Set active stencil face (GL_EXT_stencil_two_side) */
681 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
682 /** OpenGL 2.0 two-sided StencilFunc */
683 void (*StencilFuncSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum func
,
684 GLint ref
, GLuint mask
);
685 /** OpenGL 2.0 two-sided StencilMask */
686 void (*StencilMaskSeparate
)(GLcontext
*ctx
, GLenum face
, GLuint mask
);
687 /** OpenGL 2.0 two-sided StencilOp */
688 void (*StencilOpSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum fail
,
689 GLenum zfail
, GLenum zpass
);
690 /** Control the generation of texture coordinates */
691 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
692 const GLfloat
*params
);
693 /** Set texture environment parameters */
694 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
695 const GLfloat
*param
);
696 /** Set texture parameters */
697 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
698 struct gl_texture_object
*texObj
,
699 GLenum pname
, const GLfloat
*params
);
700 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
701 /** Set the viewport */
702 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
707 * \name Vertex array functions
709 * Called by the corresponding OpenGL functions.
712 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
713 GLsizei stride
, const GLvoid
*ptr
);
714 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
715 GLsizei stride
, const GLvoid
*ptr
);
716 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
717 GLsizei stride
, const GLvoid
*ptr
);
718 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
719 GLsizei stride
, const GLvoid
*ptr
);
720 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
721 GLsizei stride
, const GLvoid
*ptr
);
722 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
723 GLsizei stride
, const GLvoid
*ptr
);
724 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
725 GLsizei stride
, const GLvoid
*ptr
);
726 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
727 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
728 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
729 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
730 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
735 * \name State-query functions
737 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
740 /** Return the value or values of a selected parameter */
741 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
742 /** Return the value or values of a selected parameter */
743 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
744 /** Return the value or values of a selected parameter */
745 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
746 /** Return the value or values of a selected parameter */
747 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
748 /** Return the value or values of a selected parameter */
749 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
754 * \name Vertex buffer object functions
756 #if FEATURE_ARB_vertex_buffer_object
758 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
759 struct gl_buffer_object
*obj
);
761 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
764 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
766 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
767 const GLvoid
*data
, GLenum usage
,
768 struct gl_buffer_object
*obj
);
770 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
771 GLsizeiptrARB size
, const GLvoid
*data
,
772 struct gl_buffer_object
*obj
);
774 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
775 GLintptrARB offset
, GLsizeiptrARB size
,
776 GLvoid
*data
, struct gl_buffer_object
*obj
);
778 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
779 struct gl_buffer_object
*obj
);
781 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
782 struct gl_buffer_object
*obj
);
787 * \name Support for multiple T&L engines
792 * Bitmask of state changes that require the current T&L module to be
793 * validated, using ValidateTnlModule() below.
798 * Validate the current T&L module.
800 * This is called directly after UpdateState() when a state change that has
801 * occurred matches the dd_function_table::NeedValidate bitmask above. This
802 * ensures all computed values are up to date, thus allowing the driver to
803 * decide if the current T&L module needs to be swapped out.
805 * This must be non-NULL if a driver installs a custom T&L module and sets
806 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
808 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
811 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
812 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
813 #define PRIM_UNKNOWN GL_POLYGON+3
816 * Set by the driver-supplied T&L engine.
818 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
820 GLuint CurrentExecPrimitive
;
823 * Current state of an in-progress compilation.
825 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
826 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
828 GLuint CurrentSavePrimitive
;
831 #define FLUSH_STORED_VERTICES 0x1
832 #define FLUSH_UPDATE_CURRENT 0x2
834 * Set by the driver-supplied T&L engine whenever vertices are buffered
835 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
838 * The dd_function_table::FlushVertices call below may be used to resolve
842 GLuint SaveNeedFlush
;
845 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
846 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
847 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
848 * __GLcontextRec::Current and gl_light_attrib::Material
850 * Note that the default T&L engine never clears the
851 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
853 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
854 void (*SaveFlushVertices
)( GLcontext
*ctx
);
857 * Give the driver the opportunity to hook in its own vtxfmt for
858 * compiling optimized display lists. This is called on each valid
859 * glBegin() during list compilation.
861 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
864 * Notify driver that the special derived value _NeedEyeCoords has
867 void (*LightingSpaceChange
)( GLcontext
*ctx
);
870 * Let the T&L component know when the context becomes current.
872 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
873 GLframebuffer
*readBuffer
);
876 * Called by glNewList().
878 * Let the T&L component know what is going on with display lists
879 * in time to make changes to dispatch tables, etc.
881 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
883 * Called by glEndList().
885 * \sa dd_function_table::NewList.
887 void (*EndList
)( GLcontext
*ctx
);
890 * Called by glCallList(s).
892 * Notify the T&L component before and after calling a display list.
894 void (*BeginCallList
)( GLcontext
*ctx
,
895 struct mesa_display_list
*dlist
);
897 * Called by glEndCallList().
899 * \sa dd_function_table::BeginCallList.
901 void (*EndCallList
)( GLcontext
*ctx
);
907 * Transform/Clip/Lighting interface
909 * Drivers present a reduced set of the functions possible in
910 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
911 * remaining functions to map down to these entry points.
913 * These are the initial values to be installed into dispatch by
914 * mesa. If the T&L driver wants to modify the dispatch table
915 * while installed, it must do so itself. It would be possible for
916 * the vertexformat to install it's own initial values for these
917 * functions, but this way there is an obvious list of what is
918 * expected of the driver.
920 * If the driver wants to hook in entry points other than those
921 * listed, it must restore them to their original values in
922 * the disable() callback, below.
929 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
930 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
931 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
932 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
933 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
934 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
935 void (GLAPIENTRYP EdgeFlagv
)( const GLboolean
* );
936 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
937 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
938 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
939 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
940 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
941 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
942 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
943 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
944 void (GLAPIENTRYP Indexf
)( GLfloat
);
945 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
946 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
947 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
948 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
949 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
950 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
951 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
952 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
953 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
954 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
955 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
956 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
957 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
958 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
959 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
960 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
961 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
962 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
963 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
964 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
965 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
966 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
967 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
968 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
969 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
970 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
971 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
972 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
973 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
974 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
975 void (GLAPIENTRYP Begin
)( GLenum
);
976 void (GLAPIENTRYP End
)( void );
977 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
978 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
979 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
980 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
981 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
982 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
983 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
984 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
985 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
986 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
987 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
988 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
989 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
990 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
991 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
992 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
997 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1003 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
1004 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
1005 const GLvoid
*indices
);
1006 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
1007 GLuint end
, GLsizei count
,
1008 GLenum type
, const GLvoid
*indices
);
1014 * If you don't support eval, fallback to the default vertex format
1015 * on receiving an eval call and use the pipeline mechanism to
1016 * provide partial T&L acceleration.
1018 * Mesa will provide a set of helper functions to do eval within
1019 * accelerated vertex formats, eventually...
1022 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1023 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1029 #endif /* DD_INCLUDED */