Split driver struct into swrast/tnl/core components.
[mesa.git] / src / mesa / main / dd.h
1 /* $Id: dd.h,v 1.59 2001/03/19 02:25:35 keithw Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 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 /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
33
34 struct gl_pixelstore_attrib;
35
36 /* Mask bits sent to the driver Clear() function */
37 #define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
38 #define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
39 #define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */
40 #define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */
41 #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
42 #define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
43 #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
44
45
46 /*
47 * Device Driver function table.
48 */
49 struct dd_function_table {
50
51 /**********************************************************************
52 *** Mandatory functions: these functions must be implemented by ***
53 *** every device driver. ***
54 **********************************************************************/
55
56 const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
57 /* Return a string as needed by glGetString().
58 * Only the GL_RENDERER token must be implemented. Otherwise,
59 * NULL can be returned.
60 */
61
62 void (*UpdateState)( GLcontext *ctx, GLuint new_state );
63 /*
64 * UpdateState() is called to notify the driver after Mesa has made
65 * some internal state changes. This is in addition to any
66 * statechange callbacks Mesa may already have made.
67 */
68
69 void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
70 GLint x, GLint y, GLint width, GLint height );
71 /* Clear the color/depth/stencil/accum buffer(s).
72 * 'mask' is a bitmask of the DD_*_BIT values defined above that indicates
73 * which buffers need to be cleared.
74 * If 'all' is true then the clear the whole buffer, else clear only the
75 * region defined by (x,y,width,height).
76 * This function must obey the glColorMask, glIndexMask and glStencilMask
77 * settings! Software Mesa can do masked clears if the device driver can't.
78 */
79
80 GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
81 /*
82 * Specifies the current buffer for writing.
83 * The following values must be accepted when applicable:
84 * GL_FRONT_LEFT - this buffer always exists
85 * GL_BACK_LEFT - when double buffering
86 * GL_FRONT_RIGHT - when using stereo
87 * GL_BACK_RIGHT - when using stereo and double buffering
88 * The folowing values may optionally be accepted. Return GL_TRUE
89 * if accepted, GL_FALSE if not accepted. In practice, only drivers
90 * which can write to multiple color buffers at once should accept
91 * these values.
92 * GL_FRONT - write to front left and front right if it exists
93 * GL_BACK - write to back left and back right if it exists
94 * GL_LEFT - write to front left and back left if it exists
95 * GL_RIGHT - write to right left and back right if they exist
96 * GL_FRONT_AND_BACK - write to all four buffers if they exist
97 * GL_NONE - disable buffer write in device driver.
98 */
99
100 void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
101 /*
102 * Returns the width and height of the current color buffer.
103 */
104
105 void (*Finish)( GLcontext *ctx );
106 /*
107 * This is called whenever glFinish() is called.
108 */
109
110 void (*Flush)( GLcontext *ctx );
111 /*
112 * This is called whenever glFlush() is called.
113 */
114
115 void (*Error)( GLcontext *ctx );
116 /*
117 * Called whenever an error is generated. ctx->ErrorValue contains
118 * the error value.
119 */
120
121
122 /***
123 *** For hardware accumulation buffer:
124 ***/
125 void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
126 GLint xpos, GLint ypos, GLint width, GLint height );
127 /* Execute glAccum command within the given scissor region.
128 */
129
130
131 /***
132 *** glDraw/Read/CopyPixels and glBitmap functions:
133 ***/
134
135 void (*DrawPixels)( GLcontext *ctx,
136 GLint x, GLint y, GLsizei width, GLsizei height,
137 GLenum format, GLenum type,
138 const struct gl_pixelstore_attrib *unpack,
139 const GLvoid *pixels );
140 /* This is called by glDrawPixels.
141 * 'unpack' describes how to unpack the source image data.
142 */
143
144 void (*ReadPixels)( GLcontext *ctx,
145 GLint x, GLint y, GLsizei width, GLsizei height,
146 GLenum format, GLenum type,
147 const struct gl_pixelstore_attrib *unpack,
148 GLvoid *dest );
149 /* Called by glReadPixels.
150 */
151
152 void (*CopyPixels)( GLcontext *ctx,
153 GLint srcx, GLint srcy,
154 GLsizei width, GLsizei height,
155 GLint dstx, GLint dsty, GLenum type );
156 /* Do a glCopyPixels. This function must respect all rasterization
157 * state, glPixelTransfer, glPixelZoom, etc.
158 */
159
160 void (*Bitmap)( GLcontext *ctx,
161 GLint x, GLint y, GLsizei width, GLsizei height,
162 const struct gl_pixelstore_attrib *unpack,
163 const GLubyte *bitmap );
164 /* This is called by glBitmap. Works the same as DrawPixels, above.
165 */
166
167 void (*ResizeBuffersMESA)( GLcontext *ctx );
168
169
170 /***
171 *** Texture image functions:
172 ***/
173 void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
174 GLint internalFormat,
175 GLint width, GLint border,
176 GLenum format, GLenum type, const GLvoid *pixels,
177 const struct gl_pixelstore_attrib *packing,
178 struct gl_texture_object *texObj,
179 struct gl_texture_image *texImage );
180 void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
181 GLint internalFormat,
182 GLint width, GLint height, GLint border,
183 GLenum format, GLenum type, const GLvoid *pixels,
184 const struct gl_pixelstore_attrib *packing,
185 struct gl_texture_object *texObj,
186 struct gl_texture_image *texImage );
187 void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
188 GLint internalFormat,
189 GLint width, GLint height, GLint depth, GLint border,
190 GLenum format, GLenum type, const GLvoid *pixels,
191 const struct gl_pixelstore_attrib *packing,
192 struct gl_texture_object *texObj,
193 struct gl_texture_image *texImage );
194 /* Called by glTexImage1/2/3D.
195 * Arguments:
196 * <target>, <level>, <format>, <type> and <pixels> are user specified.
197 * <packing> indicates the image packing of pixels.
198 * <texObj> is the target texture object.
199 * <texImage> is the target texture image. It will have the texture
200 * width, height, depth, border and internalFormat information.
201 * <retainInternalCopy> is returned by this function and indicates whether
202 * core Mesa should keep an internal copy of the texture image.
203 * Drivers should call a fallback routine from texstore.c if needed.
204 */
205
206 void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
207 GLint xoffset, GLsizei width,
208 GLenum format, GLenum type,
209 const GLvoid *pixels,
210 const struct gl_pixelstore_attrib *packing,
211 struct gl_texture_object *texObj,
212 struct gl_texture_image *texImage );
213 void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
214 GLint xoffset, GLint yoffset,
215 GLsizei width, GLsizei height,
216 GLenum format, GLenum type,
217 const GLvoid *pixels,
218 const struct gl_pixelstore_attrib *packing,
219 struct gl_texture_object *texObj,
220 struct gl_texture_image *texImage );
221 void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
222 GLint xoffset, GLint yoffset, GLint zoffset,
223 GLsizei width, GLsizei height, GLint depth,
224 GLenum format, GLenum type,
225 const GLvoid *pixels,
226 const struct gl_pixelstore_attrib *packing,
227 struct gl_texture_object *texObj,
228 struct gl_texture_image *texImage );
229 /* Called by glTexSubImage1/2/3D.
230 * Arguments:
231 * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>,
232 * <depth>, <format>, <type> and <pixels> are user specified.
233 * <packing> indicates the image packing of pixels.
234 * <texObj> is the target texture object.
235 * <texImage> is the target texture image. It will have the texture
236 * width, height, border and internalFormat information.
237 * The driver should use a fallback routine from texstore.c if needed.
238 */
239
240 void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
241 GLenum internalFormat, GLint x, GLint y,
242 GLsizei width, GLint border );
243 void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
244 GLenum internalFormat, GLint x, GLint y,
245 GLsizei width, GLsizei height, GLint border );
246 /* Called by glCopyTexImage1D and glCopyTexImage2D.
247 * Drivers should use a fallback routine from texstore.c if needed.
248 */
249
250 void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
251 GLint xoffset,
252 GLint x, GLint y, GLsizei width );
253 void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
254 GLint xoffset, GLint yoffset,
255 GLint x, GLint y,
256 GLsizei width, GLsizei height );
257 void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
258 GLint xoffset, GLint yoffset, GLint zoffset,
259 GLint x, GLint y,
260 GLsizei width, GLsizei height );
261 /* Called by glCopyTexSubImage1/2/3D.
262 * Drivers should use a fallback routine from texstore.c if needed.
263 */
264
265 GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
266 GLint level, GLint internalFormat,
267 GLenum format, GLenum type,
268 GLint width, GLint height,
269 GLint depth, GLint border);
270 /* Called by glTexImage[123]D when user specifies a proxy texture
271 * target. Return GL_TRUE if the proxy test passes, return GL_FALSE
272 * if the test fails.
273 */
274
275 /***
276 *** Compressed texture functions:
277 ***/
278
279 void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
280 GLint level, GLint internalFormat,
281 GLsizei width, GLint border,
282 GLsizei imageSize, const GLvoid *data,
283 struct gl_texture_object *texObj,
284 struct gl_texture_image *texImage );
285 void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
286 GLint level, GLint internalFormat,
287 GLsizei width, GLsizei height, GLint border,
288 GLsizei imageSize, const GLvoid *data,
289 struct gl_texture_object *texObj,
290 struct gl_texture_image *texImage );
291 void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
292 GLint level, GLint internalFormat,
293 GLsizei width, GLsizei height, GLsizei depth,
294 GLint border,
295 GLsizei imageSize, const GLvoid *data,
296 struct gl_texture_object *texObj,
297 struct gl_texture_image *texImage );
298 /* Called by glCompressedTexImage1/2/3D.
299 * Arguments:
300 * <target>, <level>, <internalFormat>, <data> are user specified.
301 * <texObj> is the target texture object.
302 * <texImage> is the target texture image. It will have the texture
303 * width, height, depth, border and internalFormat information.
304 * <retainInternalCopy> is returned by this function and indicates whether
305 * core Mesa should keep an internal copy of the texture image.
306 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
307 * should do the job.
308 */
309
310 void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
311 GLint xoffset, GLsizei width,
312 GLenum format,
313 GLsizei imageSize, const GLvoid *data,
314 struct gl_texture_object *texObj,
315 struct gl_texture_image *texImage);
316 void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
317 GLint xoffset, GLint yoffset,
318 GLsizei width, GLint height,
319 GLenum format,
320 GLsizei imageSize, const GLvoid *data,
321 struct gl_texture_object *texObj,
322 struct gl_texture_image *texImage);
323 void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
324 GLint xoffset, GLint yoffset, GLint zoffset,
325 GLsizei width, GLint height, GLint depth,
326 GLenum format,
327 GLsizei imageSize, const GLvoid *data,
328 struct gl_texture_object *texObj,
329 struct gl_texture_image *texImage);
330 /* Called by glCompressedTexSubImage1/2/3D.
331 * Arguments:
332 * <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>,
333 * <imageSize>, and <data> are user specified.
334 * <texObj> is the target texture object.
335 * <texImage> is the target texture image. It will have the texture
336 * width, height, depth, border and internalFormat information.
337 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
338 * should do the job.
339 */
340
341 GLboolean (*IsCompressedFormat)(GLcontext *ctx, GLint internalFormat);
342 /* Called to tell if a format is a compressed format.
343 */
344
345 void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
346 GLint lod, void *image,
347 const struct gl_texture_object *texObj,
348 struct gl_texture_image *texImage );
349 /* Called by glGetCompressedTexImageARB.
350 * <target>, <lod>, <image> are specified by user.
351 * <texObj> is the source texture object.
352 * <texImage> is the source texture image.
353 */
354
355 GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
356 GLint internalFormat);
357 /* Called to compute the base format for a specific compressed
358 * format. Return -1 if the internalFormat is not a specific
359 * compressed format that the driver recognizes.
360 * Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB.
361 */
362
363 #if 000
364 /* ... Note the
365 * return value differences between this function and
366 * SpecificCompressedTexFormat below.
367 */
368
369 GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
370 GLint internalFormat,
371 GLint numDimensions,
372 GLint *levelp,
373 GLsizei *widthp,
374 GLsizei *heightp,
375 GLsizei *depthp,
376 GLint *borderp,
377 GLenum *formatp,
378 GLenum *typep);
379 /* Called to turn a generic texture format into a specific
380 * texture format. For example, if a driver implements
381 * GL_3DFX_texture_compression_FXT1, this would map
382 * GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX.
383 *
384 * If the driver does not know how to handle the compressed
385 * format, then just return the generic format, and Mesa will
386 * do the right thing with it.
387 */
388
389 GLsizei (*CompressedImageSize)(GLcontext *ctx,
390 GLenum internalFormat,
391 GLuint numDimensions,
392 GLuint width,
393 GLuint height,
394 GLuint depth);
395 /* Calculate the size of a compressed image, given the image's
396 * format and dimensions.
397 */
398 #endif
399
400 /***
401 *** Texture object functions:
402 ***/
403
404 void (*BindTexture)( GLcontext *ctx, GLenum target,
405 struct gl_texture_object *tObj );
406 /* Called by glBindTexture().
407 */
408
409 void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
410 /* Called when a texture object is created.
411 */
412
413 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
414 /* Called when a texture object is about to be deallocated. Driver
415 * should free anything attached to the DriverData pointers.
416 */
417
418 GLboolean (*IsTextureResident)( GLcontext *ctx,
419 struct gl_texture_object *t );
420 /* Called by glAreTextureResident().
421 */
422
423 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
424 GLclampf priority );
425 /* Called by glPrioritizeTextures().
426 */
427
428 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
429 /* Called by glActiveTextureARB to set current texture unit.
430 */
431
432 void (*UpdateTexturePalette)( GLcontext *ctx,
433 struct gl_texture_object *tObj );
434 /* Called when the texture's color lookup table is changed.
435 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
436 * is to be updated.
437 */
438
439 /***
440 *** Imaging functionality:
441 ***/
442 void (*CopyColorTable)( GLcontext *ctx,
443 GLenum target, GLenum internalformat,
444 GLint x, GLint y, GLsizei width );
445
446 void (*CopyColorSubTable)( GLcontext *ctx,
447 GLenum target, GLsizei start,
448 GLint x, GLint y, GLsizei width );
449
450 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
451 GLenum internalFormat,
452 GLint x, GLint y, GLsizei width );
453
454 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
455 GLenum internalFormat,
456 GLint x, GLint y,
457 GLsizei width, GLsizei height );
458
459
460
461 /***
462 *** State-changing functions (drawing functions are above)
463 ***
464 *** These functions are called by their corresponding OpenGL API functions.
465 *** They're ALSO called by the gl_PopAttrib() function!!!
466 *** May add more functions like these to the device driver in the future.
467 ***/
468 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLchan ref);
469 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
470 void (*BlendEquation)(GLcontext *ctx, GLenum mode);
471 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
472 void (*BlendFuncSeparate)(GLcontext *ctx,
473 GLenum sfactorRGB, GLenum dfactorRGB,
474 GLenum sfactorA, GLenum dfactorA);
475 void (*ClearColor)(GLcontext *ctx, const GLchan color[4]);
476 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
477 void (*ClearIndex)(GLcontext *ctx, GLuint index);
478 void (*ClearStencil)(GLcontext *ctx, GLint s);
479 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
480 GLboolean bmask, GLboolean amask );
481 void (*CullFace)(GLcontext *ctx, GLenum mode);
482 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
483 void (*FrontFace)(GLcontext *ctx, GLenum mode);
484 void (*DepthFunc)(GLcontext *ctx, GLenum func);
485 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
486 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
487 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
488 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
489 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
490 void (*IndexMask)(GLcontext *ctx, GLuint mask);
491 void (*Lightfv)(GLcontext *ctx, GLenum light,
492 GLenum pname, const GLfloat *params );
493 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
494 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
495 void (*LineWidth)(GLcontext *ctx, GLfloat width);
496 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
497 void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
498 const GLfloat *params);
499 void (*PointSize)(GLcontext *ctx, GLfloat size);
500 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
501 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
502 void (*RenderMode)(GLcontext *ctx, GLenum mode );
503 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
504 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
505 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
506 void (*StencilMask)(GLcontext *ctx, GLuint mask);
507 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
508 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
509 const GLfloat *params);
510 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
511 const GLfloat *param);
512 void (*TexParameter)(GLcontext *ctx, GLenum target,
513 struct gl_texture_object *texObj,
514 GLenum pname, const GLfloat *params);
515 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
516 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
517
518
519 /***
520 *** Vertex array functions
521 ***
522 *** Called by the corresponding OpenGL functions.
523 ***/
524 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
525 GLsizei stride, const GLvoid *ptr);
526 void (*NormalPointer)(GLcontext *ctx, GLenum type,
527 GLsizei stride, const GLvoid *ptr);
528 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
529 GLsizei stride, const GLvoid *ptr);
530 void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
531 GLsizei stride, const GLvoid *ptr);
532 void (*IndexPointer)(GLcontext *ctx, GLenum type,
533 GLsizei stride, const GLvoid *ptr);
534 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
535 GLsizei stride, const GLvoid *ptr);
536 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
537 GLsizei stride, const GLvoid *ptr);
538 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
539
540
541 /*** State-query functions
542 ***
543 *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
544 ***/
545 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
546 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
547 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
548 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
549 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
550
551
552
553 /***
554 *** Support for multiple t&l engines
555 ***/
556
557 GLuint NeedValidate;
558 /* Bitmask of state changes that require the current tnl module to be
559 * validated, using ValidateTnlModule() below.
560 */
561
562 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
563 /* Validate the current tnl module. This is called directly after
564 * UpdateState() when a state change that has occured matches the
565 * NeedValidate bitmask above. This ensures all computed values are
566 * up to date, thus allowing the driver to decide if the current tnl
567 * module needs to be swapped out.
568 *
569 * This must be non-NULL if a driver installs a custom tnl module and
570 * sets the NeedValidate bitmask, but may be NULL otherwise.
571 */
572
573
574 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
575 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
576 #define PRIM_UNKNOWN GL_POLYGON+3
577
578 GLuint CurrentExecPrimitive;
579 /* Set by the driver-supplied t&l engine. Set to
580 * PRIM_OUTSIDE_BEGIN_END when outside begin/end.
581 */
582
583 GLuint CurrentSavePrimitive;
584 /* Current state of an in-progress compilation. May take on any of
585 * the additional values defined above.
586 */
587
588
589 #define FLUSH_STORED_VERTICES 0x1
590 #define FLUSH_UPDATE_CURRENT 0x2
591 GLuint NeedFlush;
592 /* Set by the driver-supplied t&l engine whenever vertices are
593 * buffered between begin/end objects or ctx->Current is not uptodate.
594 *
595 * The FlushVertices() call below may be used to resolve
596 * these conditions.
597 */
598
599 void (*FlushVertices)( GLcontext *ctx, GLuint flags );
600 /* If inside begin/end, ASSERT(0).
601 * Otherwise,
602 * if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
603 * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
604 * and ctx->Light.Material
605 *
606 * Note that the default t&l engine never clears the
607 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
608 */
609
610 void (*LightingSpaceChange)( GLcontext *ctx );
611 /* Notify driver that the special derived value _NeedEyeCoords has
612 * changed.
613 */
614
615 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
616 void (*EndList)( GLcontext *ctx );
617 /* Let the t&l component know what is going on with display lists
618 * in time to make changes to dispatch tables, etc.
619 * Called by glNewList() and glEndList(), respectively.
620 */
621
622 void (*BeginCallList)( GLcontext *ctx, GLuint list );
623 void (*EndCallList)( GLcontext *ctx );
624 /* Notify the t&l component before and after calling a display list.
625 * Called by glCallList(s), but not recursively.
626 */
627
628 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
629 GLframebuffer *readBuffer );
630 /* Let the t&l component know when the context becomes current.
631 */
632
633
634 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
635 void (*UnlockArraysEXT)( GLcontext *ctx );
636 /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
637 */
638
639 };
640
641
642
643 /*
644 * Transform/Clip/Lighting interface
645 */
646 typedef struct {
647 void (*ArrayElement)( GLint ); /* NOTE */
648 void (*Color3f)( GLfloat, GLfloat, GLfloat );
649 void (*Color3fv)( const GLfloat * );
650 void (*Color3ub)( GLubyte, GLubyte, GLubyte );
651 void (*Color3ubv)( const GLubyte * );
652 void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
653 void (*Color4fv)( const GLfloat * );
654 void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
655 void (*Color4ubv)( const GLubyte * );
656 void (*EdgeFlag)( GLboolean );
657 void (*EdgeFlagv)( const GLboolean * );
658 void (*EvalCoord1f)( GLfloat ); /* NOTE */
659 void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
660 void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
661 void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
662 void (*EvalPoint1)( GLint ); /* NOTE */
663 void (*EvalPoint2)( GLint, GLint ); /* NOTE */
664 void (*FogCoordfEXT)( GLfloat );
665 void (*FogCoordfvEXT)( const GLfloat * );
666 void (*Indexi)( GLint );
667 void (*Indexiv)( const GLint * );
668 void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
669 void (*MultiTexCoord1fARB)( GLenum, GLfloat );
670 void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * );
671 void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
672 void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * );
673 void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
674 void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * );
675 void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
676 void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * );
677 void (*Normal3f)( GLfloat, GLfloat, GLfloat );
678 void (*Normal3fv)( const GLfloat * );
679 void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
680 void (*SecondaryColor3fvEXT)( const GLfloat * );
681 void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
682 void (*SecondaryColor3ubvEXT)( const GLubyte * );
683 void (*TexCoord1f)( GLfloat );
684 void (*TexCoord1fv)( const GLfloat * );
685 void (*TexCoord2f)( GLfloat, GLfloat );
686 void (*TexCoord2fv)( const GLfloat * );
687 void (*TexCoord3f)( GLfloat, GLfloat, GLfloat );
688 void (*TexCoord3fv)( const GLfloat * );
689 void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
690 void (*TexCoord4fv)( const GLfloat * );
691 void (*Vertex2f)( GLfloat, GLfloat );
692 void (*Vertex2fv)( const GLfloat * );
693 void (*Vertex3f)( GLfloat, GLfloat, GLfloat );
694 void (*Vertex3fv)( const GLfloat * );
695 void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
696 void (*Vertex4fv)( const GLfloat * );
697 void (*CallList)( GLuint ); /* NOTE */
698 void (*Begin)( GLenum );
699 void (*End)( void );
700 /* Drivers present a reduced set of the functions possible in
701 * begin/end objects. Core mesa provides translation stubs for the
702 * remaining functions to map down to these entrypoints.
703 *
704 * These are the initial values to be installed into dispatch by
705 * mesa. If the t&l driver wants to modify the dispatch table
706 * while installed, it must do so itself. It would be possible for
707 * the vertexformat to install it's own initial values for these
708 * functions, but this way there is an obvious list of what is
709 * expected of the driver.
710 *
711 * If the driver wants to hook in entrypoints other than those
712 * listed above, it must restore them to their original values in
713 * the disable() callback, below.
714 */
715
716 void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
717 /*
718 */
719
720 void (*DrawArrays)( GLenum mode, GLint start, GLsizei count );
721 void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
722 const GLvoid *indices );
723 void (*DrawRangeElements)( GLenum mode, GLuint start,
724 GLuint end, GLsizei count,
725 GLenum type, const GLvoid *indices );
726 /* These may or may not belong here. Heuristic: If an array is
727 * enabled, the installed vertex format should support that array and
728 * it's current size natively.
729 */
730
731 void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
732 void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
733 /* If you don't support eval, fallback to the default vertex format
734 * on receiving an eval call and use the pipeline mechanism to
735 * provide partial t&l acceleration.
736 *
737 * Mesa will provide a set of helper functions to do eval within
738 * accelerated vertex formats, eventually...
739 */
740
741 GLboolean prefer_float_colors;
742 /* Should core try to send colors to glColor4f or glColor4chan,
743 * where it has a choice?
744 */
745 } GLvertexformat;
746
747
748 #endif /* DD_INCLUDED */