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