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 buffers a bitmask of BUFFER_BIT_* flags indicating which
103 * renderbuffers need to be cleared.
105 void (*Clear
)( GLcontext
*ctx
, GLbitfield buffers
);
108 * Execute glAccum command.
110 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
);
114 * \name Image-related functions
119 * Called by glDrawPixels().
120 * \p unpack describes how to unpack the source image data.
122 void (*DrawPixels
)( GLcontext
*ctx
,
123 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
124 GLenum format
, GLenum type
,
125 const struct gl_pixelstore_attrib
*unpack
,
126 const GLvoid
*pixels
);
129 * Called by glReadPixels().
131 void (*ReadPixels
)( GLcontext
*ctx
,
132 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
133 GLenum format
, GLenum type
,
134 const struct gl_pixelstore_attrib
*unpack
,
138 * Called by glCopyPixels().
140 void (*CopyPixels
)( GLcontext
*ctx
, GLint srcx
, GLint srcy
,
141 GLsizei width
, GLsizei height
,
142 GLint dstx
, GLint dsty
, GLenum type
);
145 * Called by glBitmap().
147 void (*Bitmap
)( GLcontext
*ctx
,
148 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
149 const struct gl_pixelstore_attrib
*unpack
,
150 const GLubyte
*bitmap
);
155 * \name Texture image functions
160 * Choose texture format.
162 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
163 * functions. The driver should examine \p internalFormat and return a
164 * pointer to an appropriate gl_texture_format.
166 const struct gl_texture_format
*(*ChooseTextureFormat
)( GLcontext
*ctx
,
167 GLint internalFormat
, GLenum srcFormat
, GLenum srcType
);
170 * Called by glTexImage1D().
172 * \param target user specified.
173 * \param format user specified.
174 * \param type user specified.
175 * \param pixels user specified.
176 * \param packing indicates the image packing of pixels.
177 * \param texObj is the target texture object.
178 * \param texImage is the target texture image. It will have the texture \p
179 * width, \p height, \p depth, \p border and \p internalFormat information.
181 * \p retainInternalCopy is returned by this function and indicates whether
182 * core Mesa should keep an internal copy of the texture image.
184 * Drivers should call a fallback routine from texstore.c if needed.
186 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
187 GLint internalFormat
,
188 GLint width
, GLint border
,
189 GLenum format
, GLenum type
, const GLvoid
*pixels
,
190 const struct gl_pixelstore_attrib
*packing
,
191 struct gl_texture_object
*texObj
,
192 struct gl_texture_image
*texImage
);
195 * Called by glTexImage2D().
197 * \sa dd_function_table::TexImage1D.
199 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
200 GLint internalFormat
,
201 GLint width
, GLint height
, GLint border
,
202 GLenum format
, GLenum type
, const GLvoid
*pixels
,
203 const struct gl_pixelstore_attrib
*packing
,
204 struct gl_texture_object
*texObj
,
205 struct gl_texture_image
*texImage
);
208 * Called by glTexImage3D().
210 * \sa dd_function_table::TexImage1D.
212 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
213 GLint internalFormat
,
214 GLint width
, GLint height
, GLint depth
, GLint border
,
215 GLenum format
, GLenum type
, const GLvoid
*pixels
,
216 const struct gl_pixelstore_attrib
*packing
,
217 struct gl_texture_object
*texObj
,
218 struct gl_texture_image
*texImage
);
221 * Called by glTexSubImage1D().
223 * \param target user specified.
224 * \param level user specified.
225 * \param xoffset user specified.
226 * \param yoffset user specified.
227 * \param zoffset user specified.
228 * \param width user specified.
229 * \param height user specified.
230 * \param depth user specified.
231 * \param format user specified.
232 * \param type user specified.
233 * \param pixels user specified.
234 * \param packing indicates the image packing of pixels.
235 * \param texObj is the target texture object.
236 * \param texImage is the target texture image. It will have the texture \p
237 * width, \p height, \p border and \p internalFormat information.
239 * The driver should use a fallback routine from texstore.c if needed.
241 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
242 GLint xoffset
, GLsizei width
,
243 GLenum format
, GLenum type
,
244 const GLvoid
*pixels
,
245 const struct gl_pixelstore_attrib
*packing
,
246 struct gl_texture_object
*texObj
,
247 struct gl_texture_image
*texImage
);
250 * Called by glTexSubImage2D().
252 * \sa dd_function_table::TexSubImage1D.
254 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
255 GLint xoffset
, GLint yoffset
,
256 GLsizei width
, GLsizei height
,
257 GLenum format
, GLenum type
,
258 const GLvoid
*pixels
,
259 const struct gl_pixelstore_attrib
*packing
,
260 struct gl_texture_object
*texObj
,
261 struct gl_texture_image
*texImage
);
264 * Called by glTexSubImage3D().
266 * \sa dd_function_table::TexSubImage1D.
268 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
269 GLint xoffset
, GLint yoffset
, GLint zoffset
,
270 GLsizei width
, GLsizei height
, GLint depth
,
271 GLenum format
, GLenum type
,
272 const GLvoid
*pixels
,
273 const struct gl_pixelstore_attrib
*packing
,
274 struct gl_texture_object
*texObj
,
275 struct gl_texture_image
*texImage
);
278 * Called by glGetTexImage().
280 void (*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
281 GLenum format
, GLenum type
, GLvoid
*pixels
,
282 struct gl_texture_object
*texObj
,
283 struct gl_texture_image
*texImage
);
286 * Called by glCopyTexImage1D().
288 * Drivers should use a fallback routine from texstore.c if needed.
290 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
291 GLenum internalFormat
, GLint x
, GLint y
,
292 GLsizei width
, GLint border
);
295 * Called by glCopyTexImage2D().
297 * Drivers should use a fallback routine from texstore.c if needed.
299 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
300 GLenum internalFormat
, GLint x
, GLint y
,
301 GLsizei width
, GLsizei height
, GLint border
);
304 * Called by glCopyTexSubImage1D().
306 * Drivers should use a fallback routine from texstore.c if needed.
308 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
310 GLint x
, GLint y
, GLsizei width
);
312 * Called by glCopyTexSubImage2D().
314 * Drivers should use a fallback routine from texstore.c if needed.
316 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
317 GLint xoffset
, GLint yoffset
,
319 GLsizei width
, GLsizei height
);
321 * Called by glCopyTexSubImage3D().
323 * Drivers should use a fallback routine from texstore.c if needed.
325 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
326 GLint xoffset
, GLint yoffset
, GLint zoffset
,
328 GLsizei width
, GLsizei height
);
331 * Called by glTexImage[123]D when user specifies a proxy texture
334 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
336 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
337 GLint level
, GLint internalFormat
,
338 GLenum format
, GLenum type
,
339 GLint width
, GLint height
,
340 GLint depth
, GLint border
);
345 * \name Compressed texture functions
350 * Called by glCompressedTexImage1D().
352 * \param target user specified.
353 * \param format user specified.
354 * \param type user specified.
355 * \param pixels user specified.
356 * \param packing indicates the image packing of pixels.
357 * \param texObj is the target texture object.
358 * \param texImage is the target texture image. It will have the texture \p
359 * width, \p height, \p depth, \p border and \p internalFormat information.
361 * \a retainInternalCopy is returned by this function and indicates whether
362 * core Mesa should keep an internal copy of the texture image.
364 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
365 GLint level
, GLint internalFormat
,
366 GLsizei width
, GLint border
,
367 GLsizei imageSize
, const GLvoid
*data
,
368 struct gl_texture_object
*texObj
,
369 struct gl_texture_image
*texImage
);
371 * Called by glCompressedTexImage2D().
373 * \sa dd_function_table::CompressedTexImage1D.
375 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
376 GLint level
, GLint internalFormat
,
377 GLsizei width
, GLsizei height
, GLint border
,
378 GLsizei imageSize
, const GLvoid
*data
,
379 struct gl_texture_object
*texObj
,
380 struct gl_texture_image
*texImage
);
382 * Called by glCompressedTexImage3D().
384 * \sa dd_function_table::CompressedTexImage3D.
386 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
387 GLint level
, GLint internalFormat
,
388 GLsizei width
, GLsizei height
, GLsizei depth
,
390 GLsizei imageSize
, const GLvoid
*data
,
391 struct gl_texture_object
*texObj
,
392 struct gl_texture_image
*texImage
);
395 * Called by glCompressedTexSubImage1D().
397 * \param target user specified.
398 * \param level user specified.
399 * \param xoffset user specified.
400 * \param yoffset user specified.
401 * \param zoffset user specified.
402 * \param width user specified.
403 * \param height user specified.
404 * \param depth user specified.
405 * \param imageSize user specified.
406 * \param data user specified.
407 * \param texObj is the target texture object.
408 * \param texImage is the target texture image. It will have the texture \p
409 * width, \p height, \p depth, \p border and \p internalFormat information.
411 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
412 GLint xoffset
, GLsizei width
,
414 GLsizei imageSize
, const GLvoid
*data
,
415 struct gl_texture_object
*texObj
,
416 struct gl_texture_image
*texImage
);
418 * Called by glCompressedTexSubImage2D().
420 * \sa dd_function_table::CompressedTexImage3D.
422 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
423 GLint xoffset
, GLint yoffset
,
424 GLsizei width
, GLint height
,
426 GLsizei imageSize
, const GLvoid
*data
,
427 struct gl_texture_object
*texObj
,
428 struct gl_texture_image
*texImage
);
430 * Called by glCompressedTexSubImage3D().
432 * \sa dd_function_table::CompressedTexImage3D.
434 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
435 GLint xoffset
, GLint yoffset
, GLint zoffset
,
436 GLsizei width
, GLint height
, GLint depth
,
438 GLsizei imageSize
, const GLvoid
*data
,
439 struct gl_texture_object
*texObj
,
440 struct gl_texture_image
*texImage
);
444 * Called by glGetCompressedTexImage.
446 void (*GetCompressedTexImage
)(GLcontext
*ctx
, GLenum target
, GLint level
,
448 const struct gl_texture_object
*texObj
,
449 const struct gl_texture_image
*texImage
);
452 * Called to query number of bytes of storage needed to store the
453 * specified compressed texture.
455 GLuint (*CompressedTextureSize
)( GLcontext
*ctx
, GLsizei width
,
456 GLsizei height
, GLsizei depth
,
461 * \name Texture object functions
466 * Called by glBindTexture().
468 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
469 struct gl_texture_object
*tObj
);
472 * Called to allocate a new texture object.
473 * A new gl_texture_object should be returned. The driver should
474 * attach to it any device-specific info it needs.
476 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
479 * Called when a texture object is about to be deallocated.
481 * Driver should delete the gl_texture_object object and anything
484 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
487 * Called to allocate a new texture image object.
489 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
492 * Called to free tImage->Data.
494 void (*FreeTexImageData
)( GLcontext
*ctx
, struct gl_texture_image
*tImage
);
496 /** Map texture image data into user space */
497 void (*MapTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
498 /** Unmap texture images from user space */
499 void (*UnmapTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
502 * Note: no context argument. This function doesn't initially look
503 * like it belongs here, except that the driver is the only entity
504 * that knows for sure how the texture memory is allocated - via
505 * the above callbacks. There is then an argument that the driver
506 * knows what memcpy paths might be fast. Typically this is invoked with
508 * to -- a pointer into texture memory allocated by NewTextureImage() above.
509 * from -- a pointer into client memory or a mesa temporary.
510 * sz -- nr bytes to copy.
512 void* (*TextureMemCpy
)( void *to
, const void *from
, size_t sz
);
515 * Called by glAreTextureResident().
517 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
518 struct gl_texture_object
*t
);
521 * Called by glPrioritizeTextures().
523 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
527 * Called by glActiveTextureARB() to set current texture unit.
529 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
532 * Called when the texture's color lookup table is changed.
534 * If \p tObj is NULL then the shared texture palette
535 * gl_texture_object::Palette is to be updated.
537 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
538 struct gl_texture_object
*tObj
);
543 * \name Imaging functionality
546 void (*CopyColorTable
)( GLcontext
*ctx
,
547 GLenum target
, GLenum internalformat
,
548 GLint x
, GLint y
, GLsizei width
);
550 void (*CopyColorSubTable
)( GLcontext
*ctx
,
551 GLenum target
, GLsizei start
,
552 GLint x
, GLint y
, GLsizei width
);
554 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
555 GLenum internalFormat
,
556 GLint x
, GLint y
, GLsizei width
);
558 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
559 GLenum internalFormat
,
561 GLsizei width
, GLsizei height
);
566 * \name Vertex/fragment program functions
569 /** Bind a vertex/fragment program */
570 void (*BindProgram
)(GLcontext
*ctx
, GLenum target
, struct gl_program
*prog
);
571 /** Allocate a new program */
572 struct gl_program
* (*NewProgram
)(GLcontext
*ctx
, GLenum target
, GLuint id
);
573 /** Delete a program */
574 void (*DeleteProgram
)(GLcontext
*ctx
, struct gl_program
*prog
);
575 /** Notify driver that a program string has been specified. */
576 void (*ProgramStringNotify
)(GLcontext
*ctx
, GLenum target
,
577 struct gl_program
*prog
);
578 /** Get value of a program register during program execution. */
579 void (*GetProgramRegister
)(GLcontext
*ctx
, enum register_file file
,
580 GLuint index
, GLfloat val
[4]);
582 /** Query if program can be loaded onto hardware */
583 GLboolean (*IsProgramNative
)(GLcontext
*ctx
, GLenum target
,
584 struct gl_program
*prog
);
590 * \name State-changing functions.
592 * \note drawing functions are above.
594 * These functions are called by their corresponding OpenGL API functions.
595 * They are \e also called by the gl_PopAttrib() function!!!
596 * May add more functions like these to the device driver in the future.
599 /** Specify the alpha test function */
600 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
601 /** Set the blend color */
602 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
603 /** Set the blend equation */
604 void (*BlendEquationSeparate
)(GLcontext
*ctx
, GLenum modeRGB
, GLenum modeA
);
605 /** Specify pixel arithmetic */
606 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
607 GLenum sfactorRGB
, GLenum dfactorRGB
,
608 GLenum sfactorA
, GLenum dfactorA
);
609 /** Specify clear values for the color buffers */
610 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
611 /** Specify the clear value for the depth buffer */
612 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
613 /** Specify the clear value for the color index buffers */
614 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
615 /** Specify the clear value for the stencil buffer */
616 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
617 /** Specify a plane against which all geometry is clipped */
618 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
619 /** Enable and disable writing of frame buffer color components */
620 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
621 GLboolean bmask
, GLboolean amask
);
622 /** Cause a material color to track the current color */
623 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
624 /** Specify whether front- or back-facing facets can be culled */
625 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
626 /** Define front- and back-facing polygons */
627 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
628 /** Specify the value used for depth buffer comparisons */
629 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
630 /** Enable or disable writing into the depth buffer */
631 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
632 /** Specify mapping of depth values from NDC to window coordinates */
633 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
634 /** Specify the current buffer for writing */
635 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
636 /** Specify the buffers for writing for fragment programs*/
637 void (*DrawBuffers
)( GLcontext
*ctx
, GLsizei n
, const GLenum
*buffers
);
638 /** Enable or disable server-side gl capabilities */
639 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
640 /** Specify fog parameters */
641 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
642 /** Specify implementation-specific hints */
643 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
644 /** Control the writing of individual bits in the color index buffers */
645 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
646 /** Set light source parameters.
647 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
648 * been transformed to eye-space.
650 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
651 GLenum pname
, const GLfloat
*params
);
652 /** Set the lighting model parameters */
653 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
654 /** Specify the line stipple pattern */
655 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
656 /** Specify the width of rasterized lines */
657 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
658 /** Specify a logical pixel operation for color index rendering */
659 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
660 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
661 const GLfloat
*params
);
662 /** Specify the diameter of rasterized points */
663 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
664 /** Select a polygon rasterization mode */
665 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
666 /** Set the scale and units used to calculate depth values */
667 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
668 /** Set the polygon stippling pattern */
669 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
670 /* Specifies the current buffer for reading */
671 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
672 /** Set rasterization mode */
673 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
674 /** Define the scissor box */
675 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
676 /** Select flat or smooth shading */
677 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
678 /** OpenGL 2.0 two-sided StencilFunc */
679 void (*StencilFuncSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum func
,
680 GLint ref
, GLuint mask
);
681 /** OpenGL 2.0 two-sided StencilMask */
682 void (*StencilMaskSeparate
)(GLcontext
*ctx
, GLenum face
, GLuint mask
);
683 /** OpenGL 2.0 two-sided StencilOp */
684 void (*StencilOpSeparate
)(GLcontext
*ctx
, GLenum face
, GLenum fail
,
685 GLenum zfail
, GLenum zpass
);
686 /** Control the generation of texture coordinates */
687 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
688 const GLfloat
*params
);
689 /** Set texture environment parameters */
690 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
691 const GLfloat
*param
);
692 /** Set texture parameters */
693 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
694 struct gl_texture_object
*texObj
,
695 GLenum pname
, const GLfloat
*params
);
696 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
697 /** Set the viewport */
698 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
703 * \name Vertex array functions
705 * Called by the corresponding OpenGL functions.
708 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
709 GLsizei stride
, const GLvoid
*ptr
);
710 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
711 GLsizei stride
, const GLvoid
*ptr
);
712 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
713 GLsizei stride
, const GLvoid
*ptr
);
714 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
715 GLsizei stride
, const GLvoid
*ptr
);
716 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
717 GLsizei stride
, const GLvoid
*ptr
);
718 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
719 GLsizei stride
, const GLvoid
*ptr
);
720 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
721 GLsizei stride
, const GLvoid
*ptr
);
722 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
723 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
724 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
725 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
726 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
731 * \name State-query functions
733 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
736 /** Return the value or values of a selected parameter */
737 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
738 /** Return the value or values of a selected parameter */
739 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
740 /** Return the value or values of a selected parameter */
741 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
742 /** Return the value or values of a selected parameter */
743 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
744 /** Return the value or values of a selected parameter */
745 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
750 * \name Vertex/pixel buffer object functions
752 #if FEATURE_ARB_vertex_buffer_object
754 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
755 struct gl_buffer_object
*obj
);
757 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, GLuint buffer
,
760 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
762 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
763 const GLvoid
*data
, GLenum usage
,
764 struct gl_buffer_object
*obj
);
766 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
767 GLsizeiptrARB size
, const GLvoid
*data
,
768 struct gl_buffer_object
*obj
);
770 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
771 GLintptrARB offset
, GLsizeiptrARB size
,
772 GLvoid
*data
, struct gl_buffer_object
*obj
);
774 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
775 struct gl_buffer_object
*obj
);
777 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
778 struct gl_buffer_object
*obj
);
783 * \name Functions for GL_EXT_framebuffer_object
785 #if FEATURE_EXT_framebuffer_object
787 struct gl_framebuffer
* (*NewFramebuffer
)(GLcontext
*ctx
, GLuint name
);
788 struct gl_renderbuffer
* (*NewRenderbuffer
)(GLcontext
*ctx
, GLuint name
);
789 void (*BindFramebuffer
)(GLcontext
*ctx
, GLenum target
,
790 struct gl_framebuffer
*fb
, struct gl_framebuffer
*fbread
);
791 void (*FramebufferRenderbuffer
)(GLcontext
*ctx
,
792 struct gl_framebuffer
*fb
,
794 struct gl_renderbuffer
*rb
);
795 void (*RenderTexture
)(GLcontext
*ctx
,
796 struct gl_framebuffer
*fb
,
797 struct gl_renderbuffer_attachment
*att
);
798 void (*FinishRenderTexture
)(GLcontext
*ctx
,
799 struct gl_renderbuffer_attachment
*att
);
802 #if FEATURE_EXT_framebuffer_blit
803 void (*BlitFramebuffer
)(GLcontext
*ctx
,
804 GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
805 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
806 GLbitfield mask
, GLenum filter
);
810 * \name Query objects
813 struct gl_query_object
* (*NewQueryObject
)(GLcontext
*ctx
, GLuint id
);
814 void (*BeginQuery
)(GLcontext
*ctx
, GLenum target
,
815 struct gl_query_object
*q
);
816 void (*EndQuery
)(GLcontext
*ctx
, GLenum target
, struct gl_query_object
*q
);
821 * \name Vertex Array objects
824 struct gl_array_object
* (*NewArrayObject
)(GLcontext
*ctx
, GLuint id
);
825 void (*DeleteArrayObject
)(GLcontext
*ctx
, struct gl_array_object
*obj
);
826 void (*BindArrayObject
)(GLcontext
*ctx
, struct gl_array_object
*obj
);
830 * \name GLSL-related functions (ARB extensions and OpenGL 2.x)
833 void (*AttachShader
)(GLcontext
*ctx
, GLuint program
, GLuint shader
);
834 void (*BindAttribLocation
)(GLcontext
*ctx
, GLuint program
, GLuint index
,
835 const GLcharARB
*name
);
836 void (*CompileShader
)(GLcontext
*ctx
, GLuint shader
);
837 GLuint (*CreateShader
)(GLcontext
*ctx
, GLenum type
);
838 GLuint (*CreateProgram
)(GLcontext
*ctx
);
839 void (*DeleteProgram2
)(GLcontext
*ctx
, GLuint program
);
840 void (*DeleteShader
)(GLcontext
*ctx
, GLuint shader
);
841 void (*DetachShader
)(GLcontext
*ctx
, GLuint program
, GLuint shader
);
842 void (*GetActiveAttrib
)(GLcontext
*ctx
, GLuint program
, GLuint index
,
843 GLsizei maxLength
, GLsizei
* length
, GLint
* size
,
844 GLenum
* type
, GLcharARB
* name
);
845 void (*GetActiveUniform
)(GLcontext
*ctx
, GLuint program
, GLuint index
,
846 GLsizei maxLength
, GLsizei
*length
, GLint
*size
,
847 GLenum
*type
, GLcharARB
*name
);
848 void (*GetAttachedShaders
)(GLcontext
*ctx
, GLuint program
, GLsizei maxCount
,
849 GLsizei
*count
, GLuint
*obj
);
850 GLint (*GetAttribLocation
)(GLcontext
*ctx
, GLuint program
,
851 const GLcharARB
*name
);
852 GLuint (*GetHandle
)(GLcontext
*ctx
, GLenum pname
);
853 void (*GetProgramiv
)(GLcontext
*ctx
, GLuint program
,
854 GLenum pname
, GLint
*params
);
855 void (*GetProgramInfoLog
)(GLcontext
*ctx
, GLuint program
, GLsizei bufSize
,
856 GLsizei
*length
, GLchar
*infoLog
);
857 void (*GetShaderiv
)(GLcontext
*ctx
, GLuint shader
,
858 GLenum pname
, GLint
*params
);
859 void (*GetShaderInfoLog
)(GLcontext
*ctx
, GLuint shader
, GLsizei bufSize
,
860 GLsizei
*length
, GLchar
*infoLog
);
861 void (*GetShaderSource
)(GLcontext
*ctx
, GLuint shader
, GLsizei maxLength
,
862 GLsizei
*length
, GLcharARB
*sourceOut
);
863 void (*GetUniformfv
)(GLcontext
*ctx
, GLuint program
, GLint location
,
865 GLint (*GetUniformLocation
)(GLcontext
*ctx
, GLuint program
,
866 const GLcharARB
*name
);
867 GLboolean (*IsProgram
)(GLcontext
*ctx
, GLuint name
);
868 GLboolean (*IsShader
)(GLcontext
*ctx
, GLuint name
);
869 void (*LinkProgram
)(GLcontext
*ctx
, GLuint program
);
870 void (*ShaderSource
)(GLcontext
*ctx
, GLuint shader
, const GLchar
*source
);
871 void (*Uniform
)(GLcontext
*ctx
, GLint location
, GLsizei count
,
872 const GLvoid
*values
, GLenum type
);
873 void (*UniformMatrix
)(GLcontext
*ctx
, GLint cols
, GLint rows
,
874 GLenum matrixType
, GLint location
, GLsizei count
,
875 GLboolean transpose
, const GLfloat
*values
);
876 void (*UseProgram
)(GLcontext
*ctx
, GLuint program
);
877 void (*ValidateProgram
)(GLcontext
*ctx
, GLuint program
);
878 /* XXX many more to come */
883 * \name Support for multiple T&L engines
888 * Bitmask of state changes that require the current T&L module to be
889 * validated, using ValidateTnlModule() below.
894 * Validate the current T&L module.
896 * This is called directly after UpdateState() when a state change that has
897 * occurred matches the dd_function_table::NeedValidate bitmask above. This
898 * ensures all computed values are up to date, thus allowing the driver to
899 * decide if the current T&L module needs to be swapped out.
901 * This must be non-NULL if a driver installs a custom T&L module and sets
902 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
904 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
907 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
908 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
909 #define PRIM_UNKNOWN GL_POLYGON+3
912 * Set by the driver-supplied T&L engine.
914 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
916 GLuint CurrentExecPrimitive
;
919 * Current state of an in-progress compilation.
921 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
922 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
924 GLuint CurrentSavePrimitive
;
927 #define FLUSH_STORED_VERTICES 0x1
928 #define FLUSH_UPDATE_CURRENT 0x2
930 * Set by the driver-supplied T&L engine whenever vertices are buffered
931 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
934 * The dd_function_table::FlushVertices call below may be used to resolve
938 GLuint SaveNeedFlush
;
941 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
942 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
943 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
944 * __GLcontextRec::Current and gl_light_attrib::Material
946 * Note that the default T&L engine never clears the
947 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
949 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
950 void (*SaveFlushVertices
)( GLcontext
*ctx
);
953 * Give the driver the opportunity to hook in its own vtxfmt for
954 * compiling optimized display lists. This is called on each valid
955 * glBegin() during list compilation.
957 GLboolean (*NotifySaveBegin
)( GLcontext
*ctx
, GLenum mode
);
960 * Notify driver that the special derived value _NeedEyeCoords has
963 void (*LightingSpaceChange
)( GLcontext
*ctx
);
966 * Called by glNewList().
968 * Let the T&L component know what is going on with display lists
969 * in time to make changes to dispatch tables, etc.
971 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
973 * Called by glEndList().
975 * \sa dd_function_table::NewList.
977 void (*EndList
)( GLcontext
*ctx
);
980 * Called by glCallList(s).
982 * Notify the T&L component before and after calling a display list.
984 void (*BeginCallList
)( GLcontext
*ctx
,
985 struct mesa_display_list
*dlist
);
987 * Called by glEndCallList().
989 * \sa dd_function_table::BeginCallList.
991 void (*EndCallList
)( GLcontext
*ctx
);
997 * Transform/Clip/Lighting interface
999 * Drivers present a reduced set of the functions possible in
1000 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
1001 * remaining functions to map down to these entry points.
1003 * These are the initial values to be installed into dispatch by
1004 * mesa. If the T&L driver wants to modify the dispatch table
1005 * while installed, it must do so itself. It would be possible for
1006 * the vertexformat to install it's own initial values for these
1007 * functions, but this way there is an obvious list of what is
1008 * expected of the driver.
1010 * If the driver wants to hook in entry points other than those
1011 * listed, it must restore them to their original values in
1012 * the disable() callback, below.
1019 void (GLAPIENTRYP ArrayElement
)( GLint
); /* NOTE */
1020 void (GLAPIENTRYP Color3f
)( GLfloat
, GLfloat
, GLfloat
);
1021 void (GLAPIENTRYP Color3fv
)( const GLfloat
* );
1022 void (GLAPIENTRYP Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1023 void (GLAPIENTRYP Color4fv
)( const GLfloat
* );
1024 void (GLAPIENTRYP EdgeFlag
)( GLboolean
);
1025 void (GLAPIENTRYP EvalCoord1f
)( GLfloat
); /* NOTE */
1026 void (GLAPIENTRYP EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
1027 void (GLAPIENTRYP EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
1028 void (GLAPIENTRYP EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
1029 void (GLAPIENTRYP EvalPoint1
)( GLint
); /* NOTE */
1030 void (GLAPIENTRYP EvalPoint2
)( GLint
, GLint
); /* NOTE */
1031 void (GLAPIENTRYP FogCoordfEXT
)( GLfloat
);
1032 void (GLAPIENTRYP FogCoordfvEXT
)( const GLfloat
* );
1033 void (GLAPIENTRYP Indexf
)( GLfloat
);
1034 void (GLAPIENTRYP Indexfv
)( const GLfloat
* );
1035 void (GLAPIENTRYP Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
1036 void (GLAPIENTRYP MultiTexCoord1fARB
)( GLenum
, GLfloat
);
1037 void (GLAPIENTRYP MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
1038 void (GLAPIENTRYP MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
1039 void (GLAPIENTRYP MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
1040 void (GLAPIENTRYP MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
1041 void (GLAPIENTRYP MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
1042 void (GLAPIENTRYP MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1043 void (GLAPIENTRYP MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
1044 void (GLAPIENTRYP Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
1045 void (GLAPIENTRYP Normal3fv
)( const GLfloat
* );
1046 void (GLAPIENTRYP SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
1047 void (GLAPIENTRYP SecondaryColor3fvEXT
)( const GLfloat
* );
1048 void (GLAPIENTRYP TexCoord1f
)( GLfloat
);
1049 void (GLAPIENTRYP TexCoord1fv
)( const GLfloat
* );
1050 void (GLAPIENTRYP TexCoord2f
)( GLfloat
, GLfloat
);
1051 void (GLAPIENTRYP TexCoord2fv
)( const GLfloat
* );
1052 void (GLAPIENTRYP TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
1053 void (GLAPIENTRYP TexCoord3fv
)( const GLfloat
* );
1054 void (GLAPIENTRYP TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1055 void (GLAPIENTRYP TexCoord4fv
)( const GLfloat
* );
1056 void (GLAPIENTRYP Vertex2f
)( GLfloat
, GLfloat
);
1057 void (GLAPIENTRYP Vertex2fv
)( const GLfloat
* );
1058 void (GLAPIENTRYP Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
1059 void (GLAPIENTRYP Vertex3fv
)( const GLfloat
* );
1060 void (GLAPIENTRYP Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1061 void (GLAPIENTRYP Vertex4fv
)( const GLfloat
* );
1062 void (GLAPIENTRYP CallList
)( GLuint
); /* NOTE */
1063 void (GLAPIENTRYP CallLists
)( GLsizei
, GLenum
, const GLvoid
* ); /* NOTE */
1064 void (GLAPIENTRYP Begin
)( GLenum
);
1065 void (GLAPIENTRYP End
)( void );
1066 /* GL_NV_vertex_program */
1067 void (GLAPIENTRYP VertexAttrib1fNV
)( GLuint index
, GLfloat x
);
1068 void (GLAPIENTRYP VertexAttrib1fvNV
)( GLuint index
, const GLfloat
*v
);
1069 void (GLAPIENTRYP VertexAttrib2fNV
)( GLuint index
, GLfloat x
, GLfloat y
);
1070 void (GLAPIENTRYP VertexAttrib2fvNV
)( GLuint index
, const GLfloat
*v
);
1071 void (GLAPIENTRYP VertexAttrib3fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1072 void (GLAPIENTRYP VertexAttrib3fvNV
)( GLuint index
, const GLfloat
*v
);
1073 void (GLAPIENTRYP VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1074 void (GLAPIENTRYP VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
1075 #if FEATURE_ARB_vertex_program
1076 void (GLAPIENTRYP VertexAttrib1fARB
)( GLuint index
, GLfloat x
);
1077 void (GLAPIENTRYP VertexAttrib1fvARB
)( GLuint index
, const GLfloat
*v
);
1078 void (GLAPIENTRYP VertexAttrib2fARB
)( GLuint index
, GLfloat x
, GLfloat y
);
1079 void (GLAPIENTRYP VertexAttrib2fvARB
)( GLuint index
, const GLfloat
*v
);
1080 void (GLAPIENTRYP VertexAttrib3fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
);
1081 void (GLAPIENTRYP VertexAttrib3fvARB
)( GLuint index
, const GLfloat
*v
);
1082 void (GLAPIENTRYP VertexAttrib4fARB
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
1083 void (GLAPIENTRYP VertexAttrib4fvARB
)( GLuint index
, const GLfloat
*v
);
1089 void (GLAPIENTRYP Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
1095 void (GLAPIENTRYP DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
1096 void (GLAPIENTRYP DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
1097 const GLvoid
*indices
);
1098 void (GLAPIENTRYP DrawRangeElements
)( GLenum mode
, GLuint start
,
1099 GLuint end
, GLsizei count
,
1100 GLenum type
, const GLvoid
*indices
);
1106 * If you don't support eval, fallback to the default vertex format
1107 * on receiving an eval call and use the pipeline mechanism to
1108 * provide partial T&L acceleration.
1110 * Mesa will provide a set of helper functions to do eval within
1111 * accelerated vertex formats, eventually...
1114 void (GLAPIENTRYP EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
1115 void (GLAPIENTRYP EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
1121 #endif /* DD_INCLUDED */