Enable GL_ARB_texture_compression for XMesa/GLX driver. Texture
[mesa.git] / src / mesa / main / dd.h
1 /* $Id: dd.h,v 1.62 2001/06/15 14:18:46 brianp 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 const struct gl_texture_format *
174 (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
175 GLenum srcFormat, GLenum srcType );
176 /* This is called by the _mesa_store_tex[sub]image[123]d() fallback
177 * functions. The driver should examine <internalFormat> and return a
178 * pointer to an appropriate gl_texture_format.
179 */
180
181 void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
182 GLint internalFormat,
183 GLint width, GLint border,
184 GLenum format, GLenum type, const GLvoid *pixels,
185 const struct gl_pixelstore_attrib *packing,
186 struct gl_texture_object *texObj,
187 struct gl_texture_image *texImage );
188 void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
189 GLint internalFormat,
190 GLint width, GLint height, GLint border,
191 GLenum format, GLenum type, const GLvoid *pixels,
192 const struct gl_pixelstore_attrib *packing,
193 struct gl_texture_object *texObj,
194 struct gl_texture_image *texImage );
195 void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
196 GLint internalFormat,
197 GLint width, GLint height, GLint depth, GLint border,
198 GLenum format, GLenum type, const GLvoid *pixels,
199 const struct gl_pixelstore_attrib *packing,
200 struct gl_texture_object *texObj,
201 struct gl_texture_image *texImage );
202 /* Called by glTexImage1/2/3D.
203 * Arguments:
204 * <target>, <level>, <format>, <type> and <pixels> are user specified.
205 * <packing> indicates the image packing of pixels.
206 * <texObj> is the target texture object.
207 * <texImage> is the target texture image. It will have the texture
208 * width, height, depth, border and internalFormat information.
209 * <retainInternalCopy> is returned by this function and indicates whether
210 * core Mesa should keep an internal copy of the texture image.
211 * Drivers should call a fallback routine from texstore.c if needed.
212 */
213
214 void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
215 GLint xoffset, GLsizei width,
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 (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
222 GLint xoffset, GLint yoffset,
223 GLsizei width, GLsizei height,
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 void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
230 GLint xoffset, GLint yoffset, GLint zoffset,
231 GLsizei width, GLsizei height, GLint depth,
232 GLenum format, GLenum type,
233 const GLvoid *pixels,
234 const struct gl_pixelstore_attrib *packing,
235 struct gl_texture_object *texObj,
236 struct gl_texture_image *texImage );
237 /* Called by glTexSubImage1/2/3D.
238 * Arguments:
239 * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>,
240 * <depth>, <format>, <type> and <pixels> are user specified.
241 * <packing> indicates the image packing of pixels.
242 * <texObj> is the target texture object.
243 * <texImage> is the target texture image. It will have the texture
244 * width, height, border and internalFormat information.
245 * The driver should use a fallback routine from texstore.c if needed.
246 */
247
248 void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
249 GLenum internalFormat, GLint x, GLint y,
250 GLsizei width, GLint border );
251 void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
252 GLenum internalFormat, GLint x, GLint y,
253 GLsizei width, GLsizei height, GLint border );
254 /* Called by glCopyTexImage1D and glCopyTexImage2D.
255 * Drivers should use a fallback routine from texstore.c if needed.
256 */
257
258 void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
259 GLint xoffset,
260 GLint x, GLint y, GLsizei width );
261 void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
262 GLint xoffset, GLint yoffset,
263 GLint x, GLint y,
264 GLsizei width, GLsizei height );
265 void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
266 GLint xoffset, GLint yoffset, GLint zoffset,
267 GLint x, GLint y,
268 GLsizei width, GLsizei height );
269 /* Called by glCopyTexSubImage1/2/3D.
270 * Drivers should use a fallback routine from texstore.c if needed.
271 */
272
273 GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
274 GLint level, GLint internalFormat,
275 GLenum format, GLenum type,
276 GLint width, GLint height,
277 GLint depth, GLint border);
278 /* Called by glTexImage[123]D when user specifies a proxy texture
279 * target. Return GL_TRUE if the proxy test passes, return GL_FALSE
280 * if the test fails.
281 */
282
283 /***
284 *** Compressed texture functions:
285 ***/
286
287 void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
288 GLint level, GLint internalFormat,
289 GLsizei width, GLint border,
290 GLsizei imageSize, const GLvoid *data,
291 struct gl_texture_object *texObj,
292 struct gl_texture_image *texImage );
293 void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
294 GLint level, GLint internalFormat,
295 GLsizei width, GLsizei height, GLint border,
296 GLsizei imageSize, const GLvoid *data,
297 struct gl_texture_object *texObj,
298 struct gl_texture_image *texImage );
299 void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
300 GLint level, GLint internalFormat,
301 GLsizei width, GLsizei height, GLsizei depth,
302 GLint border,
303 GLsizei imageSize, const GLvoid *data,
304 struct gl_texture_object *texObj,
305 struct gl_texture_image *texImage );
306 /* Called by glCompressedTexImage1/2/3D.
307 * Arguments:
308 * <target>, <level>, <internalFormat>, <data> are user specified.
309 * <texObj> is the target texture object.
310 * <texImage> is the target texture image. It will have the texture
311 * width, height, depth, border and internalFormat information.
312 * <retainInternalCopy> is returned by this function and indicates whether
313 * core Mesa should keep an internal copy of the texture image.
314 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
315 * should do the job.
316 */
317
318 void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
319 GLint xoffset, GLsizei width,
320 GLenum format,
321 GLsizei imageSize, const GLvoid *data,
322 struct gl_texture_object *texObj,
323 struct gl_texture_image *texImage);
324 void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
325 GLint xoffset, GLint yoffset,
326 GLsizei width, GLint height,
327 GLenum format,
328 GLsizei imageSize, const GLvoid *data,
329 struct gl_texture_object *texObj,
330 struct gl_texture_image *texImage);
331 void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
332 GLint xoffset, GLint yoffset, GLint zoffset,
333 GLsizei width, GLint height, GLint depth,
334 GLenum format,
335 GLsizei imageSize, const GLvoid *data,
336 struct gl_texture_object *texObj,
337 struct gl_texture_image *texImage);
338 /* Called by glCompressedTexSubImage1/2/3D.
339 * Arguments:
340 * <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>,
341 * <imageSize>, and <data> are user specified.
342 * <texObj> is the target texture object.
343 * <texImage> is the target texture image. It will have the texture
344 * width, height, depth, border and internalFormat information.
345 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
346 * should do the job.
347 */
348
349 void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target,
350 GLint level, void *image,
351 const struct gl_texture_object *texObj,
352 struct gl_texture_image *texImage );
353 /* Called by glGetCompressedTexImageARB.
354 * <target>, <level>, <image> are specified by user.
355 * <texObj> is the source texture object.
356 * <texImage> is the source texture image.
357 */
358
359 GLint (*BaseCompressedTexFormat)(GLcontext *ctx,
360 GLint internalFormat);
361 /* Called to compute the base format for a specific compressed
362 * format. Return -1 if the internalFormat is not a specific
363 * compressed format that the driver recognizes.
364 * Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB.
365 */
366
367 GLint (*CompressedTextureSize)(GLcontext *ctx,
368 const struct gl_texture_image *texImage);
369
370 #if 000
371 /* ... Note the
372 * return value differences between this function and
373 * SpecificCompressedTexFormat below.
374 */
375
376 GLint (*SpecificCompressedTexFormat)(GLcontext *ctx,
377 GLint internalFormat,
378 GLint numDimensions,
379 GLint *levelp,
380 GLsizei *widthp,
381 GLsizei *heightp,
382 GLsizei *depthp,
383 GLint *borderp,
384 GLenum *formatp,
385 GLenum *typep);
386 /* Called to turn a generic texture format into a specific
387 * texture format. For example, if a driver implements
388 * GL_3DFX_texture_compression_FXT1, this would map
389 * GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX.
390 *
391 * If the driver does not know how to handle the compressed
392 * format, then just return the generic format, and Mesa will
393 * do the right thing with it.
394 */
395
396 #endif
397
398 /***
399 *** Texture object functions:
400 ***/
401
402 void (*BindTexture)( GLcontext *ctx, GLenum target,
403 struct gl_texture_object *tObj );
404 /* Called by glBindTexture().
405 */
406
407 void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
408 /* Called when a texture object is created.
409 */
410
411 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
412 /* Called when a texture object is about to be deallocated. Driver
413 * should free anything attached to the DriverData pointers.
414 */
415
416 GLboolean (*IsTextureResident)( GLcontext *ctx,
417 struct gl_texture_object *t );
418 /* Called by glAreTextureResident().
419 */
420
421 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
422 GLclampf priority );
423 /* Called by glPrioritizeTextures().
424 */
425
426 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
427 /* Called by glActiveTextureARB to set current texture unit.
428 */
429
430 void (*UpdateTexturePalette)( GLcontext *ctx,
431 struct gl_texture_object *tObj );
432 /* Called when the texture's color lookup table is changed.
433 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
434 * is to be updated.
435 */
436
437 /***
438 *** Imaging functionality:
439 ***/
440 void (*CopyColorTable)( GLcontext *ctx,
441 GLenum target, GLenum internalformat,
442 GLint x, GLint y, GLsizei width );
443
444 void (*CopyColorSubTable)( GLcontext *ctx,
445 GLenum target, GLsizei start,
446 GLint x, GLint y, GLsizei width );
447
448 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
449 GLenum internalFormat,
450 GLint x, GLint y, GLsizei width );
451
452 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
453 GLenum internalFormat,
454 GLint x, GLint y,
455 GLsizei width, GLsizei height );
456
457
458
459 /***
460 *** State-changing functions (drawing functions are above)
461 ***
462 *** These functions are called by their corresponding OpenGL API functions.
463 *** They're ALSO called by the gl_PopAttrib() function!!!
464 *** May add more functions like these to the device driver in the future.
465 ***/
466 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLchan ref);
467 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
468 void (*BlendEquation)(GLcontext *ctx, GLenum mode);
469 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
470 void (*BlendFuncSeparate)(GLcontext *ctx,
471 GLenum sfactorRGB, GLenum dfactorRGB,
472 GLenum sfactorA, GLenum dfactorA);
473 void (*ClearColor)(GLcontext *ctx, const GLchan color[4]);
474 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
475 void (*ClearIndex)(GLcontext *ctx, GLuint index);
476 void (*ClearStencil)(GLcontext *ctx, GLint s);
477 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
478 GLboolean bmask, GLboolean amask );
479 void (*CullFace)(GLcontext *ctx, GLenum mode);
480 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
481 void (*FrontFace)(GLcontext *ctx, GLenum mode);
482 void (*DepthFunc)(GLcontext *ctx, GLenum func);
483 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
484 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
485 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
486 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
487 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
488 void (*IndexMask)(GLcontext *ctx, GLuint mask);
489 void (*Lightfv)(GLcontext *ctx, GLenum light,
490 GLenum pname, const GLfloat *params );
491 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
492 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
493 void (*LineWidth)(GLcontext *ctx, GLfloat width);
494 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
495 void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
496 const GLfloat *params);
497 void (*PointSize)(GLcontext *ctx, GLfloat size);
498 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
499 void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
500 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
501 void (*RenderMode)(GLcontext *ctx, GLenum mode );
502 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
503 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
504 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
505 void (*StencilMask)(GLcontext *ctx, GLuint mask);
506 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
507 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
508 const GLfloat *params);
509 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
510 const GLfloat *param);
511 void (*TexParameter)(GLcontext *ctx, GLenum target,
512 struct gl_texture_object *texObj,
513 GLenum pname, const GLfloat *params);
514 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
515 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
516
517
518 /***
519 *** Vertex array functions
520 ***
521 *** Called by the corresponding OpenGL functions.
522 ***/
523 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
524 GLsizei stride, const GLvoid *ptr);
525 void (*NormalPointer)(GLcontext *ctx, GLenum type,
526 GLsizei stride, const GLvoid *ptr);
527 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
528 GLsizei stride, const GLvoid *ptr);
529 void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
530 GLsizei stride, const GLvoid *ptr);
531 void (*IndexPointer)(GLcontext *ctx, GLenum type,
532 GLsizei stride, const GLvoid *ptr);
533 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
534 GLsizei stride, const GLvoid *ptr);
535 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
536 GLsizei stride, const GLvoid *ptr);
537 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
538
539
540 /*** State-query functions
541 ***
542 *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
543 ***/
544 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
545 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
546 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
547 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
548 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
549
550
551
552 /***
553 *** Support for multiple t&l engines
554 ***/
555
556 GLuint NeedValidate;
557 /* Bitmask of state changes that require the current tnl module to be
558 * validated, using ValidateTnlModule() below.
559 */
560
561 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
562 /* Validate the current tnl module. This is called directly after
563 * UpdateState() when a state change that has occured matches the
564 * NeedValidate bitmask above. This ensures all computed values are
565 * up to date, thus allowing the driver to decide if the current tnl
566 * module needs to be swapped out.
567 *
568 * This must be non-NULL if a driver installs a custom tnl module and
569 * sets the NeedValidate bitmask, but may be NULL otherwise.
570 */
571
572
573 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
574 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
575 #define PRIM_UNKNOWN GL_POLYGON+3
576
577 GLuint CurrentExecPrimitive;
578 /* Set by the driver-supplied t&l engine. Set to
579 * PRIM_OUTSIDE_BEGIN_END when outside begin/end.
580 */
581
582 GLuint CurrentSavePrimitive;
583 /* Current state of an in-progress compilation. May take on any of
584 * the additional values defined above.
585 */
586
587
588 #define FLUSH_STORED_VERTICES 0x1
589 #define FLUSH_UPDATE_CURRENT 0x2
590 GLuint NeedFlush;
591 /* Set by the driver-supplied t&l engine whenever vertices are
592 * buffered between begin/end objects or ctx->Current is not uptodate.
593 *
594 * The FlushVertices() call below may be used to resolve
595 * these conditions.
596 */
597
598 void (*FlushVertices)( GLcontext *ctx, GLuint flags );
599 /* If inside begin/end, ASSERT(0).
600 * Otherwise,
601 * if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
602 * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
603 * and ctx->Light.Material
604 *
605 * Note that the default t&l engine never clears the
606 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
607 */
608
609 void (*LightingSpaceChange)( GLcontext *ctx );
610 /* Notify driver that the special derived value _NeedEyeCoords has
611 * changed.
612 */
613
614 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
615 void (*EndList)( GLcontext *ctx );
616 /* Let the t&l component know what is going on with display lists
617 * in time to make changes to dispatch tables, etc.
618 * Called by glNewList() and glEndList(), respectively.
619 */
620
621 void (*BeginCallList)( GLcontext *ctx, GLuint list );
622 void (*EndCallList)( GLcontext *ctx );
623 /* Notify the t&l component before and after calling a display list.
624 * Called by glCallList(s), but not recursively.
625 */
626
627 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
628 GLframebuffer *readBuffer );
629 /* Let the t&l component know when the context becomes current.
630 */
631
632
633 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
634 void (*UnlockArraysEXT)( GLcontext *ctx );
635 /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
636 */
637
638 };
639
640
641
642 /*
643 * Transform/Clip/Lighting interface
644 */
645 typedef struct {
646 void (*ArrayElement)( GLint ); /* NOTE */
647 void (*Color3f)( GLfloat, GLfloat, GLfloat );
648 void (*Color3fv)( const GLfloat * );
649 void (*Color3ub)( GLubyte, GLubyte, GLubyte );
650 void (*Color3ubv)( const GLubyte * );
651 void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
652 void (*Color4fv)( const GLfloat * );
653 void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
654 void (*Color4ubv)( const GLubyte * );
655 void (*EdgeFlag)( GLboolean );
656 void (*EdgeFlagv)( const GLboolean * );
657 void (*EvalCoord1f)( GLfloat ); /* NOTE */
658 void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
659 void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
660 void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
661 void (*EvalPoint1)( GLint ); /* NOTE */
662 void (*EvalPoint2)( GLint, GLint ); /* NOTE */
663 void (*FogCoordfEXT)( GLfloat );
664 void (*FogCoordfvEXT)( const GLfloat * );
665 void (*Indexi)( GLint );
666 void (*Indexiv)( const GLint * );
667 void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
668 void (*MultiTexCoord1fARB)( GLenum, GLfloat );
669 void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * );
670 void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
671 void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * );
672 void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
673 void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * );
674 void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
675 void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * );
676 void (*Normal3f)( GLfloat, GLfloat, GLfloat );
677 void (*Normal3fv)( const GLfloat * );
678 void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
679 void (*SecondaryColor3fvEXT)( const GLfloat * );
680 void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
681 void (*SecondaryColor3ubvEXT)( const GLubyte * );
682 void (*TexCoord1f)( GLfloat );
683 void (*TexCoord1fv)( const GLfloat * );
684 void (*TexCoord2f)( GLfloat, GLfloat );
685 void (*TexCoord2fv)( const GLfloat * );
686 void (*TexCoord3f)( GLfloat, GLfloat, GLfloat );
687 void (*TexCoord3fv)( const GLfloat * );
688 void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
689 void (*TexCoord4fv)( const GLfloat * );
690 void (*Vertex2f)( GLfloat, GLfloat );
691 void (*Vertex2fv)( const GLfloat * );
692 void (*Vertex3f)( GLfloat, GLfloat, GLfloat );
693 void (*Vertex3fv)( const GLfloat * );
694 void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
695 void (*Vertex4fv)( const GLfloat * );
696 void (*CallList)( GLuint ); /* NOTE */
697 void (*Begin)( GLenum );
698 void (*End)( void );
699 /* Drivers present a reduced set of the functions possible in
700 * begin/end objects. Core mesa provides translation stubs for the
701 * remaining functions to map down to these entrypoints.
702 *
703 * These are the initial values to be installed into dispatch by
704 * mesa. If the t&l driver wants to modify the dispatch table
705 * while installed, it must do so itself. It would be possible for
706 * the vertexformat to install it's own initial values for these
707 * functions, but this way there is an obvious list of what is
708 * expected of the driver.
709 *
710 * If the driver wants to hook in entrypoints other than those
711 * listed above, it must restore them to their original values in
712 * the disable() callback, below.
713 */
714
715 void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
716 /*
717 */
718
719 void (*DrawArrays)( GLenum mode, GLint start, GLsizei count );
720 void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
721 const GLvoid *indices );
722 void (*DrawRangeElements)( GLenum mode, GLuint start,
723 GLuint end, GLsizei count,
724 GLenum type, const GLvoid *indices );
725 /* These may or may not belong here. Heuristic: If an array is
726 * enabled, the installed vertex format should support that array and
727 * it's current size natively.
728 */
729
730 void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
731 void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
732 /* If you don't support eval, fallback to the default vertex format
733 * on receiving an eval call and use the pipeline mechanism to
734 * provide partial t&l acceleration.
735 *
736 * Mesa will provide a set of helper functions to do eval within
737 * accelerated vertex formats, eventually...
738 */
739
740 GLboolean prefer_float_colors;
741 /* Should core try to send colors to glColor4f or glColor4chan,
742 * where it has a choice?
743 */
744 } GLvertexformat;
745
746
747 #endif /* DD_INCLUDED */