add callbacks for stipple
[mesa.git] / src / mesa / main / dd.h
1 /* $Id: dd.h,v 1.12 2000/02/27 20:38:15 keithw 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
36 struct gl_pixelstore_attrib;
37
38
39 struct vertex_buffer;
40 struct immediate;
41 struct 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 */
135 struct 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 ***/
395
396 void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
397 const GLdepth depth[], const GLubyte mask[] );
398 /* Write a horizontal span of values into the depth buffer. Only write
399 * depth[i] value if mask[i] is nonzero.
400 */
401
402 void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
403 GLdepth depth[] );
404 /* Read a horizontal span of values from the depth buffer.
405 */
406
407
408 void (*WriteDepthPixels)( GLcontext *ctx, GLuint n,
409 const GLint x[], const GLint y[],
410 const GLdepth depth[], const GLubyte mask[] );
411 /* Write an array of randomly positioned depth values into the
412 * depth buffer. Only write depth[i] value if mask[i] is nonzero.
413 */
414
415 void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
416 const GLint x[], const GLint y[],
417 GLdepth depth[] );
418 /* Read an array of randomly positioned depth values from the depth buffer.
419 */
420
421
422
423 /***
424 *** For supporting hardware stencil buffers:
425 *** Either ALL or NONE of these functions must be implemented!
426 ***/
427
428 void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
429 const GLstencil stencil[], const GLubyte mask[] );
430 /* Write a horizontal span of stencil values into the stencil buffer.
431 * If mask is NULL, write all stencil values.
432 * Else, only write stencil[i] if mask[i] is non-zero.
433 */
434
435
436 void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
437 GLstencil stencil[] );
438 /* Read a horizontal span of stencil values from the stencil buffer.
439 */
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 /***
460 *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions:
461 ***/
462
463 points_func PointsFunc;
464 line_func LineFunc;
465 triangle_func TriangleFunc;
466 quad_func QuadFunc;
467 rect_func RectFunc;
468
469
470 GLboolean (*DrawPixels)( GLcontext *ctx,
471 GLint x, GLint y, GLsizei width, GLsizei height,
472 GLenum format, GLenum type,
473 const struct gl_pixelstore_attrib *unpack,
474 const GLvoid *pixels );
475 /* This is called by glDrawPixels.
476 * 'unpack' describes how to unpack the source image data.
477 * Return GL_TRUE if the driver succeeds, return GL_FALSE if core Mesa
478 * must do the job.
479 */
480
481 GLboolean (*Bitmap)( GLcontext *ctx,
482 GLint x, GLint y, GLsizei width, GLsizei height,
483 const struct gl_pixelstore_attrib *unpack,
484 const GLubyte *bitmap );
485 /* This is called by glBitmap. Works the same as DrawPixels, above.
486 */
487
488 void (*RenderStart)( GLcontext *ctx );
489 void (*RenderFinish)( GLcontext *ctx );
490 /* KW: These replace Begin and End, and have more relaxed semantics.
491 * They are called prior-to and after one or more vb flush, and are
492 * thus decoupled from the gl_begin/gl_end pairs, which are possibly
493 * more frequent. If a begin/end pair covers >1 vertex buffer, these
494 * are called at most once for the pair. (a bit broken at present)
495 */
496
497 void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
498 /* This function, if not NULL, is called whenever new window coordinates
499 * are put in the vertex buffer. The vertices in question are those n
500 * such that start <= n < end.
501 * The device driver can convert the window coords to its own specialized
502 * format. The 3Dfx driver uses this.
503 *
504 * Note: Deprecated in favour of RegisterPipelineStages, below.
505 */
506
507
508 render_func *RenderVBClippedTab;
509 render_func *RenderVBCulledTab;
510 render_func *RenderVBRawTab;
511 /* These function tables allow the device driver to rasterize an
512 * entire begin/end group of primitives at once. See the
513 * gl_render_vb() function in vbrender.c for more details.
514 */
515
516
517 void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive );
518 /* If registered, this will be called when rendering transitions between
519 * points, lines and triangles. It is not called on transitions between
520 * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between
521 * triangles and quads or triangles and polygons.
522 */
523
524 GLuint TriangleCaps;
525 /* Holds a list of the reasons why we might normally want to call
526 * render_triangle, but which are in fact implemented by the
527 * driver. The FX driver sets this to DD_TRI_CULL, and will soon
528 * implement DD_TRI_OFFSET.
529 */
530
531
532 GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
533 /* Driver may request additional render passes by returning GL_TRUE
534 * when this function is called. This function will be called
535 * after the first pass, and passes will be made until the function
536 * returns GL_FALSE. If no function is registered, only one pass
537 * is made.
538 *
539 * This function will be first invoked with passno == 1.
540 */
541
542 /***
543 *** Texture mapping functions:
544 ***/
545
546 void (*TexEnv)( GLcontext *ctx, GLenum pname, const GLfloat *param );
547 /*
548 * Called whenever glTexEnv*() is called.
549 * Pname will be one of GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR.
550 * If pname is GL_TEXTURE_ENV_MODE then param will be one
551 * of GL_MODULATE, GL_BLEND, GL_DECAL, or GL_REPLACE.
552 */
553
554 void (*TexImage)( GLcontext *ctx, GLenum target,
555 struct gl_texture_object *tObj, GLint level,
556 GLint internalFormat,
557 const struct gl_texture_image *image );
558 /*
559 * Called whenever a texture object's image is changed.
560 * texObject is the number of the texture object being changed.
561 * level indicates the mipmap level.
562 * internalFormat is the format in which the texture is to be stored.
563 * image is a pointer to a gl_texture_image struct which contains
564 * the actual image data.
565 */
566
567 void (*TexSubImage)( GLcontext *ctx, GLenum target,
568 struct gl_texture_object *tObj, GLint level,
569 GLint xoffset, GLint yoffset,
570 GLsizei width, GLsizei height,
571 GLint internalFormat,
572 const struct gl_texture_image *image );
573 /*
574 * Called from glTexSubImage() to define a sub-region of a texture.
575 */
576
577 void (*TexParameter)( GLcontext *ctx, GLenum target,
578 struct gl_texture_object *tObj,
579 GLenum pname, const GLfloat *params );
580 /*
581 * Called whenever glTexParameter*() is called.
582 * target is GL_TEXTURE_1D or GL_TEXTURE_2D
583 * texObject is the texture object to modify
584 * pname is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER,
585 * GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_BORDER_COLOR.
586 * params is dependant on pname. See man glTexParameter.
587 */
588
589 void (*BindTexture)( GLcontext *ctx, GLenum target,
590 struct gl_texture_object *tObj );
591 /*
592 * Called whenever glBindTexture() is called. This specifies which
593 * texture is to be the current one. No dirty flags will be set.
594 */
595
596 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
597 /*
598 * Called when a texture object is about to be deallocated. Driver
599 * should free anything attached to the DriverData pointers.
600 */
601
602 void (*UpdateTexturePalette)( GLcontext *ctx,
603 struct gl_texture_object *tObj );
604 /*
605 * Called when the texture's color lookup table is changed.
606 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
607 * was changed.
608 */
609
610 void (*UseGlobalTexturePalette)( GLcontext *ctx, GLboolean state );
611 /*
612 * Called via glEnable/Disable(GL_SHARED_TEXTURE_PALETTE_EXT)
613 */
614
615 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
616 /*
617 * Called by glActiveTextureARB to set current texture unit.
618 */
619
620
621 GLboolean (*IsTextureResident)( GLcontext *ctx,
622 struct gl_texture_object *t );
623 /*
624 * Allows the driver to implement the AreTexturesResident tests without
625 * knowing about Mesa's internal hash tables for textures.
626 */
627
628 void (*PrioritizeTexture)( GLcontext *ctx,
629 struct gl_texture_object *t,
630 GLclampf priority );
631 /*
632 * Notify driver of priority change for a texture.
633 */
634
635
636
637
638 /***
639 *** NEW in Mesa 3.x
640 ***/
641
642 void (*RegisterVB)( struct vertex_buffer *VB );
643 void (*UnregisterVB)( struct vertex_buffer *VB );
644 /* Do any processing (eg allocate memory) required to set up a new
645 * vertex_buffer.
646 */
647
648
649 void (*ResetVB)( struct vertex_buffer *VB );
650 void (*ResetCvaVB)( struct vertex_buffer *VB, GLuint stages );
651 /* Do any reset operations necessary to the driver data associated
652 * with these vertex buffers.
653 */
654
655 GLuint RenderVectorFlags;
656 /* What do the render tables require of the vectors they deal
657 * with?
658 */
659
660 GLuint (*RegisterPipelineStages)( struct gl_pipeline_stage *out,
661 const struct gl_pipeline_stage *in,
662 GLuint nr );
663 /* Register new pipeline stages, or modify existing ones. See also
664 * the OptimizePipeline() functions.
665 */
666
667
668 GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
669 GLboolean (*BuildEltPipeline)( GLcontext *ctx );
670 /* Perform the full pipeline build, or return false.
671 */
672
673
674 void (*OptimizePrecalcPipeline)( GLcontext *ctx, struct gl_pipeline *pipe );
675 void (*OptimizeImmediatePipeline)( GLcontext *ctx, struct gl_pipeline *pipe);
676 /* Check to see if a fast path exists for this combination of stages
677 * in the precalc and immediate (elt) pipelines.
678 */
679
680
681 /*
682 * State-changing functions (drawing functions are above)
683 *
684 * These functions are called by their corresponding OpenGL API functions.
685 * They're ALSO called by the gl_PopAttrib() function!!!
686 * May add more functions like these to the device driver in the future.
687 * This should reduce the amount of state checking that
688 * the driver's UpdateState() function must do.
689 */
690 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLclampf ref);
691 void (*BlendEquation)(GLcontext *ctx, GLenum mode);
692 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
693 void (*BlendFuncSeparate)( GLcontext *ctx, GLenum sfactorRGB,
694 GLenum dfactorRGB, GLenum sfactorA,
695 GLenum dfactorA );
696 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
697 void (*CullFace)(GLcontext *ctx, GLenum mode);
698 void (*FrontFace)(GLcontext *ctx, GLenum mode);
699 void (*DepthFunc)(GLcontext *ctx, GLenum func);
700 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
701 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
702 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
703 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
704 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
705 void (*Lightfv)(GLcontext *ctx, GLenum light,
706 GLenum pname, const GLfloat *params, GLint nparams );
707 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
708 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
709 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
710 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
711 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
712 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
713 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
714 void (*ClearStencil)(GLcontext *ctx, GLint s);
715 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
716 void (*StencilMask)(GLcontext *ctx, GLuint mask);
717 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
718 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
719 };
720
721
722
723 #endif
724