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 given framebuffer to the given size.
80 void (*ResizeBuffers
)( GLcontext
*ctx
, GLframebuffer
*fb
,
81 GLuint width
, GLuint height
);
84 * Called whenever an error is generated.
86 * __GLcontextRec::ErrorValue contains the error value.
88 void (*Error
)( GLcontext
*ctx
);
91 * This is called whenever glFinish() is called.
93 void (*Finish
)( GLcontext
*ctx
);
96 * This is called whenever glFlush() is called.
98 void (*Flush
)( GLcontext
*ctx
);
101 * Clear the color/depth/stencil/accum buffer(s).
103 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
104 * which buffers need to be cleared.
105 * \param all if true then clear the whole buffer, else clear only the
106 * region defined by <tt>(x, y, width, height)</tt>.
108 * This function must obey the glColorMask(), glIndexMask() and
109 * glStencilMask() settings!
110 * Software Mesa can do masked clears if the device driver can't.
112 void (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
113 GLint x
, GLint y
, GLint width
, GLint height
);
117 * \name For hardware accumulation buffer
121 * Execute glAccum command within the given scissor region.
123 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
,
124 GLint xpos
, GLint ypos
, GLint width
, GLint height
);
129 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
134 * This is called by glDrawPixels().
136 * \p unpack describes how to unpack the source image data.
138 void (*DrawPixels
)( GLcontext
*ctx
,
139 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
140 GLenum format
, GLenum type
,
141 const struct gl_pixelstore_attrib
*unpack
,
142 const GLvoid
*pixels
);
145 * Called by glReadPixels().
147 void (*ReadPixels
)( GLcontext
*ctx
,
148 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
149 GLenum format
, GLenum type
,
150 const struct gl_pixelstore_attrib
*unpack
,
154 * Do a glCopyPixels().
156 * This function must respect all rasterization state, glPixelTransfer(),
157 * glPixelZoom(), etc.
159 void (*CopyPixels
)( GLcontext
*ctx
, GLint srcx
, GLint srcy
,
160 GLsizei width
, GLsizei height
,
161 GLint dstx
, GLint dsty
, GLenum type
);
164 * This is called by glBitmap().
166 * Works the same as dd_function_table::DrawPixels, above.
168 void (*Bitmap
)( GLcontext
*ctx
,
169 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
170 const struct gl_pixelstore_attrib
*unpack
,
171 const GLubyte
*bitmap
);
176 * \name Texture image functions
181 * Choose texture format.
183 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
184 * functions. The driver should examine \p internalFormat and return a
185 * pointer to an appropriate gl_texture_format.
187 const struct gl_texture_format
*(*ChooseTextureFormat
)( GLcontext
*ctx
,
188 GLint internalFormat
, GLenum srcFormat
, GLenum srcType
);
191 * Called by glTexImage1D().
193 * \param target user specified.
194 * \param format user specified.
195 * \param type user specified.
196 * \param pixels user specified.
197 * \param packing indicates the image packing of pixels.
198 * \param texObj is the target texture object.
199 * \param texImage is the target texture image. It will have the texture \p
200 * width, \p height, \p depth, \p border and \p internalFormat information.
202 * \p retainInternalCopy is returned by this function and indicates whether
203 * core Mesa should keep an internal copy of the texture image.
205 * Drivers should call a fallback routine from texstore.c if needed.
207 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
208 GLint internalFormat
,
209 GLint width
, GLint border
,
210 GLenum format
, GLenum type
, const GLvoid
*pixels
,
211 const struct gl_pixelstore_attrib
*packing
,
212 struct gl_texture_object
*texObj
,
213 struct gl_texture_image
*texImage
);
216 * Called by glTexImage2D().
218 * \sa dd_function_table::TexImage1D.
220 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
221 GLint internalFormat
,
222 GLint width
, GLint height
, GLint border
,
223 GLenum format
, GLenum type
, const GLvoid
*pixels
,
224 const struct gl_pixelstore_attrib
*packing
,
225 struct gl_texture_object
*texObj
,
226 struct gl_texture_image
*texImage
);
229 * Called by glTexImage3D().
231 * \sa dd_function_table::TexImage1D.
233 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
234 GLint internalFormat
,
235 GLint width
, GLint height
, GLint depth
, GLint border
,
236 GLenum format
, GLenum type
, const GLvoid
*pixels
,
237 const struct gl_pixelstore_attrib
*packing
,
238 struct gl_texture_object
*texObj
,
239 struct gl_texture_image
*texImage
);
242 * Called by glTexSubImage1D().
244 * \param target user specified.
245 * \param level user specified.
246 * \param xoffset user specified.
247 * \param yoffset user specified.
248 * \param zoffset user specified.
249 * \param width user specified.
250 * \param height user specified.
251 * \param depth user specified.
252 * \param format user specified.
253 * \param type user specified.
254 * \param pixels user specified.
255 * \param packing indicates the image packing of pixels.
256 * \param texObj is the target texture object.
257 * \param texImage is the target texture image. It will have the texture \p
258 * width, \p height, \p border and \p internalFormat information.
260 * The driver should use a fallback routine from texstore.c if needed.
262 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
263 GLint xoffset
, GLsizei width
,
264 GLenum format
, GLenum type
,
265 const GLvoid
*pixels
,
266 const struct gl_pixelstore_attrib
*packing
,
267 struct gl_texture_object
*texObj
,
268 struct gl_texture_image
*texImage
);
271 * Called by glTexSubImage2D().
273 * \sa dd_function_table::TexSubImage1D.
275 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
276 GLint xoffset
, GLint yoffset
,
277 GLsizei width
, GLsizei height
,
278 GLenum format
, GLenum type
,
279 const GLvoid
*pixels
,
280 const struct gl_pixelstore_attrib
*packing
,
281 struct gl_texture_object
*texObj
,
282 struct gl_texture_image
*texImage
);
285 * Called by glTexSubImage3D().
287 * \sa dd_function_table::TexSubImage1D.
289 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
290 GLint xoffset
, GLint yoffset
, GLint zoffset
,
291 GLsizei width
, GLsizei height
, GLint depth
,
292 GLenum format
, GLenum type
,
293 const GLvoid
*pixels
,
294 const struct gl_pixelstore_attrib
*packing
,
295 struct gl_texture_object
*texObj
,
296 struct gl_texture_image
*texImage
);
299 * Called by glGetTexImage().
301 void (*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
302 GLenum format
, GLenum type
, GLvoid
*pixels
,
303 const struct gl_texture_object
*texObj
,
304 const struct gl_texture_image
*texImage
);
307 * Called by glCopyTexImage1D().
309 * Drivers should use a fallback routine from texstore.c if needed.
311 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
312 GLenum internalFormat
, GLint x
, GLint y
,
313 GLsizei width
, GLint border
);
316 * Called by glCopyTexImage2D().
318 * Drivers should use a fallback routine from texstore.c if needed.
320 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
321 GLenum internalFormat
, GLint x
, GLint y
,
322 GLsizei width
, GLsizei height
, GLint border
);
325 * Called by glCopyTexSubImage1D().
327 * Drivers should use a fallback routine from texstore.c if needed.
329 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
331 GLint x
, GLint y
, GLsizei width
);
333 * Called by glCopyTexSubImage2D().
335 * Drivers should use a fallback routine from texstore.c if needed.
337 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
338 GLint xoffset
, GLint yoffset
,
340 GLsizei width
, GLsizei height
);
342 * Called by glCopyTexSubImage3D().
344 * Drivers should use a fallback routine from texstore.c if needed.
346 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
347 GLint xoffset
, GLint yoffset
, GLint zoffset
,
349 GLsizei width
, GLsizei height
);
352 * Called by glTexImage[123]D when user specifies a proxy texture
355 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
357 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
358 GLint level
, GLint internalFormat
,
359 GLenum format
, GLenum type
,
360 GLint width
, GLint height
,
361 GLint depth
, GLint border
);
366 * \name Compressed texture functions
371 * Called by glCompressedTexImage1D().
373 * \param target user specified.
374 * \param format user specified.
375 * \param type user specified.
376 * \param pixels user specified.
377 * \param packing indicates the image packing of pixels.
378 * \param texObj is the target texture object.
379 * \param texImage is the target texture image. It will have the texture \p
380 * width, \p height, \p depth, \p border and \p internalFormat information.
382 * \a retainInternalCopy is returned by this function and indicates whether
383 * core Mesa should keep an internal copy of the texture image.
385 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
386 GLint level
, GLint internalFormat
,
387 GLsizei width
, GLint border
,
388 GLsizei imageSize
, const GLvoid
*data
,
389 struct gl_texture_object
*texObj
,
390 struct gl_texture_image
*texImage
);
392 * Called by glCompressedTexImage2D().
394 * \sa dd_function_table::CompressedTexImage1D.
396 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
397 GLint level
, GLint internalFormat
,
398 GLsizei width
, GLsizei height
, GLint border
,
399 GLsizei imageSize
, const GLvoid
*data
,
400 struct gl_texture_object
*texObj
,
401 struct gl_texture_image
*texImage
);
403 * Called by glCompressedTexImage3D().
405 * \sa dd_function_table::CompressedTexImage3D.
407 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
408 GLint level
, GLint internalFormat
,
409 GLsizei width
, GLsizei height
, GLsizei depth
,
411 GLsizei imageSize
, const GLvoid
*data
,
412 struct gl_texture_object
*texObj
,
413 struct gl_texture_image
*texImage
);
416 * Called by glCompressedTexSubImage1D().
418 * \param target user specified.
419 * \param level user specified.
420 * \param xoffset user specified.
421 * \param yoffset user specified.
422 * \param zoffset user specified.
423 * \param width user specified.
424 * \param height user specified.
425 * \param depth user specified.
426 * \param imageSize user specified.
427 * \param data user specified.
428 * \param texObj is the target texture object.
429 * \param texImage is the target texture image. It will have the texture \p
430 * width, \p height, \p depth, \p border and \p internalFormat information.
432 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
433 GLint xoffset
, GLsizei width
,
435 GLsizei imageSize
, const GLvoid
*data
,
436 struct gl_texture_object
*texObj
,
437 struct gl_texture_image
*texImage
);
439 * Called by glCompressedTexSubImage2D().
441 * \sa dd_function_table::CompressedTexImage3D.
443 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
444 GLint xoffset
, GLint yoffset
,
445 GLsizei width
, GLint height
,
447 GLsizei imageSize
, const GLvoid
*data
,
448 struct gl_texture_object
*texObj
,
449 struct gl_texture_image
*texImage
);
451 * Called by glCompressedTexSubImage3D().
453 * \sa dd_function_table::CompressedTexImage3D.
455 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
456 GLint xoffset
, GLint yoffset
, GLint zoffset
,
457 GLsizei width
, GLint height
, GLint depth
,
459 GLsizei imageSize
, const GLvoid
*data
,
460 struct gl_texture_object
*texObj
,
461 struct gl_texture_image
*texImage
);
465 * Called by glGetCompressedTexImage.
467 void (*GetCompressedTexImage
)(GLcontext
*ctx
, GLenum target
, GLint level
,
469 const struct gl_texture_object
*texObj
,
470 const struct gl_texture_image
*texImage
);
473 * Called to query number of bytes of storage needed to store the
474 * specified compressed texture.
476 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
, GLsizei width
,
477 GLsizei height
, GLsizei depth
,
482 * \name Texture object functions
487 * Called by glBindTexture().
489 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
490 struct gl_texture_object
*tObj
);
493 * Called to allocate a new texture object.
494 * A new gl_texture_object should be returned. The driver should
495 * attach to it any device-specific info it needs.
497 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
500 * Called when a texture object is about to be deallocated.
502 * Driver should delete the gl_texture_object object and anything
505 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
508 * Called to allocate a new texture image object.
510 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
513 * Called to free tImage->Data.
515 void (*FreeTexImageData
)( GLcontext
*ctx
, struct gl_texture_image
*tImage
);
518 * Called by glAreTextureResident().
520 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
521 struct gl_texture_object
*t
);
524 * Called by glPrioritizeTextures().
526 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
530 * Called by glActiveTextureARB() to set current texture unit.
532 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
535 * Called when the texture's color lookup table is changed.
537 * If \p tObj is NULL then the shared texture palette
538 * gl_texture_object::Palette is to be updated.
540 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
541 struct gl_texture_object
*tObj
);
546 * \name Imaging functionality
549 void (*CopyColorTable
)( GLcontext
*ctx
,
550 GLenum target
, GLenum internalformat
,
551 GLint x
, GLint y
, GLsizei width
);
553 void (*CopyColorSubTable
)( GLcontext
*ctx
,
554 GLenum target
, GLsizei start
,
555 GLint x
, GLint y
, GLsizei width
);
557 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
558 GLenum internalFormat
,
559 GLint x
, GLint y
, GLsizei width
);
561 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
562 GLenum internalFormat
,
564 GLsizei width
, GLsizei height
);
569 * \name Vertex/fragment program functions
572 /** Bind a vertex/fragment program */
573 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct program
*prog
);
574 /** Allocate a new program */
575 struct program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
576 /** Delete a program */
577 void (*DeleteProgram
)(GLcontext
*ctx
, struct program
*prog
);
578 /** Notify driver that a program string has been specified. */
579 void (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
580 struct program
*prog
);
584 /** Query if program can be loaded onto hardware */
585 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
586 struct program
*prog
);
592 * \name State-changing functions.
594 * \note drawing functions are above.
596 * These functions are called by their corresponding OpenGL API functions.
597 * They are \e also called by the gl_PopAttrib() function!!!
598 * May add more functions like these to the device driver in the future.
601 /** Specify the alpha test function */
602 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
603 /** Set the blend color */
604 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
605 /** Set the blend equation */
606 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
607 /** Specify pixel arithmetic */
608 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
609 GLenum sfactorRGB
, GLenum dfactorRGB
,
610 GLenum sfactorA
, GLenum dfactorA
);
611 /** Specify clear values for the color buffers */
612 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
613 /** Specify the clear value for the depth buffer */
614 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
615 /** Specify the clear value for the color index buffers */
616 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
617 /** Specify the clear value for the stencil buffer */
618 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
619 /** Specify a plane against which all geometry is clipped */
620 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
621 /** Enable and disable writing of frame buffer color components */
622 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
623 GLboolean bmask
, GLboolean amask
);
624 /** Cause a material color to track the current color */
625 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
626 /** Specify whether front- or back-facing facets can be culled */
627 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
628 /** Define front- and back-facing polygons */
629 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
630 /** Specify the value used for depth buffer comparisons */
631 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
632 /** Enable or disable writing into the depth buffer */
633 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
634 /** Specify mapping of depth values from NDC to window coordinates */
635 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
636 /** Specify the current buffer for writing */
637 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
638 /** Specify the buffers for writing for fragment programs*/
639 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
640 /** Enable or disable server-side gl capabilities */
641 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
642 /** Specify fog parameters */
643 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
644 /** Specify implementation-specific hints */
645 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
646 /** Control the writing of individual bits in the color index buffers */
647 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
648 /** Set light source parameters */
649 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
650 GLenum pname
, const GLfloat
*params
);
651 /** Set the lighting model parameters */
652 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
653 /** Specify the line stipple pattern */
654 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
655 /** Specify the width of rasterized lines */
656 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
657 /** Specify a logical pixel operation for color index rendering */
658 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
659 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
660 const GLfloat
*params
);
661 /** Specify the diameter of rasterized points */
662 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
663 /** Select a polygon rasterization mode */
664 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
665 /** Set the scale and units used to calculate depth values */
666 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
667 /** Set the polygon stippling pattern */
668 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
669 /* Specifies the current buffer for reading */
670 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
671 /** Set rasterization mode */
672 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
673 /** Define the scissor box */
674 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
675 /** Select flat or smooth shading */
676 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
677 /** Set function and reference value for stencil testing */
678 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
679 /** Control the writing of individual bits in the stencil planes */
680 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
681 /** Set stencil test actions */
682 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
683 /** Set active stencil face (GL_EXT_stencil_two_side) */
684 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
685 /** OpenGL 2.0 two-sided StencilFunc */
686 void (*StencilFuncSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum func
,
687 GLint ref
, GLuint mask
);
688 /** OpenGL 2.0 two-sided StencilMask */
689 void (*StencilMaskSeparate
)(GLcontext
*ctx
, GLenum face
, GLuint mask
);
690 /** OpenGL 2.0 two-sided StencilOp */
691 void (*StencilOpSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum fail
,
692 GLenum zfail
, GLenum zpass
);
693 /** Control the generation of texture coordinates */
694 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
695 const GLfloat
*params
);
696 /** Set texture environment parameters */
697 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
698 const GLfloat
*param
);
699 /** Set texture parameters */
700 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
701 struct gl_texture_object
*texObj
,
702 GLenum pname
, const GLfloat
*params
);
703 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
704 /** Set the viewport */
705 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
710 * \name Vertex array functions
712 * Called by the corresponding OpenGL functions.
715 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
716 GLsizei stride
, const GLvoid
*ptr
);
717 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
718 GLsizei stride
, const GLvoid
*ptr
);
719 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
720 GLsizei stride
, const GLvoid
*ptr
);
721 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
722 GLsizei stride
, const GLvoid
*ptr
);
723 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
724 GLsizei stride
, const GLvoid
*ptr
);
725 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
726 GLsizei stride
, const GLvoid
*ptr
);
727 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
728 GLsizei stride
, const GLvoid
*ptr
);
729 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
730 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
731 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
732 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
733 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
738 * \name State-query functions
740 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
743 /** Return the value or values of a selected parameter */
744 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
745 /** Return the value or values of a selected parameter */
746 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
747 /** Return the value or values of a selected parameter */
748 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
749 /** Return the value or values of a selected parameter */
750 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
751 /** Return the value or values of a selected parameter */
752 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
757 * \name Vertex/pixel buffer object functions
759 #if FEATURE_ARB_vertex_buffer_object
761 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
762 struct gl_buffer_object
*obj
);
764 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
767 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
769 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
770 const GLvoid
*data
, GLenum usage
,
771 struct gl_buffer_object
*obj
);
773 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
774 GLsizeiptrARB size
, const GLvoid
*data
,
775 struct gl_buffer_object
*obj
);
777 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
778 GLintptrARB offset
, GLsizeiptrARB size
,
779 GLvoid
*data
, struct gl_buffer_object
*obj
);
781 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
782 struct gl_buffer_object
*obj
);
784 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
785 struct gl_buffer_object
*obj
);
790 * \name Functions for GL_EXT_framebuffer_object
792 #if FEATURE_EXT_framebuffer_object
794 struct gl_framebuffer
* (*NewFramebuffer
)(GLcontext
*ctx
, GLuint name
);
795 struct gl_renderbuffer
* (*NewRenderbuffer
)(GLcontext
*ctx
, GLuint name
);
796 void (*FramebufferRenderbuffer
)(GLcontext
*ctx
,
797 struct gl_renderbuffer_attachment
*att
,
798 struct gl_renderbuffer
*rb
);
799 void (*RenderbufferTexture
)(GLcontext
*ctx
,
800 struct gl_renderbuffer_attachment
*att
,
801 struct gl_texture_object
*texObj
,
802 GLenum texTarget
, GLuint level
, GLuint zoffset
);
808 * \name Support for multiple T&L engines
813 * Bitmask of state changes that require the current T&L module to be
814 * validated, using ValidateTnlModule() below.
819 * Validate the current T&L module.
821 * This is called directly after UpdateState() when a state change that has
822 * occurred matches the dd_function_table::NeedValidate bitmask above. This
823 * ensures all computed values are up to date, thus allowing the driver to
824 * decide if the current T&L module needs to be swapped out.
826 * This must be non-NULL if a driver installs a custom T&L module and sets
827 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
829 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
832 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
833 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
834 #define PRIM_UNKNOWN GL_POLYGON+3
837 * Set by the driver-supplied T&L engine.
839 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
841 GLuint CurrentExecPrimitive
;
844 * Current state of an in-progress compilation.
846 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
847 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
849 GLuint CurrentSavePrimitive
;
852 #define FLUSH_STORED_VERTICES 0x1
853 #define FLUSH_UPDATE_CURRENT 0x2
855 * Set by the driver-supplied T&L engine whenever vertices are buffered
856 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
859 * The dd_function_table::FlushVertices call below may be used to resolve
863 GLuint SaveNeedFlush
;
866 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
867 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
868 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
869 * __GLcontextRec::Current and gl_light_attrib::Material
871 * Note that the default T&L engine never clears the
872 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
874 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
875 void (*SaveFlushVertices
)( GLcontext
*ctx
);
878 * Give the driver the opportunity to hook in its own vtxfmt for
879 * compiling optimized display lists. This is called on each valid
880 * glBegin() during list compilation.
882 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
885 * Notify driver that the special derived value _NeedEyeCoords has
888 void (*LightingSpaceChange
)( GLcontext
*ctx
);
891 * Let the T&L component know when the context becomes current.
893 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
894 GLframebuffer
*readBuffer
);
897 * Called by glNewList().
899 * Let the T&L component know what is going on with display lists
900 * in time to make changes to dispatch tables, etc.
902 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
904 * Called by glEndList().
906 * \sa dd_function_table::NewList.
908 void (*EndList
)( GLcontext
*ctx
);
911 * Called by glCallList(s).
913 * Notify the T&L component before and after calling a display list.
915 void (*BeginCallList
)( GLcontext
*ctx
,
916 struct mesa_display_list
*dlist
);
918 * Called by glEndCallList().
920 * \sa dd_function_table::BeginCallList.
922 void (*EndCallList
)( GLcontext
*ctx
);
928 * Transform/Clip/Lighting interface
930 * Drivers present a reduced set of the functions possible in
931 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
932 * remaining functions to map down to these entry points.
934 * These are the initial values to be installed into dispatch by
935 * mesa. If the T&L driver wants to modify the dispatch table
936 * while installed, it must do so itself. It would be possible for
937 * the vertexformat to install it's own initial values for these
938 * functions, but this way there is an obvious list of what is
939 * expected of the driver.
941 * If the driver wants to hook in entry points other than those
942 * listed, it must restore them to their original values in
943 * the disable() callback, below.
950 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
951 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
952 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
953 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
954 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
955 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
956 void (GLAPIENTRYP EdgeFlagv
)( const GLboolean
* );
957 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
958 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
959 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
960 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
961 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
962 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
963 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
964 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
965 void (GLAPIENTRYP Indexf
)( GLfloat
);
966 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
967 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
968 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
969 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
970 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
971 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
972 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
973 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
974 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
975 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
976 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
977 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
978 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
979 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
980 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
981 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
982 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
983 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
984 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
985 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
986 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
987 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
988 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
989 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
990 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
991 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
992 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
993 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
994 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
995 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
996 void (GLAPIENTRYP Begin
)( GLenum
);
997 void (GLAPIENTRYP End
)( void );
998 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
999 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
1000 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
1001 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
1002 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1003 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
1004 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1005 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
1006 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
1007 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
1008 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
1009 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
1010 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1011 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
1012 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1013 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
1018 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1024 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
1025 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
1026 const GLvoid
*indices
);
1027 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
1028 GLuint end
, GLsizei count
,
1029 GLenum type
, const GLvoid
*indices
);
1035 * If you don't support eval, fallback to the default vertex format
1036 * on receiving an eval call and use the pipeline mechanism to
1037 * provide partial T&L acceleration.
1039 * Mesa will provide a set of helper functions to do eval within
1040 * accelerated vertex formats, eventually...
1043 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1044 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1050 #endif /* DD_INCLUDED */