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 * Note: when new functions are added here, the drivers/common/driverfuncs.c
63 * file should be updated too!!!
65 struct dd_function_table
{
67 * Return a string as needed by glGetString().
69 * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
72 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
75 * Notify the driver after Mesa has made some internal state changes.
77 * This is in addition to any state change callbacks Mesa may already have
80 void (*UpdateState
)( GLcontext
*ctx
, GLuint new_state
);
83 * Get the width and height of the named buffer/window.
85 * Mesa uses this to determine when the driver's window size has changed.
87 void (*GetBufferSize
)( GLframebuffer
*buffer
,
88 GLuint
*width
, GLuint
*height
);
91 * Resize the driver's depth/stencil/accum/back buffers to match the
92 * size given in the GLframebuffer struct.
94 * This is typically called when Mesa detects that a window size has changed.
96 void (*ResizeBuffers
)( GLframebuffer
*buffer
);
99 * Called whenever an error is generated.
101 * __GLcontextRec::ErrorValue contains the error value.
103 void (*Error
)( GLcontext
*ctx
);
106 * This is called whenever glFinish() is called.
108 void (*Finish
)( GLcontext
*ctx
);
111 * This is called whenever glFlush() is called.
113 void (*Flush
)( GLcontext
*ctx
);
116 * Clear the color/depth/stencil/accum buffer(s).
118 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
119 * which buffers need to be cleared.
120 * \param all if true then clear the whole buffer, else clear only the
121 * region defined by <tt>(x, y, width, height)</tt>.
123 * This function must obey the glColorMask(), glIndexMask() and
124 * glStencilMask() settings!
125 * Software Mesa can do masked clears if the device driver can't.
127 void (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
128 GLint x
, GLint y
, GLint width
, GLint height
);
132 * \name For hardware accumulation buffer
136 * Execute glAccum command within the given scissor region.
138 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
,
139 GLint xpos
, GLint ypos
, GLint width
, GLint height
);
144 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
149 * This is called by glDrawPixels().
151 * \p unpack describes how to unpack the source image data.
153 void (*DrawPixels
)( GLcontext
*ctx
,
154 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
155 GLenum format
, GLenum type
,
156 const struct gl_pixelstore_attrib
*unpack
,
157 const GLvoid
*pixels
);
160 * Called by glReadPixels().
162 void (*ReadPixels
)( GLcontext
*ctx
,
163 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
164 GLenum format
, GLenum type
,
165 const struct gl_pixelstore_attrib
*unpack
,
169 * Do a glCopyPixels().
171 * This function must respect all rasterization state, glPixelTransfer(),
172 * glPixelZoom(), etc.
174 void (*CopyPixels
)( GLcontext
*ctx
,
175 GLint srcx
, GLint srcy
,
176 GLsizei width
, GLsizei height
,
177 GLint dstx
, GLint dsty
, GLenum type
);
180 * This is called by glBitmap().
182 * Works the same as dd_function_table::DrawPixels, above.
184 void (*Bitmap
)( GLcontext
*ctx
,
185 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
186 const struct gl_pixelstore_attrib
*unpack
,
187 const GLubyte
*bitmap
);
192 * \name Texture image functions
197 * Choose texture format.
199 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
200 * functions. The driver should examine \p internalFormat and return a
201 * pointer to an appropriate gl_texture_format.
203 const struct gl_texture_format
*
204 (*ChooseTextureFormat
)( GLcontext
*ctx
, GLint internalFormat
,
205 GLenum srcFormat
, GLenum srcType
);
208 * Called by glTexImage1D().
210 * \param target user specified.
211 * \param format user specified.
212 * \param type user specified.
213 * \param pixels user specified.
214 * \param packing indicates the image packing of pixels.
215 * \param texObj is the target texture object.
216 * \param texImage is the target texture image. It will have the texture \p
217 * width, \p height, \p depth, \p border and \p internalFormat information.
219 * \p retainInternalCopy is returned by this function and indicates whether
220 * core Mesa should keep an internal copy of the texture image.
222 * Drivers should call a fallback routine from texstore.c if needed.
224 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
225 GLint internalFormat
,
226 GLint width
, GLint border
,
227 GLenum format
, GLenum type
, const GLvoid
*pixels
,
228 const struct gl_pixelstore_attrib
*packing
,
229 struct gl_texture_object
*texObj
,
230 struct gl_texture_image
*texImage
);
233 * Called by glTexImage2D().
235 * \sa dd_function_table::TexImage1D.
237 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
238 GLint internalFormat
,
239 GLint width
, GLint height
, GLint border
,
240 GLenum format
, GLenum type
, const GLvoid
*pixels
,
241 const struct gl_pixelstore_attrib
*packing
,
242 struct gl_texture_object
*texObj
,
243 struct gl_texture_image
*texImage
);
246 * Called by glTexImage3D().
248 * \sa dd_function_table::TexImage1D.
250 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
251 GLint internalFormat
,
252 GLint width
, GLint height
, GLint depth
, GLint border
,
253 GLenum format
, GLenum type
, const GLvoid
*pixels
,
254 const struct gl_pixelstore_attrib
*packing
,
255 struct gl_texture_object
*texObj
,
256 struct gl_texture_image
*texImage
);
259 * Called by glTexSubImage1D().
261 * \param target user specified.
262 * \param level user specified.
263 * \param xoffset user specified.
264 * \param yoffset user specified.
265 * \param zoffset user specified.
266 * \param width user specified.
267 * \param height user specified.
268 * \param depth user specified.
269 * \param format user specified.
270 * \param type user specified.
271 * \param pixels user specified.
272 * \param packing indicates the image packing of pixels.
273 * \param texObj is the target texture object.
274 * \param texImage is the target texture image. It will have the texture \p
275 * width, \p height, \p border and \p internalFormat information.
277 * The driver should use a fallback routine from texstore.c if needed.
279 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
280 GLint xoffset
, GLsizei width
,
281 GLenum format
, GLenum type
,
282 const GLvoid
*pixels
,
283 const struct gl_pixelstore_attrib
*packing
,
284 struct gl_texture_object
*texObj
,
285 struct gl_texture_image
*texImage
);
288 * Called by glTexSubImage2D().
290 * \sa dd_function_table::TexSubImage1D.
292 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
293 GLint xoffset
, GLint yoffset
,
294 GLsizei width
, GLsizei height
,
295 GLenum format
, GLenum type
,
296 const GLvoid
*pixels
,
297 const struct gl_pixelstore_attrib
*packing
,
298 struct gl_texture_object
*texObj
,
299 struct gl_texture_image
*texImage
);
302 * Called by glTexSubImage3D().
304 * \sa dd_function_table::TexSubImage1D.
306 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
307 GLint xoffset
, GLint yoffset
, GLint zoffset
,
308 GLsizei width
, GLsizei height
, GLint depth
,
309 GLenum format
, GLenum type
,
310 const GLvoid
*pixels
,
311 const struct gl_pixelstore_attrib
*packing
,
312 struct gl_texture_object
*texObj
,
313 struct gl_texture_image
*texImage
);
316 * Called by glCopyTexImage1D().
318 * Drivers should use a fallback routine from texstore.c if needed.
320 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
321 GLenum internalFormat
, GLint x
, GLint y
,
322 GLsizei width
, GLint border
);
325 * Called by glCopyTexImage2D().
327 * Drivers should use a fallback routine from texstore.c if needed.
329 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
330 GLenum internalFormat
, GLint x
, GLint y
,
331 GLsizei width
, GLsizei height
, GLint border
);
334 * Called by glCopyTexSubImage1D().
336 * Drivers should use a fallback routine from texstore.c if needed.
338 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
340 GLint x
, GLint y
, GLsizei width
);
342 * Called by glCopyTexSubImage2D().
344 * Drivers should use a fallback routine from texstore.c if needed.
346 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
347 GLint xoffset
, GLint yoffset
,
349 GLsizei width
, GLsizei height
);
351 * Called by glCopyTexSubImage3D().
353 * Drivers should use a fallback routine from texstore.c if needed.
355 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
356 GLint xoffset
, GLint yoffset
, GLint zoffset
,
358 GLsizei width
, GLsizei height
);
361 * Called by glTexImage[123]D when user specifies a proxy texture
364 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
366 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
367 GLint level
, GLint internalFormat
,
368 GLenum format
, GLenum type
,
369 GLint width
, GLint height
,
370 GLint depth
, GLint border
);
375 * \name Compressed texture functions
380 * Called by glCompressedTexImage1D().
382 * \param target user specified.
383 * \param format user specified.
384 * \param type user specified.
385 * \param pixels user specified.
386 * \param packing indicates the image packing of pixels.
387 * \param texObj is the target texture object.
388 * \param texImage is the target texture image. It will have the texture \p
389 * width, \p height, \p depth, \p border and \p internalFormat information.
391 * \a retainInternalCopy is returned by this function and indicates whether
392 * core Mesa should keep an internal copy of the texture image.
394 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
395 GLint level
, GLint internalFormat
,
396 GLsizei width
, GLint border
,
397 GLsizei imageSize
, const GLvoid
*data
,
398 struct gl_texture_object
*texObj
,
399 struct gl_texture_image
*texImage
);
401 * Called by glCompressedTexImage2D().
403 * \sa dd_function_table::CompressedTexImage1D.
405 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
406 GLint level
, GLint internalFormat
,
407 GLsizei width
, GLsizei height
, GLint border
,
408 GLsizei imageSize
, const GLvoid
*data
,
409 struct gl_texture_object
*texObj
,
410 struct gl_texture_image
*texImage
);
412 * Called by glCompressedTexImage3D().
414 * \sa dd_function_table::CompressedTexImage3D.
416 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
417 GLint level
, GLint internalFormat
,
418 GLsizei width
, GLsizei height
, GLsizei depth
,
420 GLsizei imageSize
, const GLvoid
*data
,
421 struct gl_texture_object
*texObj
,
422 struct gl_texture_image
*texImage
);
425 * Called by glCompressedTexSubImage1D().
427 * \param target user specified.
428 * \param level user specified.
429 * \param xoffset user specified.
430 * \param yoffset user specified.
431 * \param zoffset user specified.
432 * \param width user specified.
433 * \param height user specified.
434 * \param depth user specified.
435 * \param imageSize user specified.
436 * \param data user specified.
437 * \param texObj is the target texture object.
438 * \param texImage is the target texture image. It will have the texture \p
439 * width, \p height, \p depth, \p border and \p internalFormat information.
441 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
442 GLint xoffset
, GLsizei width
,
444 GLsizei imageSize
, const GLvoid
*data
,
445 struct gl_texture_object
*texObj
,
446 struct gl_texture_image
*texImage
);
448 * Called by glCompressedTexSubImage2D().
450 * \sa dd_function_table::CompressedTexImage3D.
452 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
453 GLint xoffset
, GLint yoffset
,
454 GLsizei width
, GLint height
,
456 GLsizei imageSize
, const GLvoid
*data
,
457 struct gl_texture_object
*texObj
,
458 struct gl_texture_image
*texImage
);
460 * Called by glCompressedTexSubImage3D().
462 * \sa dd_function_table::CompressedTexImage3D.
464 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
465 GLint xoffset
, GLint yoffset
, GLint zoffset
,
466 GLsizei width
, GLint height
, GLint depth
,
468 GLsizei imageSize
, const GLvoid
*data
,
469 struct gl_texture_object
*texObj
,
470 struct gl_texture_image
*texImage
);
472 * Called to validate a certain compressed format.
474 GLboolean (*IsCompressedFormat
)( GLcontext
*ctx
, GLenum internalFormat
);
476 * Called to get bytes of storage needed for the given texture size and
479 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
,
480 GLsizei width
, GLsizei height
, GLsizei depth
,
485 * \name Texture object functions
490 * Called by glBindTexture().
492 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
493 struct gl_texture_object
*tObj
);
496 * Called to allocate a new texture object.
497 * A new gl_texture_object should be returned. The driver should
498 * attach to it any device-specific info it needs.
500 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
503 * Called when a texture object is about to be deallocated.
505 * Driver should delete the gl_texture_object object and anything
508 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
511 * Called to allocate a new texture image object.
513 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
516 * Called by glAreTextureResident().
518 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
519 struct gl_texture_object
*t
);
522 * Called by glPrioritizeTextures().
524 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
528 * Called by glActiveTextureARB() to set current texture unit.
530 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
533 * Called when the texture's color lookup table is changed.
535 * If \p tObj is NULL then the shared texture palette
536 * gl_texture_object::Palette is to be updated.
538 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
539 struct gl_texture_object
*tObj
);
544 * \name Imaging functionality
547 void (*CopyColorTable
)( GLcontext
*ctx
,
548 GLenum target
, GLenum internalformat
,
549 GLint x
, GLint y
, GLsizei width
);
551 void (*CopyColorSubTable
)( GLcontext
*ctx
,
552 GLenum target
, GLsizei start
,
553 GLint x
, GLint y
, GLsizei width
);
555 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
556 GLenum internalFormat
,
557 GLint x
, GLint y
, GLsizei width
);
559 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
560 GLenum internalFormat
,
562 GLsizei width
, GLsizei height
);
567 * \name Vertex/fragment program functions
570 /** Bind a vertex/fragment program */
571 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct program
*prog
);
572 /** Allocate a new program */
573 struct program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
574 /** Delete a program */
575 void (*DeleteProgram
)(GLcontext
*ctx
, struct program
*prog
);
580 * \name State-changing functions.
582 * \note drawing functions are above.
584 * These functions are called by their corresponding OpenGL API functions.
585 * They are \e also called by the gl_PopAttrib() function!!!
586 * May add more functions like these to the device driver in the future.
589 /** Specify the alpha test function */
590 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
591 /** Set the blend color */
592 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
593 /** Set the blend equation */
594 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
595 /** Specify pixel arithmetic */
596 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
597 GLenum sfactorRGB
, GLenum dfactorRGB
,
598 GLenum sfactorA
, GLenum dfactorA
);
599 /** Specify clear values for the color buffers */
600 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
601 /** Specify the clear value for the depth buffer */
602 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
603 /** Specify the clear value for the color index buffers */
604 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
605 /** Specify the clear value for the stencil buffer */
606 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
607 /** Specify a plane against which all geometry is clipped */
608 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
609 /** Enable and disable writing of frame buffer color components */
610 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
611 GLboolean bmask
, GLboolean amask
);
612 /** Cause a material color to track the current color */
613 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
614 /** Specify whether front- or back-facing facets can be culled */
615 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
616 /** Define front- and back-facing polygons */
617 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
618 /** Specify the value used for depth buffer comparisons */
619 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
620 /** Enable or disable writing into the depth buffer */
621 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
622 /** Specify mapping of depth values from normalized device coordinates to window coordinates */
623 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
624 /** Specify the current buffer for writing */
625 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
626 /** Enable or disable server-side gl capabilities */
627 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
628 /** Specify fog parameters */
629 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
630 /** Specify implementation-specific hints */
631 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
632 /** Control the writing of individual bits in the color index buffers */
633 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
634 /** Set light source parameters */
635 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
636 GLenum pname
, const GLfloat
*params
);
637 /** Set the lighting model parameters */
638 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
639 /** Specify the line stipple pattern */
640 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
641 /** Specify the width of rasterized lines */
642 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
643 /** Specify a logical pixel operation for color index rendering */
644 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
645 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
646 const GLfloat
*params
);
647 /** Specify the diameter of rasterized points */
648 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
649 /** Select a polygon rasterization mode */
650 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
651 /** Set the scale and units used to calculate depth values */
652 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
653 /** Set the polygon stippling pattern */
654 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
655 /* Specifies the current buffer for reading */
656 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
657 /** Set rasterization mode */
658 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
659 /** Define the scissor box */
660 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
661 /** Select flat or smooth shading */
662 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
663 /** Set function and reference value for stencil testing */
664 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
665 /** Control the writing of individual bits in the stencil planes */
666 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
667 /** Set stencil test actions */
668 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
669 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
670 /** Control the generation of texture coordinates */
671 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
672 const GLfloat
*params
);
673 /** Set texture environment parameters */
674 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
675 const GLfloat
*param
);
676 /** Set texture parameters */
677 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
678 struct gl_texture_object
*texObj
,
679 GLenum pname
, const GLfloat
*params
);
680 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
681 /** Set the viewport */
682 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
687 * \name Vertex array functions
689 * Called by the corresponding OpenGL functions.
692 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
693 GLsizei stride
, const GLvoid
*ptr
);
694 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
695 GLsizei stride
, const GLvoid
*ptr
);
696 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
697 GLsizei stride
, const GLvoid
*ptr
);
698 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
699 GLsizei stride
, const GLvoid
*ptr
);
700 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
701 GLsizei stride
, const GLvoid
*ptr
);
702 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
703 GLsizei stride
, const GLvoid
*ptr
);
704 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
705 GLsizei stride
, const GLvoid
*ptr
);
706 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
707 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
708 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
709 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
710 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
718 * \name State-query functions
720 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
723 /** Return the value or values of a selected parameter */
724 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
725 /** Return the value or values of a selected parameter */
726 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
727 /** Return the value or values of a selected parameter */
728 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
729 /** Return the value or values of a selected parameter */
730 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
731 /** Return the value or values of a selected parameter */
732 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
737 * \name Vertex buffer object functions
739 #if FEATURE_ARB_vertex_buffer_object
741 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
742 struct gl_buffer_object
*obj
);
744 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
747 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
749 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
750 const GLvoid
*data
, GLenum usage
,
751 struct gl_buffer_object
*obj
);
753 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
754 GLsizeiptrARB size
, const GLvoid
*data
,
755 struct gl_buffer_object
*obj
);
757 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
758 GLintptrARB offset
, GLsizeiptrARB size
,
759 GLvoid
*data
, struct gl_buffer_object
*obj
);
761 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
762 struct gl_buffer_object
*obj
);
764 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
765 struct gl_buffer_object
*obj
);
770 * \name Support for multiple T&L engines
775 * Bitmask of state changes that require the current T&L module to be
776 * validated, using ValidateTnlModule() below.
781 * Validate the current T&L module.
783 * This is called directly after UpdateState() when a state change that has
784 * occurred matches the dd_function_table::NeedValidate bitmask above. This
785 * ensures all computed values are up to date, thus allowing the driver to
786 * decide if the current T&L module needs to be swapped out.
788 * This must be non-NULL if a driver installs a custom T&L module and sets
789 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
791 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
794 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
795 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
796 #define PRIM_UNKNOWN GL_POLYGON+3
799 * Set by the driver-supplied T&L engine.
801 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
803 GLuint CurrentExecPrimitive
;
806 * Current state of an in-progress compilation.
808 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
809 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
811 GLuint CurrentSavePrimitive
;
814 #define FLUSH_STORED_VERTICES 0x1
815 #define FLUSH_UPDATE_CURRENT 0x2
817 * Set by the driver-supplied T&L engine whenever vertices are buffered
818 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
821 * The dd_function_table::FlushVertices call below may be used to resolve
825 GLuint SaveNeedFlush
;
828 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
829 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
830 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
831 * __GLcontextRec::Current and gl_light_attrib::Material
833 * Note that the default T&L engine never clears the
834 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
836 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
837 void (*SaveFlushVertices
)( GLcontext
*ctx
);
840 * Give the driver the opportunity to hook in its own vtxfmt for
841 * compiling optimized display lists. This is called on each valid
842 * glBegin() during list compilation.
844 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
847 * Notify driver that the special derived value _NeedEyeCoords has
850 void (*LightingSpaceChange
)( GLcontext
*ctx
);
853 * Let the T&L component know when the context becomes current.
855 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
856 GLframebuffer
*readBuffer
);
859 * Called by glNewList().
861 * Let the T&L component know what is going on with display lists
862 * in time to make changes to dispatch tables, etc.
864 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
866 * Called by glEndList().
868 * \sa dd_function_table::NewList.
870 void (*EndList
)( GLcontext
*ctx
);
873 * Called by glCallList(s), but not recursively.
875 * Notify the T&L component before and after calling a display list.
876 * Called by glCallList(s), but not recursively.
878 void (*BeginCallList
)( GLcontext
*ctx
, GLuint list
);
880 * Called by glEndCallList().
882 * \sa dd_function_table::BeginCallList.
884 void (*EndCallList
)( GLcontext
*ctx
);
890 * Transform/Clip/Lighting interface
892 * Drivers present a reduced set of the functions possible in
893 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
894 * remaining functions to map down to these entry points.
896 * These are the initial values to be installed into dispatch by
897 * mesa. If the T&L driver wants to modify the dispatch table
898 * while installed, it must do so itself. It would be possible for
899 * the vertexformat to install it's own initial values for these
900 * functions, but this way there is an obvious list of what is
901 * expected of the driver.
903 * If the driver wants to hook in entry points other than those
904 * listed, it must restore them to their original values in
905 * the disable() callback, below.
912 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
913 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
914 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
915 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
916 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
917 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
918 void (GLAPIENTRYP EdgeFlagv
)( const GLboolean
* );
919 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
920 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
921 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
922 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
923 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
924 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
925 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
926 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
927 void (GLAPIENTRYP Indexf
)( GLfloat
);
928 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
929 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
930 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
931 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
932 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
933 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
934 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
935 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
936 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
937 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
938 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
939 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
940 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
941 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
942 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
943 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
944 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
945 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
946 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
947 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
948 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
949 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
950 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
951 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
952 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
953 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
954 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
955 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
956 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
957 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
958 void (GLAPIENTRYP Begin
)( GLenum
);
959 void (GLAPIENTRYP End
)( void );
960 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
961 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
962 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
963 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
964 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
965 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
966 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
967 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
972 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
978 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
979 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
980 const GLvoid
*indices
);
981 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
982 GLuint end
, GLsizei count
,
983 GLenum type
, const GLvoid
*indices
);
989 * If you don't support eval, fallback to the default vertex format
990 * on receiving an eval call and use the pipeline mechanism to
991 * provide partial T&L acceleration.
993 * Mesa will provide a set of helper functions to do eval within
994 * accelerated vertex formats, eventually...
997 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
998 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1004 #endif /* DD_INCLUDED */