3 * Device driver interfaces.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2006 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().
55 * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
58 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
61 * Notify the driver after Mesa has made some internal state changes.
63 * This is in addition to any state change callbacks Mesa may already have
66 void (*UpdateState
)( GLcontext
*ctx
, GLbitfield new_state
);
69 * Get the width and height of the named buffer/window.
71 * Mesa uses this to determine when the driver's window size has changed.
72 * XXX OBSOLETE: this function will be removed in the future.
74 void (*GetBufferSize
)( GLframebuffer
*buffer
,
75 GLuint
*width
, GLuint
*height
);
78 * Resize the given framebuffer to the given size.
79 * XXX OBSOLETE: this function will be removed in the future.
81 void (*ResizeBuffers
)( GLcontext
*ctx
, GLframebuffer
*fb
,
82 GLuint width
, GLuint height
);
85 * 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).
102 * \param mask a bitmask of BUFFER_BIT_* flags indicating which
103 * renderbuffers need to be cleared.
105 void (*Clear
)( GLcontext
*ctx
, GLbitfield buffers
);
108 * \name For hardware accumulation buffer
112 * Execute glAccum command.
114 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
);
119 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
124 * This is called by glDrawPixels().
126 * \p unpack describes how to unpack the source image data.
128 void (*DrawPixels
)( GLcontext
*ctx
,
129 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
130 GLenum format
, GLenum type
,
131 const struct gl_pixelstore_attrib
*unpack
,
132 const GLvoid
*pixels
);
135 * Called by glReadPixels().
137 void (*ReadPixels
)( GLcontext
*ctx
,
138 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
139 GLenum format
, GLenum type
,
140 const struct gl_pixelstore_attrib
*unpack
,
144 * Do a glCopyPixels().
146 * This function must respect all rasterization state, glPixelTransfer(),
147 * glPixelZoom(), etc.
149 void (*CopyPixels
)( GLcontext
*ctx
, GLint srcx
, GLint srcy
,
150 GLsizei width
, GLsizei height
,
151 GLint dstx
, GLint dsty
, GLenum type
);
154 * This is called by glBitmap().
156 * Works the same as dd_function_table::DrawPixels, above.
158 void (*Bitmap
)( GLcontext
*ctx
,
159 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
160 const struct gl_pixelstore_attrib
*unpack
,
161 const GLubyte
*bitmap
);
166 * \name Texture image functions
171 * Choose texture format.
173 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
174 * functions. The driver should examine \p internalFormat and return a
175 * pointer to an appropriate gl_texture_format.
177 const struct gl_texture_format
*(*ChooseTextureFormat
)( GLcontext
*ctx
,
178 GLint internalFormat
, GLenum srcFormat
, GLenum srcType
);
181 * Called by glTexImage1D().
183 * \param target user specified.
184 * \param format user specified.
185 * \param type user specified.
186 * \param pixels user specified.
187 * \param packing indicates the image packing of pixels.
188 * \param texObj is the target texture object.
189 * \param texImage is the target texture image. It will have the texture \p
190 * width, \p height, \p depth, \p border and \p internalFormat information.
192 * \p retainInternalCopy is returned by this function and indicates whether
193 * core Mesa should keep an internal copy of the texture image.
195 * Drivers should call a fallback routine from texstore.c if needed.
197 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
198 GLint internalFormat
,
199 GLint width
, GLint border
,
200 GLenum format
, GLenum type
, const GLvoid
*pixels
,
201 const struct gl_pixelstore_attrib
*packing
,
202 struct gl_texture_object
*texObj
,
203 struct gl_texture_image
*texImage
);
206 * Called by glTexImage2D().
208 * \sa dd_function_table::TexImage1D.
210 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
211 GLint internalFormat
,
212 GLint width
, GLint height
, GLint border
,
213 GLenum format
, GLenum type
, const GLvoid
*pixels
,
214 const struct gl_pixelstore_attrib
*packing
,
215 struct gl_texture_object
*texObj
,
216 struct gl_texture_image
*texImage
);
219 * Called by glTexImage3D().
221 * \sa dd_function_table::TexImage1D.
223 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
224 GLint internalFormat
,
225 GLint width
, GLint height
, GLint depth
, GLint border
,
226 GLenum format
, GLenum type
, const GLvoid
*pixels
,
227 const struct gl_pixelstore_attrib
*packing
,
228 struct gl_texture_object
*texObj
,
229 struct gl_texture_image
*texImage
);
232 * Called by glTexSubImage1D().
234 * \param target user specified.
235 * \param level user specified.
236 * \param xoffset user specified.
237 * \param yoffset user specified.
238 * \param zoffset user specified.
239 * \param width user specified.
240 * \param height user specified.
241 * \param depth user specified.
242 * \param format user specified.
243 * \param type user specified.
244 * \param pixels user specified.
245 * \param packing indicates the image packing of pixels.
246 * \param texObj is the target texture object.
247 * \param texImage is the target texture image. It will have the texture \p
248 * width, \p height, \p border and \p internalFormat information.
250 * The driver should use a fallback routine from texstore.c if needed.
252 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
253 GLint xoffset
, GLsizei width
,
254 GLenum format
, GLenum type
,
255 const GLvoid
*pixels
,
256 const struct gl_pixelstore_attrib
*packing
,
257 struct gl_texture_object
*texObj
,
258 struct gl_texture_image
*texImage
);
261 * Called by glTexSubImage2D().
263 * \sa dd_function_table::TexSubImage1D.
265 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
266 GLint xoffset
, GLint yoffset
,
267 GLsizei width
, GLsizei height
,
268 GLenum format
, GLenum type
,
269 const GLvoid
*pixels
,
270 const struct gl_pixelstore_attrib
*packing
,
271 struct gl_texture_object
*texObj
,
272 struct gl_texture_image
*texImage
);
275 * Called by glTexSubImage3D().
277 * \sa dd_function_table::TexSubImage1D.
279 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
280 GLint xoffset
, GLint yoffset
, GLint zoffset
,
281 GLsizei width
, GLsizei height
, GLint depth
,
282 GLenum format
, GLenum type
,
283 const GLvoid
*pixels
,
284 const struct gl_pixelstore_attrib
*packing
,
285 struct gl_texture_object
*texObj
,
286 struct gl_texture_image
*texImage
);
289 * Called by glGetTexImage().
291 void (*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
292 GLenum format
, GLenum type
, GLvoid
*pixels
,
293 struct gl_texture_object
*texObj
,
294 struct gl_texture_image
*texImage
);
297 * Called by glCopyTexImage1D().
299 * Drivers should use a fallback routine from texstore.c if needed.
301 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
302 GLenum internalFormat
, GLint x
, GLint y
,
303 GLsizei width
, GLint border
);
306 * Called by glCopyTexImage2D().
308 * Drivers should use a fallback routine from texstore.c if needed.
310 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
311 GLenum internalFormat
, GLint x
, GLint y
,
312 GLsizei width
, GLsizei height
, GLint border
);
315 * Called by glCopyTexSubImage1D().
317 * Drivers should use a fallback routine from texstore.c if needed.
319 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
321 GLint x
, GLint y
, GLsizei width
);
323 * Called by glCopyTexSubImage2D().
325 * Drivers should use a fallback routine from texstore.c if needed.
327 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
328 GLint xoffset
, GLint yoffset
,
330 GLsizei width
, GLsizei height
);
332 * Called by glCopyTexSubImage3D().
334 * Drivers should use a fallback routine from texstore.c if needed.
336 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
337 GLint xoffset
, GLint yoffset
, GLint zoffset
,
339 GLsizei width
, GLsizei height
);
342 * Called by glTexImage[123]D when user specifies a proxy texture
345 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
347 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
348 GLint level
, GLint internalFormat
,
349 GLenum format
, GLenum type
,
350 GLint width
, GLint height
,
351 GLint depth
, GLint border
);
356 * \name Compressed texture functions
361 * Called by glCompressedTexImage1D().
363 * \param target user specified.
364 * \param format user specified.
365 * \param type user specified.
366 * \param pixels user specified.
367 * \param packing indicates the image packing of pixels.
368 * \param texObj is the target texture object.
369 * \param texImage is the target texture image. It will have the texture \p
370 * width, \p height, \p depth, \p border and \p internalFormat information.
372 * \a retainInternalCopy is returned by this function and indicates whether
373 * core Mesa should keep an internal copy of the texture image.
375 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
376 GLint level
, GLint internalFormat
,
377 GLsizei width
, GLint border
,
378 GLsizei imageSize
, const GLvoid
*data
,
379 struct gl_texture_object
*texObj
,
380 struct gl_texture_image
*texImage
);
382 * Called by glCompressedTexImage2D().
384 * \sa dd_function_table::CompressedTexImage1D.
386 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
387 GLint level
, GLint internalFormat
,
388 GLsizei width
, GLsizei height
, GLint border
,
389 GLsizei imageSize
, const GLvoid
*data
,
390 struct gl_texture_object
*texObj
,
391 struct gl_texture_image
*texImage
);
393 * Called by glCompressedTexImage3D().
395 * \sa dd_function_table::CompressedTexImage3D.
397 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
398 GLint level
, GLint internalFormat
,
399 GLsizei width
, GLsizei height
, GLsizei depth
,
401 GLsizei imageSize
, const GLvoid
*data
,
402 struct gl_texture_object
*texObj
,
403 struct gl_texture_image
*texImage
);
406 * Called by glCompressedTexSubImage1D().
408 * \param target user specified.
409 * \param level user specified.
410 * \param xoffset user specified.
411 * \param yoffset user specified.
412 * \param zoffset user specified.
413 * \param width user specified.
414 * \param height user specified.
415 * \param depth user specified.
416 * \param imageSize user specified.
417 * \param data user specified.
418 * \param texObj is the target texture object.
419 * \param texImage is the target texture image. It will have the texture \p
420 * width, \p height, \p depth, \p border and \p internalFormat information.
422 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
423 GLint xoffset
, GLsizei width
,
425 GLsizei imageSize
, const GLvoid
*data
,
426 struct gl_texture_object
*texObj
,
427 struct gl_texture_image
*texImage
);
429 * Called by glCompressedTexSubImage2D().
431 * \sa dd_function_table::CompressedTexImage3D.
433 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
434 GLint xoffset
, GLint yoffset
,
435 GLsizei width
, GLint height
,
437 GLsizei imageSize
, const GLvoid
*data
,
438 struct gl_texture_object
*texObj
,
439 struct gl_texture_image
*texImage
);
441 * Called by glCompressedTexSubImage3D().
443 * \sa dd_function_table::CompressedTexImage3D.
445 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
446 GLint xoffset
, GLint yoffset
, GLint zoffset
,
447 GLsizei width
, GLint height
, GLint depth
,
449 GLsizei imageSize
, const GLvoid
*data
,
450 struct gl_texture_object
*texObj
,
451 struct gl_texture_image
*texImage
);
455 * Called by glGetCompressedTexImage.
457 void (*GetCompressedTexImage
)(GLcontext
*ctx
, GLenum target
, GLint level
,
459 const struct gl_texture_object
*texObj
,
460 const struct gl_texture_image
*texImage
);
463 * Called to query number of bytes of storage needed to store the
464 * specified compressed texture.
466 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
, GLsizei width
,
467 GLsizei height
, GLsizei depth
,
472 * \name Texture object functions
477 * Called by glBindTexture().
479 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
480 struct gl_texture_object
*tObj
);
483 * Called to allocate a new texture object.
484 * A new gl_texture_object should be returned. The driver should
485 * attach to it any device-specific info it needs.
487 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
490 * Called when a texture object is about to be deallocated.
492 * Driver should delete the gl_texture_object object and anything
495 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
498 * Called to allocate a new texture image object.
500 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
503 * Called to free tImage->Data.
505 void (*FreeTexImageData
)( GLcontext
*ctx
, struct gl_texture_image
*tImage
);
508 * Note: no context argument. This function doesn't initially look
509 * like it belongs here, except that the driver is the only entity
510 * that knows for sure how the texture memory is allocated - via
511 * the above callbacks. There is then an argument that the driver
512 * knows what memcpy paths might be fast. Typically this is invoked with
514 * to -- a pointer into texture memory allocated by NewTextureImage() above.
515 * from -- a pointer into client memory or a mesa temporary.
516 * sz -- nr bytes to copy.
518 void* (*TextureMemCpy
)( void *to
, const void *from
, size_t sz
);
521 * Called by glAreTextureResident().
523 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
524 struct gl_texture_object
*t
);
527 * Called by glPrioritizeTextures().
529 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
533 * Called by glActiveTextureARB() to set current texture unit.
535 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
538 * Called when the texture's color lookup table is changed.
540 * If \p tObj is NULL then the shared texture palette
541 * gl_texture_object::Palette is to be updated.
543 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
544 struct gl_texture_object
*tObj
);
549 * \name Imaging functionality
552 void (*CopyColorTable
)( GLcontext
*ctx
,
553 GLenum target
, GLenum internalformat
,
554 GLint x
, GLint y
, GLsizei width
);
556 void (*CopyColorSubTable
)( GLcontext
*ctx
,
557 GLenum target
, GLsizei start
,
558 GLint x
, GLint y
, GLsizei width
);
560 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
561 GLenum internalFormat
,
562 GLint x
, GLint y
, GLsizei width
);
564 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
565 GLenum internalFormat
,
567 GLsizei width
, GLsizei height
);
572 * \name Vertex/fragment program functions
575 /** Bind a vertex/fragment program */
576 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct gl_program
*prog
);
577 /** Allocate a new program */
578 struct gl_program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
579 /** Delete a program */
580 void (*DeleteProgram
)(GLcontext
*ctx
, struct gl_program
*prog
);
581 /** Notify driver that a program string has been specified. */
582 void (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
583 struct gl_program
*prog
);
584 /** Get value of a fragment program register during program execution. */
585 void (*GetFragmentProgramRegister
)(GLcontext
*ctx
, enum register_file file
,
586 GLuint index
, GLfloat val
[4]);
588 /** Query if program can be loaded onto hardware */
589 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
590 struct gl_program
*prog
);
596 * \name State-changing functions.
598 * \note drawing functions are above.
600 * These functions are called by their corresponding OpenGL API functions.
601 * They are \e also called by the gl_PopAttrib() function!!!
602 * May add more functions like these to the device driver in the future.
605 /** Specify the alpha test function */
606 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
607 /** Set the blend color */
608 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
609 /** Set the blend equation */
610 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
611 /** Specify pixel arithmetic */
612 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
613 GLenum sfactorRGB
, GLenum dfactorRGB
,
614 GLenum sfactorA
, GLenum dfactorA
);
615 /** Specify clear values for the color buffers */
616 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
617 /** Specify the clear value for the depth buffer */
618 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
619 /** Specify the clear value for the color index buffers */
620 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
621 /** Specify the clear value for the stencil buffer */
622 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
623 /** Specify a plane against which all geometry is clipped */
624 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
625 /** Enable and disable writing of frame buffer color components */
626 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
627 GLboolean bmask
, GLboolean amask
);
628 /** Cause a material color to track the current color */
629 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
630 /** Specify whether front- or back-facing facets can be culled */
631 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
632 /** Define front- and back-facing polygons */
633 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
634 /** Specify the value used for depth buffer comparisons */
635 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
636 /** Enable or disable writing into the depth buffer */
637 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
638 /** Specify mapping of depth values from NDC to window coordinates */
639 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
640 /** Specify the current buffer for writing */
641 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
642 /** Specify the buffers for writing for fragment programs*/
643 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
644 /** Enable or disable server-side gl capabilities */
645 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
646 /** Specify fog parameters */
647 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
648 /** Specify implementation-specific hints */
649 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
650 /** Control the writing of individual bits in the color index buffers */
651 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
652 /** Set light source parameters.
653 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
654 * been transformed to eye-space.
656 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
657 GLenum pname
, const GLfloat
*params
);
658 /** Set the lighting model parameters */
659 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
660 /** Specify the line stipple pattern */
661 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
662 /** Specify the width of rasterized lines */
663 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
664 /** Specify a logical pixel operation for color index rendering */
665 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
666 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
667 const GLfloat
*params
);
668 /** Specify the diameter of rasterized points */
669 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
670 /** Select a polygon rasterization mode */
671 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
672 /** Set the scale and units used to calculate depth values */
673 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
674 /** Set the polygon stippling pattern */
675 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
676 /* Specifies the current buffer for reading */
677 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
678 /** Set rasterization mode */
679 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
680 /** Define the scissor box */
681 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
682 /** Select flat or smooth shading */
683 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
684 /** OpenGL 2.0 two-sided StencilFunc */
685 void (*StencilFuncSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum func
,
686 GLint ref
, GLuint mask
);
687 /** OpenGL 2.0 two-sided StencilMask */
688 void (*StencilMaskSeparate
)(GLcontext
*ctx
, GLenum face
, GLuint mask
);
689 /** OpenGL 2.0 two-sided StencilOp */
690 void (*StencilOpSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum fail
,
691 GLenum zfail
, GLenum zpass
);
692 /** Control the generation of texture coordinates */
693 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
694 const GLfloat
*params
);
695 /** Set texture environment parameters */
696 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
697 const GLfloat
*param
);
698 /** Set texture parameters */
699 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
700 struct gl_texture_object
*texObj
,
701 GLenum pname
, const GLfloat
*params
);
702 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
703 /** Set the viewport */
704 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
709 * \name Vertex array functions
711 * Called by the corresponding OpenGL functions.
714 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
715 GLsizei stride
, const GLvoid
*ptr
);
716 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
717 GLsizei stride
, const GLvoid
*ptr
);
718 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
719 GLsizei stride
, const GLvoid
*ptr
);
720 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
721 GLsizei stride
, const GLvoid
*ptr
);
722 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
723 GLsizei stride
, const GLvoid
*ptr
);
724 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
725 GLsizei stride
, const GLvoid
*ptr
);
726 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
727 GLsizei stride
, const GLvoid
*ptr
);
728 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
729 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
730 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
731 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
732 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
737 * \name State-query functions
739 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
742 /** Return the value or values of a selected parameter */
743 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
744 /** Return the value or values of a selected parameter */
745 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
746 /** Return the value or values of a selected parameter */
747 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
748 /** Return the value or values of a selected parameter */
749 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
750 /** Return the value or values of a selected parameter */
751 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
756 * \name Vertex/pixel buffer object functions
758 #if FEATURE_ARB_vertex_buffer_object
760 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
761 struct gl_buffer_object
*obj
);
763 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
766 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
768 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
769 const GLvoid
*data
, GLenum usage
,
770 struct gl_buffer_object
*obj
);
772 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
773 GLsizeiptrARB size
, const GLvoid
*data
,
774 struct gl_buffer_object
*obj
);
776 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
777 GLintptrARB offset
, GLsizeiptrARB size
,
778 GLvoid
*data
, struct gl_buffer_object
*obj
);
780 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
781 struct gl_buffer_object
*obj
);
783 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
784 struct gl_buffer_object
*obj
);
789 * \name Functions for GL_EXT_framebuffer_object
791 #if FEATURE_EXT_framebuffer_object
793 struct gl_framebuffer
* (*NewFramebuffer
)(GLcontext
*ctx
, GLuint name
);
794 struct gl_renderbuffer
* (*NewRenderbuffer
)(GLcontext
*ctx
, GLuint name
);
795 void (*BindFramebuffer
)(GLcontext
*ctx
, GLenum target
,
796 struct gl_framebuffer
*fb
);
797 void (*FramebufferRenderbuffer
)(GLcontext
*ctx
,
798 struct gl_framebuffer
*fb
,
800 struct gl_renderbuffer
*rb
);
801 void (*RenderTexture
)(GLcontext
*ctx
,
802 struct gl_framebuffer
*fb
,
803 struct gl_renderbuffer_attachment
*att
);
804 void (*FinishRenderTexture
)(GLcontext
*ctx
,
805 struct gl_renderbuffer_attachment
*att
);
808 #if FEATURE_EXT_framebuffer_blit
809 void (*BlitFramebuffer
)(GLcontext
*ctx
,
810 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
811 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
812 GLbitfield mask
, GLenum filter
);
816 * \name Query objects
819 struct gl_query_object
* (*NewQueryObject
)(GLcontext
*ctx
, GLuint id
);
820 void (*BeginQuery
)(GLcontext
*ctx
, GLenum target
,
821 struct gl_query_object
*q
);
822 void (*EndQuery
)(GLcontext
*ctx
, GLenum target
, struct gl_query_object
*q
);
827 * \name Vertex Array objects
830 struct gl_array_object
* (*NewArrayObject
)(GLcontext
*ctx
, GLuint id
);
831 void (*DeleteArrayObject
)(GLcontext
*ctx
, struct gl_array_object
*obj
);
832 void (*BindArrayObject
)(GLcontext
*ctx
, struct gl_array_object
*obj
);
837 * \name Support for multiple T&L engines
842 * Bitmask of state changes that require the current T&L module to be
843 * validated, using ValidateTnlModule() below.
848 * Validate the current T&L module.
850 * This is called directly after UpdateState() when a state change that has
851 * occurred matches the dd_function_table::NeedValidate bitmask above. This
852 * ensures all computed values are up to date, thus allowing the driver to
853 * decide if the current T&L module needs to be swapped out.
855 * This must be non-NULL if a driver installs a custom T&L module and sets
856 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
858 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
861 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
862 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
863 #define PRIM_UNKNOWN GL_POLYGON+3
866 * Set by the driver-supplied T&L engine.
868 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
870 GLuint CurrentExecPrimitive
;
873 * Current state of an in-progress compilation.
875 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
876 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
878 GLuint CurrentSavePrimitive
;
881 #define FLUSH_STORED_VERTICES 0x1
882 #define FLUSH_UPDATE_CURRENT 0x2
884 * Set by the driver-supplied T&L engine whenever vertices are buffered
885 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
888 * The dd_function_table::FlushVertices call below may be used to resolve
892 GLuint SaveNeedFlush
;
895 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
896 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
897 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
898 * __GLcontextRec::Current and gl_light_attrib::Material
900 * Note that the default T&L engine never clears the
901 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
903 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
904 void (*SaveFlushVertices
)( GLcontext
*ctx
);
907 * Give the driver the opportunity to hook in its own vtxfmt for
908 * compiling optimized display lists. This is called on each valid
909 * glBegin() during list compilation.
911 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
914 * Notify driver that the special derived value _NeedEyeCoords has
917 void (*LightingSpaceChange
)( GLcontext
*ctx
);
920 * Called by glNewList().
922 * Let the T&L component know what is going on with display lists
923 * in time to make changes to dispatch tables, etc.
925 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
927 * Called by glEndList().
929 * \sa dd_function_table::NewList.
931 void (*EndList
)( GLcontext
*ctx
);
934 * Called by glCallList(s).
936 * Notify the T&L component before and after calling a display list.
938 void (*BeginCallList
)( GLcontext
*ctx
,
939 struct mesa_display_list
*dlist
);
941 * Called by glEndCallList().
943 * \sa dd_function_table::BeginCallList.
945 void (*EndCallList
)( GLcontext
*ctx
);
951 * Transform/Clip/Lighting interface
953 * Drivers present a reduced set of the functions possible in
954 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
955 * remaining functions to map down to these entry points.
957 * These are the initial values to be installed into dispatch by
958 * mesa. If the T&L driver wants to modify the dispatch table
959 * while installed, it must do so itself. It would be possible for
960 * the vertexformat to install it's own initial values for these
961 * functions, but this way there is an obvious list of what is
962 * expected of the driver.
964 * If the driver wants to hook in entry points other than those
965 * listed, it must restore them to their original values in
966 * the disable() callback, below.
973 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
974 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
975 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
976 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
977 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
978 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
979 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
980 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
981 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
982 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
983 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
984 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
985 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
986 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
987 void (GLAPIENTRYP Indexf
)( GLfloat
);
988 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
989 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
990 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
991 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
992 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
993 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
994 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
995 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
996 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
997 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
998 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
999 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
1000 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
1001 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
1002 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
1003 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
1004 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
1005 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
1006 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
1007 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
1008 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1009 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
1010 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
1011 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
1012 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
1013 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
1014 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1015 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
1016 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
1017 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
1018 void (GLAPIENTRYP Begin
)( GLenum
);
1019 void (GLAPIENTRYP End
)( void );
1020 /* GL_NV_vertex_program */
1021 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
1022 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
1023 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
1024 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
1025 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1026 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
1027 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1028 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
1029 #if FEATURE_ARB_vertex_program
1030 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
1031 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
1032 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
1033 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
1034 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1035 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
1036 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1037 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
1043 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1049 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
1050 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
1051 const GLvoid
*indices
);
1052 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
1053 GLuint end
, GLsizei count
,
1054 GLenum type
, const GLvoid
*indices
);
1060 * If you don't support eval, fallback to the default vertex format
1061 * on receiving an eval call and use the pipeline mechanism to
1062 * provide partial T&L acceleration.
1064 * Mesa will provide a set of helper functions to do eval within
1065 * accelerated vertex formats, eventually...
1068 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1069 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1075 #endif /* DD_INCLUDED */