1 /* $Id: dd.h,v 1.20 2000/03/20 23:45:59 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 struct gl_pixelstore_attrib
;
41 struct gl_pipeline_stage
;
44 /* THIS FILE ONLY INCLUDED BY types.h !!!!! */
48 * Device Driver (DD) interface
51 * All device driver functions are accessed through pointers in the
52 * dd_function_table struct (defined below) which is stored in the GLcontext
53 * struct. Since the device driver is strictly accessed trough a table of
54 * function pointers we can:
55 * 1. switch between a number of different device drivers at runtime.
56 * 2. use optimized functions dependant on current rendering state or
57 * frame buffer configuration.
59 * The function pointers in the dd_function_table struct are divided into
60 * two groups: mandatory and optional.
61 * Mandatory functions have to be implemented by every device driver.
62 * Optional functions may or may not be implemented by the device driver.
63 * The optional functions provide ways to take advantage of special hardware
64 * or optimized algorithms.
66 * The function pointers in the dd_function_table struct should first be
67 * initialized in the driver's "MakeCurrent" function. The "MakeCurrent"
68 * function is a little different in each device driver. See the X/Mesa,
69 * GLX, or OS/Mesa drivers for examples.
71 * Later, Mesa may call the dd_function_table's UpdateState() function.
72 * This function should initialize the dd_function_table's pointers again.
73 * The UpdateState() function is called whenever the core (GL) rendering
74 * state is changed in a way which may effect rasterization. For example,
75 * the TriangleFunc() pointer may have to point to different functions
76 * depending on whether smooth or flat shading is enabled.
78 * Note that the first argument to every device driver function is a
79 * GLcontext *. In turn, the GLcontext->DriverCtx pointer points to
80 * the driver-specific context struct. See the X/Mesa or OS/Mesa interface
83 * For more information about writing a device driver see the ddsample.c
84 * file and other device drivers (X/xmesa[1234].c, OSMesa/osmesa.c, etc)
88 * Look below in the dd_function_table struct definition for descriptions
89 * of each device driver function.
92 * In the future more function pointers may be added for glReadPixels
98 * RGBA = red/green/blue/alpha
99 * CI = color index (color mapped mode)
100 * mono = all pixels have the same color or index
102 * The write_ functions all take an array of mask flags which indicate
103 * whether or not the pixel should be written. One special case exists
104 * in the write_color_span function: if the mask array is NULL, then
105 * draw all pixels. This is an optimization used for glDrawPixels().
108 * X coordinates start at 0 at the left and increase to the right
109 * Y coordinates start at 0 at the bottom and increase upward
116 /* Used by the GetParameteri device driver function */
117 #define DD_HAVE_HARDWARE_FOG 3
121 /* Mask bits sent to the driver Clear() function */
122 #define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
123 #define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
124 #define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */
125 #define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */
126 #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
127 #define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
128 #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
133 * Device Driver function table.
135 struct dd_function_table
{
137 /**********************************************************************
138 *** Mandatory functions: these functions must be implemented by ***
139 *** every device driver. ***
140 **********************************************************************/
142 const GLubyte
* (*GetString
)( GLcontext
*ctx
, GLenum name
);
143 /* Return a string as needed by glGetString().
144 * Only the GL_RENDERER token must be implemented. Otherwise,
145 * NULL can be returned.
148 void (*UpdateState
)( GLcontext
*ctx
);
150 * UpdateState() is called whenver Mesa thinks the device driver should
151 * update its state and/or the other pointers (such as PointsFunc,
152 * LineFunc, or TriangleFunc).
155 void (*ClearIndex
)( GLcontext
*ctx
, GLuint index
);
157 * Called whenever glClearIndex() is called. Set the index for clearing
158 * the color buffer when in color index mode.
161 void (*ClearColor
)( GLcontext
*ctx
, GLubyte red
, GLubyte green
,
162 GLubyte blue
, GLubyte alpha
);
164 * Called whenever glClearColor() is called. Set the color for clearing
165 * the color buffer when in RGBA mode.
168 GLbitfield (*Clear
)( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
169 GLint x
, GLint y
, GLint width
, GLint height
);
170 /* Clear the color/depth/stencil/accum buffer(s).
171 * 'mask' is a bitmask of the DD_*_BIT values defined above that indicates
172 * which buffers need to be cleared. The driver should clear those
173 * buffers then return a new bitmask indicating which buffers should be
174 * cleared by software Mesa.
175 * If 'all' is true then the clear the whole buffer, else clear only the
176 * region defined by (x,y,width,height).
177 * This function must obey the glColorMask, glIndexMask and glStencilMask
178 * settings! Software Mesa can do masked clears if the device driver can't.
181 void (*Index
)( GLcontext
*ctx
, GLuint index
);
183 * Sets current color index for drawing flat-shaded primitives.
184 * This index should also be used in the "mono" drawing functions.
187 void (*Color
)( GLcontext
*ctx
,
188 GLubyte red
, GLubyte green
, GLubyte glue
, GLubyte alpha
);
190 * Sets current color for drawing flat-shaded primitives.
191 * This color should also be used in the "mono" drawing functions.
194 GLboolean (*SetDrawBuffer
)( GLcontext
*ctx
, GLenum buffer
);
196 * Specifies the current buffer for writing.
197 * The following values must be accepted when applicable:
198 * GL_FRONT_LEFT - this buffer always exists
199 * GL_BACK_LEFT - when double buffering
200 * GL_FRONT_RIGHT - when using stereo
201 * GL_BACK_RIGHT - when using stereo and double buffering
202 * The folowing values may optionally be accepted. Return GL_TRUE
203 * if accepted, GL_FALSE if not accepted. In practice, only drivers
204 * which can write to multiple color buffers at once should accept
206 * GL_FRONT - write to front left and front right if it exists
207 * GL_BACK - write to back left and back right if it exists
208 * GL_LEFT - write to front left and back left if it exists
209 * GL_RIGHT - write to right left and back right if they exist
210 * GL_FRONT_AND_BACK - write to all four buffers if they exist
211 * GL_NONE - disable buffer write in device driver.
214 void (*SetReadBuffer
)( GLcontext
*ctx
, GLframebuffer
*colorBuffer
,
217 * Specifies the current buffer for reading.
218 * colorBuffer will be one of:
219 * GL_FRONT_LEFT - this buffer always exists
220 * GL_BACK_LEFT - when double buffering
221 * GL_FRONT_RIGHT - when using stereo
222 * GL_BACK_RIGHT - when using stereo and double buffering
225 void (*GetBufferSize
)( GLcontext
*ctx
, GLuint
*width
, GLuint
*height
);
227 * Returns the width and height of the current color buffer.
232 *** Functions for writing pixels to the frame buffer:
235 void (*WriteRGBASpan
)( const GLcontext
*ctx
,
236 GLuint n
, GLint x
, GLint y
,
237 CONST GLubyte rgba
[][4], const GLubyte mask
[] );
238 void (*WriteRGBSpan
)( const GLcontext
*ctx
,
239 GLuint n
, GLint x
, GLint y
,
240 CONST GLubyte rgb
[][3], const GLubyte mask
[] );
241 /* Write a horizontal run of RGBA or RGB pixels.
242 * If mask is NULL, draw all pixels.
243 * If mask is not null, only draw pixel [i] when mask [i] is true.
246 void (*WriteMonoRGBASpan
)( const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
247 const GLubyte mask
[] );
248 /* Write a horizontal run of RGBA pixels all with the color last
249 * specified by the Color function.
252 void (*WriteRGBAPixels
)( const GLcontext
*ctx
,
253 GLuint n
, const GLint x
[], const GLint y
[],
254 CONST GLubyte rgba
[][4], const GLubyte mask
[] );
255 /* Write array of RGBA pixels at random locations.
258 void (*WriteMonoRGBAPixels
)( const GLcontext
*ctx
,
259 GLuint n
, const GLint x
[], const GLint y
[],
260 const GLubyte mask
[] );
261 /* Write an array of mono-RGBA pixels at random locations.
264 void (*WriteCI32Span
)( const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
265 const GLuint index
[], const GLubyte mask
[] );
266 void (*WriteCI8Span
)( const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
267 const GLubyte index
[], const GLubyte mask
[] );
268 /* Write a horizontal run of CI pixels. One function is for 32bpp
269 * indexes and the other for 8bpp pixels (the common case). You mus
270 * implement both for color index mode.
273 void (*WriteMonoCISpan
)( const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
274 const GLubyte mask
[] );
275 /* Write a horizontal run of color index pixels using the color index
276 * last specified by the Index() function.
279 void (*WriteCI32Pixels
)( const GLcontext
*ctx
,
280 GLuint n
, const GLint x
[], const GLint y
[],
281 const GLuint index
[], const GLubyte mask
[] );
283 * Write a random array of CI pixels.
286 void (*WriteMonoCIPixels
)( const GLcontext
*ctx
,
287 GLuint n
, const GLint x
[], const GLint y
[],
288 const GLubyte mask
[] );
289 /* Write a random array of color index pixels using the color index
290 * last specified by the Index() function.
295 *** Functions to read pixels from frame buffer:
298 void (*ReadCI32Span
)( const GLcontext
*ctx
,
299 GLuint n
, GLint x
, GLint y
, GLuint index
[] );
300 /* Read a horizontal run of color index pixels.
303 void (*ReadRGBASpan
)( const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
305 /* Read a horizontal run of RGBA pixels.
308 void (*ReadCI32Pixels
)( const GLcontext
*ctx
,
309 GLuint n
, const GLint x
[], const GLint y
[],
310 GLuint indx
[], const GLubyte mask
[] );
311 /* Read a random array of CI pixels.
314 void (*ReadRGBAPixels
)( const GLcontext
*ctx
,
315 GLuint n
, const GLint x
[], const GLint y
[],
316 GLubyte rgba
[][4], const GLubyte mask
[] );
317 /* Read a random array of RGBA pixels.
321 /**********************************************************************
322 *** Optional functions: these functions may or may not be ***
323 *** implemented by the device driver. If the device driver ***
324 *** doesn't implement them it should never touch these pointers ***
325 *** since Mesa will either set them to NULL or point them at a ***
326 *** fall-back function. ***
327 **********************************************************************/
329 void (*Finish
)( GLcontext
*ctx
);
331 * This is called whenever glFinish() is called.
334 void (*Flush
)( GLcontext
*ctx
);
336 * This is called whenever glFlush() is called.
339 GLboolean (*IndexMask
)( GLcontext
*ctx
, GLuint mask
);
341 * Implements glIndexMask() if possible, else return GL_FALSE.
344 GLboolean (*ColorMask
)( GLcontext
*ctx
,
345 GLboolean rmask
, GLboolean gmask
,
346 GLboolean bmask
, GLboolean amask
);
348 * Implements glColorMask() if possible, else return GL_FALSE.
351 GLboolean (*LogicOp
)( GLcontext
*ctx
, GLenum op
);
353 * Implements glLogicOp() if possible, else return GL_FALSE.
356 void (*Dither
)( GLcontext
*ctx
, GLboolean enable
);
358 * Enable/disable dithering.
359 * NOTE: This function will be removed in the future in favor
360 * of the "Enable" driver function.
363 void (*Error
)( GLcontext
*ctx
);
365 * Called whenever an error is generated. ctx->ErrorValue contains
369 void (*NearFar
)( GLcontext
*ctx
, GLfloat nearVal
, GLfloat farVal
);
371 * Called from glFrustum and glOrtho to tell device driver the
372 * near and far clipping plane Z values. The 3Dfx driver, for example,
376 GLint (*GetParameteri
)( const GLcontext
*ctx
, GLint param
);
377 /* Query the device driver to get an integer parameter.
378 * Current parameters:
379 * DD_MAX_TEXTURE_SIZE return maximum texture size
381 * DD_MAX_TEXTURES number of texture sets/stages, usually 1
383 * DD_HAVE_HARDWARE_FOG the driver should return 1 (0 otherwise)
384 * when the hardware support per fragment
385 * fog for free (like the Voodoo Graphics)
386 * so the Mesa core will start to ever use
392 *** For supporting hardware Z buffers:
393 *** Either ALL or NONE of these functions must be implemented!
394 *** NOTE that Each depth value is a 32-bit GLuint. If the depth
395 *** buffer is less than 32 bits deep then the extra upperbits are zero.
398 void (*WriteDepthSpan
)( GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
399 const GLdepth depth
[], const GLubyte mask
[] );
400 /* Write a horizontal span of values into the depth buffer. Only write
401 * depth[i] value if mask[i] is nonzero.
404 void (*ReadDepthSpan
)( GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
406 /* Read a horizontal span of values from the depth buffer.
410 void (*WriteDepthPixels
)( GLcontext
*ctx
, GLuint n
,
411 const GLint x
[], const GLint y
[],
412 const GLdepth depth
[], const GLubyte mask
[] );
413 /* Write an array of randomly positioned depth values into the
414 * depth buffer. Only write depth[i] value if mask[i] is nonzero.
417 void (*ReadDepthPixels
)( GLcontext
*ctx
, GLuint n
,
418 const GLint x
[], const GLint y
[],
420 /* Read an array of randomly positioned depth values from the depth buffer.
426 *** For supporting hardware stencil buffers:
427 *** Either ALL or NONE of these functions must be implemented!
430 void (*WriteStencilSpan
)( GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
431 const GLstencil stencil
[], const GLubyte mask
[] );
432 /* Write a horizontal span of stencil values into the stencil buffer.
433 * If mask is NULL, write all stencil values.
434 * Else, only write stencil[i] if mask[i] is non-zero.
438 void (*ReadStencilSpan
)( GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
439 GLstencil stencil
[] );
440 /* Read a horizontal span of stencil values from the stencil buffer.
444 void (*WriteStencilPixels
)( GLcontext
*ctx
, GLuint n
,
445 const GLint x
[], const GLint y
[],
446 const GLstencil stencil
[],
447 const GLubyte mask
[] );
448 /* Write an array of stencil values into the stencil buffer.
449 * If mask is NULL, write all stencil values.
450 * Else, only write stencil[i] if mask[i] is non-zero.
453 void (*ReadStencilPixels
)( GLcontext
*ctx
, GLuint n
,
454 const GLint x
[], const GLint y
[],
455 GLstencil stencil
[] );
456 /* Read an array of stencil values from the stencil buffer.
462 *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions:
465 points_func PointsFunc
;
467 triangle_func TriangleFunc
;
472 GLboolean (*DrawPixels
)( GLcontext
*ctx
,
473 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
474 GLenum format
, GLenum type
,
475 const struct gl_pixelstore_attrib
*unpack
,
476 const GLvoid
*pixels
);
477 /* This is called by glDrawPixels.
478 * 'unpack' describes how to unpack the source image data.
479 * Return GL_TRUE if the driver succeeds, return GL_FALSE if core Mesa
483 GLboolean (*ReadPixels
)( GLcontext
*ctx
,
484 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
485 GLenum format
, GLenum type
,
486 const struct gl_pixelstore_attrib
*unpack
,
488 /* Called by glReadPixels.
489 * Return GL_TRUE if operation completed, else return GL_FALSE.
490 * This function must respect all glPixelTransfer settings.
493 GLboolean (*CopyPixels
)( GLcontext
*ctx
,
494 GLint srcx
, GLint srcy
,
495 GLsizei width
, GLsizei height
,
496 GLint dstx
, GLint dsty
, GLenum type
);
497 /* Do a glCopyPixels. Return GL_TRUE if operation completed, else
498 * return GL_FALSE. This function must respect all rasterization
499 * state, glPixelTransfer, glPixelZoom, etc.
502 GLboolean (*Bitmap
)( GLcontext
*ctx
,
503 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
504 const struct gl_pixelstore_attrib
*unpack
,
505 const GLubyte
*bitmap
);
506 /* This is called by glBitmap. Works the same as DrawPixels, above.
510 *** Texture mapping functions:
513 void (*TexEnv
)( GLcontext
*ctx
, GLenum target
, GLenum pname
,
514 const GLfloat
*param
);
516 * Called whenever glTexEnv*() is called.
519 void (*TexImage
)( GLcontext
*ctx
, GLenum target
,
520 struct gl_texture_object
*tObj
, GLint level
,
521 GLint internalFormat
,
522 const struct gl_texture_image
*image
);
524 * Called whenever a texture object's image is changed.
525 * texObject is the number of the texture object being changed.
526 * level indicates the mipmap level.
527 * internalFormat is the format in which the texture is to be stored.
528 * image is a pointer to a gl_texture_image struct which contains
529 * the actual image data.
532 void (*TexSubImage
)( GLcontext
*ctx
, GLenum target
,
533 struct gl_texture_object
*tObj
, GLint level
,
534 GLint xoffset
, GLint yoffset
,
535 GLsizei width
, GLsizei height
,
536 GLint internalFormat
,
537 const struct gl_texture_image
*image
);
539 * Called from glTexSubImage() to define a sub-region of a texture.
543 GLboolean (*TexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
544 GLenum format
, GLenum type
, const GLvoid
*pixels
,
545 const struct gl_pixelstore_attrib
*packing
,
546 struct gl_texture_object
*texObj
,
547 struct gl_texture_image
*texImage
,
548 GLboolean
*retainInternalCopy
);
549 GLboolean (*TexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
550 GLenum format
, GLenum type
, const GLvoid
*pixels
,
551 const struct gl_pixelstore_attrib
*packing
,
552 struct gl_texture_object
*texObj
,
553 struct gl_texture_image
*texImage
,
554 GLboolean
*retainInternalCopy
);
555 GLboolean (*TexImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
556 GLenum format
, GLenum type
, const GLvoid
*pixels
,
557 const struct gl_pixelstore_attrib
*packing
,
558 struct gl_texture_object
*texObj
,
559 struct gl_texture_image
*texImage
,
560 GLboolean
*retainInternalCopy
);
561 /* Called by glTexImage1/2/3D.
562 * Will not be called if any glPixelTransfer operations are enabled.
564 * <target>, <level>, <format>, <type> and <pixels> are user specified.
565 * <packing> indicates the image packing of pixels.
566 * <texObj> is the target texture object.
567 * <texImage> is the target texture image. It will have the texture
568 * width, height, depth, border and internalFormat information.
569 * <retainInternalCopy> is returned by this function and indicates whether
570 * core Mesa should keep an internal copy of the texture image.
571 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
572 * should do the job. If GL_FALSE is returned, this function will be
573 * called a second time after the texture image has been unpacked into
574 * GLubytes. It may be easier for the driver to handle then.
577 GLboolean (*TexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
578 GLint xoffset
, GLsizei width
,
579 GLenum format
, GLenum type
,
580 const GLvoid
*pixels
,
581 const struct gl_pixelstore_attrib
*packing
,
582 struct gl_texture_object
*texObj
,
583 struct gl_texture_image
*texImage
,
584 GLboolean
*retainInternalCopy
);
585 GLboolean (*TexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
586 GLint xoffset
, GLint yoffset
,
587 GLsizei width
, GLsizei height
,
588 GLenum format
, GLenum type
,
589 const GLvoid
*pixels
,
590 const struct gl_pixelstore_attrib
*packing
,
591 struct gl_texture_object
*texObj
,
592 struct gl_texture_image
*texImage
,
593 GLboolean
*retainInternalCopy
);
594 GLboolean (*TexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
595 GLint xoffset
, GLint yoffset
, GLint zoffset
,
596 GLsizei width
, GLsizei height
, GLint depth
,
597 GLenum format
, GLenum type
,
598 const GLvoid
*pixels
,
599 const struct gl_pixelstore_attrib
*packing
,
600 struct gl_texture_object
*texObj
,
601 struct gl_texture_image
*texImage
,
602 GLboolean
*retainInternalCopy
);
604 /* Called by glTexSubImage1/2/3D.
605 * Will not be called if any glPixelTransfer operations are enabled.
607 * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>,
608 * <depth>, <format>, <type> and <pixels> are user specified.
609 * <packing> indicates the image packing of pixels.
610 * <texObj> is the target texture object.
611 * <texImage> is the target texture image. It will have the texture
612 * width, height, border and internalFormat information.
613 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
614 * should do the job. If GL_FALSE is returned, this function will be
615 * called a second time after the texture image has been unpacked into
616 * GLubytes. It may be easier for the driver to handle then.
622 GLboolean (*CopyTexImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
623 GLenum internalFormat
, GLint x
, GLint y
,
624 GLsizei width
, GLint border
);
625 GLboolean (*CopyTexImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
626 GLenum internalFormat
, GLint x
, GLint y
,
627 GLsizei width
, GLsizei height
, GLint border
);
628 /* Called by glCopyTexImage1D and glCopyTexImage2D.
629 * Will not be called if any glPixelTransfer operations are enabled.
630 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
634 GLboolean (*CopyTexSubImage1D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
636 GLint x
, GLint y
, GLsizei width
);
637 GLboolean (*CopyTexSubImage2D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
638 GLint xoffset
, GLint yoffset
,
640 GLsizei width
, GLsizei height
);
641 GLboolean (*CopyTexSubImage3D
)( GLcontext
*ctx
, GLenum target
, GLint level
,
642 GLint xoffset
, GLint yoffset
, GLint zoffset
,
644 GLsizei width
, GLsizei height
);
645 /* Called by glCopyTexSubImage1/2/3D.
646 * Will not be called if any glPixelTransfer operations are enabled.
647 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
651 GLvoid
*(*GetTexImage
)( GLcontext
*ctx
, GLenum target
, GLint level
,
652 GLenum
*formatOut
, GLenum
*typeOut
,
653 GLboolean
*freeImageOut
);
654 /* Called by glGetTexImage or by core Mesa when a texture image
655 * is needed for software fallback rendering.
656 * Return the address of the texture image or NULL if failure.
657 * The image must be tightly packed (i.e. row stride = image width)
658 * Return the image's format and type in formatOut and typeOut.
659 * The format and type must be values which are accepted by glTexImage.
660 * Set the freeImageOut flag if the returned image should be deallocated
661 * with FREE() when finished.
662 * The size of the image can be deduced from the target and level.
663 * Core Mesa will perform any image format/type conversions that are needed.
666 void (*TexParameter
)( GLcontext
*ctx
, GLenum target
,
667 struct gl_texture_object
*tObj
,
668 GLenum pname
, const GLfloat
*params
);
670 * Called whenever glTexParameter*() is called.
671 * target is GL_TEXTURE_1D or GL_TEXTURE_2D
672 * texObject is the texture object to modify
673 * pname is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER,
674 * GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_BORDER_COLOR.
675 * params is dependant on pname. See man glTexParameter.
678 void (*BindTexture
)( GLcontext
*ctx
, GLenum target
,
679 struct gl_texture_object
*tObj
);
681 * Called whenever glBindTexture() is called. This specifies which
682 * texture is to be the current one. No dirty flags will be set.
685 void (*DeleteTexture
)( GLcontext
*ctx
, struct gl_texture_object
*tObj
);
687 * Called when a texture object is about to be deallocated. Driver
688 * should free anything attached to the DriverData pointers.
691 void (*UpdateTexturePalette
)( GLcontext
*ctx
,
692 struct gl_texture_object
*tObj
);
694 * Called when the texture's color lookup table is changed.
695 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
699 void (*ActiveTexture
)( GLcontext
*ctx
, GLuint texUnitNumber
);
701 * Called by glActiveTextureARB to set current texture unit.
705 GLboolean (*IsTextureResident
)( GLcontext
*ctx
,
706 struct gl_texture_object
*t
);
708 * Allows the driver to implement the AreTexturesResident tests without
709 * knowing about Mesa's internal hash tables for textures.
712 void (*PrioritizeTexture
)( GLcontext
*ctx
,
713 struct gl_texture_object
*t
,
715 /* Notify driver of priority change for a texture.
720 *** Transformation/Rendering functions
723 void (*RenderStart
)( GLcontext
*ctx
);
724 void (*RenderFinish
)( GLcontext
*ctx
);
725 /* KW: These replace Begin and End, and have more relaxed semantics.
726 * They are called prior-to and after one or more vb flush, and are
727 * thus decoupled from the gl_begin/gl_end pairs, which are possibly
728 * more frequent. If a begin/end pair covers >1 vertex buffer, these
729 * are called at most once for the pair. (a bit broken at present)
732 void (*RasterSetup
)( struct vertex_buffer
*VB
, GLuint start
, GLuint end
);
733 /* This function, if not NULL, is called whenever new window coordinates
734 * are put in the vertex buffer. The vertices in question are those n
735 * such that start <= n < end.
736 * The device driver can convert the window coords to its own specialized
737 * format. The 3Dfx driver uses this.
739 * Note: Deprecated in favour of RegisterPipelineStages, below.
742 render_func
*RenderVBClippedTab
;
743 render_func
*RenderVBCulledTab
;
744 render_func
*RenderVBRawTab
;
745 /* These function tables allow the device driver to rasterize an
746 * entire begin/end group of primitives at once. See the
747 * gl_render_vb() function in vbrender.c for more details.
750 void (*ReducedPrimitiveChange
)( GLcontext
*ctx
, GLenum primitive
);
751 /* If registered, this will be called when rendering transitions between
752 * points, lines and triangles. It is not called on transitions between
753 * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between
754 * triangles and quads or triangles and polygons.
758 /* Holds a list of the reasons why we might normally want to call
759 * render_triangle, but which are in fact implemented by the
760 * driver. The FX driver sets this to DD_TRI_CULL, and will soon
761 * implement DD_TRI_OFFSET.
764 GLboolean (*MultipassFunc
)( struct vertex_buffer
*VB
, GLuint passno
);
765 /* Driver may request additional render passes by returning GL_TRUE
766 * when this function is called. This function will be called
767 * after the first pass, and passes will be made until the function
768 * returns GL_FALSE. If no function is registered, only one pass
771 * This function will be first invoked with passno == 1.
778 void (*RegisterVB
)( struct vertex_buffer
*VB
);
779 void (*UnregisterVB
)( struct vertex_buffer
*VB
);
780 /* Do any processing (eg allocate memory) required to set up a new
785 void (*ResetVB
)( struct vertex_buffer
*VB
);
786 void (*ResetCvaVB
)( struct vertex_buffer
*VB
, GLuint stages
);
787 /* Do any reset operations necessary to the driver data associated
788 * with these vertex buffers.
791 GLuint RenderVectorFlags
;
792 /* What do the render tables require of the vectors they deal
796 GLuint (*RegisterPipelineStages
)( struct gl_pipeline_stage
*out
,
797 const struct gl_pipeline_stage
*in
,
799 /* Register new pipeline stages, or modify existing ones. See also
800 * the OptimizePipeline() functions.
804 GLboolean (*BuildPrecalcPipeline
)( GLcontext
*ctx
);
805 GLboolean (*BuildEltPipeline
)( GLcontext
*ctx
);
806 /* Perform the full pipeline build, or return false.
810 void (*OptimizePrecalcPipeline
)( GLcontext
*ctx
, struct gl_pipeline
*pipe
);
811 void (*OptimizeImmediatePipeline
)( GLcontext
*ctx
, struct gl_pipeline
*pipe
);
812 /* Check to see if a fast path exists for this combination of stages
813 * in the precalc and immediate (elt) pipelines.
818 * State-changing functions (drawing functions are above)
820 * These functions are called by their corresponding OpenGL API functions.
821 * They're ALSO called by the gl_PopAttrib() function!!!
822 * May add more functions like these to the device driver in the future.
823 * This should reduce the amount of state checking that
824 * the driver's UpdateState() function must do.
826 void (*AlphaFunc
)(GLcontext
*ctx
, GLenum func
, GLclampf ref
);
827 void (*BlendEquation
)(GLcontext
*ctx
, GLenum mode
);
828 void (*BlendFunc
)(GLcontext
*ctx
, GLenum sfactor
, GLenum dfactor
);
829 void (*BlendFuncSeparate
)( GLcontext
*ctx
, GLenum sfactorRGB
,
830 GLenum dfactorRGB
, GLenum sfactorA
,
832 void (*ClearDepth
)(GLcontext
*ctx
, GLclampd d
);
833 void (*CullFace
)(GLcontext
*ctx
, GLenum mode
);
834 void (*FrontFace
)(GLcontext
*ctx
, GLenum mode
);
835 void (*DepthFunc
)(GLcontext
*ctx
, GLenum func
);
836 void (*DepthMask
)(GLcontext
*ctx
, GLboolean flag
);
837 void (*DepthRange
)(GLcontext
*ctx
, GLclampd nearval
, GLclampd farval
);
838 void (*Enable
)(GLcontext
* ctx
, GLenum cap
, GLboolean state
);
839 void (*Fogfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
840 void (*Hint
)(GLcontext
*ctx
, GLenum target
, GLenum mode
);
841 void (*Lightfv
)(GLcontext
*ctx
, GLenum light
,
842 GLenum pname
, const GLfloat
*params
, GLint nparams
);
843 void (*LightModelfv
)(GLcontext
*ctx
, GLenum pname
, const GLfloat
*params
);
844 void (*LineStipple
)(GLcontext
*ctx
, GLint factor
, GLushort pattern
);
845 void (*LineWidth
)(GLcontext
*ctx
, GLfloat width
);
846 void (*LogicOpcode
)(GLcontext
*ctx
, GLenum opcode
);
847 void (*PolygonMode
)(GLcontext
*ctx
, GLenum face
, GLenum mode
);
848 void (*PolygonStipple
)(GLcontext
*ctx
, const GLubyte
*mask
);
849 void (*Scissor
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);
850 void (*ShadeModel
)(GLcontext
*ctx
, GLenum mode
);
851 void (*ClearStencil
)(GLcontext
*ctx
, GLint s
);
852 void (*StencilFunc
)(GLcontext
*ctx
, GLenum func
, GLint ref
, GLuint mask
);
853 void (*StencilMask
)(GLcontext
*ctx
, GLuint mask
);
854 void (*StencilOp
)(GLcontext
*ctx
, GLenum fail
, GLenum zfail
, GLenum zpass
);
855 void (*Viewport
)(GLcontext
*ctx
, GLint x
, GLint y
, GLsizei w
, GLsizei h
);