3 * Device driver interfaces.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
36 struct gl_pixelstore_attrib
;
38 /* Mask bits sent to the driver Clear() function */
39 #define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
40 #define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
41 #define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */
42 #define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */
43 #define DD_AUX0 AUX0_BIT /* future use */
44 #define DD_AUX1 AUX1_BIT /* future use */
45 #define DD_AUX2 AUX2_BIT /* future use */
46 #define DD_AUX3 AUX3_BIT /* future use */
47 #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
48 #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
49 #define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
53 * Device driver function table.
55 struct dd_function_table
{
57 * Return a string as needed by glGetString().
59 * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
62 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
65 * Notify the driver after Mesa has made some internal state changes.
67 * This is in addition to any state change callbacks Mesa may already have
70 void (*UpdateState
)( GLcontext
*ctx
, GLuint new_state
);
73 * Clear the color/depth/stencil/accum buffer(s).
75 * \param mask a bitmask of the DD_*_BIT values defined above that indicates
76 * which buffers need to be cleared.
77 * \param all if true then clear the whole buffer, else clear only the
78 * region defined by <tt>(x, y, width, height)</tt>.
80 * This function must obey the glColorMask(), glIndexMask() and glStencilMask()
82 * Software Mesa can do masked clears if the device driver can't.
84 void (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
85 GLint x
, GLint y
, GLint width
, GLint height
);
88 * Specify the current buffer for writing.
90 * Called via glDrawBuffer(). Note the driver must organize fallbacks (e.g.
91 * with swrast) if it cannot implement the requested mode.
93 void (*DrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
96 * Specifies the current buffer for reading.
98 * Called via glReadBuffer().
100 void (*ReadBuffer
)( GLcontext
*ctx
, GLenum buffer
);
103 * Get the width and height of the named buffer/window.
105 * Mesa uses this to determine when the driver's window size has changed.
107 void (*GetBufferSize
)( GLframebuffer
*buffer
,
108 GLuint
*width
, GLuint
*height
);
111 * Resize the driver's depth/stencil/accum/back buffers to match the
112 * size given in the GLframebuffer struct.
114 * This is typically called when Mesa detects that a window size has changed.
116 void (*ResizeBuffers
)( GLframebuffer
*buffer
);
119 * This is called whenever glFinish() is called.
121 void (*Finish
)( GLcontext
*ctx
);
124 * This is called whenever glFlush() is called.
126 void (*Flush
)( GLcontext
*ctx
);
129 * Called whenever an error is generated.
131 * __GLcontextRec::ErrorValue contains the error value.
133 void (*Error
)( GLcontext
*ctx
);
137 * \name For hardware accumulation buffer
141 * Execute glAccum command within the given scissor region.
143 void (*Accum
)( GLcontext
*ctx
, GLenum op
, GLfloat value
,
144 GLint xpos
, GLint ypos
, GLint width
, GLint height
);
149 * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
154 * This is called by glDrawPixels().
156 * \p unpack describes how to unpack the source image data.
158 void (*DrawPixels
)( GLcontext
*ctx
,
159 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
160 GLenum format
, GLenum type
,
161 const struct gl_pixelstore_attrib
*unpack
,
162 const GLvoid
*pixels
);
165 * Called by glReadPixels().
167 void (*ReadPixels
)( GLcontext
*ctx
,
168 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
169 GLenum format
, GLenum type
,
170 const struct gl_pixelstore_attrib
*unpack
,
174 * Do a glCopyPixels().
176 * This function must respect all rasterization state, glPixelTransfer(),
177 * glPixelZoom(), etc.
179 void (*CopyPixels
)( GLcontext
*ctx
,
180 GLint srcx
, GLint srcy
,
181 GLsizei width
, GLsizei height
,
182 GLint dstx
, GLint dsty
, GLenum type
);
185 * This is called by glBitmap().
187 * Works the same as dd_function_table::DrawPixels, above.
189 void (*Bitmap
)( GLcontext
*ctx
,
190 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
191 const struct gl_pixelstore_attrib
*unpack
,
192 const GLubyte
*bitmap
);
197 * \name Texture image functions
202 * Choose texture format.
204 * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
205 * functions. The driver should examine \p internalFormat and return a
206 * pointer to an appropriate gl_texture_format.
208 const struct gl_texture_format
*
209 (*ChooseTextureFormat
)( GLcontext
*ctx
, GLint internalFormat
,
210 GLenum srcFormat
, GLenum srcType
);
213 * Called by glTexImage1D().
215 * \param target user specified.
216 * \param format user specified.
217 * \param type user specified.
218 * \param pixels user specified.
219 * \param packing indicates the image packing of pixels.
220 * \param texObj is the target texture object.
221 * \param texImage is the target texture image. It will have the texture \p
222 * width, \p height, \p depth, \p border and \p internalFormat information.
224 * \p retainInternalCopy is returned by this function and indicates whether
225 * core Mesa should keep an internal copy of the texture image.
227 * Drivers should call a fallback routine from texstore.c if needed.
229 void (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
230 GLint internalFormat
,
231 GLint width
, GLint border
,
232 GLenum format
, GLenum type
, const GLvoid
*pixels
,
233 const struct gl_pixelstore_attrib
*packing
,
234 struct gl_texture_object
*texObj
,
235 struct gl_texture_image
*texImage
);
238 * Called by glTexImage2D().
240 * \sa dd_function_table::TexImage1D.
242 void (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
243 GLint internalFormat
,
244 GLint width
, GLint height
, GLint border
,
245 GLenum format
, GLenum type
, const GLvoid
*pixels
,
246 const struct gl_pixelstore_attrib
*packing
,
247 struct gl_texture_object
*texObj
,
248 struct gl_texture_image
*texImage
);
251 * Called by glTexImage3D().
253 * \sa dd_function_table::TexImage1D.
255 void (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
256 GLint internalFormat
,
257 GLint width
, GLint height
, GLint depth
, GLint border
,
258 GLenum format
, GLenum type
, 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 glTexSubImage1D().
266 * \param target user specified.
267 * \param level user specified.
268 * \param xoffset user specified.
269 * \param yoffset user specified.
270 * \param zoffset user specified.
271 * \param width user specified.
272 * \param height user specified.
273 * \param depth user specified.
274 * \param format user specified.
275 * \param type user specified.
276 * \param pixels user specified.
277 * \param packing indicates the image packing of pixels.
278 * \param texObj is the target texture object.
279 * \param texImage is the target texture image. It will have the texture \p
280 * width, \p height, \p border and \p internalFormat information.
282 * The driver should use a fallback routine from texstore.c if needed.
284 void (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
285 GLint xoffset
, GLsizei width
,
286 GLenum format
, GLenum type
,
287 const GLvoid
*pixels
,
288 const struct gl_pixelstore_attrib
*packing
,
289 struct gl_texture_object
*texObj
,
290 struct gl_texture_image
*texImage
);
293 * Called by glTexSubImage2D().
295 * \sa dd_function_table::TexSubImage1D.
297 void (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
298 GLint xoffset
, GLint yoffset
,
299 GLsizei width
, GLsizei height
,
300 GLenum format
, GLenum type
,
301 const GLvoid
*pixels
,
302 const struct gl_pixelstore_attrib
*packing
,
303 struct gl_texture_object
*texObj
,
304 struct gl_texture_image
*texImage
);
307 * Called by glTexSubImage3D().
309 * \sa dd_function_table::TexSubImage1D.
311 void (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
312 GLint xoffset
, GLint yoffset
, GLint zoffset
,
313 GLsizei width
, GLsizei height
, GLint depth
,
314 GLenum format
, GLenum type
,
315 const GLvoid
*pixels
,
316 const struct gl_pixelstore_attrib
*packing
,
317 struct gl_texture_object
*texObj
,
318 struct gl_texture_image
*texImage
);
321 * Called by glCopyTexImage1D().
323 * Drivers should use a fallback routine from texstore.c if needed.
325 void (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
326 GLenum internalFormat
, GLint x
, GLint y
,
327 GLsizei width
, GLint border
);
330 * Called by glCopyTexImage2D().
332 * Drivers should use a fallback routine from texstore.c if needed.
334 void (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
335 GLenum internalFormat
, GLint x
, GLint y
,
336 GLsizei width
, GLsizei height
, GLint border
);
339 * Called by glCopyTexSubImage1D().
341 * Drivers should use a fallback routine from texstore.c if needed.
343 void (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
345 GLint x
, GLint y
, GLsizei width
);
347 * Called by glCopyTexSubImage2D().
349 * Drivers should use a fallback routine from texstore.c if needed.
351 void (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
352 GLint xoffset
, GLint yoffset
,
354 GLsizei width
, GLsizei height
);
356 * Called by glCopyTexSubImage3D().
358 * Drivers should use a fallback routine from texstore.c if needed.
360 void (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
361 GLint xoffset
, GLint yoffset
, GLint zoffset
,
363 GLsizei width
, GLsizei height
);
366 * Called by glTexImage[123]D when user specifies a proxy texture
369 * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
371 GLboolean (*TestProxyTexImage
)(GLcontext
*ctx
, GLenum target
,
372 GLint level
, GLint internalFormat
,
373 GLenum format
, GLenum type
,
374 GLint width
, GLint height
,
375 GLint depth
, GLint border
);
380 * \name Compressed texture functions
385 * Called by glCompressedTexImage1D().
387 * \param target user specified.
388 * \param format user specified.
389 * \param type user specified.
390 * \param pixels user specified.
391 * \param packing indicates the image packing of pixels.
392 * \param texObj is the target texture object.
393 * \param texImage is the target texture image. It will have the texture \p
394 * width, \p height, \p depth, \p border and \p internalFormat information.
396 * \a retainInternalCopy is returned by this function and indicates whether
397 * core Mesa should keep an internal copy of the texture image.
399 void (*CompressedTexImage1D
)( GLcontext
*ctx
, GLenum target
,
400 GLint level
, GLint internalFormat
,
401 GLsizei width
, GLint border
,
402 GLsizei imageSize
, const GLvoid
*data
,
403 struct gl_texture_object
*texObj
,
404 struct gl_texture_image
*texImage
);
406 * Called by glCompressedTexImage2D().
408 * \sa dd_function_table::CompressedTexImage1D.
410 void (*CompressedTexImage2D
)( GLcontext
*ctx
, GLenum target
,
411 GLint level
, GLint internalFormat
,
412 GLsizei width
, GLsizei height
, GLint border
,
413 GLsizei imageSize
, const GLvoid
*data
,
414 struct gl_texture_object
*texObj
,
415 struct gl_texture_image
*texImage
);
417 * Called by glCompressedTexImage3D().
419 * \sa dd_function_table::CompressedTexImage3D.
421 void (*CompressedTexImage3D
)( GLcontext
*ctx
, GLenum target
,
422 GLint level
, GLint internalFormat
,
423 GLsizei width
, GLsizei height
, GLsizei depth
,
425 GLsizei imageSize
, const GLvoid
*data
,
426 struct gl_texture_object
*texObj
,
427 struct gl_texture_image
*texImage
);
430 * Called by glCompressedTexSubImage1D().
432 * \param target user specified.
433 * \param level user specified.
434 * \param xoffset user specified.
435 * \param yoffset user specified.
436 * \param zoffset user specified.
437 * \param width user specified.
438 * \param height user specified.
439 * \param depth user specified.
440 * \param imageSize user specified.
441 * \param data user specified.
442 * \param texObj is the target texture object.
443 * \param texImage is the target texture image. It will have the texture \p
444 * width, \p height, \p depth, \p border and \p internalFormat information.
446 void (*CompressedTexSubImage1D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
447 GLint xoffset
, GLsizei width
,
449 GLsizei imageSize
, const GLvoid
*data
,
450 struct gl_texture_object
*texObj
,
451 struct gl_texture_image
*texImage
);
453 * Called by glCompressedTexSubImage2D().
455 * \sa dd_function_table::CompressedTexImage3D.
457 void (*CompressedTexSubImage2D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
458 GLint xoffset
, GLint yoffset
,
459 GLsizei width
, GLint height
,
461 GLsizei imageSize
, const GLvoid
*data
,
462 struct gl_texture_object
*texObj
,
463 struct gl_texture_image
*texImage
);
465 * Called by glCompressedTexSubImage3D().
467 * \sa dd_function_table::CompressedTexImage3D.
469 void (*CompressedTexSubImage3D
)(GLcontext
*ctx
, GLenum target
, GLint level
,
470 GLint xoffset
, GLint yoffset
, GLint zoffset
,
471 GLsizei width
, GLint height
, GLint depth
,
473 GLsizei imageSize
, const GLvoid
*data
,
474 struct gl_texture_object
*texObj
,
475 struct gl_texture_image
*texImage
);
479 * \name Texture object functions
484 * Called by glBindTexture().
486 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
487 struct gl_texture_object
*tObj
);
490 * Called when a texture object is created.
492 void (*CreateTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
495 * Called to allocate a new texture object.
497 * \note This function pointer should be initialized by drivers \e before
498 * calling _mesa_initialize_context() since context initialization involves
499 * allocating some texture objects!
501 struct gl_texture_object
* (*NewTextureObject
)( GLcontext
*ctx
, GLuint name
,
504 * Called when a texture object is about to be deallocated.
506 * Driver should free anything attached to the DriverData pointers.
508 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
511 * Called to allocate a new texture image object.
513 struct gl_texture_image
* (*NewTextureImage
)( GLcontext
*ctx
);
516 * Called by glAreTextureResident().
518 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
519 struct gl_texture_object
*t
);
522 * Called by glPrioritizeTextures().
524 void (*PrioritizeTexture
)( GLcontext
*ctx
, struct gl_texture_object
*t
,
528 * Called by glActiveTextureARB() to set current texture unit.
530 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
533 * Called when the texture's color lookup table is changed.
535 * If \p tObj is NULL then the shared texture palette
536 * gl_texture_object::Palette is to be updated.
538 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
539 struct gl_texture_object
*tObj
);
544 * \name Imaging functionality
547 void (*CopyColorTable
)( GLcontext
*ctx
,
548 GLenum target
, GLenum internalformat
,
549 GLint x
, GLint y
, GLsizei width
);
551 void (*CopyColorSubTable
)( GLcontext
*ctx
,
552 GLenum target
, GLsizei start
,
553 GLint x
, GLint y
, GLsizei width
);
555 void (*CopyConvolutionFilter1D
)( GLcontext
*ctx
, GLenum target
,
556 GLenum internalFormat
,
557 GLint x
, GLint y
, GLsizei width
);
559 void (*CopyConvolutionFilter2D
)( GLcontext
*ctx
, GLenum target
,
560 GLenum internalFormat
,
562 GLsizei width
, GLsizei height
);
567 * \name State-changing functions.
569 * \note drawing functions are above.
571 * These functions are called by their corresponding OpenGL API functions.
572 * They are \e also called by the gl_PopAttrib() function!!!
573 * May add more functions like these to the device driver in the future.
576 /** Specify the alpha test function */
577 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLfloat ref
);
578 /** Set the blend color */
579 void (*BlendColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
580 /** Set the blend equation */
581 void (*BlendEquation
)(GLcontext
*ctx
, GLenum mode
);
582 /** Specify pixel arithmetic */
583 void (*BlendFunc
)(GLcontext
*ctx
, GLenum sfactor
, GLenum dfactor
);
584 void (*BlendFuncSeparate
)(GLcontext
*ctx
,
585 GLenum sfactorRGB
, GLenum dfactorRGB
,
586 GLenum sfactorA
, GLenum dfactorA
);
587 /** Specify clear values for the color buffers */
588 void (*ClearColor
)(GLcontext
*ctx
, const GLfloat color
[4]);
589 /** Specify the clear value for the depth buffer */
590 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
591 /** Specify the clear value for the color index buffers */
592 void (*ClearIndex
)(GLcontext
*ctx
, GLuint index
);
593 /** Specify the clear value for the stencil buffer */
594 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
595 /** Specify a plane against which all geometry is clipped */
596 void (*ClipPlane
)(GLcontext
*ctx
, GLenum plane
, const GLfloat
*equation
);
597 /** Enable and disable writing of frame buffer color components */
598 void (*ColorMask
)(GLcontext
*ctx
, GLboolean rmask
, GLboolean gmask
,
599 GLboolean bmask
, GLboolean amask
);
600 /** Cause a material color to track the current color */
601 void (*ColorMaterial
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
602 /** Specify whether front- or back-facing facets can be culled */
603 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
604 /** Define front- and back-facing polygons */
605 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
606 /** Specify the value used for depth buffer comparisons */
607 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
608 /** Enable or disable writing into the depth buffer */
609 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
610 /** Specify mapping of depth values from normalized device coordinates to window coordinates */
611 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
612 /** Enable or disable server-side gl capabilities */
613 void (*Enable
)(GLcontext
*ctx
, GLenum cap
, GLboolean state
);
614 /** Specify fog parameters */
615 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
616 /** Specify implementation-specific hints */
617 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
618 /** Control the writing of individual bits in the color index buffers */
619 void (*IndexMask
)(GLcontext
*ctx
, GLuint mask
);
620 /** Set light source parameters */
621 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
622 GLenum pname
, const GLfloat
*params
);
623 /** Set the lighting model parameters */
624 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
625 /** Specify the line stipple pattern */
626 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
627 /** Specify the width of rasterized lines */
628 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
629 /** Specify a logical pixel operation for color index rendering */
630 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
631 void (*PointParameterfv
)(GLcontext
*ctx
, GLenum pname
,
632 const GLfloat
*params
);
633 /** Specify the diameter of rasterized points */
634 void (*PointSize
)(GLcontext
*ctx
, GLfloat size
);
635 /** Select a polygon rasterization mode */
636 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
637 /** Set the scale and units used to calculate depth values */
638 void (*PolygonOffset
)(GLcontext
*ctx
, GLfloat factor
, GLfloat units
);
639 /** Set the polygon stippling pattern */
640 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
641 /** Set rasterization mode */
642 void (*RenderMode
)(GLcontext
*ctx
, GLenum mode
);
643 /** Define the scissor box */
644 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
645 /** Select flat or smooth shading */
646 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
647 /** Set function and reference value for stencil testing */
648 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
649 /** Control the writing of individual bits in the stencil planes */
650 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
651 /** Set stencil test actions */
652 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
653 void (*ActiveStencilFace
)(GLcontext
*ctx
, GLuint face
);
654 /** Control the generation of texture coordinates */
655 void (*TexGen
)(GLcontext
*ctx
, GLenum coord
, GLenum pname
,
656 const GLfloat
*params
);
657 /** Set texture environment parameters */
658 void (*TexEnv
)(GLcontext
*ctx
, GLenum target
, GLenum pname
,
659 const GLfloat
*param
);
660 /** Set texture parameters */
661 void (*TexParameter
)(GLcontext
*ctx
, GLenum target
,
662 struct gl_texture_object
*texObj
,
663 GLenum pname
, const GLfloat
*params
);
664 void (*TextureMatrix
)(GLcontext
*ctx
, GLuint unit
, const GLmatrix
*mat
);
665 /** Set the viewport */
666 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
671 * \name Vertex array functions
673 * Called by the corresponding OpenGL functions.
676 void (*VertexPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
677 GLsizei stride
, const GLvoid
*ptr
);
678 void (*NormalPointer
)(GLcontext
*ctx
, GLenum type
,
679 GLsizei stride
, const GLvoid
*ptr
);
680 void (*ColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
681 GLsizei stride
, const GLvoid
*ptr
);
682 void (*FogCoordPointer
)(GLcontext
*ctx
, GLenum type
,
683 GLsizei stride
, const GLvoid
*ptr
);
684 void (*IndexPointer
)(GLcontext
*ctx
, GLenum type
,
685 GLsizei stride
, const GLvoid
*ptr
);
686 void (*SecondaryColorPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
687 GLsizei stride
, const GLvoid
*ptr
);
688 void (*TexCoordPointer
)(GLcontext
*ctx
, GLint size
, GLenum type
,
689 GLsizei stride
, const GLvoid
*ptr
);
690 void (*EdgeFlagPointer
)(GLcontext
*ctx
, GLsizei stride
, const GLvoid
*ptr
);
691 void (*VertexAttribPointer
)(GLcontext
*ctx
, GLuint index
, GLint size
,
692 GLenum type
, GLsizei stride
, const GLvoid
*ptr
);
697 * \name State-query functions
699 * Return GL_TRUE if query was completed, GL_FALSE otherwise.
702 /** Return the value or values of a selected parameter */
703 GLboolean (*GetBooleanv
)(GLcontext
*ctx
, GLenum pname
, GLboolean
*result
);
704 /** Return the value or values of a selected parameter */
705 GLboolean (*GetDoublev
)(GLcontext
*ctx
, GLenum pname
, GLdouble
*result
);
706 /** Return the value or values of a selected parameter */
707 GLboolean (*GetFloatv
)(GLcontext
*ctx
, GLenum pname
, GLfloat
*result
);
708 /** Return the value or values of a selected parameter */
709 GLboolean (*GetIntegerv
)(GLcontext
*ctx
, GLenum pname
, GLint
*result
);
710 /** Return the value or values of a selected parameter */
711 GLboolean (*GetPointerv
)(GLcontext
*ctx
, GLenum pname
, GLvoid
**result
);
716 * \name Support for multiple T&L engines
721 * Bitmask of state changes that require the current T&L module to be
722 * validated, using ValidateTnlModule() below.
727 * Validate the current T&L module.
729 * This is called directly after UpdateState() when a state change that has
730 * occurred matches the dd_function_table::NeedValidate bitmask above. This
731 * ensures all computed values are up to date, thus allowing the driver to
732 * decide if the current T&L module needs to be swapped out.
734 * This must be non-NULL if a driver installs a custom T&L module and sets
735 * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
737 void (*ValidateTnlModule
)( GLcontext
*ctx
, GLuint new_state
);
740 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
741 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
742 #define PRIM_UNKNOWN GL_POLYGON+3
745 * Set by the driver-supplied T&L engine.
747 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
749 GLuint CurrentExecPrimitive
;
752 * Current state of an in-progress compilation.
754 * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
755 * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
757 GLuint CurrentSavePrimitive
;
760 #define FLUSH_STORED_VERTICES 0x1
761 #define FLUSH_UPDATE_CURRENT 0x2
763 * Set by the driver-supplied T&L engine whenever vertices are buffered
764 * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
767 * The dd_function_table::FlushVertices call below may be used to resolve
773 * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
774 * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
775 * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
776 * __GLcontextRec::Current and gl_light_attrib::Material
778 * Note that the default T&L engine never clears the
779 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
781 void (*FlushVertices
)( GLcontext
*ctx
, GLuint flags
);
784 * Notify driver that the special derived value _NeedEyeCoords has
787 void (*LightingSpaceChange
)( GLcontext
*ctx
);
790 * Called by glNewList().
792 * Let the T&L component know what is going on with display lists
793 * in time to make changes to dispatch tables, etc.
795 void (*NewList
)( GLcontext
*ctx
, GLuint list
, GLenum mode
);
797 * Called by glEndList().
799 * \sa dd_function_table::NewList.
801 void (*EndList
)( GLcontext
*ctx
);
804 * Called by glCallList(s), but not recursively.
806 * Notify the T&L component before and after calling a display list.
807 * Called by glCallList(s), but not recursively.
809 void (*BeginCallList
)( GLcontext
*ctx
, GLuint list
);
811 * Called by glEndCallList().
813 * \sa dd_function_table::BeginCallList.
815 void (*EndCallList
)( GLcontext
*ctx
);
818 * Let the T&L component know when the context becomes current.
820 void (*MakeCurrent
)( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
821 GLframebuffer
*readBuffer
);
824 * Called by glLockArraysEXT().
826 void (*LockArraysEXT
)( GLcontext
*ctx
, GLint first
, GLsizei count
);
828 * Called by UnlockArraysEXT().
830 void (*UnlockArraysEXT
)( GLcontext
*ctx
);
835 * \name Vertex buffer object functions
839 void (*BindBuffer
)( GLcontext
*ctx
, GLenum target
,
840 struct gl_buffer_object
*obj
);
842 struct gl_buffer_object
* (*NewBufferObject
)( GLcontext
*ctx
, int buffer
,
845 void (*DeleteBuffer
)( GLcontext
*ctx
, struct gl_buffer_object
*obj
);
847 void (*BufferData
)( GLcontext
*ctx
, GLenum target
, GLsizeiptrARB size
,
848 const GLvoid
*data
, GLenum usage
,
849 struct gl_buffer_object
*obj
);
851 void (*BufferSubData
)( GLcontext
*ctx
, GLenum target
, GLintptrARB offset
,
852 GLsizeiptrARB size
, const GLvoid
*data
,
853 struct gl_buffer_object
*obj
);
855 void (*GetBufferSubData
)( GLcontext
*ctx
, GLenum target
,
856 GLintptrARB offset
, GLsizeiptrARB size
,
857 GLvoid
*data
, struct gl_buffer_object
*obj
);
859 void * (*MapBuffer
)( GLcontext
*ctx
, GLenum target
, GLenum access
,
860 struct gl_buffer_object
*obj
);
862 GLboolean (*UnmapBuffer
)( GLcontext
*ctx
, GLenum target
,
863 struct gl_buffer_object
*obj
);
869 * Transform/Clip/Lighting interface
871 * Drivers present a reduced set of the functions possible in
872 * glBegin()/glEnd() objects. Core mesa provides translation stubs for the
873 * remaining functions to map down to these entry points.
875 * These are the initial values to be installed into dispatch by
876 * mesa. If the T&L driver wants to modify the dispatch table
877 * while installed, it must do so itself. It would be possible for
878 * the vertexformat to install it's own initial values for these
879 * functions, but this way there is an obvious list of what is
880 * expected of the driver.
882 * If the driver wants to hook in entry points other than those
883 * listed, it must restore them to their original values in
884 * the disable() callback, below.
891 void (*ArrayElement
)( GLint
); /* NOTE */
892 void (*Color3f
)( GLfloat
, GLfloat
, GLfloat
);
893 void (*Color3fv
)( const GLfloat
* );
894 void (*Color3ub
)( GLubyte
, GLubyte
, GLubyte
);
895 void (*Color3ubv
)( const GLubyte
* );
896 void (*Color4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
897 void (*Color4fv
)( const GLfloat
* );
898 void (*Color4ub
)( GLubyte
, GLubyte
, GLubyte
, GLubyte
);
899 void (*Color4ubv
)( const GLubyte
* );
900 void (*EdgeFlag
)( GLboolean
);
901 void (*EdgeFlagv
)( const GLboolean
* );
902 void (*EvalCoord1f
)( GLfloat
); /* NOTE */
903 void (*EvalCoord1fv
)( const GLfloat
* ); /* NOTE */
904 void (*EvalCoord2f
)( GLfloat
, GLfloat
); /* NOTE */
905 void (*EvalCoord2fv
)( const GLfloat
* ); /* NOTE */
906 void (*EvalPoint1
)( GLint
); /* NOTE */
907 void (*EvalPoint2
)( GLint
, GLint
); /* NOTE */
908 void (*FogCoordfEXT
)( GLfloat
);
909 void (*FogCoordfvEXT
)( const GLfloat
* );
910 void (*Indexi
)( GLint
);
911 void (*Indexiv
)( const GLint
* );
912 void (*Materialfv
)( GLenum face
, GLenum pname
, const GLfloat
* ); /* NOTE */
913 void (*MultiTexCoord1fARB
)( GLenum
, GLfloat
);
914 void (*MultiTexCoord1fvARB
)( GLenum
, const GLfloat
* );
915 void (*MultiTexCoord2fARB
)( GLenum
, GLfloat
, GLfloat
);
916 void (*MultiTexCoord2fvARB
)( GLenum
, const GLfloat
* );
917 void (*MultiTexCoord3fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
);
918 void (*MultiTexCoord3fvARB
)( GLenum
, const GLfloat
* );
919 void (*MultiTexCoord4fARB
)( GLenum
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
920 void (*MultiTexCoord4fvARB
)( GLenum
, const GLfloat
* );
921 void (*Normal3f
)( GLfloat
, GLfloat
, GLfloat
);
922 void (*Normal3fv
)( const GLfloat
* );
923 void (*SecondaryColor3fEXT
)( GLfloat
, GLfloat
, GLfloat
);
924 void (*SecondaryColor3fvEXT
)( const GLfloat
* );
925 void (*SecondaryColor3ubEXT
)( GLubyte
, GLubyte
, GLubyte
);
926 void (*SecondaryColor3ubvEXT
)( const GLubyte
* );
927 void (*TexCoord1f
)( GLfloat
);
928 void (*TexCoord1fv
)( const GLfloat
* );
929 void (*TexCoord2f
)( GLfloat
, GLfloat
);
930 void (*TexCoord2fv
)( const GLfloat
* );
931 void (*TexCoord3f
)( GLfloat
, GLfloat
, GLfloat
);
932 void (*TexCoord3fv
)( const GLfloat
* );
933 void (*TexCoord4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
934 void (*TexCoord4fv
)( const GLfloat
* );
935 void (*Vertex2f
)( GLfloat
, GLfloat
);
936 void (*Vertex2fv
)( const GLfloat
* );
937 void (*Vertex3f
)( GLfloat
, GLfloat
, GLfloat
);
938 void (*Vertex3fv
)( const GLfloat
* );
939 void (*Vertex4f
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
940 void (*Vertex4fv
)( const GLfloat
* );
941 void (*CallList
)( GLuint
); /* NOTE */
942 void (*Begin
)( GLenum
);
944 void (*VertexAttrib4fNV
)( GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
);
945 void (*VertexAttrib4fvNV
)( GLuint index
, const GLfloat
*v
);
950 void (*Rectf
)( GLfloat
, GLfloat
, GLfloat
, GLfloat
);
955 * These may or may not belong here. Heuristic: if an array is
956 * enabled, the installed vertex format should support that array and
957 * its current size natively.
960 void (*DrawArrays
)( GLenum mode
, GLint start
, GLsizei count
);
961 void (*DrawElements
)( GLenum mode
, GLsizei count
, GLenum type
,
962 const GLvoid
*indices
);
963 void (*DrawRangeElements
)( GLenum mode
, GLuint start
,
964 GLuint end
, GLsizei count
,
965 GLenum type
, const GLvoid
*indices
);
971 * If you don't support eval, fallback to the default vertex format
972 * on receiving an eval call and use the pipeline mechanism to
973 * provide partial T&L acceleration.
975 * Mesa will provide a set of helper functions to do eval within
976 * accelerated vertex formats, eventually...
979 void (*EvalMesh1
)( GLenum mode
, GLint i1
, GLint i2
);
980 void (*EvalMesh2
)( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
);
984 * Should core try to send colors to glColor4f or glColor4chan,
985 * where it has a choice?
987 GLboolean prefer_float_colors
;
991 #endif /* DD_INCLUDED */