dd.h revision 9ac51f57efe07ed43a1e4224a7f5daddec401b36
1 2/* 3 * Mesa 3-D graphics library 4 * Version: 4.1 5 * 6 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a 9 * copy of this software and associated documentation files (the "Software"), 10 * to deal in the Software without restriction, including without limitation 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * and/or sell copies of the Software, and to permit persons to whom the 13 * Software is furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included 16 * in all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 */ 25 26 27 28#ifndef DD_INCLUDED 29#define DD_INCLUDED 30 31/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ 32 33struct gl_pixelstore_attrib; 34 35/* Mask bits sent to the driver Clear() function */ 36#define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */ 37#define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */ 38#define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */ 39#define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */ 40#define DD_AUX0 AUX0_BIT /* future use */ 41#define DD_AUX1 AUX1_BIT /* future use */ 42#define DD_AUX2 AUX2_BIT /* future use */ 43#define DD_AUX3 AUX3_BIT /* future use */ 44#define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */ 45#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */ 46#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */ 47 48 49/* 50 * Device Driver function table. 51 */ 52struct dd_function_table { 53 const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); 54 /* Return a string as needed by glGetString(). 55 * Only the GL_RENDERER token must be implemented. Otherwise, 56 * NULL can be returned. 57 */ 58 59 void (*UpdateState)( GLcontext *ctx, GLuint new_state ); 60 /* 61 * UpdateState() is called to notify the driver after Mesa has made 62 * some internal state changes. This is in addition to any 63 * statechange callbacks Mesa may already have made. 64 */ 65 66 void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all, 67 GLint x, GLint y, GLint width, GLint height ); 68 /* Clear the color/depth/stencil/accum buffer(s). 69 * 'mask' is a bitmask of the DD_*_BIT values defined above that indicates 70 * which buffers need to be cleared. 71 * If 'all' is true then the clear the whole buffer, else clear only the 72 * region defined by (x,y,width,height). 73 * This function must obey the glColorMask, glIndexMask and glStencilMask 74 * settings! 75 * Software Mesa can do masked clears if the device driver can't. 76 */ 77 78 void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); 79 /* 80 * Specifies the current buffer for writing. Called via glDrawBuffer(). 81 * Note the driver must organize fallbacks (eg with swrast) if it 82 * cannot implement the requested mode. 83 */ 84 85 86 void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); 87 /* 88 * Specifies the current buffer for reading. Called via glReadBuffer(). 89 */ 90 91 void (*GetBufferSize)( GLframebuffer *buffer, 92 GLuint *width, GLuint *height ); 93 /* 94 * Returns the width and height of the named buffer/window. 95 * Mesa uses this to determine when the driver's window size has changed. 96 */ 97 98 void (*ResizeBuffers)( GLframebuffer *buffer ); 99 /* 100 * Resize the driver's depth/stencil/accum/back buffers to match the 101 * size given in the GLframebuffer struct. This is typically called 102 * when Mesa detects that a window size has changed. 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 /*** 168 *** Texture image functions: 169 ***/ 170 const struct gl_texture_format * 171 (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat, 172 GLenum srcFormat, GLenum srcType ); 173 /* This is called by the _mesa_store_tex[sub]image[123]d() fallback 174 * functions. The driver should examine <internalFormat> and return a 175 * pointer to an appropriate gl_texture_format. 176 */ 177 178 void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, 179 GLint internalFormat, 180 GLint width, GLint border, 181 GLenum format, GLenum type, const GLvoid *pixels, 182 const struct gl_pixelstore_attrib *packing, 183 struct gl_texture_object *texObj, 184 struct gl_texture_image *texImage ); 185 void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, 186 GLint internalFormat, 187 GLint width, GLint height, GLint border, 188 GLenum format, GLenum type, const GLvoid *pixels, 189 const struct gl_pixelstore_attrib *packing, 190 struct gl_texture_object *texObj, 191 struct gl_texture_image *texImage ); 192 void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, 193 GLint internalFormat, 194 GLint width, GLint height, GLint depth, GLint border, 195 GLenum format, GLenum type, const GLvoid *pixels, 196 const struct gl_pixelstore_attrib *packing, 197 struct gl_texture_object *texObj, 198 struct gl_texture_image *texImage ); 199 /* Called by glTexImage1/2/3D. 200 * Arguments: 201 * <target>, <level>, <format>, <type> and <pixels> are user specified. 202 * <packing> indicates the image packing of pixels. 203 * <texObj> is the target texture object. 204 * <texImage> is the target texture image. It will have the texture 205 * width, height, depth, border and internalFormat information. 206 * <retainInternalCopy> is returned by this function and indicates whether 207 * core Mesa should keep an internal copy of the texture image. 208 * Drivers should call a fallback routine from texstore.c if needed. 209 */ 210 211 void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, 212 GLint xoffset, GLsizei width, 213 GLenum format, GLenum type, 214 const GLvoid *pixels, 215 const struct gl_pixelstore_attrib *packing, 216 struct gl_texture_object *texObj, 217 struct gl_texture_image *texImage ); 218 void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, 219 GLint xoffset, GLint yoffset, 220 GLsizei width, GLsizei height, 221 GLenum format, GLenum type, 222 const GLvoid *pixels, 223 const struct gl_pixelstore_attrib *packing, 224 struct gl_texture_object *texObj, 225 struct gl_texture_image *texImage ); 226 void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, 227 GLint xoffset, GLint yoffset, GLint zoffset, 228 GLsizei width, GLsizei height, GLint depth, 229 GLenum format, GLenum type, 230 const GLvoid *pixels, 231 const struct gl_pixelstore_attrib *packing, 232 struct gl_texture_object *texObj, 233 struct gl_texture_image *texImage ); 234 /* Called by glTexSubImage1/2/3D. 235 * Arguments: 236 * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>, 237 * <depth>, <format>, <type> and <pixels> are user specified. 238 * <packing> indicates the image packing of pixels. 239 * <texObj> is the target texture object. 240 * <texImage> is the target texture image. It will have the texture 241 * width, height, border and internalFormat information. 242 * The driver should use a fallback routine from texstore.c if needed. 243 */ 244 245 void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, 246 GLenum internalFormat, GLint x, GLint y, 247 GLsizei width, GLint border ); 248 void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level, 249 GLenum internalFormat, GLint x, GLint y, 250 GLsizei width, GLsizei height, GLint border ); 251 /* Called by glCopyTexImage1D and glCopyTexImage2D. 252 * Drivers should use a fallback routine from texstore.c if needed. 253 */ 254 255 void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, 256 GLint xoffset, 257 GLint x, GLint y, GLsizei width ); 258 void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, 259 GLint xoffset, GLint yoffset, 260 GLint x, GLint y, 261 GLsizei width, GLsizei height ); 262 void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, 263 GLint xoffset, GLint yoffset, GLint zoffset, 264 GLint x, GLint y, 265 GLsizei width, GLsizei height ); 266 /* Called by glCopyTexSubImage1/2/3D. 267 * Drivers should use a fallback routine from texstore.c if needed. 268 */ 269 270 GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target, 271 GLint level, GLint internalFormat, 272 GLenum format, GLenum type, 273 GLint width, GLint height, 274 GLint depth, GLint border); 275 /* Called by glTexImage[123]D when user specifies a proxy texture 276 * target. Return GL_TRUE if the proxy test passes, return GL_FALSE 277 * if the test fails. 278 */ 279 280 /*** 281 *** Compressed texture functions: 282 ***/ 283 284 void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, 285 GLint level, GLint internalFormat, 286 GLsizei width, GLint border, 287 GLsizei imageSize, const GLvoid *data, 288 struct gl_texture_object *texObj, 289 struct gl_texture_image *texImage ); 290 void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, 291 GLint level, GLint internalFormat, 292 GLsizei width, GLsizei height, GLint border, 293 GLsizei imageSize, const GLvoid *data, 294 struct gl_texture_object *texObj, 295 struct gl_texture_image *texImage ); 296 void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, 297 GLint level, GLint internalFormat, 298 GLsizei width, GLsizei height, GLsizei depth, 299 GLint border, 300 GLsizei imageSize, const GLvoid *data, 301 struct gl_texture_object *texObj, 302 struct gl_texture_image *texImage ); 303 /* Called by glCompressedTexImage1/2/3D. 304 * Arguments: 305 * <target>, <level>, <internalFormat>, <data> are user specified. 306 * <texObj> is the target texture object. 307 * <texImage> is the target texture image. It will have the texture 308 * width, height, depth, border and internalFormat information. 309 * <retainInternalCopy> is returned by this function and indicates whether 310 * core Mesa should keep an internal copy of the texture image. 311 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa 312 * should do the job. 313 */ 314 315 void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level, 316 GLint xoffset, GLsizei width, 317 GLenum format, 318 GLsizei imageSize, const GLvoid *data, 319 struct gl_texture_object *texObj, 320 struct gl_texture_image *texImage); 321 void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level, 322 GLint xoffset, GLint yoffset, 323 GLsizei width, GLint height, 324 GLenum format, 325 GLsizei imageSize, const GLvoid *data, 326 struct gl_texture_object *texObj, 327 struct gl_texture_image *texImage); 328 void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level, 329 GLint xoffset, GLint yoffset, GLint zoffset, 330 GLsizei width, GLint height, GLint depth, 331 GLenum format, 332 GLsizei imageSize, const GLvoid *data, 333 struct gl_texture_object *texObj, 334 struct gl_texture_image *texImage); 335 /* Called by glCompressedTexSubImage1/2/3D. 336 * Arguments: 337 * <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>, 338 * <imageSize>, and <data> are user specified. 339 * <texObj> is the target texture object. 340 * <texImage> is the target texture image. It will have the texture 341 * width, height, depth, border and internalFormat information. 342 * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa 343 * should do the job. 344 */ 345 346 /*** 347 *** Texture object functions: 348 ***/ 349 350 void (*BindTexture)( GLcontext *ctx, GLenum target, 351 struct gl_texture_object *tObj ); 352 /* Called by glBindTexture(). 353 */ 354 355 struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name, 356 GLenum target ); 357 /* Called to allocate a new texture object. 358 * NOTE: this function pointer should be initialized by drivers _BEFORE_ 359 * calling _mesa_initialize_context() since context initialization involves 360 * allocating some texture objects! 361 */ 362 363 void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); 364 /* Called when a texture object is about to be deallocated. Driver 365 * should free anything attached to the DriverData pointers. 366 */ 367 368 struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx ); 369 /* Called to allocate a new texture image object. 370 */ 371 372 GLboolean (*IsTextureResident)( GLcontext *ctx, 373 struct gl_texture_object *t ); 374 /* Called by glAreTextureResident(). 375 */ 376 377 void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, 378 GLclampf priority ); 379 /* Called by glPrioritizeTextures(). 380 */ 381 382 void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber ); 383 /* Called by glActiveTextureARB to set current texture unit. 384 */ 385 386 void (*UpdateTexturePalette)( GLcontext *ctx, 387 struct gl_texture_object *tObj ); 388 /* Called when the texture's color lookup table is changed. 389 * If tObj is NULL then the shared texture palette ctx->Texture.Palette 390 * is to be updated. 391 */ 392 393 /*** 394 *** Imaging functionality: 395 ***/ 396 void (*CopyColorTable)( GLcontext *ctx, 397 GLenum target, GLenum internalformat, 398 GLint x, GLint y, GLsizei width ); 399 400 void (*CopyColorSubTable)( GLcontext *ctx, 401 GLenum target, GLsizei start, 402 GLint x, GLint y, GLsizei width ); 403 404 void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target, 405 GLenum internalFormat, 406 GLint x, GLint y, GLsizei width ); 407 408 void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target, 409 GLenum internalFormat, 410 GLint x, GLint y, 411 GLsizei width, GLsizei height ); 412 413 414 415 /*** 416 *** State-changing functions (drawing functions are above) 417 *** 418 *** These functions are called by their corresponding OpenGL API functions. 419 *** They're ALSO called by the gl_PopAttrib() function!!! 420 *** May add more functions like these to the device driver in the future. 421 ***/ 422 void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref); 423 void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]); 424 void (*BlendEquation)(GLcontext *ctx, GLenum mode); 425 void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor); 426 void (*BlendFuncSeparate)(GLcontext *ctx, 427 GLenum sfactorRGB, GLenum dfactorRGB, 428 GLenum sfactorA, GLenum dfactorA); 429 void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]); 430 void (*ClearDepth)(GLcontext *ctx, GLclampd d); 431 void (*ClearIndex)(GLcontext *ctx, GLuint index); 432 void (*ClearStencil)(GLcontext *ctx, GLint s); 433 void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation ); 434 void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask, 435 GLboolean bmask, GLboolean amask ); 436 void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode); 437 void (*CullFace)(GLcontext *ctx, GLenum mode); 438 void (*FrontFace)(GLcontext *ctx, GLenum mode); 439 void (*DepthFunc)(GLcontext *ctx, GLenum func); 440 void (*DepthMask)(GLcontext *ctx, GLboolean flag); 441 void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval); 442 void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state); 443 void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); 444 void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode); 445 void (*IndexMask)(GLcontext *ctx, GLuint mask); 446 void (*Lightfv)(GLcontext *ctx, GLenum light, 447 GLenum pname, const GLfloat *params ); 448 void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); 449 void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); 450 void (*LineWidth)(GLcontext *ctx, GLfloat width); 451 void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); 452 void (*PointParameterfv)(GLcontext *ctx, GLenum pname, 453 const GLfloat *params); 454 void (*PointSize)(GLcontext *ctx, GLfloat size); 455 void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); 456 void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units); 457 void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); 458 void (*RenderMode)(GLcontext *ctx, GLenum mode ); 459 void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); 460 void (*ShadeModel)(GLcontext *ctx, GLenum mode); 461 void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); 462 void (*StencilMask)(GLcontext *ctx, GLuint mask); 463 void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass); 464 void (*ActiveStencilFace)(GLcontext *ctx, GLuint face); 465 void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname, 466 const GLfloat *params); 467 void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, 468 const GLfloat *param); 469 void (*TexParameter)(GLcontext *ctx, GLenum target, 470 struct gl_texture_object *texObj, 471 GLenum pname, const GLfloat *params); 472 void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat); 473 void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); 474 475 /*** 476 *** Vertex array functions 477 *** 478 *** Called by the corresponding OpenGL functions. 479 ***/ 480 void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type, 481 GLsizei stride, const GLvoid *ptr); 482 void (*NormalPointer)(GLcontext *ctx, GLenum type, 483 GLsizei stride, const GLvoid *ptr); 484 void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type, 485 GLsizei stride, const GLvoid *ptr); 486 void (*FogCoordPointer)(GLcontext *ctx, GLenum type, 487 GLsizei stride, const GLvoid *ptr); 488 void (*IndexPointer)(GLcontext *ctx, GLenum type, 489 GLsizei stride, const GLvoid *ptr); 490 void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type, 491 GLsizei stride, const GLvoid *ptr); 492 void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type, 493 GLsizei stride, const GLvoid *ptr); 494 void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr); 495 void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size, 496 GLenum type, GLsizei stride, const GLvoid *ptr); 497 498 499 /*** State-query functions 500 *** 501 *** Return GL_TRUE if query was completed, GL_FALSE otherwise. 502 ***/ 503 GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result); 504 GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result); 505 GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result); 506 GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result); 507 GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result); 508 509 /*** 510 *** Support for multiple t&l engines 511 ***/ 512 513 GLuint NeedValidate; 514 /* Bitmask of state changes that require the current tnl module to be 515 * validated, using ValidateTnlModule() below. 516 */ 517 518 void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state ); 519 /* Validate the current tnl module. This is called directly after 520 * UpdateState() when a state change that has occured matches the 521 * NeedValidate bitmask above. This ensures all computed values are 522 * up to date, thus allowing the driver to decide if the current tnl 523 * module needs to be swapped out. 524 * 525 * This must be non-NULL if a driver installs a custom tnl module and 526 * sets the NeedValidate bitmask, but may be NULL otherwise. 527 */ 528 529 530#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1 531#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2 532#define PRIM_UNKNOWN GL_POLYGON+3 533 534 GLuint CurrentExecPrimitive; 535 /* Set by the driver-supplied t&l engine. Set to 536 * PRIM_OUTSIDE_BEGIN_END when outside begin/end. 537 */ 538 539 GLuint CurrentSavePrimitive; 540 /* Current state of an in-progress compilation. May take on any of 541 * the additional values defined above. 542 */ 543 544 545#define FLUSH_STORED_VERTICES 0x1 546#define FLUSH_UPDATE_CURRENT 0x2 547 GLuint NeedFlush; 548 /* Set by the driver-supplied t&l engine whenever vertices are 549 * buffered between begin/end objects or ctx->Current is not uptodate. 550 * 551 * The FlushVertices() call below may be used to resolve 552 * these conditions. 553 */ 554 555 void (*FlushVertices)( GLcontext *ctx, GLuint flags ); 556 /* If inside begin/end, ASSERT(0). 557 * Otherwise, 558 * if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices, 559 * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current 560 * and ctx->Light.Material 561 * 562 * Note that the default t&l engine never clears the 563 * FLUSH_UPDATE_CURRENT bit, even after performing the update. 564 */ 565 566 void (*LightingSpaceChange)( GLcontext *ctx ); 567 /* Notify driver that the special derived value _NeedEyeCoords has 568 * changed. 569 */ 570 571 void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode ); 572 void (*EndList)( GLcontext *ctx ); 573 /* Let the t&l component know what is going on with display lists 574 * in time to make changes to dispatch tables, etc. 575 * Called by glNewList() and glEndList(), respectively. 576 */ 577 578 void (*BeginCallList)( GLcontext *ctx, GLuint list ); 579 void (*EndCallList)( GLcontext *ctx ); 580 /* Notify the t&l component before and after calling a display list. 581 * Called by glCallList(s), but not recursively. 582 */ 583 584 void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, 585 GLframebuffer *readBuffer ); 586 /* Let the t&l component know when the context becomes current. 587 */ 588 589 590 void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); 591 void (*UnlockArraysEXT)( GLcontext *ctx ); 592 /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively. 593 */ 594}; 595 596 597 598/* 599 * Transform/Clip/Lighting interface 600 */ 601typedef struct { 602 void (*ArrayElement)( GLint ); /* NOTE */ 603 void (*Color3f)( GLfloat, GLfloat, GLfloat ); 604 void (*Color3fv)( const GLfloat * ); 605 void (*Color3ub)( GLubyte, GLubyte, GLubyte ); 606 void (*Color3ubv)( const GLubyte * ); 607 void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); 608 void (*Color4fv)( const GLfloat * ); 609 void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte ); 610 void (*Color4ubv)( const GLubyte * ); 611 void (*EdgeFlag)( GLboolean ); 612 void (*EdgeFlagv)( const GLboolean * ); 613 void (*EvalCoord1f)( GLfloat ); /* NOTE */ 614 void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */ 615 void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ 616 void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */ 617 void (*EvalPoint1)( GLint ); /* NOTE */ 618 void (*EvalPoint2)( GLint, GLint ); /* NOTE */ 619 void (*FogCoordfEXT)( GLfloat ); 620 void (*FogCoordfvEXT)( const GLfloat * ); 621 void (*Indexi)( GLint ); 622 void (*Indexiv)( const GLint * ); 623 void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ 624 void (*MultiTexCoord1fARB)( GLenum, GLfloat ); 625 void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * ); 626 void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); 627 void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * ); 628 void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); 629 void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * ); 630 void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); 631 void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * ); 632 void (*Normal3f)( GLfloat, GLfloat, GLfloat ); 633 void (*Normal3fv)( const GLfloat * ); 634 void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); 635 void (*SecondaryColor3fvEXT)( const GLfloat * ); 636 void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte ); 637 void (*SecondaryColor3ubvEXT)( const GLubyte * ); 638 void (*TexCoord1f)( GLfloat ); 639 void (*TexCoord1fv)( const GLfloat * ); 640 void (*TexCoord2f)( GLfloat, GLfloat ); 641 void (*TexCoord2fv)( const GLfloat * ); 642 void (*TexCoord3f)( GLfloat, GLfloat, GLfloat ); 643 void (*TexCoord3fv)( const GLfloat * ); 644 void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); 645 void (*TexCoord4fv)( const GLfloat * ); 646 void (*Vertex2f)( GLfloat, GLfloat ); 647 void (*Vertex2fv)( const GLfloat * ); 648 void (*Vertex3f)( GLfloat, GLfloat, GLfloat ); 649 void (*Vertex3fv)( const GLfloat * ); 650 void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); 651 void (*Vertex4fv)( const GLfloat * ); 652 void (*CallList)( GLuint ); /* NOTE */ 653 void (*Begin)( GLenum ); 654 void (*End)( void ); 655 void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); 656 void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); 657 658 /* Drivers present a reduced set of the functions possible in 659 * begin/end objects. Core mesa provides translation stubs for the 660 * remaining functions to map down to these entrypoints. 661 * 662 * These are the initial values to be installed into dispatch by 663 * mesa. If the t&l driver wants to modify the dispatch table 664 * while installed, it must do so itself. It would be possible for 665 * the vertexformat to install it's own initial values for these 666 * functions, but this way there is an obvious list of what is 667 * expected of the driver. 668 * 669 * If the driver wants to hook in entrypoints other than those 670 * listed above, it must restore them to their original values in 671 * the disable() callback, below. 672 */ 673 674 void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); 675 /* 676 */ 677 678 void (*DrawArrays)( GLenum mode, GLint start, GLsizei count ); 679 void (*DrawElements)( GLenum mode, GLsizei count, GLenum type, 680 const GLvoid *indices ); 681 void (*DrawRangeElements)( GLenum mode, GLuint start, 682 GLuint end, GLsizei count, 683 GLenum type, const GLvoid *indices ); 684 /* These may or may not belong here. Heuristic: If an array is 685 * enabled, the installed vertex format should support that array and 686 * it's current size natively. 687 */ 688 689 void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); 690 void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); 691 /* If you don't support eval, fallback to the default vertex format 692 * on receiving an eval call and use the pipeline mechanism to 693 * provide partial t&l acceleration. 694 * 695 * Mesa will provide a set of helper functions to do eval within 696 * accelerated vertex formats, eventually... 697 */ 698 699 GLboolean prefer_float_colors; 700 /* Should core try to send colors to glColor4f or glColor4chan, 701 * where it has a choice? 702 */ 703} GLvertexformat; 704 705 706#endif /* DD_INCLUDED */ 707