source: trunk/src/opengl/mesa/dd.h@ 3721

Last change on this file since 3721 was 3582, checked in by jeroen, 25 years ago

* empty log message *

File size: 34.4 KB
Line 
1/* $Id: dd.h,v 1.2 2000-05-21 20:30:06 jeroen Exp $ */
2
3/*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
8 *
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:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
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.
25 */
26
27
28
29#ifndef DD_INCLUDED
30#define DD_INCLUDED
31
32
33#include "macros.h"
34
35
36struct gl_pixelstore_attrib;
37
38
39struct vertex_buffer;
40struct immediate;
41struct gl_pipeline_stage;
42
43
44/* THIS FILE ONLY INCLUDED BY types.h !!!!! */
45
46
47/*
48 * Device Driver (DD) interface
49 *
50 *
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.
58 *
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.
65 *
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.
70 *
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.
77 *
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
81 * for an example.
82 *
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)
85 * for examples.
86 *
87 *
88 * Look below in the dd_function_table struct definition for descriptions
89 * of each device driver function.
90 *
91 *
92 * In the future more function pointers may be added for glReadPixels
93 * glCopyPixels, etc.
94 *
95 *
96 * Notes:
97 * ------
98 * RGBA = red/green/blue/alpha
99 * CI = color index (color mapped mode)
100 * mono = all pixels have the same color or index
101 *
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().
106 *
107 * IN ALL CASES:
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
110 *
111 */
112
113
114
115
116/* Used by the GetParameteri device driver function */
117#define DD_HAVE_HARDWARE_FOG 3
118
119
120
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 */
129
130
131
132/*
133 * Device Driver function table.
134 */
135struct dd_function_table {
136
137 /**********************************************************************
138 *** Mandatory functions: these functions must be implemented by ***
139 *** every device driver. ***
140 **********************************************************************/
141
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.
146 */
147
148 void (*UpdateState)( GLcontext *ctx );
149 /*
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).
153 */
154
155 void (*ClearIndex)( GLcontext *ctx, GLuint index );
156 /*
157 * Called whenever glClearIndex() is called. Set the index for clearing
158 * the color buffer when in color index mode.
159 */
160
161 void (*ClearColor)( GLcontext *ctx, GLubyte red, GLubyte green,
162 GLubyte blue, GLubyte alpha );
163 /*
164 * Called whenever glClearColor() is called. Set the color for clearing
165 * the color buffer when in RGBA mode.
166 */
167
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.
179 */
180
181 void (*Index)( GLcontext *ctx, GLuint index );
182 /*
183 * Sets current color index for drawing flat-shaded primitives.
184 * This index should also be used in the "mono" drawing functions.
185 */
186
187 void (*Color)( GLcontext *ctx,
188 GLubyte red, GLubyte green, GLubyte glue, GLubyte alpha );
189 /*
190 * Sets current color for drawing flat-shaded primitives.
191 * This color should also be used in the "mono" drawing functions.
192 */
193
194 GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
195 /*
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
205 * these values.
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.
212 */
213
214 void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer,
215 GLenum buffer );
216 /*
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
223 */
224
225 void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
226 /*
227 * Returns the width and height of the current color buffer.
228 */
229
230
231 /***
232 *** Functions for writing pixels to the frame buffer:
233 ***/
234
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.
244 */
245
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.
250 */
251
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.
256 */
257
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.
262 */
263
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.
271 */
272
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.
277 */
278
279 void (*WriteCI32Pixels)( const GLcontext *ctx,
280 GLuint n, const GLint x[], const GLint y[],
281 const GLuint index[], const GLubyte mask[] );
282 /*
283 * Write a random array of CI pixels.
284 */
285
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.
291 */
292
293
294 /***
295 *** Functions to read pixels from frame buffer:
296 ***/
297
298 void (*ReadCI32Span)( const GLcontext *ctx,
299 GLuint n, GLint x, GLint y, GLuint index[] );
300 /* Read a horizontal run of color index pixels.
301 */
302
303 void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
304 GLubyte rgba[][4] );
305 /* Read a horizontal run of RGBA pixels.
306 */
307
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.
312 */
313
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.
318 */
319
320
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 **********************************************************************/
328
329 void (*Finish)( GLcontext *ctx );
330 /*
331 * This is called whenever glFinish() is called.
332 */
333
334 void (*Flush)( GLcontext *ctx );
335 /*
336 * This is called whenever glFlush() is called.
337 */
338
339 GLboolean (*IndexMask)( GLcontext *ctx, GLuint mask );
340 /*
341 * Implements glIndexMask() if possible, else return GL_FALSE.
342 */
343
344 GLboolean (*ColorMask)( GLcontext *ctx,
345 GLboolean rmask, GLboolean gmask,
346 GLboolean bmask, GLboolean amask );
347 /*
348 * Implements glColorMask() if possible, else return GL_FALSE.
349 */
350
351 GLboolean (*LogicOp)( GLcontext *ctx, GLenum op );
352 /*
353 * Implements glLogicOp() if possible, else return GL_FALSE.
354 */
355
356 void (*Dither)( GLcontext *ctx, GLboolean enable );
357 /*
358 * Enable/disable dithering.
359 * NOTE: This function will be removed in the future in favor
360 * of the "Enable" driver function.
361 */
362
363 void (*Error)( GLcontext *ctx );
364 /*
365 * Called whenever an error is generated. ctx->ErrorValue contains
366 * the error value.
367 */
368
369 void (*NearFar)( GLcontext *ctx, GLfloat nearVal, GLfloat farVal );
370 /*
371 * Called from glFrustum and glOrtho to tell device driver the
372 * near and far clipping plane Z values. The 3Dfx driver, for example,
373 * uses this.
374 */
375
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
380 *
381 * DD_MAX_TEXTURES number of texture sets/stages, usually 1
382 *
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
387 * per fragment fog
388 */
389
390
391 /***
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.
396 ***/
397
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.
402 */
403
404 void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
405 GLdepth depth[] );
406 /* Read a horizontal span of values from the depth buffer.
407 */
408
409
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.
415 */
416
417 void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
418 const GLint x[], const GLint y[],
419 GLdepth depth[] );
420 /* Read an array of randomly positioned depth values from the depth buffer.
421 */
422
423
424
425 /***
426 *** For supporting hardware stencil buffers:
427 *** Either ALL or NONE of these functions must be implemented!
428 ***/
429
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.
435 */
436
437 void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
438 GLstencil stencil[] );
439 /* Read a horizontal span of stencil values from the stencil buffer.
440 */
441
442 void (*WriteStencilPixels)( GLcontext *ctx, GLuint n,
443 const GLint x[], const GLint y[],
444 const GLstencil stencil[],
445 const GLubyte mask[] );
446 /* Write an array of stencil values into the stencil buffer.
447 * If mask is NULL, write all stencil values.
448 * Else, only write stencil[i] if mask[i] is non-zero.
449 */
450
451 void (*ReadStencilPixels)( GLcontext *ctx, GLuint n,
452 const GLint x[], const GLint y[],
453 GLstencil stencil[] );
454 /* Read an array of stencil values from the stencil buffer.
455 */
456
457
458 /***
459 *** glDraw/Read/CopyPixels and glBitmap functions:
460 ***/
461
462 GLboolean (*DrawPixels)( GLcontext *ctx,
463 GLint x, GLint y, GLsizei width, GLsizei height,
464 GLenum format, GLenum type,
465 const struct gl_pixelstore_attrib *unpack,
466 const GLvoid *pixels );
467 /* This is called by glDrawPixels.
468 * 'unpack' describes how to unpack the source image data.
469 * Return GL_TRUE if the driver succeeds, return GL_FALSE if core Mesa
470 * must do the job.
471 */
472
473 GLboolean (*ReadPixels)( GLcontext *ctx,
474 GLint x, GLint y, GLsizei width, GLsizei height,
475 GLenum format, GLenum type,
476 const struct gl_pixelstore_attrib *unpack,
477 GLvoid *dest );
478 /* Called by glReadPixels.
479 * Return GL_TRUE if operation completed, else return GL_FALSE.
480 * This function must respect all glPixelTransfer settings.
481 */
482
483 GLboolean (*CopyPixels)( GLcontext *ctx,
484 GLint srcx, GLint srcy,
485 GLsizei width, GLsizei height,
486 GLint dstx, GLint dsty, GLenum type );
487 /* Do a glCopyPixels. Return GL_TRUE if operation completed, else
488 * return GL_FALSE. This function must respect all rasterization
489 * state, glPixelTransfer, glPixelZoom, etc.
490 */
491
492 GLboolean (*Bitmap)( GLcontext *ctx,
493 GLint x, GLint y, GLsizei width, GLsizei height,
494 const struct gl_pixelstore_attrib *unpack,
495 const GLubyte *bitmap );
496 /* This is called by glBitmap. Works the same as DrawPixels, above.
497 */
498
499
500 /***
501 *** Texture mapping functions:
502 ***/
503
504 void (*TexImage)( GLcontext *ctx, GLenum target,
505 struct gl_texture_object *tObj, GLint level,
506 GLint internalFormat,
507 const struct gl_texture_image *image );
508 /* XXX this function is obsolete */
509 /* Called whenever a texture object's image is changed.
510 * texObject is the number of the texture object being changed.
511 * level indicates the mipmap level.
512 * internalFormat is the format in which the texture is to be stored.
513 * image is a pointer to a gl_texture_image struct which contains
514 * the actual image data.
515 */
516
517 void (*TexSubImage)( GLcontext *ctx, GLenum target,
518 struct gl_texture_object *tObj, GLint level,
519 GLint xoffset, GLint yoffset,
520 GLsizei width, GLsizei height,
521 GLint internalFormat,
522 const struct gl_texture_image *image );
523 /* XXX this function is obsolete */
524 /* Called from glTexSubImage() to define a sub-region of a texture.
525 */
526
527
528 GLboolean (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
529 GLenum format, GLenum type, const GLvoid *pixels,
530 const struct gl_pixelstore_attrib *packing,
531 struct gl_texture_object *texObj,
532 struct gl_texture_image *texImage,
533 GLboolean *retainInternalCopy );
534 GLboolean (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
535 GLenum format, GLenum type, const GLvoid *pixels,
536 const struct gl_pixelstore_attrib *packing,
537 struct gl_texture_object *texObj,
538 struct gl_texture_image *texImage,
539 GLboolean *retainInternalCopy );
540 GLboolean (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
541 GLenum format, GLenum type, const GLvoid *pixels,
542 const struct gl_pixelstore_attrib *packing,
543 struct gl_texture_object *texObj,
544 struct gl_texture_image *texImage,
545 GLboolean *retainInternalCopy );
546 /* Called by glTexImage1/2/3D.
547 * Will not be called if any glPixelTransfer operations are enabled.
548 * Arguments:
549 * <target>, <level>, <format>, <type> and <pixels> are user specified.
550 * <packing> indicates the image packing of pixels.
551 * <texObj> is the target texture object.
552 * <texImage> is the target texture image. It will have the texture
553 * width, height, depth, border and internalFormat information.
554 * <retainInternalCopy> is returned by this function and indicates whether
555 * core Mesa should keep an internal copy of the texture image.
556 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
557 * should do the job. If GL_FALSE is returned, this function will be
558 * called a second time after the texture image has been unpacked into
559 * GLubytes. It may be easier for the driver to handle then.
560 */
561
562 GLboolean (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
563 GLint xoffset, GLsizei width,
564 GLenum format, GLenum type,
565 const GLvoid *pixels,
566 const struct gl_pixelstore_attrib *packing,
567 struct gl_texture_object *texObj,
568 struct gl_texture_image *texImage );
569 GLboolean (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
570 GLint xoffset, GLint yoffset,
571 GLsizei width, GLsizei height,
572 GLenum format, GLenum type,
573 const GLvoid *pixels,
574 const struct gl_pixelstore_attrib *packing,
575 struct gl_texture_object *texObj,
576 struct gl_texture_image *texImage );
577 GLboolean (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
578 GLint xoffset, GLint yoffset, GLint zoffset,
579 GLsizei width, GLsizei height, GLint depth,
580 GLenum format, GLenum type,
581 const GLvoid *pixels,
582 const struct gl_pixelstore_attrib *packing,
583 struct gl_texture_object *texObj,
584 struct gl_texture_image *texImage );
585 /* Called by glTexSubImage1/2/3D.
586 * Will not be called if any glPixelTransfer operations are enabled.
587 * Arguments:
588 * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>,
589 * <depth>, <format>, <type> and <pixels> are user specified.
590 * <packing> indicates the image packing of pixels.
591 * <texObj> is the target texture object.
592 * <texImage> is the target texture image. It will have the texture
593 * width, height, border and internalFormat information.
594 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
595 * should do the job. If GL_FALSE is returned, then TexImage1/2/3D will
596 * be called with the complete texture image.
597 */
598
599 GLboolean (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
600 GLenum internalFormat, GLint x, GLint y,
601 GLsizei width, GLint border );
602 GLboolean (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
603 GLenum internalFormat, GLint x, GLint y,
604 GLsizei width, GLsizei height, GLint border );
605 /* Called by glCopyTexImage1D and glCopyTexImage2D.
606 * Will not be called if any glPixelTransfer operations are enabled.
607 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
608 * should do the job.
609 */
610
611 GLboolean (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
612 GLint xoffset,
613 GLint x, GLint y, GLsizei width );
614 GLboolean (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
615 GLint xoffset, GLint yoffset,
616 GLint x, GLint y,
617 GLsizei width, GLsizei height );
618 GLboolean (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
619 GLint xoffset, GLint yoffset, GLint zoffset,
620 GLint x, GLint y,
621 GLsizei width, GLsizei height );
622 /* Called by glCopyTexSubImage1/2/3D.
623 * Will not be called if any glPixelTransfer operations are enabled.
624 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
625 * should do the job.
626 */
627
628 GLvoid *(*GetTexImage)( GLcontext *ctx, GLenum target, GLint level,
629 GLenum *formatOut, GLenum *typeOut,
630 GLboolean *freeImageOut );
631 /* Called by glGetTexImage or by core Mesa when a texture image
632 * is needed for software fallback rendering.
633 * Return the address of the texture image or NULL if failure.
634 * The image must be tightly packed (i.e. row stride = image width)
635 * Return the image's format and type in formatOut and typeOut.
636 * The format and type must be values which are accepted by glTexImage.
637 * Set the freeImageOut flag if the returned image should be deallocated
638 * with FREE() when finished.
639 * The size of the image can be deduced from the target and level.
640 * Core Mesa will perform any image format/type conversions that are needed.
641 */
642
643 void (*TexEnv)( GLcontext *ctx, GLenum target, GLenum pname,
644 const GLfloat *param );
645 /* Called by glTexEnv*().
646 */
647
648 void (*TexParameter)( GLcontext *ctx, GLenum target,
649 struct gl_texture_object *texObj,
650 GLenum pname, const GLfloat *params );
651 /* Called by glTexParameter*().
652 * <target> is user specified
653 * <texObj> the texture object to modify
654 * <pname> is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER,
655 * GL_TEXTURE_WRAP_[STR], or GL_TEXTURE_BORDER_COLOR.
656 * <params> is user specified.
657 */
658
659 void (*BindTexture)( GLcontext *ctx, GLenum target,
660 struct gl_texture_object *tObj );
661 /* Called by glBindTexture().
662 */
663
664 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
665 /* Called when a texture object is about to be deallocated. Driver
666 * should free anything attached to the DriverData pointers.
667 */
668
669 GLboolean (*IsTextureResident)( GLcontext *ctx,
670 struct gl_texture_object *t );
671 /* Called by glAreTextureResident().
672 */
673
674 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
675 GLclampf priority );
676 /* Called by glPrioritizeTextures().
677 */
678
679 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
680 /* Called by glActiveTextureARB to set current texture unit.
681 */
682
683 void (*UpdateTexturePalette)( GLcontext *ctx,
684 struct gl_texture_object *tObj );
685 /* Called when the texture's color lookup table is changed.
686 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
687 * is to be updated.
688 */
689
690
691
692 /***
693 *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions:
694 ***/
695
696 points_func PointsFunc;
697 line_func LineFunc;
698 triangle_func TriangleFunc;
699 quad_func QuadFunc;
700 rect_func RectFunc;
701
702
703 /***
704 *** Transformation/Rendering functions
705 ***/
706
707 void (*RenderStart)( GLcontext *ctx );
708 void (*RenderFinish)( GLcontext *ctx );
709 /* KW: These replace Begin and End, and have more relaxed semantics.
710 * They are called prior-to and after one or more vb flush, and are
711 * thus decoupled from the gl_begin/gl_end pairs, which are possibly
712 * more frequent. If a begin/end pair covers >1 vertex buffer, these
713 * are called at most once for the pair. (a bit broken at present)
714 */
715
716 void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
717 /* This function, if not NULL, is called whenever new window coordinates
718 * are put in the vertex buffer. The vertices in question are those n
719 * such that start <= n < end.
720 * The device driver can convert the window coords to its own specialized
721 * format. The 3Dfx driver uses this.
722 *
723 * Note: Deprecated in favour of RegisterPipelineStages, below.
724 */
725
726 render_func *RenderVBClippedTab;
727 render_func *RenderVBCulledTab;
728 render_func *RenderVBRawTab;
729 /* These function tables allow the device driver to rasterize an
730 * entire begin/end group of primitives at once. See the
731 * gl_render_vb() function in vbrender.c for more details.
732 */
733
734 void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive );
735 /* If registered, this will be called when rendering transitions between
736 * points, lines and triangles. It is not called on transitions between
737 * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between
738 * triangles and quads or triangles and polygons.
739 */
740
741 GLuint TriangleCaps;
742 /* Holds a list of the reasons why we might normally want to call
743 * render_triangle, but which are in fact implemented by the
744 * driver. The FX driver sets this to DD_TRI_CULL, and will soon
745 * implement DD_TRI_OFFSET.
746 */
747
748 GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
749 /* Driver may request additional render passes by returning GL_TRUE
750 * when this function is called. This function will be called
751 * after the first pass, and passes will be made until the function
752 * returns GL_FALSE. If no function is registered, only one pass
753 * is made.
754 *
755 * This function will be first invoked with passno == 1.
756 */
757
758 /***
759 *** NEW in Mesa 3.x
760 ***/
761
762 void (*RegisterVB)( struct vertex_buffer *VB );
763 void (*UnregisterVB)( struct vertex_buffer *VB );
764 /* Do any processing (eg allocate memory) required to set up a new
765 * vertex_buffer.
766 */
767
768
769 void (*ResetVB)( struct vertex_buffer *VB );
770 void (*ResetCvaVB)( struct vertex_buffer *VB, GLuint stages );
771 /* Do any reset operations necessary to the driver data associated
772 * with these vertex buffers.
773 */
774
775 GLuint RenderVectorFlags;
776 /* What do the render tables require of the vectors they deal
777 * with?
778 */
779
780 GLuint (*RegisterPipelineStages)( struct gl_pipeline_stage *out,
781 const struct gl_pipeline_stage *in,
782 GLuint nr );
783 /* Register new pipeline stages, or modify existing ones. See also
784 * the OptimizePipeline() functions.
785 */
786
787
788 GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
789 GLboolean (*BuildEltPipeline)( GLcontext *ctx );
790 /* Perform the full pipeline build, or return false.
791 */
792
793
794 void (*OptimizePrecalcPipeline)( GLcontext *ctx, struct gl_pipeline *pipe );
795 void (*OptimizeImmediatePipeline)( GLcontext *ctx, struct gl_pipeline *pipe);
796 /* Check to see if a fast path exists for this combination of stages
797 * in the precalc and immediate (elt) pipelines.
798 */
799
800
801 /*
802 * State-changing functions (drawing functions are above)
803 *
804 * These functions are called by their corresponding OpenGL API functions.
805 * They're ALSO called by the gl_PopAttrib() function!!!
806 * May add more functions like these to the device driver in the future.
807 * This should reduce the amount of state checking that
808 * the driver's UpdateState() function must do.
809 */
810 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLclampf ref);
811 void (*BlendEquation)(GLcontext *ctx, GLenum mode);
812 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
813 void (*BlendFuncSeparate)( GLcontext *ctx, GLenum sfactorRGB,
814 GLenum dfactorRGB, GLenum sfactorA,
815 GLenum dfactorA );
816 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
817 void (*CullFace)(GLcontext *ctx, GLenum mode);
818 void (*FrontFace)(GLcontext *ctx, GLenum mode);
819 void (*DepthFunc)(GLcontext *ctx, GLenum func);
820 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
821 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
822 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
823 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
824 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
825 void (*Lightfv)(GLcontext *ctx, GLenum light,
826 GLenum pname, const GLfloat *params, GLint nparams );
827 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
828 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
829 void (*LineWidth)(GLcontext *ctx, GLfloat width);
830 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
831 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
832 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
833 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
834 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
835 void (*ClearStencil)(GLcontext *ctx, GLint s);
836 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
837 void (*StencilMask)(GLcontext *ctx, GLuint mask);
838 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
839 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
840};
841
842
843
844#endif
845
Note: See TracBrowser for help on using the repository browser.