Changed a number of context fields from GLchan to GLfloat (such as ClearColor).
[mesa.git] / src / mesa / main / dd.h
1 /* $Id: dd.h,v 1.73 2002/10/04 19:10:07 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 /***
345 *** Texture object functions:
346 ***/
347
348 void (*BindTexture)( GLcontext *ctx, GLenum target,
349 struct gl_texture_object *tObj );
350 /* Called by glBindTexture().
351 */
352
353 void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
354 /* Called when a texture object is created.
355 */
356
357 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
358 /* Called when a texture object is about to be deallocated. Driver
359 * should free anything attached to the DriverData pointers.
360 */
361
362 GLboolean (*IsTextureResident)( GLcontext *ctx,
363 struct gl_texture_object *t );
364 /* Called by glAreTextureResident().
365 */
366
367 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
368 GLclampf priority );
369 /* Called by glPrioritizeTextures().
370 */
371
372 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
373 /* Called by glActiveTextureARB to set current texture unit.
374 */
375
376 void (*UpdateTexturePalette)( GLcontext *ctx,
377 struct gl_texture_object *tObj );
378 /* Called when the texture's color lookup table is changed.
379 * If tObj is NULL then the shared texture palette ctx->Texture.Palette
380 * is to be updated.
381 */
382
383 /***
384 *** Imaging functionality:
385 ***/
386 void (*CopyColorTable)( GLcontext *ctx,
387 GLenum target, GLenum internalformat,
388 GLint x, GLint y, GLsizei width );
389
390 void (*CopyColorSubTable)( GLcontext *ctx,
391 GLenum target, GLsizei start,
392 GLint x, GLint y, GLsizei width );
393
394 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
395 GLenum internalFormat,
396 GLint x, GLint y, GLsizei width );
397
398 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
399 GLenum internalFormat,
400 GLint x, GLint y,
401 GLsizei width, GLsizei height );
402
403
404
405 /***
406 *** State-changing functions (drawing functions are above)
407 ***
408 *** These functions are called by their corresponding OpenGL API functions.
409 *** They're ALSO called by the gl_PopAttrib() function!!!
410 *** May add more functions like these to the device driver in the future.
411 ***/
412 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref);
413 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
414 void (*BlendEquation)(GLcontext *ctx, GLenum mode);
415 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
416 void (*BlendFuncSeparate)(GLcontext *ctx,
417 GLenum sfactorRGB, GLenum dfactorRGB,
418 GLenum sfactorA, GLenum dfactorA);
419 void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]);
420 void (*ClearDepth)(GLcontext *ctx, GLclampd d);
421 void (*ClearIndex)(GLcontext *ctx, GLuint index);
422 void (*ClearStencil)(GLcontext *ctx, GLint s);
423 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
424 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
425 GLboolean bmask, GLboolean amask );
426 void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
427 void (*CullFace)(GLcontext *ctx, GLenum mode);
428 void (*FrontFace)(GLcontext *ctx, GLenum mode);
429 void (*DepthFunc)(GLcontext *ctx, GLenum func);
430 void (*DepthMask)(GLcontext *ctx, GLboolean flag);
431 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
432 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
433 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
434 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
435 void (*IndexMask)(GLcontext *ctx, GLuint mask);
436 void (*Lightfv)(GLcontext *ctx, GLenum light,
437 GLenum pname, const GLfloat *params );
438 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
439 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
440 void (*LineWidth)(GLcontext *ctx, GLfloat width);
441 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
442 void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
443 const GLfloat *params);
444 void (*PointSize)(GLcontext *ctx, GLfloat size);
445 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
446 void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
447 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
448 void (*RenderMode)(GLcontext *ctx, GLenum mode );
449 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
450 void (*ShadeModel)(GLcontext *ctx, GLenum mode);
451 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
452 void (*StencilMask)(GLcontext *ctx, GLuint mask);
453 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass);
454 void (*ActiveStencilFace)(GLcontext *ctx, GLuint face);
455 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
456 const GLfloat *params);
457 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
458 const GLfloat *param);
459 void (*TexParameter)(GLcontext *ctx, GLenum target,
460 struct gl_texture_object *texObj,
461 GLenum pname, const GLfloat *params);
462 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
463 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
464
465 /***
466 *** Vertex array functions
467 ***
468 *** Called by the corresponding OpenGL functions.
469 ***/
470 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
471 GLsizei stride, const GLvoid *ptr);
472 void (*NormalPointer)(GLcontext *ctx, GLenum type,
473 GLsizei stride, const GLvoid *ptr);
474 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type,
475 GLsizei stride, const GLvoid *ptr);
476 void (*FogCoordPointer)(GLcontext *ctx, GLenum type,
477 GLsizei stride, const GLvoid *ptr);
478 void (*IndexPointer)(GLcontext *ctx, GLenum type,
479 GLsizei stride, const GLvoid *ptr);
480 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type,
481 GLsizei stride, const GLvoid *ptr);
482 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type,
483 GLsizei stride, const GLvoid *ptr);
484 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
485 void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
486 GLenum type, GLsizei stride, const GLvoid *ptr);
487
488
489 /*** State-query functions
490 ***
491 *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
492 ***/
493 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
494 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
495 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
496 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
497 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
498
499 /***
500 *** Support for multiple t&l engines
501 ***/
502
503 GLuint NeedValidate;
504 /* Bitmask of state changes that require the current tnl module to be
505 * validated, using ValidateTnlModule() below.
506 */
507
508 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
509 /* Validate the current tnl module. This is called directly after
510 * UpdateState() when a state change that has occured matches the
511 * NeedValidate bitmask above. This ensures all computed values are
512 * up to date, thus allowing the driver to decide if the current tnl
513 * module needs to be swapped out.
514 *
515 * This must be non-NULL if a driver installs a custom tnl module and
516 * sets the NeedValidate bitmask, but may be NULL otherwise.
517 */
518
519
520 #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
521 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
522 #define PRIM_UNKNOWN GL_POLYGON+3
523
524 GLuint CurrentExecPrimitive;
525 /* Set by the driver-supplied t&l engine. Set to
526 * PRIM_OUTSIDE_BEGIN_END when outside begin/end.
527 */
528
529 GLuint CurrentSavePrimitive;
530 /* Current state of an in-progress compilation. May take on any of
531 * the additional values defined above.
532 */
533
534
535 #define FLUSH_STORED_VERTICES 0x1
536 #define FLUSH_UPDATE_CURRENT 0x2
537 GLuint NeedFlush;
538 /* Set by the driver-supplied t&l engine whenever vertices are
539 * buffered between begin/end objects or ctx->Current is not uptodate.
540 *
541 * The FlushVertices() call below may be used to resolve
542 * these conditions.
543 */
544
545 void (*FlushVertices)( GLcontext *ctx, GLuint flags );
546 /* If inside begin/end, ASSERT(0).
547 * Otherwise,
548 * if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
549 * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
550 * and ctx->Light.Material
551 *
552 * Note that the default t&l engine never clears the
553 * FLUSH_UPDATE_CURRENT bit, even after performing the update.
554 */
555
556 void (*LightingSpaceChange)( GLcontext *ctx );
557 /* Notify driver that the special derived value _NeedEyeCoords has
558 * changed.
559 */
560
561 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
562 void (*EndList)( GLcontext *ctx );
563 /* Let the t&l component know what is going on with display lists
564 * in time to make changes to dispatch tables, etc.
565 * Called by glNewList() and glEndList(), respectively.
566 */
567
568 void (*BeginCallList)( GLcontext *ctx, GLuint list );
569 void (*EndCallList)( GLcontext *ctx );
570 /* Notify the t&l component before and after calling a display list.
571 * Called by glCallList(s), but not recursively.
572 */
573
574 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
575 GLframebuffer *readBuffer );
576 /* Let the t&l component know when the context becomes current.
577 */
578
579
580 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
581 void (*UnlockArraysEXT)( GLcontext *ctx );
582 /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
583 */
584 };
585
586
587
588 /*
589 * Transform/Clip/Lighting interface
590 */
591 typedef struct {
592 void (*ArrayElement)( GLint ); /* NOTE */
593 void (*Color3f)( GLfloat, GLfloat, GLfloat );
594 void (*Color3fv)( const GLfloat * );
595 void (*Color3ub)( GLubyte, GLubyte, GLubyte );
596 void (*Color3ubv)( const GLubyte * );
597 void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
598 void (*Color4fv)( const GLfloat * );
599 void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
600 void (*Color4ubv)( const GLubyte * );
601 void (*EdgeFlag)( GLboolean );
602 void (*EdgeFlagv)( const GLboolean * );
603 void (*EvalCoord1f)( GLfloat ); /* NOTE */
604 void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
605 void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
606 void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
607 void (*EvalPoint1)( GLint ); /* NOTE */
608 void (*EvalPoint2)( GLint, GLint ); /* NOTE */
609 void (*FogCoordfEXT)( GLfloat );
610 void (*FogCoordfvEXT)( const GLfloat * );
611 void (*Indexi)( GLint );
612 void (*Indexiv)( const GLint * );
613 void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */
614 void (*MultiTexCoord1fARB)( GLenum, GLfloat );
615 void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * );
616 void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
617 void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * );
618 void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
619 void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * );
620 void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
621 void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * );
622 void (*Normal3f)( GLfloat, GLfloat, GLfloat );
623 void (*Normal3fv)( const GLfloat * );
624 void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
625 void (*SecondaryColor3fvEXT)( const GLfloat * );
626 void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte );
627 void (*SecondaryColor3ubvEXT)( const GLubyte * );
628 void (*TexCoord1f)( GLfloat );
629 void (*TexCoord1fv)( const GLfloat * );
630 void (*TexCoord2f)( GLfloat, GLfloat );
631 void (*TexCoord2fv)( const GLfloat * );
632 void (*TexCoord3f)( GLfloat, GLfloat, GLfloat );
633 void (*TexCoord3fv)( const GLfloat * );
634 void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
635 void (*TexCoord4fv)( const GLfloat * );
636 void (*Vertex2f)( GLfloat, GLfloat );
637 void (*Vertex2fv)( const GLfloat * );
638 void (*Vertex3f)( GLfloat, GLfloat, GLfloat );
639 void (*Vertex3fv)( const GLfloat * );
640 void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
641 void (*Vertex4fv)( const GLfloat * );
642 void (*CallList)( GLuint ); /* NOTE */
643 void (*Begin)( GLenum );
644 void (*End)( void );
645 void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
646 void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
647
648 /* Drivers present a reduced set of the functions possible in
649 * begin/end objects. Core mesa provides translation stubs for the
650 * remaining functions to map down to these entrypoints.
651 *
652 * These are the initial values to be installed into dispatch by
653 * mesa. If the t&l driver wants to modify the dispatch table
654 * while installed, it must do so itself. It would be possible for
655 * the vertexformat to install it's own initial values for these
656 * functions, but this way there is an obvious list of what is
657 * expected of the driver.
658 *
659 * If the driver wants to hook in entrypoints other than those
660 * listed above, it must restore them to their original values in
661 * the disable() callback, below.
662 */
663
664 void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
665 /*
666 */
667
668 void (*DrawArrays)( GLenum mode, GLint start, GLsizei count );
669 void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
670 const GLvoid *indices );
671 void (*DrawRangeElements)( GLenum mode, GLuint start,
672 GLuint end, GLsizei count,
673 GLenum type, const GLvoid *indices );
674 /* These may or may not belong here. Heuristic: If an array is
675 * enabled, the installed vertex format should support that array and
676 * it's current size natively.
677 */
678
679 void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
680 void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
681 /* If you don't support eval, fallback to the default vertex format
682 * on receiving an eval call and use the pipeline mechanism to
683 * provide partial t&l acceleration.
684 *
685 * Mesa will provide a set of helper functions to do eval within
686 * accelerated vertex formats, eventually...
687 */
688
689 GLboolean prefer_float_colors;
690 /* Should core try to send colors to glColor4f or glColor4chan,
691 * where it has a choice?
692 */
693 } GLvertexformat;
694
695
696 #endif /* DD_INCLUDED */