dlist.c revision fea6e5a69588012cf0373f36dff99a45b0202f55
1/* 2 * Mesa 3-D graphics library 3 * Version: 6.5.1 4 * 5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included 15 * in all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 26/** 27 * \file dlist.c 28 * Display lists management functions. 29 */ 30 31#include "glheader.h" 32#include "imports.h" 33#include "api_arrayelt.h" 34#include "api_loopback.h" 35#include "config.h" 36#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 37#include "arbprogram.h" 38#include "program.h" 39#endif 40#include "attrib.h" 41#include "blend.h" 42#include "buffers.h" 43#if FEATURE_ARB_vertex_buffer_object 44#include "bufferobj.h" 45#endif 46#include "arrayobj.h" 47#include "clip.h" 48#include "colormac.h" 49#include "colortab.h" 50#include "context.h" 51#include "convolve.h" 52#include "depth.h" 53#include "dlist.h" 54#include "enable.h" 55#include "enums.h" 56#include "eval.h" 57#include "extensions.h" 58#include "feedback.h" 59#include "get.h" 60#include "glapi.h" 61#include "hash.h" 62#include "histogram.h" 63#include "image.h" 64#include "light.h" 65#include "lines.h" 66#include "dlist.h" 67#include "macros.h" 68#include "matrix.h" 69#include "occlude.h" 70#include "pixel.h" 71#include "points.h" 72#include "polygon.h" 73#include "state.h" 74#include "texobj.h" 75#include "teximage.h" 76#include "texstate.h" 77#include "mtypes.h" 78#include "varray.h" 79#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program 80#include "nvprogram.h" 81#include "program.h" 82#endif 83#if FEATURE_ATI_fragment_shader 84#include "atifragshader.h" 85#endif 86 87#include "math/m_matrix.h" 88#include "math/m_xform.h" 89 90#include "dispatch.h" 91 92 93/** 94 * Flush vertices. 95 * 96 * \param ctx GL context. 97 * 98 * Checks if dd_function_table::SaveNeedFlush is marked to flush 99 * stored (save) vertices, and calls 100 * dd_function_table::SaveFlushVertices if so. 101 */ 102#define SAVE_FLUSH_VERTICES(ctx) \ 103do { \ 104 if (ctx->Driver.SaveNeedFlush) \ 105 ctx->Driver.SaveFlushVertices(ctx); \ 106} while (0) 107 108 109/** 110 * Macro to assert that the API call was made outside the 111 * glBegin()/glEnd() pair, with return value. 112 * 113 * \param ctx GL context. 114 * \param retval value to return value in case the assertion fails. 115 */ 116#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \ 117do { \ 118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ 119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ 120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ 121 return retval; \ 122 } \ 123} while (0) 124 125/** 126 * Macro to assert that the API call was made outside the 127 * glBegin()/glEnd() pair. 128 * 129 * \param ctx GL context. 130 */ 131#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \ 132do { \ 133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ 134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ 135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ 136 return; \ 137 } \ 138} while (0) 139 140/** 141 * Macro to assert that the API call was made outside the 142 * glBegin()/glEnd() pair and flush the vertices. 143 * 144 * \param ctx GL context. 145 */ 146#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \ 147do { \ 148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \ 149 SAVE_FLUSH_VERTICES(ctx); \ 150} while (0) 151 152/** 153 * Macro to assert that the API call was made outside the 154 * glBegin()/glEnd() pair and flush the vertices, with return value. 155 * 156 * \param ctx GL context. 157 * \param retval value to return value in case the assertion fails. 158 */ 159#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\ 160do { \ 161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \ 162 SAVE_FLUSH_VERTICES(ctx); \ 163} while (0) 164 165 166 167/** 168 * Display list opcodes. 169 * 170 * The fact that these identifiers are assigned consecutive 171 * integer values starting at 0 is very important, see InstSize array usage) 172 */ 173typedef enum 174{ 175 OPCODE_INVALID = -1, /* Force signed enum */ 176 OPCODE_ACCUM, 177 OPCODE_ALPHA_FUNC, 178 OPCODE_BIND_TEXTURE, 179 OPCODE_BITMAP, 180 OPCODE_BLEND_COLOR, 181 OPCODE_BLEND_EQUATION, 182 OPCODE_BLEND_EQUATION_SEPARATE, 183 OPCODE_BLEND_FUNC_SEPARATE, 184 OPCODE_CALL_LIST, 185 OPCODE_CALL_LIST_OFFSET, 186 OPCODE_CLEAR, 187 OPCODE_CLEAR_ACCUM, 188 OPCODE_CLEAR_COLOR, 189 OPCODE_CLEAR_DEPTH, 190 OPCODE_CLEAR_INDEX, 191 OPCODE_CLEAR_STENCIL, 192 OPCODE_CLIP_PLANE, 193 OPCODE_COLOR_MASK, 194 OPCODE_COLOR_MATERIAL, 195 OPCODE_COLOR_TABLE, 196 OPCODE_COLOR_TABLE_PARAMETER_FV, 197 OPCODE_COLOR_TABLE_PARAMETER_IV, 198 OPCODE_COLOR_SUB_TABLE, 199 OPCODE_CONVOLUTION_FILTER_1D, 200 OPCODE_CONVOLUTION_FILTER_2D, 201 OPCODE_CONVOLUTION_PARAMETER_I, 202 OPCODE_CONVOLUTION_PARAMETER_IV, 203 OPCODE_CONVOLUTION_PARAMETER_F, 204 OPCODE_CONVOLUTION_PARAMETER_FV, 205 OPCODE_COPY_COLOR_SUB_TABLE, 206 OPCODE_COPY_COLOR_TABLE, 207 OPCODE_COPY_PIXELS, 208 OPCODE_COPY_TEX_IMAGE1D, 209 OPCODE_COPY_TEX_IMAGE2D, 210 OPCODE_COPY_TEX_SUB_IMAGE1D, 211 OPCODE_COPY_TEX_SUB_IMAGE2D, 212 OPCODE_COPY_TEX_SUB_IMAGE3D, 213 OPCODE_CULL_FACE, 214 OPCODE_DEPTH_FUNC, 215 OPCODE_DEPTH_MASK, 216 OPCODE_DEPTH_RANGE, 217 OPCODE_DISABLE, 218 OPCODE_DRAW_BUFFER, 219 OPCODE_DRAW_PIXELS, 220 OPCODE_ENABLE, 221 OPCODE_EVALMESH1, 222 OPCODE_EVALMESH2, 223 OPCODE_FOG, 224 OPCODE_FRONT_FACE, 225 OPCODE_FRUSTUM, 226 OPCODE_HINT, 227 OPCODE_HISTOGRAM, 228 OPCODE_INDEX_MASK, 229 OPCODE_INIT_NAMES, 230 OPCODE_LIGHT, 231 OPCODE_LIGHT_MODEL, 232 OPCODE_LINE_STIPPLE, 233 OPCODE_LINE_WIDTH, 234 OPCODE_LIST_BASE, 235 OPCODE_LOAD_IDENTITY, 236 OPCODE_LOAD_MATRIX, 237 OPCODE_LOAD_NAME, 238 OPCODE_LOGIC_OP, 239 OPCODE_MAP1, 240 OPCODE_MAP2, 241 OPCODE_MAPGRID1, 242 OPCODE_MAPGRID2, 243 OPCODE_MATRIX_MODE, 244 OPCODE_MIN_MAX, 245 OPCODE_MULT_MATRIX, 246 OPCODE_ORTHO, 247 OPCODE_PASSTHROUGH, 248 OPCODE_PIXEL_MAP, 249 OPCODE_PIXEL_TRANSFER, 250 OPCODE_PIXEL_ZOOM, 251 OPCODE_POINT_SIZE, 252 OPCODE_POINT_PARAMETERS, 253 OPCODE_POLYGON_MODE, 254 OPCODE_POLYGON_STIPPLE, 255 OPCODE_POLYGON_OFFSET, 256 OPCODE_POP_ATTRIB, 257 OPCODE_POP_MATRIX, 258 OPCODE_POP_NAME, 259 OPCODE_PRIORITIZE_TEXTURE, 260 OPCODE_PUSH_ATTRIB, 261 OPCODE_PUSH_MATRIX, 262 OPCODE_PUSH_NAME, 263 OPCODE_RASTER_POS, 264 OPCODE_READ_BUFFER, 265 OPCODE_RESET_HISTOGRAM, 266 OPCODE_RESET_MIN_MAX, 267 OPCODE_ROTATE, 268 OPCODE_SCALE, 269 OPCODE_SCISSOR, 270 OPCODE_SELECT_TEXTURE_SGIS, 271 OPCODE_SELECT_TEXTURE_COORD_SET, 272 OPCODE_SHADE_MODEL, 273 OPCODE_STENCIL_FUNC, 274 OPCODE_STENCIL_MASK, 275 OPCODE_STENCIL_OP, 276 OPCODE_TEXENV, 277 OPCODE_TEXGEN, 278 OPCODE_TEXPARAMETER, 279 OPCODE_TEX_IMAGE1D, 280 OPCODE_TEX_IMAGE2D, 281 OPCODE_TEX_IMAGE3D, 282 OPCODE_TEX_SUB_IMAGE1D, 283 OPCODE_TEX_SUB_IMAGE2D, 284 OPCODE_TEX_SUB_IMAGE3D, 285 OPCODE_TRANSLATE, 286 OPCODE_VIEWPORT, 287 OPCODE_WINDOW_POS, 288 /* GL_ARB_multitexture */ 289 OPCODE_ACTIVE_TEXTURE, 290 /* GL_ARB_texture_compression */ 291 OPCODE_COMPRESSED_TEX_IMAGE_1D, 292 OPCODE_COMPRESSED_TEX_IMAGE_2D, 293 OPCODE_COMPRESSED_TEX_IMAGE_3D, 294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 297 /* GL_ARB_multisample */ 298 OPCODE_SAMPLE_COVERAGE, 299 /* GL_ARB_window_pos */ 300 OPCODE_WINDOW_POS_ARB, 301 /* GL_NV_vertex_program */ 302 OPCODE_BIND_PROGRAM_NV, 303 OPCODE_EXECUTE_PROGRAM_NV, 304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV, 305 OPCODE_LOAD_PROGRAM_NV, 306 OPCODE_PROGRAM_PARAMETER4F_NV, 307 OPCODE_TRACK_MATRIX_NV, 308 /* GL_NV_fragment_program */ 309 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 310 OPCODE_PROGRAM_NAMED_PARAMETER_NV, 311 /* GL_EXT_stencil_two_side */ 312 OPCODE_ACTIVE_STENCIL_FACE_EXT, 313 /* GL_EXT_depth_bounds_test */ 314 OPCODE_DEPTH_BOUNDS_EXT, 315 /* GL_ARB_vertex/fragment_program */ 316 OPCODE_PROGRAM_STRING_ARB, 317 OPCODE_PROGRAM_ENV_PARAMETER_ARB, 318 /* GL_ARB_occlusion_query */ 319 OPCODE_BEGIN_QUERY_ARB, 320 OPCODE_END_QUERY_ARB, 321 /* GL_ARB_draw_buffers */ 322 OPCODE_DRAW_BUFFERS_ARB, 323 /* GL_ATI_fragment_shader */ 324 OPCODE_BIND_FRAGMENT_SHADER_ATI, 325 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 326 /* OpenGL 2.0 */ 327 OPCODE_STENCIL_FUNC_SEPARATE, 328 OPCODE_STENCIL_OP_SEPARATE, 329 OPCODE_STENCIL_MASK_SEPARATE, 330 331 /* GL_EXT_framebuffer_blit */ 332 OPCODE_BLIT_FRAMEBUFFER, 333 334 /* Vertex attributes -- fallback for when optimized display 335 * list build isn't active. 336 */ 337 OPCODE_ATTR_1F_NV, 338 OPCODE_ATTR_2F_NV, 339 OPCODE_ATTR_3F_NV, 340 OPCODE_ATTR_4F_NV, 341 OPCODE_ATTR_1F_ARB, 342 OPCODE_ATTR_2F_ARB, 343 OPCODE_ATTR_3F_ARB, 344 OPCODE_ATTR_4F_ARB, 345 OPCODE_MATERIAL, 346 OPCODE_BEGIN, 347 OPCODE_END, 348 OPCODE_RECTF, 349 OPCODE_EVAL_C1, 350 OPCODE_EVAL_C2, 351 OPCODE_EVAL_P1, 352 OPCODE_EVAL_P2, 353 354 /* The following three are meta instructions */ 355 OPCODE_ERROR, /* raise compiled-in error */ 356 OPCODE_CONTINUE, 357 OPCODE_END_OF_LIST, 358 OPCODE_EXT_0 359} OpCode; 360 361 362 363/** 364 * Display list node. 365 * 366 * Display list instructions are stored as sequences of "nodes". Nodes 367 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks 368 * are linked together with a pointer. 369 * 370 * Each instruction in the display list is stored as a sequence of 371 * contiguous nodes in memory. 372 * Each node is the union of a variety of data types. 373 */ 374union node 375{ 376 OpCode opcode; 377 GLboolean b; 378 GLbitfield bf; 379 GLubyte ub; 380 GLshort s; 381 GLushort us; 382 GLint i; 383 GLuint ui; 384 GLenum e; 385 GLfloat f; 386 GLvoid *data; 387 void *next; /* If prev node's opcode==OPCODE_CONTINUE */ 388}; 389 390 391/** 392 * How many nodes to allocate at a time. 393 * 394 * \note Reduced now that we hold vertices etc. elsewhere. 395 */ 396#define BLOCK_SIZE 256 397 398 399 400/** 401 * Number of nodes of storage needed for each instruction. 402 * Sizes for dynamically allocated opcodes are stored in the context struct. 403 */ 404static GLuint InstSize[OPCODE_END_OF_LIST + 1]; 405 406void mesa_print_display_list(GLuint list); 407 408 409/**********************************************************************/ 410/***** Private *****/ 411/**********************************************************************/ 412 413 414/** 415 * Make an empty display list. This is used by glGenLists() to 416 * reserve display list IDs. 417 */ 418static struct mesa_display_list * 419make_list(GLuint list, GLuint count) 420{ 421 struct mesa_display_list *dlist = CALLOC_STRUCT(mesa_display_list); 422 dlist->id = list; 423 dlist->node = (Node *) _mesa_malloc(sizeof(Node) * count); 424 dlist->node[0].opcode = OPCODE_END_OF_LIST; 425 return dlist; 426} 427 428 429/** 430 * Lookup function to just encapsulate casting. 431 */ 432static INLINE struct mesa_display_list * 433lookup_list(GLcontext *ctx, GLuint list) 434{ 435 return (struct mesa_display_list *) 436 _mesa_HashLookup(ctx->Shared->DisplayList, list); 437} 438 439 440 441/** 442 * Delete the named display list, but don't remove from hash table. 443 * \param dlist - display list pointer 444 */ 445void 446_mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist) 447{ 448 Node *n, *block; 449 GLboolean done; 450 451 n = block = dlist->node; 452 453 done = block ? GL_FALSE : GL_TRUE; 454 while (!done) { 455 456 /* check for extension opcodes first */ 457 458 GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; 459 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { 460 ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]); 461 n += ctx->ListExt.Opcode[i].Size; 462 } 463 else { 464 switch (n[0].opcode) { 465 /* for some commands, we need to free malloc'd memory */ 466 case OPCODE_MAP1: 467 _mesa_free(n[6].data); 468 n += InstSize[n[0].opcode]; 469 break; 470 case OPCODE_MAP2: 471 _mesa_free(n[10].data); 472 n += InstSize[n[0].opcode]; 473 break; 474 case OPCODE_DRAW_PIXELS: 475 _mesa_free(n[5].data); 476 n += InstSize[n[0].opcode]; 477 break; 478 case OPCODE_BITMAP: 479 _mesa_free(n[7].data); 480 n += InstSize[n[0].opcode]; 481 break; 482 case OPCODE_COLOR_TABLE: 483 _mesa_free(n[6].data); 484 n += InstSize[n[0].opcode]; 485 break; 486 case OPCODE_COLOR_SUB_TABLE: 487 _mesa_free(n[6].data); 488 n += InstSize[n[0].opcode]; 489 break; 490 case OPCODE_CONVOLUTION_FILTER_1D: 491 _mesa_free(n[6].data); 492 n += InstSize[n[0].opcode]; 493 break; 494 case OPCODE_CONVOLUTION_FILTER_2D: 495 _mesa_free(n[7].data); 496 n += InstSize[n[0].opcode]; 497 break; 498 case OPCODE_POLYGON_STIPPLE: 499 _mesa_free(n[1].data); 500 n += InstSize[n[0].opcode]; 501 break; 502 case OPCODE_TEX_IMAGE1D: 503 _mesa_free(n[8].data); 504 n += InstSize[n[0].opcode]; 505 break; 506 case OPCODE_TEX_IMAGE2D: 507 _mesa_free(n[9].data); 508 n += InstSize[n[0].opcode]; 509 break; 510 case OPCODE_TEX_IMAGE3D: 511 _mesa_free(n[10].data); 512 n += InstSize[n[0].opcode]; 513 break; 514 case OPCODE_TEX_SUB_IMAGE1D: 515 _mesa_free(n[7].data); 516 n += InstSize[n[0].opcode]; 517 break; 518 case OPCODE_TEX_SUB_IMAGE2D: 519 _mesa_free(n[9].data); 520 n += InstSize[n[0].opcode]; 521 break; 522 case OPCODE_TEX_SUB_IMAGE3D: 523 _mesa_free(n[11].data); 524 n += InstSize[n[0].opcode]; 525 break; 526 case OPCODE_COMPRESSED_TEX_IMAGE_1D: 527 _mesa_free(n[7].data); 528 n += InstSize[n[0].opcode]; 529 break; 530 case OPCODE_COMPRESSED_TEX_IMAGE_2D: 531 _mesa_free(n[8].data); 532 n += InstSize[n[0].opcode]; 533 break; 534 case OPCODE_COMPRESSED_TEX_IMAGE_3D: 535 _mesa_free(n[9].data); 536 n += InstSize[n[0].opcode]; 537 break; 538 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: 539 _mesa_free(n[7].data); 540 n += InstSize[n[0].opcode]; 541 break; 542 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: 543 _mesa_free(n[9].data); 544 n += InstSize[n[0].opcode]; 545 break; 546 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: 547 _mesa_free(n[11].data); 548 n += InstSize[n[0].opcode]; 549 break; 550#if FEATURE_NV_vertex_program 551 case OPCODE_LOAD_PROGRAM_NV: 552 _mesa_free(n[4].data); /* program string */ 553 n += InstSize[n[0].opcode]; 554 break; 555 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: 556 _mesa_free(n[2].data); /* array of program ids */ 557 n += InstSize[n[0].opcode]; 558 break; 559#endif 560#if FEATURE_NV_fragment_program 561 case OPCODE_PROGRAM_NAMED_PARAMETER_NV: 562 _mesa_free(n[3].data); /* parameter name */ 563 n += InstSize[n[0].opcode]; 564 break; 565#endif 566#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 567 case OPCODE_PROGRAM_STRING_ARB: 568 _mesa_free(n[4].data); /* program string */ 569 n += InstSize[n[0].opcode]; 570 break; 571#endif 572 case OPCODE_CONTINUE: 573 n = (Node *) n[1].next; 574 _mesa_free(block); 575 block = n; 576 break; 577 case OPCODE_END_OF_LIST: 578 _mesa_free(block); 579 done = GL_TRUE; 580 break; 581 default: 582 /* Most frequent case */ 583 n += InstSize[n[0].opcode]; 584 break; 585 } 586 } 587 } 588 589 _mesa_free(dlist); 590} 591 592 593/** 594 * Destroy a display list and remove from hash table. 595 * \param list - display list number 596 */ 597static void 598destroy_list(GLcontext *ctx, GLuint list) 599{ 600 struct mesa_display_list *dlist; 601 602 if (list == 0) 603 return; 604 605 dlist = lookup_list(ctx, list); 606 if (!dlist) 607 return; 608 609 _mesa_delete_list(ctx, dlist); 610 _mesa_HashRemove(ctx->Shared->DisplayList, list); 611} 612 613 614/* 615 * Translate the nth element of list from type to GLuint. 616 */ 617static GLuint 618translate_id(GLsizei n, GLenum type, const GLvoid * list) 619{ 620 GLbyte *bptr; 621 GLubyte *ubptr; 622 GLshort *sptr; 623 GLushort *usptr; 624 GLint *iptr; 625 GLuint *uiptr; 626 GLfloat *fptr; 627 628 switch (type) { 629 case GL_BYTE: 630 bptr = (GLbyte *) list; 631 return (GLuint) *(bptr + n); 632 case GL_UNSIGNED_BYTE: 633 ubptr = (GLubyte *) list; 634 return (GLuint) *(ubptr + n); 635 case GL_SHORT: 636 sptr = (GLshort *) list; 637 return (GLuint) *(sptr + n); 638 case GL_UNSIGNED_SHORT: 639 usptr = (GLushort *) list; 640 return (GLuint) *(usptr + n); 641 case GL_INT: 642 iptr = (GLint *) list; 643 return (GLuint) *(iptr + n); 644 case GL_UNSIGNED_INT: 645 uiptr = (GLuint *) list; 646 return (GLuint) *(uiptr + n); 647 case GL_FLOAT: 648 fptr = (GLfloat *) list; 649 return (GLuint) *(fptr + n); 650 case GL_2_BYTES: 651 ubptr = ((GLubyte *) list) + 2 * n; 652 return (GLuint) *ubptr * 256 + (GLuint) * (ubptr + 1); 653 case GL_3_BYTES: 654 ubptr = ((GLubyte *) list) + 3 * n; 655 return (GLuint) * ubptr * 65536 656 + (GLuint) *(ubptr + 1) * 256 + (GLuint) * (ubptr + 2); 657 case GL_4_BYTES: 658 ubptr = ((GLubyte *) list) + 4 * n; 659 return (GLuint) *ubptr * 16777216 660 + (GLuint) *(ubptr + 1) * 65536 661 + (GLuint) *(ubptr + 2) * 256 + (GLuint) * (ubptr + 3); 662 default: 663 return 0; 664 } 665} 666 667 668 669 670/**********************************************************************/ 671/***** Public *****/ 672/**********************************************************************/ 673 674/** 675 * Wrapper for _mesa_unpack_image() that handles pixel buffer objects. 676 * \todo This won't suffice when the PBO is really in VRAM/GPU memory. 677 */ 678static GLvoid * 679unpack_image(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, 680 GLenum format, GLenum type, const GLvoid * pixels, 681 const struct gl_pixelstore_attrib *unpack) 682{ 683 if (unpack->BufferObj->Name == 0) { 684 /* no PBO */ 685 return _mesa_unpack_image(dimensions, width, height, depth, format, 686 type, pixels, unpack); 687 } 688 else 689 if (_mesa_validate_pbo_access 690 (dimensions, unpack, width, height, depth, format, type, pixels)) { 691 const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels); 692 return _mesa_unpack_image(dimensions, width, height, depth, format, 693 type, src, unpack); 694 } 695 /* bad access! */ 696 return NULL; 697} 698 699 700/** 701 * Allocate space for a display list instruction. 702 * \param opcode the instruction opcode (OPCODE_* value) 703 * \param size instruction size in bytes, not counting opcode. 704 * \return pointer to the usable data area (not including the internal 705 * opcode). 706 */ 707void * 708_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes) 709{ 710 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node); 711 Node *n; 712 713 if (opcode < (GLuint) OPCODE_EXT_0) { 714 if (InstSize[opcode] == 0) { 715 /* save instruction size now */ 716 InstSize[opcode] = numNodes; 717 } 718 else { 719 /* make sure instruction size agrees */ 720 ASSERT(numNodes == InstSize[opcode]); 721 } 722 } 723 724 if (ctx->ListState.CurrentPos + numNodes + 2 > BLOCK_SIZE) { 725 /* This block is full. Allocate a new block and chain to it */ 726 Node *newblock; 727 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; 728 n[0].opcode = OPCODE_CONTINUE; 729 newblock = (Node *) _mesa_malloc(sizeof(Node) * BLOCK_SIZE); 730 if (!newblock) { 731 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list"); 732 return NULL; 733 } 734 n[1].next = (Node *) newblock; 735 ctx->ListState.CurrentBlock = newblock; 736 ctx->ListState.CurrentPos = 0; 737 } 738 739 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; 740 ctx->ListState.CurrentPos += numNodes; 741 742 n[0].opcode = (OpCode) opcode; 743 744 return (void *) (n + 1); /* return ptr to node following opcode */ 745} 746 747 748/** 749 * This function allows modules and drivers to get their own opcodes 750 * for extending display list functionality. 751 * \param ctx the rendering context 752 * \param size number of bytes for storing the new display list command 753 * \param execute function to execute the new display list command 754 * \param destroy function to destroy the new display list command 755 * \param print function to print the new display list command 756 * \return the new opcode number or -1 if error 757 */ 758GLint 759_mesa_alloc_opcode(GLcontext *ctx, 760 GLuint size, 761 void (*execute) (GLcontext *, void *), 762 void (*destroy) (GLcontext *, void *), 763 void (*print) (GLcontext *, void *)) 764{ 765 if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) { 766 const GLuint i = ctx->ListExt.NumOpcodes++; 767 ctx->ListExt.Opcode[i].Size = 768 1 + (size + sizeof(Node) - 1) / sizeof(Node); 769 ctx->ListExt.Opcode[i].Execute = execute; 770 ctx->ListExt.Opcode[i].Destroy = destroy; 771 ctx->ListExt.Opcode[i].Print = print; 772 return i + OPCODE_EXT_0; 773 } 774 return -1; 775} 776 777 778 779/** 780 * Allocate display list instruction. Returns Node ptr to where the opcode 781 * is stored. 782 * - nParams is the number of function parameters 783 * - return value a pointer to sizeof(Node) before the actual 784 * usable data area. 785 */ 786#define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \ 787 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1) 788 789 790 791/* 792 * Display List compilation functions 793 */ 794static void GLAPIENTRY 795save_Accum(GLenum op, GLfloat value) 796{ 797 GET_CURRENT_CONTEXT(ctx); 798 Node *n; 799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 800 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACCUM, 2); 801 if (n) { 802 n[1].e = op; 803 n[2].f = value; 804 } 805 if (ctx->ExecuteFlag) { 806 CALL_Accum(ctx->Exec, (op, value)); 807 } 808} 809 810 811static void GLAPIENTRY 812save_AlphaFunc(GLenum func, GLclampf ref) 813{ 814 GET_CURRENT_CONTEXT(ctx); 815 Node *n; 816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 817 n = ALLOC_INSTRUCTION(ctx, OPCODE_ALPHA_FUNC, 2); 818 if (n) { 819 n[1].e = func; 820 n[2].f = (GLfloat) ref; 821 } 822 if (ctx->ExecuteFlag) { 823 CALL_AlphaFunc(ctx->Exec, (func, ref)); 824 } 825} 826 827 828static void GLAPIENTRY 829save_BindTexture(GLenum target, GLuint texture) 830{ 831 GET_CURRENT_CONTEXT(ctx); 832 Node *n; 833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 834 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_TEXTURE, 2); 835 if (n) { 836 n[1].e = target; 837 n[2].ui = texture; 838 } 839 if (ctx->ExecuteFlag) { 840 CALL_BindTexture(ctx->Exec, (target, texture)); 841 } 842} 843 844 845static void GLAPIENTRY 846save_Bitmap(GLsizei width, GLsizei height, 847 GLfloat xorig, GLfloat yorig, 848 GLfloat xmove, GLfloat ymove, const GLubyte * pixels) 849{ 850 GET_CURRENT_CONTEXT(ctx); 851 GLvoid *image = _mesa_unpack_bitmap(width, height, pixels, &ctx->Unpack); 852 Node *n; 853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 854 n = ALLOC_INSTRUCTION(ctx, OPCODE_BITMAP, 7); 855 if (n) { 856 n[1].i = (GLint) width; 857 n[2].i = (GLint) height; 858 n[3].f = xorig; 859 n[4].f = yorig; 860 n[5].f = xmove; 861 n[6].f = ymove; 862 n[7].data = image; 863 } 864 else if (image) { 865 _mesa_free(image); 866 } 867 if (ctx->ExecuteFlag) { 868 CALL_Bitmap(ctx->Exec, (width, height, 869 xorig, yorig, xmove, ymove, pixels)); 870 } 871} 872 873 874static void GLAPIENTRY 875save_BlendEquation(GLenum mode) 876{ 877 GET_CURRENT_CONTEXT(ctx); 878 Node *n; 879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 880 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION, 1); 881 if (n) { 882 n[1].e = mode; 883 } 884 if (ctx->ExecuteFlag) { 885 CALL_BlendEquation(ctx->Exec, (mode)); 886 } 887} 888 889 890static void GLAPIENTRY 891save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA) 892{ 893 GET_CURRENT_CONTEXT(ctx); 894 Node *n; 895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 896 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2); 897 if (n) { 898 n[1].e = modeRGB; 899 n[2].e = modeA; 900 } 901 if (ctx->ExecuteFlag) { 902 CALL_BlendEquationSeparateEXT(ctx->Exec, (modeRGB, modeA)); 903 } 904} 905 906 907static void GLAPIENTRY 908save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, 909 GLenum sfactorA, GLenum dfactorA) 910{ 911 GET_CURRENT_CONTEXT(ctx); 912 Node *n; 913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 914 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4); 915 if (n) { 916 n[1].e = sfactorRGB; 917 n[2].e = dfactorRGB; 918 n[3].e = sfactorA; 919 n[4].e = dfactorA; 920 } 921 if (ctx->ExecuteFlag) { 922 CALL_BlendFuncSeparateEXT(ctx->Exec, 923 (sfactorRGB, dfactorRGB, sfactorA, dfactorA)); 924 } 925} 926 927 928static void GLAPIENTRY 929save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) 930{ 931 GET_CURRENT_CONTEXT(ctx); 932 Node *n; 933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 934 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_COLOR, 4); 935 if (n) { 936 n[1].f = red; 937 n[2].f = green; 938 n[3].f = blue; 939 n[4].f = alpha; 940 } 941 if (ctx->ExecuteFlag) { 942 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha)); 943 } 944} 945 946 947void GLAPIENTRY 948_mesa_save_CallList(GLuint list) 949{ 950 GET_CURRENT_CONTEXT(ctx); 951 Node *n; 952 SAVE_FLUSH_VERTICES(ctx); 953 954 n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST, 1); 955 if (n) { 956 n[1].ui = list; 957 } 958 959 /* After this, we don't know what begin/end state we're in: 960 */ 961 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 962 963 if (ctx->ExecuteFlag) { 964 CALL_CallList(ctx->Exec, (list)); 965 } 966} 967 968 969void GLAPIENTRY 970_mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists) 971{ 972 GET_CURRENT_CONTEXT(ctx); 973 GLint i; 974 GLboolean typeErrorFlag; 975 976 SAVE_FLUSH_VERTICES(ctx); 977 978 switch (type) { 979 case GL_BYTE: 980 case GL_UNSIGNED_BYTE: 981 case GL_SHORT: 982 case GL_UNSIGNED_SHORT: 983 case GL_INT: 984 case GL_UNSIGNED_INT: 985 case GL_FLOAT: 986 case GL_2_BYTES: 987 case GL_3_BYTES: 988 case GL_4_BYTES: 989 typeErrorFlag = GL_FALSE; 990 break; 991 default: 992 typeErrorFlag = GL_TRUE; 993 } 994 995 for (i = 0; i < n; i++) { 996 GLuint list = translate_id(i, type, lists); 997 Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2); 998 if (n) { 999 n[1].ui = list; 1000 n[2].b = typeErrorFlag; 1001 } 1002 } 1003 1004 /* After this, we don't know what begin/end state we're in: 1005 */ 1006 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 1007 1008 if (ctx->ExecuteFlag) { 1009 CALL_CallLists(ctx->Exec, (n, type, lists)); 1010 } 1011} 1012 1013 1014static void GLAPIENTRY 1015save_Clear(GLbitfield mask) 1016{ 1017 GET_CURRENT_CONTEXT(ctx); 1018 Node *n; 1019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1020 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR, 1); 1021 if (n) { 1022 n[1].bf = mask; 1023 } 1024 if (ctx->ExecuteFlag) { 1025 CALL_Clear(ctx->Exec, (mask)); 1026 } 1027} 1028 1029 1030static void GLAPIENTRY 1031save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) 1032{ 1033 GET_CURRENT_CONTEXT(ctx); 1034 Node *n; 1035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1036 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_ACCUM, 4); 1037 if (n) { 1038 n[1].f = red; 1039 n[2].f = green; 1040 n[3].f = blue; 1041 n[4].f = alpha; 1042 } 1043 if (ctx->ExecuteFlag) { 1044 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha)); 1045 } 1046} 1047 1048 1049static void GLAPIENTRY 1050save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) 1051{ 1052 GET_CURRENT_CONTEXT(ctx); 1053 Node *n; 1054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1055 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_COLOR, 4); 1056 if (n) { 1057 n[1].f = red; 1058 n[2].f = green; 1059 n[3].f = blue; 1060 n[4].f = alpha; 1061 } 1062 if (ctx->ExecuteFlag) { 1063 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha)); 1064 } 1065} 1066 1067 1068static void GLAPIENTRY 1069save_ClearDepth(GLclampd depth) 1070{ 1071 GET_CURRENT_CONTEXT(ctx); 1072 Node *n; 1073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1074 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_DEPTH, 1); 1075 if (n) { 1076 n[1].f = (GLfloat) depth; 1077 } 1078 if (ctx->ExecuteFlag) { 1079 CALL_ClearDepth(ctx->Exec, (depth)); 1080 } 1081} 1082 1083 1084static void GLAPIENTRY 1085save_ClearIndex(GLfloat c) 1086{ 1087 GET_CURRENT_CONTEXT(ctx); 1088 Node *n; 1089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1090 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_INDEX, 1); 1091 if (n) { 1092 n[1].f = c; 1093 } 1094 if (ctx->ExecuteFlag) { 1095 CALL_ClearIndex(ctx->Exec, (c)); 1096 } 1097} 1098 1099 1100static void GLAPIENTRY 1101save_ClearStencil(GLint s) 1102{ 1103 GET_CURRENT_CONTEXT(ctx); 1104 Node *n; 1105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1106 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_STENCIL, 1); 1107 if (n) { 1108 n[1].i = s; 1109 } 1110 if (ctx->ExecuteFlag) { 1111 CALL_ClearStencil(ctx->Exec, (s)); 1112 } 1113} 1114 1115 1116static void GLAPIENTRY 1117save_ClipPlane(GLenum plane, const GLdouble * equ) 1118{ 1119 GET_CURRENT_CONTEXT(ctx); 1120 Node *n; 1121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1122 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLIP_PLANE, 5); 1123 if (n) { 1124 n[1].e = plane; 1125 n[2].f = (GLfloat) equ[0]; 1126 n[3].f = (GLfloat) equ[1]; 1127 n[4].f = (GLfloat) equ[2]; 1128 n[5].f = (GLfloat) equ[3]; 1129 } 1130 if (ctx->ExecuteFlag) { 1131 CALL_ClipPlane(ctx->Exec, (plane, equ)); 1132 } 1133} 1134 1135 1136 1137static void GLAPIENTRY 1138save_ColorMask(GLboolean red, GLboolean green, 1139 GLboolean blue, GLboolean alpha) 1140{ 1141 GET_CURRENT_CONTEXT(ctx); 1142 Node *n; 1143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1144 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MASK, 4); 1145 if (n) { 1146 n[1].b = red; 1147 n[2].b = green; 1148 n[3].b = blue; 1149 n[4].b = alpha; 1150 } 1151 if (ctx->ExecuteFlag) { 1152 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha)); 1153 } 1154} 1155 1156 1157static void GLAPIENTRY 1158save_ColorMaterial(GLenum face, GLenum mode) 1159{ 1160 GET_CURRENT_CONTEXT(ctx); 1161 Node *n; 1162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1163 1164 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MATERIAL, 2); 1165 if (n) { 1166 n[1].e = face; 1167 n[2].e = mode; 1168 } 1169 if (ctx->ExecuteFlag) { 1170 CALL_ColorMaterial(ctx->Exec, (face, mode)); 1171 } 1172} 1173 1174 1175static void GLAPIENTRY 1176save_ColorTable(GLenum target, GLenum internalFormat, 1177 GLsizei width, GLenum format, GLenum type, 1178 const GLvoid * table) 1179{ 1180 GET_CURRENT_CONTEXT(ctx); 1181 if (_mesa_is_proxy_texture(target)) { 1182 /* execute immediately */ 1183 CALL_ColorTable(ctx->Exec, (target, internalFormat, width, 1184 format, type, table)); 1185 } 1186 else { 1187 GLvoid *image = unpack_image(1, width, 1, 1, format, type, table, 1188 &ctx->Unpack); 1189 Node *n; 1190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1191 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE, 6); 1192 if (n) { 1193 n[1].e = target; 1194 n[2].e = internalFormat; 1195 n[3].i = width; 1196 n[4].e = format; 1197 n[5].e = type; 1198 n[6].data = image; 1199 } 1200 else if (image) { 1201 _mesa_free(image); 1202 } 1203 if (ctx->ExecuteFlag) { 1204 CALL_ColorTable(ctx->Exec, (target, internalFormat, width, 1205 format, type, table)); 1206 } 1207 } 1208} 1209 1210 1211 1212static void GLAPIENTRY 1213save_ColorTableParameterfv(GLenum target, GLenum pname, 1214 const GLfloat *params) 1215{ 1216 GET_CURRENT_CONTEXT(ctx); 1217 Node *n; 1218 1219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1220 1221 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6); 1222 if (n) { 1223 n[1].e = target; 1224 n[2].e = pname; 1225 n[3].f = params[0]; 1226 if (pname == GL_COLOR_TABLE_SGI || 1227 pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || 1228 pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || 1229 pname == GL_TEXTURE_COLOR_TABLE_SGI) { 1230 n[4].f = params[1]; 1231 n[5].f = params[2]; 1232 n[6].f = params[3]; 1233 } 1234 } 1235 1236 if (ctx->ExecuteFlag) { 1237 CALL_ColorTableParameterfv(ctx->Exec, (target, pname, params)); 1238 } 1239} 1240 1241 1242static void GLAPIENTRY 1243save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) 1244{ 1245 GET_CURRENT_CONTEXT(ctx); 1246 Node *n; 1247 1248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1249 1250 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6); 1251 if (n) { 1252 n[1].e = target; 1253 n[2].e = pname; 1254 n[3].i = params[0]; 1255 if (pname == GL_COLOR_TABLE_SGI || 1256 pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || 1257 pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || 1258 pname == GL_TEXTURE_COLOR_TABLE_SGI) { 1259 n[4].i = params[1]; 1260 n[5].i = params[2]; 1261 n[6].i = params[3]; 1262 } 1263 } 1264 1265 if (ctx->ExecuteFlag) { 1266 CALL_ColorTableParameteriv(ctx->Exec, (target, pname, params)); 1267 } 1268} 1269 1270 1271 1272static void GLAPIENTRY 1273save_ColorSubTable(GLenum target, GLsizei start, GLsizei count, 1274 GLenum format, GLenum type, const GLvoid * table) 1275{ 1276 GET_CURRENT_CONTEXT(ctx); 1277 GLvoid *image = unpack_image(1, count, 1, 1, format, type, table, 1278 &ctx->Unpack); 1279 Node *n; 1280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1281 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_SUB_TABLE, 6); 1282 if (n) { 1283 n[1].e = target; 1284 n[2].i = start; 1285 n[3].i = count; 1286 n[4].e = format; 1287 n[5].e = type; 1288 n[6].data = image; 1289 } 1290 else if (image) { 1291 _mesa_free(image); 1292 } 1293 if (ctx->ExecuteFlag) { 1294 CALL_ColorSubTable(ctx->Exec, 1295 (target, start, count, format, type, table)); 1296 } 1297} 1298 1299 1300static void GLAPIENTRY 1301save_CopyColorSubTable(GLenum target, GLsizei start, 1302 GLint x, GLint y, GLsizei width) 1303{ 1304 GET_CURRENT_CONTEXT(ctx); 1305 Node *n; 1306 1307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1308 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5); 1309 if (n) { 1310 n[1].e = target; 1311 n[2].i = start; 1312 n[3].i = x; 1313 n[4].i = y; 1314 n[5].i = width; 1315 } 1316 if (ctx->ExecuteFlag) { 1317 CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width)); 1318 } 1319} 1320 1321 1322static void GLAPIENTRY 1323save_CopyColorTable(GLenum target, GLenum internalformat, 1324 GLint x, GLint y, GLsizei width) 1325{ 1326 GET_CURRENT_CONTEXT(ctx); 1327 Node *n; 1328 1329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1330 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_TABLE, 5); 1331 if (n) { 1332 n[1].e = target; 1333 n[2].e = internalformat; 1334 n[3].i = x; 1335 n[4].i = y; 1336 n[5].i = width; 1337 } 1338 if (ctx->ExecuteFlag) { 1339 CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width)); 1340 } 1341} 1342 1343 1344static void GLAPIENTRY 1345save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, 1346 GLenum format, GLenum type, const GLvoid * filter) 1347{ 1348 GET_CURRENT_CONTEXT(ctx); 1349 GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter, 1350 &ctx->Unpack); 1351 Node *n; 1352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1353 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6); 1354 if (n) { 1355 n[1].e = target; 1356 n[2].e = internalFormat; 1357 n[3].i = width; 1358 n[4].e = format; 1359 n[5].e = type; 1360 n[6].data = image; 1361 } 1362 else if (image) { 1363 _mesa_free(image); 1364 } 1365 if (ctx->ExecuteFlag) { 1366 CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width, 1367 format, type, filter)); 1368 } 1369} 1370 1371 1372static void GLAPIENTRY 1373save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, 1374 GLsizei width, GLsizei height, GLenum format, 1375 GLenum type, const GLvoid * filter) 1376{ 1377 GET_CURRENT_CONTEXT(ctx); 1378 GLvoid *image = unpack_image(2, width, height, 1, format, type, filter, 1379 &ctx->Unpack); 1380 Node *n; 1381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1382 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7); 1383 if (n) { 1384 n[1].e = target; 1385 n[2].e = internalFormat; 1386 n[3].i = width; 1387 n[4].i = height; 1388 n[5].e = format; 1389 n[6].e = type; 1390 n[7].data = image; 1391 } 1392 else if (image) { 1393 _mesa_free(image); 1394 } 1395 if (ctx->ExecuteFlag) { 1396 CALL_ConvolutionFilter2D(ctx->Exec, 1397 (target, internalFormat, width, height, format, 1398 type, filter)); 1399 } 1400} 1401 1402 1403static void GLAPIENTRY 1404save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) 1405{ 1406 GET_CURRENT_CONTEXT(ctx); 1407 Node *n; 1408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1409 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3); 1410 if (n) { 1411 n[1].e = target; 1412 n[2].e = pname; 1413 n[3].i = param; 1414 } 1415 if (ctx->ExecuteFlag) { 1416 CALL_ConvolutionParameteri(ctx->Exec, (target, pname, param)); 1417 } 1418} 1419 1420 1421static void GLAPIENTRY 1422save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) 1423{ 1424 GET_CURRENT_CONTEXT(ctx); 1425 Node *n; 1426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1427 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6); 1428 if (n) { 1429 n[1].e = target; 1430 n[2].e = pname; 1431 n[3].i = params[0]; 1432 if (pname == GL_CONVOLUTION_BORDER_COLOR || 1433 pname == GL_CONVOLUTION_FILTER_SCALE || 1434 pname == GL_CONVOLUTION_FILTER_BIAS) { 1435 n[4].i = params[1]; 1436 n[5].i = params[2]; 1437 n[6].i = params[3]; 1438 } 1439 else { 1440 n[4].i = n[5].i = n[6].i = 0; 1441 } 1442 } 1443 if (ctx->ExecuteFlag) { 1444 CALL_ConvolutionParameteriv(ctx->Exec, (target, pname, params)); 1445 } 1446} 1447 1448 1449static void GLAPIENTRY 1450save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) 1451{ 1452 GET_CURRENT_CONTEXT(ctx); 1453 Node *n; 1454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1455 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3); 1456 if (n) { 1457 n[1].e = target; 1458 n[2].e = pname; 1459 n[3].f = param; 1460 } 1461 if (ctx->ExecuteFlag) { 1462 CALL_ConvolutionParameterf(ctx->Exec, (target, pname, param)); 1463 } 1464} 1465 1466 1467static void GLAPIENTRY 1468save_ConvolutionParameterfv(GLenum target, GLenum pname, 1469 const GLfloat *params) 1470{ 1471 GET_CURRENT_CONTEXT(ctx); 1472 Node *n; 1473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1474 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6); 1475 if (n) { 1476 n[1].e = target; 1477 n[2].e = pname; 1478 n[3].f = params[0]; 1479 if (pname == GL_CONVOLUTION_BORDER_COLOR || 1480 pname == GL_CONVOLUTION_FILTER_SCALE || 1481 pname == GL_CONVOLUTION_FILTER_BIAS) { 1482 n[4].f = params[1]; 1483 n[5].f = params[2]; 1484 n[6].f = params[3]; 1485 } 1486 else { 1487 n[4].f = n[5].f = n[6].f = 0.0F; 1488 } 1489 } 1490 if (ctx->ExecuteFlag) { 1491 CALL_ConvolutionParameterfv(ctx->Exec, (target, pname, params)); 1492 } 1493} 1494 1495 1496static void GLAPIENTRY 1497save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) 1498{ 1499 GET_CURRENT_CONTEXT(ctx); 1500 Node *n; 1501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1502 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_PIXELS, 5); 1503 if (n) { 1504 n[1].i = x; 1505 n[2].i = y; 1506 n[3].i = (GLint) width; 1507 n[4].i = (GLint) height; 1508 n[5].e = type; 1509 } 1510 if (ctx->ExecuteFlag) { 1511 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type)); 1512 } 1513} 1514 1515 1516 1517static void GLAPIENTRY 1518save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat, 1519 GLint x, GLint y, GLsizei width, GLint border) 1520{ 1521 GET_CURRENT_CONTEXT(ctx); 1522 Node *n; 1523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1524 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE1D, 7); 1525 if (n) { 1526 n[1].e = target; 1527 n[2].i = level; 1528 n[3].e = internalformat; 1529 n[4].i = x; 1530 n[5].i = y; 1531 n[6].i = width; 1532 n[7].i = border; 1533 } 1534 if (ctx->ExecuteFlag) { 1535 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat, 1536 x, y, width, border)); 1537 } 1538} 1539 1540 1541static void GLAPIENTRY 1542save_CopyTexImage2D(GLenum target, GLint level, 1543 GLenum internalformat, 1544 GLint x, GLint y, GLsizei width, 1545 GLsizei height, GLint border) 1546{ 1547 GET_CURRENT_CONTEXT(ctx); 1548 Node *n; 1549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1550 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE2D, 8); 1551 if (n) { 1552 n[1].e = target; 1553 n[2].i = level; 1554 n[3].e = internalformat; 1555 n[4].i = x; 1556 n[5].i = y; 1557 n[6].i = width; 1558 n[7].i = height; 1559 n[8].i = border; 1560 } 1561 if (ctx->ExecuteFlag) { 1562 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat, 1563 x, y, width, height, border)); 1564 } 1565} 1566 1567 1568 1569static void GLAPIENTRY 1570save_CopyTexSubImage1D(GLenum target, GLint level, 1571 GLint xoffset, GLint x, GLint y, GLsizei width) 1572{ 1573 GET_CURRENT_CONTEXT(ctx); 1574 Node *n; 1575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1576 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6); 1577 if (n) { 1578 n[1].e = target; 1579 n[2].i = level; 1580 n[3].i = xoffset; 1581 n[4].i = x; 1582 n[5].i = y; 1583 n[6].i = width; 1584 } 1585 if (ctx->ExecuteFlag) { 1586 CALL_CopyTexSubImage1D(ctx->Exec, 1587 (target, level, xoffset, x, y, width)); 1588 } 1589} 1590 1591 1592static void GLAPIENTRY 1593save_CopyTexSubImage2D(GLenum target, GLint level, 1594 GLint xoffset, GLint yoffset, 1595 GLint x, GLint y, GLsizei width, GLint height) 1596{ 1597 GET_CURRENT_CONTEXT(ctx); 1598 Node *n; 1599 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1600 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8); 1601 if (n) { 1602 n[1].e = target; 1603 n[2].i = level; 1604 n[3].i = xoffset; 1605 n[4].i = yoffset; 1606 n[5].i = x; 1607 n[6].i = y; 1608 n[7].i = width; 1609 n[8].i = height; 1610 } 1611 if (ctx->ExecuteFlag) { 1612 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset, 1613 x, y, width, height)); 1614 } 1615} 1616 1617 1618static void GLAPIENTRY 1619save_CopyTexSubImage3D(GLenum target, GLint level, 1620 GLint xoffset, GLint yoffset, GLint zoffset, 1621 GLint x, GLint y, GLsizei width, GLint height) 1622{ 1623 GET_CURRENT_CONTEXT(ctx); 1624 Node *n; 1625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1626 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9); 1627 if (n) { 1628 n[1].e = target; 1629 n[2].i = level; 1630 n[3].i = xoffset; 1631 n[4].i = yoffset; 1632 n[5].i = zoffset; 1633 n[6].i = x; 1634 n[7].i = y; 1635 n[8].i = width; 1636 n[9].i = height; 1637 } 1638 if (ctx->ExecuteFlag) { 1639 CALL_CopyTexSubImage3D(ctx->Exec, (target, level, 1640 xoffset, yoffset, zoffset, 1641 x, y, width, height)); 1642 } 1643} 1644 1645 1646static void GLAPIENTRY 1647save_CullFace(GLenum mode) 1648{ 1649 GET_CURRENT_CONTEXT(ctx); 1650 Node *n; 1651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1652 n = ALLOC_INSTRUCTION(ctx, OPCODE_CULL_FACE, 1); 1653 if (n) { 1654 n[1].e = mode; 1655 } 1656 if (ctx->ExecuteFlag) { 1657 CALL_CullFace(ctx->Exec, (mode)); 1658 } 1659} 1660 1661 1662static void GLAPIENTRY 1663save_DepthFunc(GLenum func) 1664{ 1665 GET_CURRENT_CONTEXT(ctx); 1666 Node *n; 1667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1668 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_FUNC, 1); 1669 if (n) { 1670 n[1].e = func; 1671 } 1672 if (ctx->ExecuteFlag) { 1673 CALL_DepthFunc(ctx->Exec, (func)); 1674 } 1675} 1676 1677 1678static void GLAPIENTRY 1679save_DepthMask(GLboolean mask) 1680{ 1681 GET_CURRENT_CONTEXT(ctx); 1682 Node *n; 1683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1684 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_MASK, 1); 1685 if (n) { 1686 n[1].b = mask; 1687 } 1688 if (ctx->ExecuteFlag) { 1689 CALL_DepthMask(ctx->Exec, (mask)); 1690 } 1691} 1692 1693 1694static void GLAPIENTRY 1695save_DepthRange(GLclampd nearval, GLclampd farval) 1696{ 1697 GET_CURRENT_CONTEXT(ctx); 1698 Node *n; 1699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1700 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_RANGE, 2); 1701 if (n) { 1702 n[1].f = (GLfloat) nearval; 1703 n[2].f = (GLfloat) farval; 1704 } 1705 if (ctx->ExecuteFlag) { 1706 CALL_DepthRange(ctx->Exec, (nearval, farval)); 1707 } 1708} 1709 1710 1711static void GLAPIENTRY 1712save_Disable(GLenum cap) 1713{ 1714 GET_CURRENT_CONTEXT(ctx); 1715 Node *n; 1716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1717 n = ALLOC_INSTRUCTION(ctx, OPCODE_DISABLE, 1); 1718 if (n) { 1719 n[1].e = cap; 1720 } 1721 if (ctx->ExecuteFlag) { 1722 CALL_Disable(ctx->Exec, (cap)); 1723 } 1724} 1725 1726 1727static void GLAPIENTRY 1728save_DrawBuffer(GLenum mode) 1729{ 1730 GET_CURRENT_CONTEXT(ctx); 1731 Node *n; 1732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1733 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFER, 1); 1734 if (n) { 1735 n[1].e = mode; 1736 } 1737 if (ctx->ExecuteFlag) { 1738 CALL_DrawBuffer(ctx->Exec, (mode)); 1739 } 1740} 1741 1742 1743static void GLAPIENTRY 1744save_DrawPixels(GLsizei width, GLsizei height, 1745 GLenum format, GLenum type, const GLvoid * pixels) 1746{ 1747 GET_CURRENT_CONTEXT(ctx); 1748 GLvoid *image = unpack_image(2, width, height, 1, format, type, 1749 pixels, &ctx->Unpack); 1750 Node *n; 1751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1752 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_PIXELS, 5); 1753 if (n) { 1754 n[1].i = width; 1755 n[2].i = height; 1756 n[3].e = format; 1757 n[4].e = type; 1758 n[5].data = image; 1759 } 1760 else if (image) { 1761 _mesa_free(image); 1762 } 1763 if (ctx->ExecuteFlag) { 1764 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels)); 1765 } 1766} 1767 1768 1769 1770static void GLAPIENTRY 1771save_Enable(GLenum cap) 1772{ 1773 GET_CURRENT_CONTEXT(ctx); 1774 Node *n; 1775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1776 n = ALLOC_INSTRUCTION(ctx, OPCODE_ENABLE, 1); 1777 if (n) { 1778 n[1].e = cap; 1779 } 1780 if (ctx->ExecuteFlag) { 1781 CALL_Enable(ctx->Exec, (cap)); 1782 } 1783} 1784 1785 1786 1787static void GLAPIENTRY 1788_mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) 1789{ 1790 GET_CURRENT_CONTEXT(ctx); 1791 Node *n; 1792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1793 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH1, 3); 1794 if (n) { 1795 n[1].e = mode; 1796 n[2].i = i1; 1797 n[3].i = i2; 1798 } 1799 if (ctx->ExecuteFlag) { 1800 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2)); 1801 } 1802} 1803 1804 1805static void GLAPIENTRY 1806_mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) 1807{ 1808 GET_CURRENT_CONTEXT(ctx); 1809 Node *n; 1810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1811 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH2, 5); 1812 if (n) { 1813 n[1].e = mode; 1814 n[2].i = i1; 1815 n[3].i = i2; 1816 n[4].i = j1; 1817 n[5].i = j2; 1818 } 1819 if (ctx->ExecuteFlag) { 1820 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2)); 1821 } 1822} 1823 1824 1825 1826 1827static void GLAPIENTRY 1828save_Fogfv(GLenum pname, const GLfloat *params) 1829{ 1830 GET_CURRENT_CONTEXT(ctx); 1831 Node *n; 1832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1833 n = ALLOC_INSTRUCTION(ctx, OPCODE_FOG, 5); 1834 if (n) { 1835 n[1].e = pname; 1836 n[2].f = params[0]; 1837 n[3].f = params[1]; 1838 n[4].f = params[2]; 1839 n[5].f = params[3]; 1840 } 1841 if (ctx->ExecuteFlag) { 1842 CALL_Fogfv(ctx->Exec, (pname, params)); 1843 } 1844} 1845 1846 1847static void GLAPIENTRY 1848save_Fogf(GLenum pname, GLfloat param) 1849{ 1850 save_Fogfv(pname, ¶m); 1851} 1852 1853 1854static void GLAPIENTRY 1855save_Fogiv(GLenum pname, const GLint *params) 1856{ 1857 GLfloat p[4]; 1858 switch (pname) { 1859 case GL_FOG_MODE: 1860 case GL_FOG_DENSITY: 1861 case GL_FOG_START: 1862 case GL_FOG_END: 1863 case GL_FOG_INDEX: 1864 p[0] = (GLfloat) *params; 1865 break; 1866 case GL_FOG_COLOR: 1867 p[0] = INT_TO_FLOAT(params[0]); 1868 p[1] = INT_TO_FLOAT(params[1]); 1869 p[2] = INT_TO_FLOAT(params[2]); 1870 p[3] = INT_TO_FLOAT(params[3]); 1871 break; 1872 default: 1873 /* Error will be caught later in gl_Fogfv */ 1874 ; 1875 } 1876 save_Fogfv(pname, p); 1877} 1878 1879 1880static void GLAPIENTRY 1881save_Fogi(GLenum pname, GLint param) 1882{ 1883 save_Fogiv(pname, ¶m); 1884} 1885 1886 1887static void GLAPIENTRY 1888save_FrontFace(GLenum mode) 1889{ 1890 GET_CURRENT_CONTEXT(ctx); 1891 Node *n; 1892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1893 n = ALLOC_INSTRUCTION(ctx, OPCODE_FRONT_FACE, 1); 1894 if (n) { 1895 n[1].e = mode; 1896 } 1897 if (ctx->ExecuteFlag) { 1898 CALL_FrontFace(ctx->Exec, (mode)); 1899 } 1900} 1901 1902 1903static void GLAPIENTRY 1904save_Frustum(GLdouble left, GLdouble right, 1905 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) 1906{ 1907 GET_CURRENT_CONTEXT(ctx); 1908 Node *n; 1909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1910 n = ALLOC_INSTRUCTION(ctx, OPCODE_FRUSTUM, 6); 1911 if (n) { 1912 n[1].f = (GLfloat) left; 1913 n[2].f = (GLfloat) right; 1914 n[3].f = (GLfloat) bottom; 1915 n[4].f = (GLfloat) top; 1916 n[5].f = (GLfloat) nearval; 1917 n[6].f = (GLfloat) farval; 1918 } 1919 if (ctx->ExecuteFlag) { 1920 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval)); 1921 } 1922} 1923 1924 1925static void GLAPIENTRY 1926save_Hint(GLenum target, GLenum mode) 1927{ 1928 GET_CURRENT_CONTEXT(ctx); 1929 Node *n; 1930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1931 n = ALLOC_INSTRUCTION(ctx, OPCODE_HINT, 2); 1932 if (n) { 1933 n[1].e = target; 1934 n[2].e = mode; 1935 } 1936 if (ctx->ExecuteFlag) { 1937 CALL_Hint(ctx->Exec, (target, mode)); 1938 } 1939} 1940 1941 1942static void GLAPIENTRY 1943save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, 1944 GLboolean sink) 1945{ 1946 GET_CURRENT_CONTEXT(ctx); 1947 Node *n; 1948 1949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1950 n = ALLOC_INSTRUCTION(ctx, OPCODE_HISTOGRAM, 4); 1951 if (n) { 1952 n[1].e = target; 1953 n[2].i = width; 1954 n[3].e = internalFormat; 1955 n[4].b = sink; 1956 } 1957 if (ctx->ExecuteFlag) { 1958 CALL_Histogram(ctx->Exec, (target, width, internalFormat, sink)); 1959 } 1960} 1961 1962 1963static void GLAPIENTRY 1964save_IndexMask(GLuint mask) 1965{ 1966 GET_CURRENT_CONTEXT(ctx); 1967 Node *n; 1968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1969 n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX_MASK, 1); 1970 if (n) { 1971 n[1].ui = mask; 1972 } 1973 if (ctx->ExecuteFlag) { 1974 CALL_IndexMask(ctx->Exec, (mask)); 1975 } 1976} 1977 1978 1979static void GLAPIENTRY 1980save_InitNames(void) 1981{ 1982 GET_CURRENT_CONTEXT(ctx); 1983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1984 (void) ALLOC_INSTRUCTION(ctx, OPCODE_INIT_NAMES, 0); 1985 if (ctx->ExecuteFlag) { 1986 CALL_InitNames(ctx->Exec, ()); 1987 } 1988} 1989 1990 1991static void GLAPIENTRY 1992save_Lightfv(GLenum light, GLenum pname, const GLfloat *params) 1993{ 1994 GET_CURRENT_CONTEXT(ctx); 1995 Node *n; 1996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 1997 n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT, 6); 1998 if (OPCODE_LIGHT) { 1999 GLint i, nParams; 2000 n[1].e = light; 2001 n[2].e = pname; 2002 switch (pname) { 2003 case GL_AMBIENT: 2004 nParams = 4; 2005 break; 2006 case GL_DIFFUSE: 2007 nParams = 4; 2008 break; 2009 case GL_SPECULAR: 2010 nParams = 4; 2011 break; 2012 case GL_POSITION: 2013 nParams = 4; 2014 break; 2015 case GL_SPOT_DIRECTION: 2016 nParams = 3; 2017 break; 2018 case GL_SPOT_EXPONENT: 2019 nParams = 1; 2020 break; 2021 case GL_SPOT_CUTOFF: 2022 nParams = 1; 2023 break; 2024 case GL_CONSTANT_ATTENUATION: 2025 nParams = 1; 2026 break; 2027 case GL_LINEAR_ATTENUATION: 2028 nParams = 1; 2029 break; 2030 case GL_QUADRATIC_ATTENUATION: 2031 nParams = 1; 2032 break; 2033 default: 2034 nParams = 0; 2035 } 2036 for (i = 0; i < nParams; i++) { 2037 n[3 + i].f = params[i]; 2038 } 2039 } 2040 if (ctx->ExecuteFlag) { 2041 CALL_Lightfv(ctx->Exec, (light, pname, params)); 2042 } 2043} 2044 2045 2046static void GLAPIENTRY 2047save_Lightf(GLenum light, GLenum pname, GLfloat params) 2048{ 2049 save_Lightfv(light, pname, ¶ms); 2050} 2051 2052 2053static void GLAPIENTRY 2054save_Lightiv(GLenum light, GLenum pname, const GLint *params) 2055{ 2056 GLfloat fparam[4]; 2057 switch (pname) { 2058 case GL_AMBIENT: 2059 case GL_DIFFUSE: 2060 case GL_SPECULAR: 2061 fparam[0] = INT_TO_FLOAT(params[0]); 2062 fparam[1] = INT_TO_FLOAT(params[1]); 2063 fparam[2] = INT_TO_FLOAT(params[2]); 2064 fparam[3] = INT_TO_FLOAT(params[3]); 2065 break; 2066 case GL_POSITION: 2067 fparam[0] = (GLfloat) params[0]; 2068 fparam[1] = (GLfloat) params[1]; 2069 fparam[2] = (GLfloat) params[2]; 2070 fparam[3] = (GLfloat) params[3]; 2071 break; 2072 case GL_SPOT_DIRECTION: 2073 fparam[0] = (GLfloat) params[0]; 2074 fparam[1] = (GLfloat) params[1]; 2075 fparam[2] = (GLfloat) params[2]; 2076 break; 2077 case GL_SPOT_EXPONENT: 2078 case GL_SPOT_CUTOFF: 2079 case GL_CONSTANT_ATTENUATION: 2080 case GL_LINEAR_ATTENUATION: 2081 case GL_QUADRATIC_ATTENUATION: 2082 fparam[0] = (GLfloat) params[0]; 2083 break; 2084 default: 2085 /* error will be caught later in gl_Lightfv */ 2086 ; 2087 } 2088 save_Lightfv(light, pname, fparam); 2089} 2090 2091 2092static void GLAPIENTRY 2093save_Lighti(GLenum light, GLenum pname, GLint param) 2094{ 2095 save_Lightiv(light, pname, ¶m); 2096} 2097 2098 2099static void GLAPIENTRY 2100save_LightModelfv(GLenum pname, const GLfloat *params) 2101{ 2102 GET_CURRENT_CONTEXT(ctx); 2103 Node *n; 2104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2105 n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT_MODEL, 5); 2106 if (n) { 2107 n[1].e = pname; 2108 n[2].f = params[0]; 2109 n[3].f = params[1]; 2110 n[4].f = params[2]; 2111 n[5].f = params[3]; 2112 } 2113 if (ctx->ExecuteFlag) { 2114 CALL_LightModelfv(ctx->Exec, (pname, params)); 2115 } 2116} 2117 2118 2119static void GLAPIENTRY 2120save_LightModelf(GLenum pname, GLfloat param) 2121{ 2122 save_LightModelfv(pname, ¶m); 2123} 2124 2125 2126static void GLAPIENTRY 2127save_LightModeliv(GLenum pname, const GLint *params) 2128{ 2129 GLfloat fparam[4]; 2130 switch (pname) { 2131 case GL_LIGHT_MODEL_AMBIENT: 2132 fparam[0] = INT_TO_FLOAT(params[0]); 2133 fparam[1] = INT_TO_FLOAT(params[1]); 2134 fparam[2] = INT_TO_FLOAT(params[2]); 2135 fparam[3] = INT_TO_FLOAT(params[3]); 2136 break; 2137 case GL_LIGHT_MODEL_LOCAL_VIEWER: 2138 case GL_LIGHT_MODEL_TWO_SIDE: 2139 case GL_LIGHT_MODEL_COLOR_CONTROL: 2140 fparam[0] = (GLfloat) params[0]; 2141 break; 2142 default: 2143 /* Error will be caught later in gl_LightModelfv */ 2144 ; 2145 } 2146 save_LightModelfv(pname, fparam); 2147} 2148 2149 2150static void GLAPIENTRY 2151save_LightModeli(GLenum pname, GLint param) 2152{ 2153 save_LightModeliv(pname, ¶m); 2154} 2155 2156 2157static void GLAPIENTRY 2158save_LineStipple(GLint factor, GLushort pattern) 2159{ 2160 GET_CURRENT_CONTEXT(ctx); 2161 Node *n; 2162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2163 n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_STIPPLE, 2); 2164 if (n) { 2165 n[1].i = factor; 2166 n[2].us = pattern; 2167 } 2168 if (ctx->ExecuteFlag) { 2169 CALL_LineStipple(ctx->Exec, (factor, pattern)); 2170 } 2171} 2172 2173 2174static void GLAPIENTRY 2175save_LineWidth(GLfloat width) 2176{ 2177 GET_CURRENT_CONTEXT(ctx); 2178 Node *n; 2179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2180 n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_WIDTH, 1); 2181 if (n) { 2182 n[1].f = width; 2183 } 2184 if (ctx->ExecuteFlag) { 2185 CALL_LineWidth(ctx->Exec, (width)); 2186 } 2187} 2188 2189 2190static void GLAPIENTRY 2191save_ListBase(GLuint base) 2192{ 2193 GET_CURRENT_CONTEXT(ctx); 2194 Node *n; 2195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2196 n = ALLOC_INSTRUCTION(ctx, OPCODE_LIST_BASE, 1); 2197 if (n) { 2198 n[1].ui = base; 2199 } 2200 if (ctx->ExecuteFlag) { 2201 CALL_ListBase(ctx->Exec, (base)); 2202 } 2203} 2204 2205 2206static void GLAPIENTRY 2207save_LoadIdentity(void) 2208{ 2209 GET_CURRENT_CONTEXT(ctx); 2210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2211 (void) ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_IDENTITY, 0); 2212 if (ctx->ExecuteFlag) { 2213 CALL_LoadIdentity(ctx->Exec, ()); 2214 } 2215} 2216 2217 2218static void GLAPIENTRY 2219save_LoadMatrixf(const GLfloat * m) 2220{ 2221 GET_CURRENT_CONTEXT(ctx); 2222 Node *n; 2223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2224 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_MATRIX, 16); 2225 if (n) { 2226 GLuint i; 2227 for (i = 0; i < 16; i++) { 2228 n[1 + i].f = m[i]; 2229 } 2230 } 2231 if (ctx->ExecuteFlag) { 2232 CALL_LoadMatrixf(ctx->Exec, (m)); 2233 } 2234} 2235 2236 2237static void GLAPIENTRY 2238save_LoadMatrixd(const GLdouble * m) 2239{ 2240 GLfloat f[16]; 2241 GLint i; 2242 for (i = 0; i < 16; i++) { 2243 f[i] = (GLfloat) m[i]; 2244 } 2245 save_LoadMatrixf(f); 2246} 2247 2248 2249static void GLAPIENTRY 2250save_LoadName(GLuint name) 2251{ 2252 GET_CURRENT_CONTEXT(ctx); 2253 Node *n; 2254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2255 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_NAME, 1); 2256 if (n) { 2257 n[1].ui = name; 2258 } 2259 if (ctx->ExecuteFlag) { 2260 CALL_LoadName(ctx->Exec, (name)); 2261 } 2262} 2263 2264 2265static void GLAPIENTRY 2266save_LogicOp(GLenum opcode) 2267{ 2268 GET_CURRENT_CONTEXT(ctx); 2269 Node *n; 2270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2271 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOGIC_OP, 1); 2272 if (n) { 2273 n[1].e = opcode; 2274 } 2275 if (ctx->ExecuteFlag) { 2276 CALL_LogicOp(ctx->Exec, (opcode)); 2277 } 2278} 2279 2280 2281static void GLAPIENTRY 2282save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, 2283 GLint order, const GLdouble * points) 2284{ 2285 GET_CURRENT_CONTEXT(ctx); 2286 Node *n; 2287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2288 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6); 2289 if (n) { 2290 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points); 2291 n[1].e = target; 2292 n[2].f = (GLfloat) u1; 2293 n[3].f = (GLfloat) u2; 2294 n[4].i = _mesa_evaluator_components(target); /* stride */ 2295 n[5].i = order; 2296 n[6].data = (void *) pnts; 2297 } 2298 if (ctx->ExecuteFlag) { 2299 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points)); 2300 } 2301} 2302 2303static void GLAPIENTRY 2304save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, 2305 GLint order, const GLfloat * points) 2306{ 2307 GET_CURRENT_CONTEXT(ctx); 2308 Node *n; 2309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2310 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6); 2311 if (n) { 2312 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points); 2313 n[1].e = target; 2314 n[2].f = u1; 2315 n[3].f = u2; 2316 n[4].i = _mesa_evaluator_components(target); /* stride */ 2317 n[5].i = order; 2318 n[6].data = (void *) pnts; 2319 } 2320 if (ctx->ExecuteFlag) { 2321 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points)); 2322 } 2323} 2324 2325 2326static void GLAPIENTRY 2327save_Map2d(GLenum target, 2328 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, 2329 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, 2330 const GLdouble * points) 2331{ 2332 GET_CURRENT_CONTEXT(ctx); 2333 Node *n; 2334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2335 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10); 2336 if (n) { 2337 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder, 2338 vstride, vorder, points); 2339 n[1].e = target; 2340 n[2].f = (GLfloat) u1; 2341 n[3].f = (GLfloat) u2; 2342 n[4].f = (GLfloat) v1; 2343 n[5].f = (GLfloat) v2; 2344 /* XXX verify these strides are correct */ 2345 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */ 2346 n[7].i = _mesa_evaluator_components(target); /*vstride */ 2347 n[8].i = uorder; 2348 n[9].i = vorder; 2349 n[10].data = (void *) pnts; 2350 } 2351 if (ctx->ExecuteFlag) { 2352 CALL_Map2d(ctx->Exec, (target, 2353 u1, u2, ustride, uorder, 2354 v1, v2, vstride, vorder, points)); 2355 } 2356} 2357 2358 2359static void GLAPIENTRY 2360save_Map2f(GLenum target, 2361 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, 2362 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, 2363 const GLfloat * points) 2364{ 2365 GET_CURRENT_CONTEXT(ctx); 2366 Node *n; 2367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2368 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10); 2369 if (n) { 2370 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder, 2371 vstride, vorder, points); 2372 n[1].e = target; 2373 n[2].f = u1; 2374 n[3].f = u2; 2375 n[4].f = v1; 2376 n[5].f = v2; 2377 /* XXX verify these strides are correct */ 2378 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */ 2379 n[7].i = _mesa_evaluator_components(target); /*vstride */ 2380 n[8].i = uorder; 2381 n[9].i = vorder; 2382 n[10].data = (void *) pnts; 2383 } 2384 if (ctx->ExecuteFlag) { 2385 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder, 2386 v1, v2, vstride, vorder, points)); 2387 } 2388} 2389 2390 2391static void GLAPIENTRY 2392save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2) 2393{ 2394 GET_CURRENT_CONTEXT(ctx); 2395 Node *n; 2396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2397 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID1, 3); 2398 if (n) { 2399 n[1].i = un; 2400 n[2].f = u1; 2401 n[3].f = u2; 2402 } 2403 if (ctx->ExecuteFlag) { 2404 CALL_MapGrid1f(ctx->Exec, (un, u1, u2)); 2405 } 2406} 2407 2408 2409static void GLAPIENTRY 2410save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2) 2411{ 2412 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2); 2413} 2414 2415 2416static void GLAPIENTRY 2417save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2, 2418 GLint vn, GLfloat v1, GLfloat v2) 2419{ 2420 GET_CURRENT_CONTEXT(ctx); 2421 Node *n; 2422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2423 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID2, 6); 2424 if (n) { 2425 n[1].i = un; 2426 n[2].f = u1; 2427 n[3].f = u2; 2428 n[4].i = vn; 2429 n[5].f = v1; 2430 n[6].f = v2; 2431 } 2432 if (ctx->ExecuteFlag) { 2433 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2)); 2434 } 2435} 2436 2437 2438 2439static void GLAPIENTRY 2440save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2, 2441 GLint vn, GLdouble v1, GLdouble v2) 2442{ 2443 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2, 2444 vn, (GLfloat) v1, (GLfloat) v2); 2445} 2446 2447 2448static void GLAPIENTRY 2449save_MatrixMode(GLenum mode) 2450{ 2451 GET_CURRENT_CONTEXT(ctx); 2452 Node *n; 2453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2454 n = ALLOC_INSTRUCTION(ctx, OPCODE_MATRIX_MODE, 1); 2455 if (n) { 2456 n[1].e = mode; 2457 } 2458 if (ctx->ExecuteFlag) { 2459 CALL_MatrixMode(ctx->Exec, (mode)); 2460 } 2461} 2462 2463 2464static void GLAPIENTRY 2465save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) 2466{ 2467 GET_CURRENT_CONTEXT(ctx); 2468 Node *n; 2469 2470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2471 n = ALLOC_INSTRUCTION(ctx, OPCODE_MIN_MAX, 3); 2472 if (n) { 2473 n[1].e = target; 2474 n[2].e = internalFormat; 2475 n[3].b = sink; 2476 } 2477 if (ctx->ExecuteFlag) { 2478 CALL_Minmax(ctx->Exec, (target, internalFormat, sink)); 2479 } 2480} 2481 2482 2483static void GLAPIENTRY 2484save_MultMatrixf(const GLfloat * m) 2485{ 2486 GET_CURRENT_CONTEXT(ctx); 2487 Node *n; 2488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2489 n = ALLOC_INSTRUCTION(ctx, OPCODE_MULT_MATRIX, 16); 2490 if (n) { 2491 GLuint i; 2492 for (i = 0; i < 16; i++) { 2493 n[1 + i].f = m[i]; 2494 } 2495 } 2496 if (ctx->ExecuteFlag) { 2497 CALL_MultMatrixf(ctx->Exec, (m)); 2498 } 2499} 2500 2501 2502static void GLAPIENTRY 2503save_MultMatrixd(const GLdouble * m) 2504{ 2505 GLfloat f[16]; 2506 GLint i; 2507 for (i = 0; i < 16; i++) { 2508 f[i] = (GLfloat) m[i]; 2509 } 2510 save_MultMatrixf(f); 2511} 2512 2513 2514static void GLAPIENTRY 2515save_NewList(GLuint list, GLenum mode) 2516{ 2517 GET_CURRENT_CONTEXT(ctx); 2518 /* It's an error to call this function while building a display list */ 2519 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList"); 2520 (void) list; 2521 (void) mode; 2522} 2523 2524 2525 2526static void GLAPIENTRY 2527save_Ortho(GLdouble left, GLdouble right, 2528 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) 2529{ 2530 GET_CURRENT_CONTEXT(ctx); 2531 Node *n; 2532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2533 n = ALLOC_INSTRUCTION(ctx, OPCODE_ORTHO, 6); 2534 if (n) { 2535 n[1].f = (GLfloat) left; 2536 n[2].f = (GLfloat) right; 2537 n[3].f = (GLfloat) bottom; 2538 n[4].f = (GLfloat) top; 2539 n[5].f = (GLfloat) nearval; 2540 n[6].f = (GLfloat) farval; 2541 } 2542 if (ctx->ExecuteFlag) { 2543 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval)); 2544 } 2545} 2546 2547 2548static void GLAPIENTRY 2549save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) 2550{ 2551 GET_CURRENT_CONTEXT(ctx); 2552 Node *n; 2553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2554 n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_MAP, 3); 2555 if (n) { 2556 n[1].e = map; 2557 n[2].i = mapsize; 2558 n[3].data = (void *) _mesa_malloc(mapsize * sizeof(GLfloat)); 2559 MEMCPY(n[3].data, (void *) values, mapsize * sizeof(GLfloat)); 2560 } 2561 if (ctx->ExecuteFlag) { 2562 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values)); 2563 } 2564} 2565 2566 2567static void GLAPIENTRY 2568save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values) 2569{ 2570 GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; 2571 GLint i; 2572 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) { 2573 for (i = 0; i < mapsize; i++) { 2574 fvalues[i] = (GLfloat) values[i]; 2575 } 2576 } 2577 else { 2578 for (i = 0; i < mapsize; i++) { 2579 fvalues[i] = UINT_TO_FLOAT(values[i]); 2580 } 2581 } 2582 save_PixelMapfv(map, mapsize, fvalues); 2583} 2584 2585 2586static void GLAPIENTRY 2587save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values) 2588{ 2589 GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; 2590 GLint i; 2591 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) { 2592 for (i = 0; i < mapsize; i++) { 2593 fvalues[i] = (GLfloat) values[i]; 2594 } 2595 } 2596 else { 2597 for (i = 0; i < mapsize; i++) { 2598 fvalues[i] = USHORT_TO_FLOAT(values[i]); 2599 } 2600 } 2601 save_PixelMapfv(map, mapsize, fvalues); 2602} 2603 2604 2605static void GLAPIENTRY 2606save_PixelTransferf(GLenum pname, GLfloat param) 2607{ 2608 GET_CURRENT_CONTEXT(ctx); 2609 Node *n; 2610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2611 n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_TRANSFER, 2); 2612 if (n) { 2613 n[1].e = pname; 2614 n[2].f = param; 2615 } 2616 if (ctx->ExecuteFlag) { 2617 CALL_PixelTransferf(ctx->Exec, (pname, param)); 2618 } 2619} 2620 2621 2622static void GLAPIENTRY 2623save_PixelTransferi(GLenum pname, GLint param) 2624{ 2625 save_PixelTransferf(pname, (GLfloat) param); 2626} 2627 2628 2629static void GLAPIENTRY 2630save_PixelZoom(GLfloat xfactor, GLfloat yfactor) 2631{ 2632 GET_CURRENT_CONTEXT(ctx); 2633 Node *n; 2634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2635 n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_ZOOM, 2); 2636 if (n) { 2637 n[1].f = xfactor; 2638 n[2].f = yfactor; 2639 } 2640 if (ctx->ExecuteFlag) { 2641 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor)); 2642 } 2643} 2644 2645 2646static void GLAPIENTRY 2647save_PointParameterfvEXT(GLenum pname, const GLfloat *params) 2648{ 2649 GET_CURRENT_CONTEXT(ctx); 2650 Node *n; 2651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2652 n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_PARAMETERS, 4); 2653 if (n) { 2654 n[1].e = pname; 2655 n[2].f = params[0]; 2656 n[3].f = params[1]; 2657 n[4].f = params[2]; 2658 } 2659 if (ctx->ExecuteFlag) { 2660 CALL_PointParameterfvEXT(ctx->Exec, (pname, params)); 2661 } 2662} 2663 2664 2665static void GLAPIENTRY 2666save_PointParameterfEXT(GLenum pname, GLfloat param) 2667{ 2668 save_PointParameterfvEXT(pname, ¶m); 2669} 2670 2671static void GLAPIENTRY 2672save_PointParameteriNV(GLenum pname, GLint param) 2673{ 2674 GLfloat p = (GLfloat) param; 2675 save_PointParameterfvEXT(pname, &p); 2676} 2677 2678static void GLAPIENTRY 2679save_PointParameterivNV(GLenum pname, const GLint * param) 2680{ 2681 GLfloat p = (GLfloat) param[0]; 2682 save_PointParameterfvEXT(pname, &p); 2683} 2684 2685 2686static void GLAPIENTRY 2687save_PointSize(GLfloat size) 2688{ 2689 GET_CURRENT_CONTEXT(ctx); 2690 Node *n; 2691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2692 n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_SIZE, 1); 2693 if (n) { 2694 n[1].f = size; 2695 } 2696 if (ctx->ExecuteFlag) { 2697 CALL_PointSize(ctx->Exec, (size)); 2698 } 2699} 2700 2701 2702static void GLAPIENTRY 2703save_PolygonMode(GLenum face, GLenum mode) 2704{ 2705 GET_CURRENT_CONTEXT(ctx); 2706 Node *n; 2707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2708 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_MODE, 2); 2709 if (n) { 2710 n[1].e = face; 2711 n[2].e = mode; 2712 } 2713 if (ctx->ExecuteFlag) { 2714 CALL_PolygonMode(ctx->Exec, (face, mode)); 2715 } 2716} 2717 2718 2719/* 2720 * Polygon stipple must have been upacked already! 2721 */ 2722static void GLAPIENTRY 2723save_PolygonStipple(const GLubyte * pattern) 2724{ 2725 GET_CURRENT_CONTEXT(ctx); 2726 Node *n; 2727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2728 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); 2729 if (n) { 2730 void *data; 2731 n[1].data = _mesa_malloc(32 * 4); 2732 data = n[1].data; /* This needed for Acorn compiler */ 2733 MEMCPY(data, pattern, 32 * 4); 2734 } 2735 if (ctx->ExecuteFlag) { 2736 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern)); 2737 } 2738} 2739 2740 2741static void GLAPIENTRY 2742save_PolygonOffset(GLfloat factor, GLfloat units) 2743{ 2744 GET_CURRENT_CONTEXT(ctx); 2745 Node *n; 2746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2747 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_OFFSET, 2); 2748 if (n) { 2749 n[1].f = factor; 2750 n[2].f = units; 2751 } 2752 if (ctx->ExecuteFlag) { 2753 CALL_PolygonOffset(ctx->Exec, (factor, units)); 2754 } 2755} 2756 2757 2758static void GLAPIENTRY 2759save_PolygonOffsetEXT(GLfloat factor, GLfloat bias) 2760{ 2761 GET_CURRENT_CONTEXT(ctx); 2762 /* XXX mult by DepthMaxF here??? */ 2763 save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias); 2764} 2765 2766 2767static void GLAPIENTRY 2768save_PopAttrib(void) 2769{ 2770 GET_CURRENT_CONTEXT(ctx); 2771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2772 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_ATTRIB, 0); 2773 if (ctx->ExecuteFlag) { 2774 CALL_PopAttrib(ctx->Exec, ()); 2775 } 2776} 2777 2778 2779static void GLAPIENTRY 2780save_PopMatrix(void) 2781{ 2782 GET_CURRENT_CONTEXT(ctx); 2783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2784 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_MATRIX, 0); 2785 if (ctx->ExecuteFlag) { 2786 CALL_PopMatrix(ctx->Exec, ()); 2787 } 2788} 2789 2790 2791static void GLAPIENTRY 2792save_PopName(void) 2793{ 2794 GET_CURRENT_CONTEXT(ctx); 2795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2796 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_NAME, 0); 2797 if (ctx->ExecuteFlag) { 2798 CALL_PopName(ctx->Exec, ()); 2799 } 2800} 2801 2802 2803static void GLAPIENTRY 2804save_PrioritizeTextures(GLsizei num, const GLuint * textures, 2805 const GLclampf * priorities) 2806{ 2807 GET_CURRENT_CONTEXT(ctx); 2808 GLint i; 2809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2810 2811 for (i = 0; i < num; i++) { 2812 Node *n; 2813 n = ALLOC_INSTRUCTION(ctx, OPCODE_PRIORITIZE_TEXTURE, 2); 2814 if (n) { 2815 n[1].ui = textures[i]; 2816 n[2].f = priorities[i]; 2817 } 2818 } 2819 if (ctx->ExecuteFlag) { 2820 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities)); 2821 } 2822} 2823 2824 2825static void GLAPIENTRY 2826save_PushAttrib(GLbitfield mask) 2827{ 2828 GET_CURRENT_CONTEXT(ctx); 2829 Node *n; 2830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2831 n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_ATTRIB, 1); 2832 if (n) { 2833 n[1].bf = mask; 2834 } 2835 if (ctx->ExecuteFlag) { 2836 CALL_PushAttrib(ctx->Exec, (mask)); 2837 } 2838} 2839 2840 2841static void GLAPIENTRY 2842save_PushMatrix(void) 2843{ 2844 GET_CURRENT_CONTEXT(ctx); 2845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2846 (void) ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_MATRIX, 0); 2847 if (ctx->ExecuteFlag) { 2848 CALL_PushMatrix(ctx->Exec, ()); 2849 } 2850} 2851 2852 2853static void GLAPIENTRY 2854save_PushName(GLuint name) 2855{ 2856 GET_CURRENT_CONTEXT(ctx); 2857 Node *n; 2858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2859 n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_NAME, 1); 2860 if (n) { 2861 n[1].ui = name; 2862 } 2863 if (ctx->ExecuteFlag) { 2864 CALL_PushName(ctx->Exec, (name)); 2865 } 2866} 2867 2868 2869static void GLAPIENTRY 2870save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 2871{ 2872 GET_CURRENT_CONTEXT(ctx); 2873 Node *n; 2874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 2875 n = ALLOC_INSTRUCTION(ctx, OPCODE_RASTER_POS, 4); 2876 if (n) { 2877 n[1].f = x; 2878 n[2].f = y; 2879 n[3].f = z; 2880 n[4].f = w; 2881 } 2882 if (ctx->ExecuteFlag) { 2883 CALL_RasterPos4f(ctx->Exec, (x, y, z, w)); 2884 } 2885} 2886 2887static void GLAPIENTRY 2888save_RasterPos2d(GLdouble x, GLdouble y) 2889{ 2890 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 2891} 2892 2893static void GLAPIENTRY 2894save_RasterPos2f(GLfloat x, GLfloat y) 2895{ 2896 save_RasterPos4f(x, y, 0.0F, 1.0F); 2897} 2898 2899static void GLAPIENTRY 2900save_RasterPos2i(GLint x, GLint y) 2901{ 2902 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 2903} 2904 2905static void GLAPIENTRY 2906save_RasterPos2s(GLshort x, GLshort y) 2907{ 2908 save_RasterPos4f(x, y, 0.0F, 1.0F); 2909} 2910 2911static void GLAPIENTRY 2912save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) 2913{ 2914 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 2915} 2916 2917static void GLAPIENTRY 2918save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) 2919{ 2920 save_RasterPos4f(x, y, z, 1.0F); 2921} 2922 2923static void GLAPIENTRY 2924save_RasterPos3i(GLint x, GLint y, GLint z) 2925{ 2926 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 2927} 2928 2929static void GLAPIENTRY 2930save_RasterPos3s(GLshort x, GLshort y, GLshort z) 2931{ 2932 save_RasterPos4f(x, y, z, 1.0F); 2933} 2934 2935static void GLAPIENTRY 2936save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) 2937{ 2938 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2939} 2940 2941static void GLAPIENTRY 2942save_RasterPos4i(GLint x, GLint y, GLint z, GLint w) 2943{ 2944 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 2945} 2946 2947static void GLAPIENTRY 2948save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) 2949{ 2950 save_RasterPos4f(x, y, z, w); 2951} 2952 2953static void GLAPIENTRY 2954save_RasterPos2dv(const GLdouble * v) 2955{ 2956 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 2957} 2958 2959static void GLAPIENTRY 2960save_RasterPos2fv(const GLfloat * v) 2961{ 2962 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); 2963} 2964 2965static void GLAPIENTRY 2966save_RasterPos2iv(const GLint * v) 2967{ 2968 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 2969} 2970 2971static void GLAPIENTRY 2972save_RasterPos2sv(const GLshort * v) 2973{ 2974 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); 2975} 2976 2977static void GLAPIENTRY 2978save_RasterPos3dv(const GLdouble * v) 2979{ 2980 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 2981} 2982 2983static void GLAPIENTRY 2984save_RasterPos3fv(const GLfloat * v) 2985{ 2986 save_RasterPos4f(v[0], v[1], v[2], 1.0F); 2987} 2988 2989static void GLAPIENTRY 2990save_RasterPos3iv(const GLint * v) 2991{ 2992 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 2993} 2994 2995static void GLAPIENTRY 2996save_RasterPos3sv(const GLshort * v) 2997{ 2998 save_RasterPos4f(v[0], v[1], v[2], 1.0F); 2999} 3000 3001static void GLAPIENTRY 3002save_RasterPos4dv(const GLdouble * v) 3003{ 3004 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 3005 (GLfloat) v[2], (GLfloat) v[3]); 3006} 3007 3008static void GLAPIENTRY 3009save_RasterPos4fv(const GLfloat * v) 3010{ 3011 save_RasterPos4f(v[0], v[1], v[2], v[3]); 3012} 3013 3014static void GLAPIENTRY 3015save_RasterPos4iv(const GLint * v) 3016{ 3017 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 3018 (GLfloat) v[2], (GLfloat) v[3]); 3019} 3020 3021static void GLAPIENTRY 3022save_RasterPos4sv(const GLshort * v) 3023{ 3024 save_RasterPos4f(v[0], v[1], v[2], v[3]); 3025} 3026 3027 3028static void GLAPIENTRY 3029save_PassThrough(GLfloat token) 3030{ 3031 GET_CURRENT_CONTEXT(ctx); 3032 Node *n; 3033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3034 n = ALLOC_INSTRUCTION(ctx, OPCODE_PASSTHROUGH, 1); 3035 if (n) { 3036 n[1].f = token; 3037 } 3038 if (ctx->ExecuteFlag) { 3039 CALL_PassThrough(ctx->Exec, (token)); 3040 } 3041} 3042 3043 3044static void GLAPIENTRY 3045save_ReadBuffer(GLenum mode) 3046{ 3047 GET_CURRENT_CONTEXT(ctx); 3048 Node *n; 3049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3050 n = ALLOC_INSTRUCTION(ctx, OPCODE_READ_BUFFER, 1); 3051 if (n) { 3052 n[1].e = mode; 3053 } 3054 if (ctx->ExecuteFlag) { 3055 CALL_ReadBuffer(ctx->Exec, (mode)); 3056 } 3057} 3058 3059 3060static void GLAPIENTRY 3061save_ResetHistogram(GLenum target) 3062{ 3063 GET_CURRENT_CONTEXT(ctx); 3064 Node *n; 3065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3066 n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_HISTOGRAM, 1); 3067 if (n) { 3068 n[1].e = target; 3069 } 3070 if (ctx->ExecuteFlag) { 3071 CALL_ResetHistogram(ctx->Exec, (target)); 3072 } 3073} 3074 3075 3076static void GLAPIENTRY 3077save_ResetMinmax(GLenum target) 3078{ 3079 GET_CURRENT_CONTEXT(ctx); 3080 Node *n; 3081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3082 n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_MIN_MAX, 1); 3083 if (n) { 3084 n[1].e = target; 3085 } 3086 if (ctx->ExecuteFlag) { 3087 CALL_ResetMinmax(ctx->Exec, (target)); 3088 } 3089} 3090 3091 3092static void GLAPIENTRY 3093save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) 3094{ 3095 GET_CURRENT_CONTEXT(ctx); 3096 Node *n; 3097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3098 n = ALLOC_INSTRUCTION(ctx, OPCODE_ROTATE, 4); 3099 if (n) { 3100 n[1].f = angle; 3101 n[2].f = x; 3102 n[3].f = y; 3103 n[4].f = z; 3104 } 3105 if (ctx->ExecuteFlag) { 3106 CALL_Rotatef(ctx->Exec, (angle, x, y, z)); 3107 } 3108} 3109 3110 3111static void GLAPIENTRY 3112save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) 3113{ 3114 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); 3115} 3116 3117 3118static void GLAPIENTRY 3119save_Scalef(GLfloat x, GLfloat y, GLfloat z) 3120{ 3121 GET_CURRENT_CONTEXT(ctx); 3122 Node *n; 3123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3124 n = ALLOC_INSTRUCTION(ctx, OPCODE_SCALE, 3); 3125 if (n) { 3126 n[1].f = x; 3127 n[2].f = y; 3128 n[3].f = z; 3129 } 3130 if (ctx->ExecuteFlag) { 3131 CALL_Scalef(ctx->Exec, (x, y, z)); 3132 } 3133} 3134 3135 3136static void GLAPIENTRY 3137save_Scaled(GLdouble x, GLdouble y, GLdouble z) 3138{ 3139 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); 3140} 3141 3142 3143static void GLAPIENTRY 3144save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height) 3145{ 3146 GET_CURRENT_CONTEXT(ctx); 3147 Node *n; 3148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3149 n = ALLOC_INSTRUCTION(ctx, OPCODE_SCISSOR, 4); 3150 if (n) { 3151 n[1].i = x; 3152 n[2].i = y; 3153 n[3].i = width; 3154 n[4].i = height; 3155 } 3156 if (ctx->ExecuteFlag) { 3157 CALL_Scissor(ctx->Exec, (x, y, width, height)); 3158 } 3159} 3160 3161 3162static void GLAPIENTRY 3163save_ShadeModel(GLenum mode) 3164{ 3165 GET_CURRENT_CONTEXT(ctx); 3166 Node *n; 3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3168 n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1); 3169 if (n) { 3170 n[1].e = mode; 3171 } 3172 if (ctx->ExecuteFlag) { 3173 CALL_ShadeModel(ctx->Exec, (mode)); 3174 } 3175} 3176 3177 3178static void GLAPIENTRY 3179save_StencilFunc(GLenum func, GLint ref, GLuint mask) 3180{ 3181 GET_CURRENT_CONTEXT(ctx); 3182 Node *n; 3183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3184 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC, 3); 3185 if (n) { 3186 n[1].e = func; 3187 n[2].i = ref; 3188 n[3].ui = mask; 3189 } 3190 if (ctx->ExecuteFlag) { 3191 CALL_StencilFunc(ctx->Exec, (func, ref, mask)); 3192 } 3193} 3194 3195 3196static void GLAPIENTRY 3197save_StencilMask(GLuint mask) 3198{ 3199 GET_CURRENT_CONTEXT(ctx); 3200 Node *n; 3201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3202 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK, 1); 3203 if (n) { 3204 n[1].ui = mask; 3205 } 3206 if (ctx->ExecuteFlag) { 3207 CALL_StencilMask(ctx->Exec, (mask)); 3208 } 3209} 3210 3211 3212static void GLAPIENTRY 3213save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) 3214{ 3215 GET_CURRENT_CONTEXT(ctx); 3216 Node *n; 3217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3218 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP, 3); 3219 if (n) { 3220 n[1].e = fail; 3221 n[2].e = zfail; 3222 n[3].e = zpass; 3223 } 3224 if (ctx->ExecuteFlag) { 3225 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass)); 3226 } 3227} 3228 3229 3230static void GLAPIENTRY 3231save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) 3232{ 3233 GET_CURRENT_CONTEXT(ctx); 3234 Node *n; 3235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3236 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); 3237 if (n) { 3238 n[1].e = face; 3239 n[2].e = func; 3240 n[3].i = ref; 3241 n[4].ui = mask; 3242 } 3243 if (ctx->ExecuteFlag) { 3244 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask)); 3245 } 3246} 3247 3248 3249static void GLAPIENTRY 3250save_StencilMaskSeparate(GLenum face, GLuint mask) 3251{ 3252 GET_CURRENT_CONTEXT(ctx); 3253 Node *n; 3254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3255 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2); 3256 if (n) { 3257 n[1].e = face; 3258 n[2].ui = mask; 3259 } 3260 if (ctx->ExecuteFlag) { 3261 CALL_StencilMaskSeparate(ctx->Exec, (face, mask)); 3262 } 3263} 3264 3265 3266static void GLAPIENTRY 3267save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) 3268{ 3269 GET_CURRENT_CONTEXT(ctx); 3270 Node *n; 3271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3272 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP_SEPARATE, 4); 3273 if (n) { 3274 n[1].e = face; 3275 n[2].e = fail; 3276 n[3].e = zfail; 3277 n[4].e = zpass; 3278 } 3279 if (ctx->ExecuteFlag) { 3280 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass)); 3281 } 3282} 3283 3284 3285static void GLAPIENTRY 3286save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params) 3287{ 3288 GET_CURRENT_CONTEXT(ctx); 3289 Node *n; 3290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3291 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXENV, 6); 3292 if (n) { 3293 n[1].e = target; 3294 n[2].e = pname; 3295 if (pname == GL_TEXTURE_ENV_COLOR) { 3296 n[3].f = params[0]; 3297 n[4].f = params[1]; 3298 n[5].f = params[2]; 3299 n[6].f = params[3]; 3300 } 3301 else { 3302 n[3].f = params[0]; 3303 n[4].f = n[5].f = n[6].f = 0.0F; 3304 } 3305 } 3306 if (ctx->ExecuteFlag) { 3307 CALL_TexEnvfv(ctx->Exec, (target, pname, params)); 3308 } 3309} 3310 3311 3312static void GLAPIENTRY 3313save_TexEnvf(GLenum target, GLenum pname, GLfloat param) 3314{ 3315 save_TexEnvfv(target, pname, ¶m); 3316} 3317 3318 3319static void GLAPIENTRY 3320save_TexEnvi(GLenum target, GLenum pname, GLint param) 3321{ 3322 GLfloat p[4]; 3323 p[0] = (GLfloat) param; 3324 p[1] = p[2] = p[3] = 0.0; 3325 save_TexEnvfv(target, pname, p); 3326} 3327 3328 3329static void GLAPIENTRY 3330save_TexEnviv(GLenum target, GLenum pname, const GLint * param) 3331{ 3332 GLfloat p[4]; 3333 if (pname == GL_TEXTURE_ENV_COLOR) { 3334 p[0] = INT_TO_FLOAT(param[0]); 3335 p[1] = INT_TO_FLOAT(param[1]); 3336 p[2] = INT_TO_FLOAT(param[2]); 3337 p[3] = INT_TO_FLOAT(param[3]); 3338 } 3339 else { 3340 p[0] = (GLfloat) param[0]; 3341 p[1] = p[2] = p[3] = 0.0F; 3342 } 3343 save_TexEnvfv(target, pname, p); 3344} 3345 3346 3347static void GLAPIENTRY 3348save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) 3349{ 3350 GET_CURRENT_CONTEXT(ctx); 3351 Node *n; 3352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3353 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXGEN, 6); 3354 if (n) { 3355 n[1].e = coord; 3356 n[2].e = pname; 3357 n[3].f = params[0]; 3358 n[4].f = params[1]; 3359 n[5].f = params[2]; 3360 n[6].f = params[3]; 3361 } 3362 if (ctx->ExecuteFlag) { 3363 CALL_TexGenfv(ctx->Exec, (coord, pname, params)); 3364 } 3365} 3366 3367 3368static void GLAPIENTRY 3369save_TexGeniv(GLenum coord, GLenum pname, const GLint *params) 3370{ 3371 GLfloat p[4]; 3372 p[0] = (GLfloat) params[0]; 3373 p[1] = (GLfloat) params[1]; 3374 p[2] = (GLfloat) params[2]; 3375 p[3] = (GLfloat) params[3]; 3376 save_TexGenfv(coord, pname, p); 3377} 3378 3379 3380static void GLAPIENTRY 3381save_TexGend(GLenum coord, GLenum pname, GLdouble param) 3382{ 3383 GLfloat p = (GLfloat) param; 3384 save_TexGenfv(coord, pname, &p); 3385} 3386 3387 3388static void GLAPIENTRY 3389save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params) 3390{ 3391 GLfloat p[4]; 3392 p[0] = (GLfloat) params[0]; 3393 p[1] = (GLfloat) params[1]; 3394 p[2] = (GLfloat) params[2]; 3395 p[3] = (GLfloat) params[3]; 3396 save_TexGenfv(coord, pname, p); 3397} 3398 3399 3400static void GLAPIENTRY 3401save_TexGenf(GLenum coord, GLenum pname, GLfloat param) 3402{ 3403 save_TexGenfv(coord, pname, ¶m); 3404} 3405 3406 3407static void GLAPIENTRY 3408save_TexGeni(GLenum coord, GLenum pname, GLint param) 3409{ 3410 save_TexGeniv(coord, pname, ¶m); 3411} 3412 3413 3414static void GLAPIENTRY 3415save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) 3416{ 3417 GET_CURRENT_CONTEXT(ctx); 3418 Node *n; 3419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3420 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXPARAMETER, 6); 3421 if (n) { 3422 n[1].e = target; 3423 n[2].e = pname; 3424 n[3].f = params[0]; 3425 n[4].f = params[1]; 3426 n[5].f = params[2]; 3427 n[6].f = params[3]; 3428 } 3429 if (ctx->ExecuteFlag) { 3430 CALL_TexParameterfv(ctx->Exec, (target, pname, params)); 3431 } 3432} 3433 3434 3435static void GLAPIENTRY 3436save_TexParameterf(GLenum target, GLenum pname, GLfloat param) 3437{ 3438 save_TexParameterfv(target, pname, ¶m); 3439} 3440 3441 3442static void GLAPIENTRY 3443save_TexParameteri(GLenum target, GLenum pname, GLint param) 3444{ 3445 GLfloat fparam[4]; 3446 fparam[0] = (GLfloat) param; 3447 fparam[1] = fparam[2] = fparam[3] = 0.0; 3448 save_TexParameterfv(target, pname, fparam); 3449} 3450 3451 3452static void GLAPIENTRY 3453save_TexParameteriv(GLenum target, GLenum pname, const GLint *params) 3454{ 3455 GLfloat fparam[4]; 3456 fparam[0] = (GLfloat) params[0]; 3457 fparam[1] = fparam[2] = fparam[3] = 0.0; 3458 save_TexParameterfv(target, pname, fparam); 3459} 3460 3461 3462static void GLAPIENTRY 3463save_TexImage1D(GLenum target, 3464 GLint level, GLint components, 3465 GLsizei width, GLint border, 3466 GLenum format, GLenum type, const GLvoid * pixels) 3467{ 3468 GET_CURRENT_CONTEXT(ctx); 3469 if (target == GL_PROXY_TEXTURE_1D) { 3470 /* don't compile, execute immediately */ 3471 CALL_TexImage1D(ctx->Exec, (target, level, components, width, 3472 border, format, type, pixels)); 3473 } 3474 else { 3475 GLvoid *image = unpack_image(1, width, 1, 1, format, type, 3476 pixels, &ctx->Unpack); 3477 Node *n; 3478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3479 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8); 3480 if (n) { 3481 n[1].e = target; 3482 n[2].i = level; 3483 n[3].i = components; 3484 n[4].i = (GLint) width; 3485 n[5].i = border; 3486 n[6].e = format; 3487 n[7].e = type; 3488 n[8].data = image; 3489 } 3490 else if (image) { 3491 _mesa_free(image); 3492 } 3493 if (ctx->ExecuteFlag) { 3494 CALL_TexImage1D(ctx->Exec, (target, level, components, width, 3495 border, format, type, pixels)); 3496 } 3497 } 3498} 3499 3500 3501static void GLAPIENTRY 3502save_TexImage2D(GLenum target, 3503 GLint level, GLint components, 3504 GLsizei width, GLsizei height, GLint border, 3505 GLenum format, GLenum type, const GLvoid * pixels) 3506{ 3507 GET_CURRENT_CONTEXT(ctx); 3508 if (target == GL_PROXY_TEXTURE_2D) { 3509 /* don't compile, execute immediately */ 3510 CALL_TexImage2D(ctx->Exec, (target, level, components, width, 3511 height, border, format, type, pixels)); 3512 } 3513 else { 3514 GLvoid *image = unpack_image(2, width, height, 1, format, type, 3515 pixels, &ctx->Unpack); 3516 Node *n; 3517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3518 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9); 3519 if (n) { 3520 n[1].e = target; 3521 n[2].i = level; 3522 n[3].i = components; 3523 n[4].i = (GLint) width; 3524 n[5].i = (GLint) height; 3525 n[6].i = border; 3526 n[7].e = format; 3527 n[8].e = type; 3528 n[9].data = image; 3529 } 3530 else if (image) { 3531 _mesa_free(image); 3532 } 3533 if (ctx->ExecuteFlag) { 3534 CALL_TexImage2D(ctx->Exec, (target, level, components, width, 3535 height, border, format, type, pixels)); 3536 } 3537 } 3538} 3539 3540 3541static void GLAPIENTRY 3542save_TexImage3D(GLenum target, 3543 GLint level, GLint internalFormat, 3544 GLsizei width, GLsizei height, GLsizei depth, 3545 GLint border, 3546 GLenum format, GLenum type, const GLvoid * pixels) 3547{ 3548 GET_CURRENT_CONTEXT(ctx); 3549 if (target == GL_PROXY_TEXTURE_3D) { 3550 /* don't compile, execute immediately */ 3551 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width, 3552 height, depth, border, format, type, 3553 pixels)); 3554 } 3555 else { 3556 Node *n; 3557 GLvoid *image = unpack_image(3, width, height, depth, format, type, 3558 pixels, &ctx->Unpack); 3559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3560 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10); 3561 if (n) { 3562 n[1].e = target; 3563 n[2].i = level; 3564 n[3].i = (GLint) internalFormat; 3565 n[4].i = (GLint) width; 3566 n[5].i = (GLint) height; 3567 n[6].i = (GLint) depth; 3568 n[7].i = border; 3569 n[8].e = format; 3570 n[9].e = type; 3571 n[10].data = image; 3572 } 3573 else if (image) { 3574 _mesa_free(image); 3575 } 3576 if (ctx->ExecuteFlag) { 3577 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width, 3578 height, depth, border, format, type, 3579 pixels)); 3580 } 3581 } 3582} 3583 3584 3585static void GLAPIENTRY 3586save_TexSubImage1D(GLenum target, GLint level, GLint xoffset, 3587 GLsizei width, GLenum format, GLenum type, 3588 const GLvoid * pixels) 3589{ 3590 GET_CURRENT_CONTEXT(ctx); 3591 Node *n; 3592 GLvoid *image = unpack_image(1, width, 1, 1, format, type, 3593 pixels, &ctx->Unpack); 3594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3595 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7); 3596 if (n) { 3597 n[1].e = target; 3598 n[2].i = level; 3599 n[3].i = xoffset; 3600 n[4].i = (GLint) width; 3601 n[5].e = format; 3602 n[6].e = type; 3603 n[7].data = image; 3604 } 3605 else if (image) { 3606 _mesa_free(image); 3607 } 3608 if (ctx->ExecuteFlag) { 3609 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width, 3610 format, type, pixels)); 3611 } 3612} 3613 3614 3615static void GLAPIENTRY 3616save_TexSubImage2D(GLenum target, GLint level, 3617 GLint xoffset, GLint yoffset, 3618 GLsizei width, GLsizei height, 3619 GLenum format, GLenum type, const GLvoid * pixels) 3620{ 3621 GET_CURRENT_CONTEXT(ctx); 3622 Node *n; 3623 GLvoid *image = unpack_image(2, width, height, 1, format, type, 3624 pixels, &ctx->Unpack); 3625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3626 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9); 3627 if (n) { 3628 n[1].e = target; 3629 n[2].i = level; 3630 n[3].i = xoffset; 3631 n[4].i = yoffset; 3632 n[5].i = (GLint) width; 3633 n[6].i = (GLint) height; 3634 n[7].e = format; 3635 n[8].e = type; 3636 n[9].data = image; 3637 } 3638 else if (image) { 3639 _mesa_free(image); 3640 } 3641 if (ctx->ExecuteFlag) { 3642 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset, 3643 width, height, format, type, pixels)); 3644 } 3645} 3646 3647 3648static void GLAPIENTRY 3649save_TexSubImage3D(GLenum target, GLint level, 3650 GLint xoffset, GLint yoffset, GLint zoffset, 3651 GLsizei width, GLsizei height, GLsizei depth, 3652 GLenum format, GLenum type, const GLvoid * pixels) 3653{ 3654 GET_CURRENT_CONTEXT(ctx); 3655 Node *n; 3656 GLvoid *image = unpack_image(3, width, height, depth, format, type, 3657 pixels, &ctx->Unpack); 3658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3659 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11); 3660 if (n) { 3661 n[1].e = target; 3662 n[2].i = level; 3663 n[3].i = xoffset; 3664 n[4].i = yoffset; 3665 n[5].i = zoffset; 3666 n[6].i = (GLint) width; 3667 n[7].i = (GLint) height; 3668 n[8].i = (GLint) depth; 3669 n[9].e = format; 3670 n[10].e = type; 3671 n[11].data = image; 3672 } 3673 else if (image) { 3674 _mesa_free(image); 3675 } 3676 if (ctx->ExecuteFlag) { 3677 CALL_TexSubImage3D(ctx->Exec, (target, level, 3678 xoffset, yoffset, zoffset, 3679 width, height, depth, format, type, 3680 pixels)); 3681 } 3682} 3683 3684 3685static void GLAPIENTRY 3686save_Translatef(GLfloat x, GLfloat y, GLfloat z) 3687{ 3688 GET_CURRENT_CONTEXT(ctx); 3689 Node *n; 3690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3691 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRANSLATE, 3); 3692 if (n) { 3693 n[1].f = x; 3694 n[2].f = y; 3695 n[3].f = z; 3696 } 3697 if (ctx->ExecuteFlag) { 3698 CALL_Translatef(ctx->Exec, (x, y, z)); 3699 } 3700} 3701 3702 3703static void GLAPIENTRY 3704save_Translated(GLdouble x, GLdouble y, GLdouble z) 3705{ 3706 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); 3707} 3708 3709 3710 3711static void GLAPIENTRY 3712save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) 3713{ 3714 GET_CURRENT_CONTEXT(ctx); 3715 Node *n; 3716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3717 n = ALLOC_INSTRUCTION(ctx, OPCODE_VIEWPORT, 4); 3718 if (n) { 3719 n[1].i = x; 3720 n[2].i = y; 3721 n[3].i = (GLint) width; 3722 n[4].i = (GLint) height; 3723 } 3724 if (ctx->ExecuteFlag) { 3725 CALL_Viewport(ctx->Exec, (x, y, width, height)); 3726 } 3727} 3728 3729 3730static void GLAPIENTRY 3731save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 3732{ 3733 GET_CURRENT_CONTEXT(ctx); 3734 Node *n; 3735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3736 n = ALLOC_INSTRUCTION(ctx, OPCODE_WINDOW_POS, 4); 3737 if (n) { 3738 n[1].f = x; 3739 n[2].f = y; 3740 n[3].f = z; 3741 n[4].f = w; 3742 } 3743 if (ctx->ExecuteFlag) { 3744 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w)); 3745 } 3746} 3747 3748static void GLAPIENTRY 3749save_WindowPos2dMESA(GLdouble x, GLdouble y) 3750{ 3751 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 3752} 3753 3754static void GLAPIENTRY 3755save_WindowPos2fMESA(GLfloat x, GLfloat y) 3756{ 3757 save_WindowPos4fMESA(x, y, 0.0F, 1.0F); 3758} 3759 3760static void GLAPIENTRY 3761save_WindowPos2iMESA(GLint x, GLint y) 3762{ 3763 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 3764} 3765 3766static void GLAPIENTRY 3767save_WindowPos2sMESA(GLshort x, GLshort y) 3768{ 3769 save_WindowPos4fMESA(x, y, 0.0F, 1.0F); 3770} 3771 3772static void GLAPIENTRY 3773save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) 3774{ 3775 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 3776} 3777 3778static void GLAPIENTRY 3779save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) 3780{ 3781 save_WindowPos4fMESA(x, y, z, 1.0F); 3782} 3783 3784static void GLAPIENTRY 3785save_WindowPos3iMESA(GLint x, GLint y, GLint z) 3786{ 3787 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 3788} 3789 3790static void GLAPIENTRY 3791save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) 3792{ 3793 save_WindowPos4fMESA(x, y, z, 1.0F); 3794} 3795 3796static void GLAPIENTRY 3797save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) 3798{ 3799 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 3800} 3801 3802static void GLAPIENTRY 3803save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) 3804{ 3805 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 3806} 3807 3808static void GLAPIENTRY 3809save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) 3810{ 3811 save_WindowPos4fMESA(x, y, z, w); 3812} 3813 3814static void GLAPIENTRY 3815save_WindowPos2dvMESA(const GLdouble * v) 3816{ 3817 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 3818} 3819 3820static void GLAPIENTRY 3821save_WindowPos2fvMESA(const GLfloat * v) 3822{ 3823 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); 3824} 3825 3826static void GLAPIENTRY 3827save_WindowPos2ivMESA(const GLint * v) 3828{ 3829 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 3830} 3831 3832static void GLAPIENTRY 3833save_WindowPos2svMESA(const GLshort * v) 3834{ 3835 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); 3836} 3837 3838static void GLAPIENTRY 3839save_WindowPos3dvMESA(const GLdouble * v) 3840{ 3841 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 3842} 3843 3844static void GLAPIENTRY 3845save_WindowPos3fvMESA(const GLfloat * v) 3846{ 3847 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); 3848} 3849 3850static void GLAPIENTRY 3851save_WindowPos3ivMESA(const GLint * v) 3852{ 3853 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 3854} 3855 3856static void GLAPIENTRY 3857save_WindowPos3svMESA(const GLshort * v) 3858{ 3859 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); 3860} 3861 3862static void GLAPIENTRY 3863save_WindowPos4dvMESA(const GLdouble * v) 3864{ 3865 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 3866 (GLfloat) v[2], (GLfloat) v[3]); 3867} 3868 3869static void GLAPIENTRY 3870save_WindowPos4fvMESA(const GLfloat * v) 3871{ 3872 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); 3873} 3874 3875static void GLAPIENTRY 3876save_WindowPos4ivMESA(const GLint * v) 3877{ 3878 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 3879 (GLfloat) v[2], (GLfloat) v[3]); 3880} 3881 3882static void GLAPIENTRY 3883save_WindowPos4svMESA(const GLshort * v) 3884{ 3885 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); 3886} 3887 3888 3889 3890/* GL_ARB_multitexture */ 3891static void GLAPIENTRY 3892save_ActiveTextureARB(GLenum target) 3893{ 3894 GET_CURRENT_CONTEXT(ctx); 3895 Node *n; 3896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3897 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_TEXTURE, 1); 3898 if (n) { 3899 n[1].e = target; 3900 } 3901 if (ctx->ExecuteFlag) { 3902 CALL_ActiveTextureARB(ctx->Exec, (target)); 3903 } 3904} 3905 3906 3907/* GL_ARB_transpose_matrix */ 3908 3909static void GLAPIENTRY 3910save_LoadTransposeMatrixdARB(const GLdouble m[16]) 3911{ 3912 GLfloat tm[16]; 3913 _math_transposefd(tm, m); 3914 save_LoadMatrixf(tm); 3915} 3916 3917 3918static void GLAPIENTRY 3919save_LoadTransposeMatrixfARB(const GLfloat m[16]) 3920{ 3921 GLfloat tm[16]; 3922 _math_transposef(tm, m); 3923 save_LoadMatrixf(tm); 3924} 3925 3926 3927static void GLAPIENTRY 3928save_MultTransposeMatrixdARB(const GLdouble m[16]) 3929{ 3930 GLfloat tm[16]; 3931 _math_transposefd(tm, m); 3932 save_MultMatrixf(tm); 3933} 3934 3935 3936static void GLAPIENTRY 3937save_MultTransposeMatrixfARB(const GLfloat m[16]) 3938{ 3939 GLfloat tm[16]; 3940 _math_transposef(tm, m); 3941 save_MultMatrixf(tm); 3942} 3943 3944 3945/* GL_ARB_texture_compression */ 3946static void GLAPIENTRY 3947save_CompressedTexImage1DARB(GLenum target, GLint level, 3948 GLenum internalFormat, GLsizei width, 3949 GLint border, GLsizei imageSize, 3950 const GLvoid * data) 3951{ 3952 GET_CURRENT_CONTEXT(ctx); 3953 if (target == GL_PROXY_TEXTURE_1D) { 3954 /* don't compile, execute immediately */ 3955 CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat, 3956 width, border, imageSize, 3957 data)); 3958 } 3959 else { 3960 Node *n; 3961 GLvoid *image; 3962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 3963 /* make copy of image */ 3964 image = _mesa_malloc(imageSize); 3965 if (!image) { 3966 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); 3967 return; 3968 } 3969 MEMCPY(image, data, imageSize); 3970 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7); 3971 if (n) { 3972 n[1].e = target; 3973 n[2].i = level; 3974 n[3].e = internalFormat; 3975 n[4].i = (GLint) width; 3976 n[5].i = border; 3977 n[6].i = imageSize; 3978 n[7].data = image; 3979 } 3980 else if (image) { 3981 _mesa_free(image); 3982 } 3983 if (ctx->ExecuteFlag) { 3984 CALL_CompressedTexImage1DARB(ctx->Exec, 3985 (target, level, internalFormat, width, 3986 border, imageSize, data)); 3987 } 3988 } 3989} 3990 3991 3992static void GLAPIENTRY 3993save_CompressedTexImage2DARB(GLenum target, GLint level, 3994 GLenum internalFormat, GLsizei width, 3995 GLsizei height, GLint border, GLsizei imageSize, 3996 const GLvoid * data) 3997{ 3998 GET_CURRENT_CONTEXT(ctx); 3999 if (target == GL_PROXY_TEXTURE_2D) { 4000 /* don't compile, execute immediately */ 4001 CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat, 4002 width, height, border, 4003 imageSize, data)); 4004 } 4005 else { 4006 Node *n; 4007 GLvoid *image; 4008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4009 /* make copy of image */ 4010 image = _mesa_malloc(imageSize); 4011 if (!image) { 4012 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); 4013 return; 4014 } 4015 MEMCPY(image, data, imageSize); 4016 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8); 4017 if (n) { 4018 n[1].e = target; 4019 n[2].i = level; 4020 n[3].e = internalFormat; 4021 n[4].i = (GLint) width; 4022 n[5].i = (GLint) height; 4023 n[6].i = border; 4024 n[7].i = imageSize; 4025 n[8].data = image; 4026 } 4027 else if (image) { 4028 _mesa_free(image); 4029 } 4030 if (ctx->ExecuteFlag) { 4031 CALL_CompressedTexImage2DARB(ctx->Exec, 4032 (target, level, internalFormat, width, 4033 height, border, imageSize, data)); 4034 } 4035 } 4036} 4037 4038 4039static void GLAPIENTRY 4040save_CompressedTexImage3DARB(GLenum target, GLint level, 4041 GLenum internalFormat, GLsizei width, 4042 GLsizei height, GLsizei depth, GLint border, 4043 GLsizei imageSize, const GLvoid * data) 4044{ 4045 GET_CURRENT_CONTEXT(ctx); 4046 if (target == GL_PROXY_TEXTURE_3D) { 4047 /* don't compile, execute immediately */ 4048 CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat, 4049 width, height, depth, border, 4050 imageSize, data)); 4051 } 4052 else { 4053 Node *n; 4054 GLvoid *image; 4055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4056 /* make copy of image */ 4057 image = _mesa_malloc(imageSize); 4058 if (!image) { 4059 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); 4060 return; 4061 } 4062 MEMCPY(image, data, imageSize); 4063 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9); 4064 if (n) { 4065 n[1].e = target; 4066 n[2].i = level; 4067 n[3].e = internalFormat; 4068 n[4].i = (GLint) width; 4069 n[5].i = (GLint) height; 4070 n[6].i = (GLint) depth; 4071 n[7].i = border; 4072 n[8].i = imageSize; 4073 n[9].data = image; 4074 } 4075 else if (image) { 4076 _mesa_free(image); 4077 } 4078 if (ctx->ExecuteFlag) { 4079 CALL_CompressedTexImage3DARB(ctx->Exec, 4080 (target, level, internalFormat, width, 4081 height, depth, border, imageSize, 4082 data)); 4083 } 4084 } 4085} 4086 4087 4088static void GLAPIENTRY 4089save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, 4090 GLsizei width, GLenum format, 4091 GLsizei imageSize, const GLvoid * data) 4092{ 4093 Node *n; 4094 GLvoid *image; 4095 4096 GET_CURRENT_CONTEXT(ctx); 4097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4098 4099 /* make copy of image */ 4100 image = _mesa_malloc(imageSize); 4101 if (!image) { 4102 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); 4103 return; 4104 } 4105 MEMCPY(image, data, imageSize); 4106 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7); 4107 if (n) { 4108 n[1].e = target; 4109 n[2].i = level; 4110 n[3].i = xoffset; 4111 n[4].i = (GLint) width; 4112 n[5].e = format; 4113 n[6].i = imageSize; 4114 n[7].data = image; 4115 } 4116 else if (image) { 4117 _mesa_free(image); 4118 } 4119 if (ctx->ExecuteFlag) { 4120 CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset, 4121 width, format, imageSize, 4122 data)); 4123 } 4124} 4125 4126 4127static void GLAPIENTRY 4128save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, 4129 GLint yoffset, GLsizei width, GLsizei height, 4130 GLenum format, GLsizei imageSize, 4131 const GLvoid * data) 4132{ 4133 Node *n; 4134 GLvoid *image; 4135 4136 GET_CURRENT_CONTEXT(ctx); 4137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4138 4139 /* make copy of image */ 4140 image = _mesa_malloc(imageSize); 4141 if (!image) { 4142 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); 4143 return; 4144 } 4145 MEMCPY(image, data, imageSize); 4146 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9); 4147 if (n) { 4148 n[1].e = target; 4149 n[2].i = level; 4150 n[3].i = xoffset; 4151 n[4].i = yoffset; 4152 n[5].i = (GLint) width; 4153 n[6].i = (GLint) height; 4154 n[7].e = format; 4155 n[8].i = imageSize; 4156 n[9].data = image; 4157 } 4158 else if (image) { 4159 _mesa_free(image); 4160 } 4161 if (ctx->ExecuteFlag) { 4162 CALL_CompressedTexSubImage2DARB(ctx->Exec, 4163 (target, level, xoffset, yoffset, width, 4164 height, format, imageSize, data)); 4165 } 4166} 4167 4168 4169static void GLAPIENTRY 4170save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, 4171 GLint yoffset, GLint zoffset, GLsizei width, 4172 GLsizei height, GLsizei depth, GLenum format, 4173 GLsizei imageSize, const GLvoid * data) 4174{ 4175 Node *n; 4176 GLvoid *image; 4177 4178 GET_CURRENT_CONTEXT(ctx); 4179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4180 4181 /* make copy of image */ 4182 image = _mesa_malloc(imageSize); 4183 if (!image) { 4184 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); 4185 return; 4186 } 4187 MEMCPY(image, data, imageSize); 4188 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11); 4189 if (n) { 4190 n[1].e = target; 4191 n[2].i = level; 4192 n[3].i = xoffset; 4193 n[4].i = yoffset; 4194 n[5].i = zoffset; 4195 n[6].i = (GLint) width; 4196 n[7].i = (GLint) height; 4197 n[8].i = (GLint) depth; 4198 n[9].e = format; 4199 n[10].i = imageSize; 4200 n[11].data = image; 4201 } 4202 else if (image) { 4203 _mesa_free(image); 4204 } 4205 if (ctx->ExecuteFlag) { 4206 CALL_CompressedTexSubImage3DARB(ctx->Exec, 4207 (target, level, xoffset, yoffset, 4208 zoffset, width, height, depth, format, 4209 imageSize, data)); 4210 } 4211} 4212 4213 4214/* GL_ARB_multisample */ 4215static void GLAPIENTRY 4216save_SampleCoverageARB(GLclampf value, GLboolean invert) 4217{ 4218 GET_CURRENT_CONTEXT(ctx); 4219 Node *n; 4220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4221 n = ALLOC_INSTRUCTION(ctx, OPCODE_SAMPLE_COVERAGE, 2); 4222 if (n) { 4223 n[1].f = value; 4224 n[2].b = invert; 4225 } 4226 if (ctx->ExecuteFlag) { 4227 CALL_SampleCoverageARB(ctx->Exec, (value, invert)); 4228 } 4229} 4230 4231 4232/* 4233 * GL_NV_vertex_program 4234 */ 4235#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 4236static void GLAPIENTRY 4237save_BindProgramNV(GLenum target, GLuint id) 4238{ 4239 GET_CURRENT_CONTEXT(ctx); 4240 Node *n; 4241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4242 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_PROGRAM_NV, 2); 4243 if (n) { 4244 n[1].e = target; 4245 n[2].ui = id; 4246 } 4247 if (ctx->ExecuteFlag) { 4248 CALL_BindProgramNV(ctx->Exec, (target, id)); 4249 } 4250} 4251#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ 4252 4253#if FEATURE_NV_vertex_program 4254static void GLAPIENTRY 4255save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) 4256{ 4257 GET_CURRENT_CONTEXT(ctx); 4258 Node *n; 4259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4260 n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); 4261 if (n) { 4262 n[1].e = target; 4263 n[2].ui = id; 4264 n[3].f = params[0]; 4265 n[4].f = params[1]; 4266 n[5].f = params[2]; 4267 n[6].f = params[3]; 4268 } 4269 if (ctx->ExecuteFlag) { 4270 CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); 4271 } 4272} 4273 4274 4275static void GLAPIENTRY 4276save_ProgramParameter4fNV(GLenum target, GLuint index, 4277 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 4278{ 4279 GET_CURRENT_CONTEXT(ctx); 4280 Node *n; 4281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4282 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6); 4283 if (n) { 4284 n[1].e = target; 4285 n[2].ui = index; 4286 n[3].f = x; 4287 n[4].f = y; 4288 n[5].f = z; 4289 n[6].f = w; 4290 } 4291 if (ctx->ExecuteFlag) { 4292 CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w)); 4293 } 4294} 4295 4296 4297static void GLAPIENTRY 4298save_ProgramParameter4fvNV(GLenum target, GLuint index, 4299 const GLfloat *params) 4300{ 4301 save_ProgramParameter4fNV(target, index, params[0], params[1], 4302 params[2], params[3]); 4303} 4304 4305 4306static void GLAPIENTRY 4307save_ProgramParameter4dNV(GLenum target, GLuint index, 4308 GLdouble x, GLdouble y, GLdouble z, GLdouble w) 4309{ 4310 save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, 4311 (GLfloat) z, (GLfloat) w); 4312} 4313 4314 4315static void GLAPIENTRY 4316save_ProgramParameter4dvNV(GLenum target, GLuint index, 4317 const GLdouble *params) 4318{ 4319 save_ProgramParameter4fNV(target, index, (GLfloat) params[0], 4320 (GLfloat) params[1], (GLfloat) params[2], 4321 (GLfloat) params[3]); 4322} 4323 4324 4325static void GLAPIENTRY 4326save_ProgramParameters4dvNV(GLenum target, GLuint index, 4327 GLuint num, const GLdouble *params) 4328{ 4329 GLuint i; 4330 for (i = 0; i < num; i++) { 4331 save_ProgramParameter4dvNV(target, index + i, params + 4 * i); 4332 } 4333} 4334 4335 4336static void GLAPIENTRY 4337save_ProgramParameters4fvNV(GLenum target, GLuint index, 4338 GLuint num, const GLfloat *params) 4339{ 4340 GLuint i; 4341 for (i = 0; i < num; i++) { 4342 save_ProgramParameter4fvNV(target, index + i, params + 4 * i); 4343 } 4344} 4345 4346 4347static void GLAPIENTRY 4348save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, 4349 const GLubyte * program) 4350{ 4351 GET_CURRENT_CONTEXT(ctx); 4352 Node *n; 4353 GLubyte *programCopy; 4354 4355 programCopy = (GLubyte *) _mesa_malloc(len); 4356 if (!programCopy) { 4357 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); 4358 return; 4359 } 4360 _mesa_memcpy(programCopy, program, len); 4361 4362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4363 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4); 4364 if (n) { 4365 n[1].e = target; 4366 n[2].ui = id; 4367 n[3].i = len; 4368 n[4].data = programCopy; 4369 } 4370 if (ctx->ExecuteFlag) { 4371 CALL_LoadProgramNV(ctx->Exec, (target, id, len, program)); 4372 } 4373} 4374 4375 4376static void GLAPIENTRY 4377save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids) 4378{ 4379 GET_CURRENT_CONTEXT(ctx); 4380 Node *n; 4381 GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); 4382 if (!idCopy) { 4383 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); 4384 return; 4385 } 4386 _mesa_memcpy(idCopy, ids, num * sizeof(GLuint)); 4387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4388 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2); 4389 if (n) { 4390 n[1].i = num; 4391 n[2].data = idCopy; 4392 } 4393 if (ctx->ExecuteFlag) { 4394 CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids)); 4395 } 4396} 4397 4398 4399static void GLAPIENTRY 4400save_TrackMatrixNV(GLenum target, GLuint address, 4401 GLenum matrix, GLenum transform) 4402{ 4403 GET_CURRENT_CONTEXT(ctx); 4404 Node *n; 4405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4406 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 4); 4407 if (n) { 4408 n[1].e = target; 4409 n[2].ui = address; 4410 n[3].e = matrix; 4411 n[4].e = transform; 4412 } 4413 if (ctx->ExecuteFlag) { 4414 CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform)); 4415 } 4416} 4417#endif /* FEATURE_NV_vertex_program */ 4418 4419 4420/* 4421 * GL_NV_fragment_program 4422 */ 4423#if FEATURE_NV_fragment_program 4424static void GLAPIENTRY 4425save_ProgramLocalParameter4fARB(GLenum target, GLuint index, 4426 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 4427{ 4428 GET_CURRENT_CONTEXT(ctx); 4429 Node *n; 4430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4431 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 4432 if (n) { 4433 n[1].e = target; 4434 n[2].ui = index; 4435 n[3].f = x; 4436 n[4].f = y; 4437 n[5].f = z; 4438 n[6].f = w; 4439 } 4440 if (ctx->ExecuteFlag) { 4441 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); 4442 } 4443} 4444 4445 4446static void GLAPIENTRY 4447save_ProgramLocalParameter4fvARB(GLenum target, GLuint index, 4448 const GLfloat *params) 4449{ 4450 GET_CURRENT_CONTEXT(ctx); 4451 Node *n; 4452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4453 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 4454 if (n) { 4455 n[1].e = target; 4456 n[2].ui = index; 4457 n[3].f = params[0]; 4458 n[4].f = params[1]; 4459 n[5].f = params[2]; 4460 n[6].f = params[3]; 4461 } 4462 if (ctx->ExecuteFlag) { 4463 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params)); 4464 } 4465} 4466 4467 4468static void GLAPIENTRY 4469save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, 4470 const GLfloat *params) 4471{ 4472 GET_CURRENT_CONTEXT(ctx); 4473 Node *n; 4474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4475 4476 if (count > 0) { 4477 unsigned i; 4478 const GLfloat * p = params; 4479 4480 for (i = 0 ; i < count ; i++) { 4481 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 4482 if (n) { 4483 n[1].e = target; 4484 n[2].ui = index; 4485 n[3].f = p[0]; 4486 n[4].f = p[1]; 4487 n[5].f = p[2]; 4488 n[6].f = p[3]; 4489 p += 4; 4490 } 4491 } 4492 } 4493 4494 if (ctx->ExecuteFlag) { 4495 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params)); 4496 } 4497} 4498 4499 4500static void GLAPIENTRY 4501save_ProgramLocalParameter4dARB(GLenum target, GLuint index, 4502 GLdouble x, GLdouble y, 4503 GLdouble z, GLdouble w) 4504{ 4505 GET_CURRENT_CONTEXT(ctx); 4506 Node *n; 4507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4508 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 4509 if (n) { 4510 n[1].e = target; 4511 n[2].ui = index; 4512 n[3].f = (GLfloat) x; 4513 n[4].f = (GLfloat) y; 4514 n[5].f = (GLfloat) z; 4515 n[6].f = (GLfloat) w; 4516 } 4517 if (ctx->ExecuteFlag) { 4518 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w)); 4519 } 4520} 4521 4522 4523static void GLAPIENTRY 4524save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, 4525 const GLdouble *params) 4526{ 4527 GET_CURRENT_CONTEXT(ctx); 4528 Node *n; 4529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4530 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 4531 if (n) { 4532 n[1].e = target; 4533 n[2].ui = index; 4534 n[3].f = (GLfloat) params[0]; 4535 n[4].f = (GLfloat) params[1]; 4536 n[5].f = (GLfloat) params[2]; 4537 n[6].f = (GLfloat) params[3]; 4538 } 4539 if (ctx->ExecuteFlag) { 4540 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params)); 4541 } 4542} 4543 4544static void GLAPIENTRY 4545save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, 4546 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 4547{ 4548 GET_CURRENT_CONTEXT(ctx); 4549 Node *n; 4550 GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); 4551 if (!nameCopy) { 4552 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); 4553 return; 4554 } 4555 _mesa_memcpy(nameCopy, name, len); 4556 4557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4558 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); 4559 if (n) { 4560 n[1].ui = id; 4561 n[2].i = len; 4562 n[3].data = nameCopy; 4563 n[4].f = x; 4564 n[5].f = y; 4565 n[6].f = z; 4566 n[7].f = w; 4567 } 4568 if (ctx->ExecuteFlag) { 4569 CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w)); 4570 } 4571} 4572 4573 4574static void GLAPIENTRY 4575save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name, 4576 const float v[]) 4577{ 4578 save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]); 4579} 4580 4581 4582static void GLAPIENTRY 4583save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name, 4584 GLdouble x, GLdouble y, GLdouble z, GLdouble w) 4585{ 4586 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y, 4587 (GLfloat) z, (GLfloat) w); 4588} 4589 4590 4591static void GLAPIENTRY 4592save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, 4593 const double v[]) 4594{ 4595 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0], 4596 (GLfloat) v[1], (GLfloat) v[2], 4597 (GLfloat) v[3]); 4598} 4599 4600#endif /* FEATURE_NV_fragment_program */ 4601 4602 4603 4604/* GL_EXT_stencil_two_side */ 4605static void GLAPIENTRY 4606save_ActiveStencilFaceEXT(GLenum face) 4607{ 4608 GET_CURRENT_CONTEXT(ctx); 4609 Node *n; 4610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4611 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1); 4612 if (n) { 4613 n[1].e = face; 4614 } 4615 if (ctx->ExecuteFlag) { 4616 CALL_ActiveStencilFaceEXT(ctx->Exec, (face)); 4617 } 4618} 4619 4620 4621/* GL_EXT_depth_bounds_test */ 4622static void GLAPIENTRY 4623save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax) 4624{ 4625 GET_CURRENT_CONTEXT(ctx); 4626 Node *n; 4627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4628 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2); 4629 if (n) { 4630 n[1].f = (GLfloat) zmin; 4631 n[2].f = (GLfloat) zmax; 4632 } 4633 if (ctx->ExecuteFlag) { 4634 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax)); 4635 } 4636} 4637 4638 4639 4640#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 4641 4642static void GLAPIENTRY 4643save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, 4644 const GLvoid * string) 4645{ 4646 GET_CURRENT_CONTEXT(ctx); 4647 Node *n; 4648 GLubyte *programCopy; 4649 4650 programCopy = (GLubyte *) _mesa_malloc(len); 4651 if (!programCopy) { 4652 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); 4653 return; 4654 } 4655 _mesa_memcpy(programCopy, string, len); 4656 4657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4658 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4); 4659 if (n) { 4660 n[1].e = target; 4661 n[2].e = format; 4662 n[3].i = len; 4663 n[4].data = programCopy; 4664 } 4665 if (ctx->ExecuteFlag) { 4666 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string)); 4667 } 4668} 4669 4670 4671static void GLAPIENTRY 4672save_ProgramEnvParameter4fARB(GLenum target, GLuint index, 4673 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 4674{ 4675 GET_CURRENT_CONTEXT(ctx); 4676 Node *n; 4677 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4678 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); 4679 if (n) { 4680 n[1].e = target; 4681 n[2].ui = index; 4682 n[3].f = x; 4683 n[4].f = y; 4684 n[5].f = z; 4685 n[6].f = w; 4686 } 4687 if (ctx->ExecuteFlag) { 4688 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); 4689 } 4690} 4691 4692 4693static void GLAPIENTRY 4694save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, 4695 const GLfloat *params) 4696{ 4697 save_ProgramEnvParameter4fARB(target, index, params[0], params[1], 4698 params[2], params[3]); 4699} 4700 4701 4702static void GLAPIENTRY 4703save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, 4704 const GLfloat * params) 4705{ 4706 GET_CURRENT_CONTEXT(ctx); 4707 Node *n; 4708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4709 4710 if (count > 0) { 4711 unsigned i; 4712 const GLfloat * p = params; 4713 4714 for (i = 0 ; i < count ; i++) { 4715 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); 4716 if (n) { 4717 n[1].e = target; 4718 n[2].ui = index; 4719 n[3].f = p[0]; 4720 n[4].f = p[1]; 4721 n[5].f = p[2]; 4722 n[6].f = p[3]; 4723 p += 4; 4724 } 4725 } 4726 } 4727 4728 if (ctx->ExecuteFlag) { 4729 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params)); 4730 } 4731} 4732 4733 4734static void GLAPIENTRY 4735save_ProgramEnvParameter4dARB(GLenum target, GLuint index, 4736 GLdouble x, GLdouble y, GLdouble z, GLdouble w) 4737{ 4738 save_ProgramEnvParameter4fARB(target, index, 4739 (GLfloat) x, 4740 (GLfloat) y, (GLfloat) z, (GLfloat) w); 4741} 4742 4743 4744static void GLAPIENTRY 4745save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, 4746 const GLdouble *params) 4747{ 4748 save_ProgramEnvParameter4fARB(target, index, 4749 (GLfloat) params[0], 4750 (GLfloat) params[1], 4751 (GLfloat) params[2], (GLfloat) params[3]); 4752} 4753 4754#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ 4755 4756 4757#if FEATURE_ARB_occlusion_query 4758 4759static void GLAPIENTRY 4760save_BeginQueryARB(GLenum target, GLuint id) 4761{ 4762 GET_CURRENT_CONTEXT(ctx); 4763 Node *n; 4764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4765 n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN_QUERY_ARB, 2); 4766 if (n) { 4767 n[1].e = target; 4768 n[2].ui = id; 4769 } 4770 if (ctx->ExecuteFlag) { 4771 CALL_BeginQueryARB(ctx->Exec, (target, id)); 4772 } 4773} 4774 4775 4776static void GLAPIENTRY 4777save_EndQueryARB(GLenum target) 4778{ 4779 GET_CURRENT_CONTEXT(ctx); 4780 Node *n; 4781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4782 n = ALLOC_INSTRUCTION(ctx, OPCODE_END_QUERY_ARB, 1); 4783 if (n) { 4784 n[1].e = target; 4785 } 4786 if (ctx->ExecuteFlag) { 4787 CALL_EndQueryARB(ctx->Exec, (target)); 4788 } 4789} 4790 4791#endif /* FEATURE_ARB_occlusion_query */ 4792 4793 4794static void GLAPIENTRY 4795save_DrawBuffersARB(GLsizei count, const GLenum * buffers) 4796{ 4797 GET_CURRENT_CONTEXT(ctx); 4798 Node *n; 4799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 4800 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS); 4801 if (n) { 4802 GLint i; 4803 n[1].i = count; 4804 if (count > MAX_DRAW_BUFFERS) 4805 count = MAX_DRAW_BUFFERS; 4806 for (i = 0; i < count; i++) { 4807 n[2 + i].e = buffers[i]; 4808 } 4809 } 4810 if (ctx->ExecuteFlag) { 4811 CALL_DrawBuffersARB(ctx->Exec, (count, buffers)); 4812 } 4813} 4814 4815#if FEATURE_ATI_fragment_shader 4816static void GLAPIENTRY 4817save_BindFragmentShaderATI(GLuint id) 4818{ 4819 GET_CURRENT_CONTEXT(ctx); 4820 Node *n; 4821 4822 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1); 4823 if (n) { 4824 n[1].ui = id; 4825 } 4826 if (ctx->ExecuteFlag) { 4827 CALL_BindFragmentShaderATI(ctx->Exec, (id)); 4828 } 4829} 4830 4831static void GLAPIENTRY 4832save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value) 4833{ 4834 GET_CURRENT_CONTEXT(ctx); 4835 Node *n; 4836 4837 n = ALLOC_INSTRUCTION(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5); 4838 if (n) { 4839 n[1].ui = dst; 4840 n[2].f = value[0]; 4841 n[3].f = value[1]; 4842 n[4].f = value[2]; 4843 n[5].f = value[3]; 4844 } 4845 if (ctx->ExecuteFlag) { 4846 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value)); 4847 } 4848} 4849#endif 4850 4851static void 4852save_Attr1fNV(GLenum attr, GLfloat x) 4853{ 4854 GET_CURRENT_CONTEXT(ctx); 4855 Node *n; 4856 SAVE_FLUSH_VERTICES(ctx); 4857 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_NV, 2); 4858 if (n) { 4859 n[1].e = attr; 4860 n[2].f = x; 4861 } 4862 4863 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 4864 ctx->ListState.ActiveAttribSize[attr] = 1; 4865 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); 4866 4867 if (ctx->ExecuteFlag) { 4868 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x)); 4869 } 4870} 4871 4872static void 4873save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y) 4874{ 4875 GET_CURRENT_CONTEXT(ctx); 4876 Node *n; 4877 SAVE_FLUSH_VERTICES(ctx); 4878 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_NV, 3); 4879 if (n) { 4880 n[1].e = attr; 4881 n[2].f = x; 4882 n[3].f = y; 4883 } 4884 4885 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 4886 ctx->ListState.ActiveAttribSize[attr] = 2; 4887 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); 4888 4889 if (ctx->ExecuteFlag) { 4890 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y)); 4891 } 4892} 4893 4894static void 4895save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z) 4896{ 4897 GET_CURRENT_CONTEXT(ctx); 4898 Node *n; 4899 SAVE_FLUSH_VERTICES(ctx); 4900 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_NV, 4); 4901 if (n) { 4902 n[1].e = attr; 4903 n[2].f = x; 4904 n[3].f = y; 4905 n[4].f = z; 4906 } 4907 4908 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 4909 ctx->ListState.ActiveAttribSize[attr] = 3; 4910 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); 4911 4912 if (ctx->ExecuteFlag) { 4913 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z)); 4914 } 4915} 4916 4917static void 4918save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 4919{ 4920 GET_CURRENT_CONTEXT(ctx); 4921 Node *n; 4922 SAVE_FLUSH_VERTICES(ctx); 4923 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_NV, 5); 4924 if (n) { 4925 n[1].e = attr; 4926 n[2].f = x; 4927 n[3].f = y; 4928 n[4].f = z; 4929 n[5].f = w; 4930 } 4931 4932 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 4933 ctx->ListState.ActiveAttribSize[attr] = 4; 4934 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); 4935 4936 if (ctx->ExecuteFlag) { 4937 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w)); 4938 } 4939} 4940 4941 4942static void 4943save_Attr1fARB(GLenum attr, GLfloat x) 4944{ 4945 GET_CURRENT_CONTEXT(ctx); 4946 Node *n; 4947 SAVE_FLUSH_VERTICES(ctx); 4948 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_ARB, 2); 4949 if (n) { 4950 n[1].e = attr; 4951 n[2].f = x; 4952 } 4953 4954 ASSERT(attr < MAX_VERTEX_ATTRIBS); 4955 ctx->ListState.ActiveAttribSize[attr] = 1; 4956 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); 4957 4958 if (ctx->ExecuteFlag) { 4959 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x)); 4960 } 4961} 4962 4963static void 4964save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y) 4965{ 4966 GET_CURRENT_CONTEXT(ctx); 4967 Node *n; 4968 SAVE_FLUSH_VERTICES(ctx); 4969 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_ARB, 3); 4970 if (n) { 4971 n[1].e = attr; 4972 n[2].f = x; 4973 n[3].f = y; 4974 } 4975 4976 ASSERT(attr < MAX_VERTEX_ATTRIBS); 4977 ctx->ListState.ActiveAttribSize[attr] = 2; 4978 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); 4979 4980 if (ctx->ExecuteFlag) { 4981 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y)); 4982 } 4983} 4984 4985static void 4986save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z) 4987{ 4988 GET_CURRENT_CONTEXT(ctx); 4989 Node *n; 4990 SAVE_FLUSH_VERTICES(ctx); 4991 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_ARB, 4); 4992 if (n) { 4993 n[1].e = attr; 4994 n[2].f = x; 4995 n[3].f = y; 4996 n[4].f = z; 4997 } 4998 4999 ASSERT(attr < MAX_VERTEX_ATTRIBS); 5000 ctx->ListState.ActiveAttribSize[attr] = 3; 5001 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); 5002 5003 if (ctx->ExecuteFlag) { 5004 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z)); 5005 } 5006} 5007 5008static void 5009save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 5010{ 5011 GET_CURRENT_CONTEXT(ctx); 5012 Node *n; 5013 SAVE_FLUSH_VERTICES(ctx); 5014 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_ARB, 5); 5015 if (n) { 5016 n[1].e = attr; 5017 n[2].f = x; 5018 n[3].f = y; 5019 n[4].f = z; 5020 n[5].f = w; 5021 } 5022 5023 ASSERT(attr < MAX_VERTEX_ATTRIBS); 5024 ctx->ListState.ActiveAttribSize[attr] = 4; 5025 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); 5026 5027 if (ctx->ExecuteFlag) { 5028 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w)); 5029 } 5030} 5031 5032 5033static void GLAPIENTRY 5034save_EvalCoord1f(GLfloat x) 5035{ 5036 GET_CURRENT_CONTEXT(ctx); 5037 Node *n; 5038 SAVE_FLUSH_VERTICES(ctx); 5039 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C1, 1); 5040 if (n) { 5041 n[1].f = x; 5042 } 5043 if (ctx->ExecuteFlag) { 5044 CALL_EvalCoord1f(ctx->Exec, (x)); 5045 } 5046} 5047 5048static void GLAPIENTRY 5049save_EvalCoord1fv(const GLfloat * v) 5050{ 5051 save_EvalCoord1f(v[0]); 5052} 5053 5054static void GLAPIENTRY 5055save_EvalCoord2f(GLfloat x, GLfloat y) 5056{ 5057 GET_CURRENT_CONTEXT(ctx); 5058 Node *n; 5059 SAVE_FLUSH_VERTICES(ctx); 5060 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C2, 2); 5061 if (n) { 5062 n[1].f = x; 5063 n[2].f = y; 5064 } 5065 if (ctx->ExecuteFlag) { 5066 CALL_EvalCoord2f(ctx->Exec, (x, y)); 5067 } 5068} 5069 5070static void GLAPIENTRY 5071save_EvalCoord2fv(const GLfloat * v) 5072{ 5073 save_EvalCoord2f(v[0], v[1]); 5074} 5075 5076 5077static void GLAPIENTRY 5078save_EvalPoint1(GLint x) 5079{ 5080 GET_CURRENT_CONTEXT(ctx); 5081 Node *n; 5082 SAVE_FLUSH_VERTICES(ctx); 5083 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P1, 1); 5084 if (n) { 5085 n[1].i = x; 5086 } 5087 if (ctx->ExecuteFlag) { 5088 CALL_EvalPoint1(ctx->Exec, (x)); 5089 } 5090} 5091 5092static void GLAPIENTRY 5093save_EvalPoint2(GLint x, GLint y) 5094{ 5095 GET_CURRENT_CONTEXT(ctx); 5096 Node *n; 5097 SAVE_FLUSH_VERTICES(ctx); 5098 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P2, 2); 5099 if (n) { 5100 n[1].i = x; 5101 n[2].i = y; 5102 } 5103 if (ctx->ExecuteFlag) { 5104 CALL_EvalPoint2(ctx->Exec, (x, y)); 5105 } 5106} 5107 5108static void GLAPIENTRY 5109save_Indexf(GLfloat x) 5110{ 5111 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x); 5112} 5113 5114static void GLAPIENTRY 5115save_Indexfv(const GLfloat * v) 5116{ 5117 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]); 5118} 5119 5120static void GLAPIENTRY 5121save_EdgeFlag(GLboolean x) 5122{ 5123 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0); 5124} 5125 5126static void GLAPIENTRY 5127save_Materialfv(GLenum face, GLenum pname, const GLfloat * param) 5128{ 5129 GET_CURRENT_CONTEXT(ctx); 5130 Node *n; 5131 int args, i; 5132 5133 SAVE_FLUSH_VERTICES(ctx); 5134 5135 switch (face) { 5136 case GL_BACK: 5137 case GL_FRONT: 5138 case GL_FRONT_AND_BACK: 5139 break; 5140 default: 5141 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(face)"); 5142 return; 5143 } 5144 5145 switch (pname) { 5146 case GL_EMISSION: 5147 case GL_AMBIENT: 5148 case GL_DIFFUSE: 5149 case GL_SPECULAR: 5150 case GL_AMBIENT_AND_DIFFUSE: 5151 args = 4; 5152 break; 5153 case GL_SHININESS: 5154 args = 1; 5155 break; 5156 case GL_COLOR_INDEXES: 5157 args = 3; 5158 break; 5159 default: 5160 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)"); 5161 return; 5162 } 5163 5164 n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6); 5165 if (n) { 5166 n[1].e = face; 5167 n[2].e = pname; 5168 for (i = 0; i < args; i++) 5169 n[3 + i].f = param[i]; 5170 } 5171 5172 { 5173 GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL); 5174 for (i = 0; i < MAT_ATTRIB_MAX; i++) 5175 if (bitmask & (1 << i)) { 5176 ctx->ListState.ActiveMaterialSize[i] = args; 5177 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param); 5178 } 5179 } 5180 5181 if (ctx->ExecuteFlag) { 5182 CALL_Materialfv(ctx->Exec, (face, pname, param)); 5183 } 5184} 5185 5186static void GLAPIENTRY 5187save_Begin(GLenum mode) 5188{ 5189 GET_CURRENT_CONTEXT(ctx); 5190 Node *n; 5191 GLboolean error = GL_FALSE; 5192 5193 if ( /*mode < GL_POINTS || */ mode > GL_POLYGON) { 5194 _mesa_compile_error(ctx, GL_INVALID_ENUM, "Begin (mode)"); 5195 error = GL_TRUE; 5196 } 5197 else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) { 5198 /* Typically the first begin. This may raise an error on 5199 * playback, depending on whether CallList is issued from inside 5200 * a begin/end or not. 5201 */ 5202 ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; 5203 } 5204 else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) { 5205 ctx->Driver.CurrentSavePrimitive = mode; 5206 } 5207 else { 5208 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin"); 5209 error = GL_TRUE; 5210 } 5211 5212 if (!error) { 5213 /* Give the driver an opportunity to hook in an optimized 5214 * display list compiler. 5215 */ 5216 if (ctx->Driver.NotifySaveBegin(ctx, mode)) 5217 return; 5218 5219 SAVE_FLUSH_VERTICES(ctx); 5220 n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN, 1); 5221 if (n) { 5222 n[1].e = mode; 5223 } 5224 } 5225 5226 if (ctx->ExecuteFlag) { 5227 CALL_Begin(ctx->Exec, (mode)); 5228 } 5229} 5230 5231static void GLAPIENTRY 5232save_End(void) 5233{ 5234 GET_CURRENT_CONTEXT(ctx); 5235 SAVE_FLUSH_VERTICES(ctx); 5236 (void) ALLOC_INSTRUCTION(ctx, OPCODE_END, 0); 5237 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; 5238 if (ctx->ExecuteFlag) { 5239 CALL_End(ctx->Exec, ()); 5240 } 5241} 5242 5243static void GLAPIENTRY 5244save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d) 5245{ 5246 GET_CURRENT_CONTEXT(ctx); 5247 Node *n; 5248 SAVE_FLUSH_VERTICES(ctx); 5249 n = ALLOC_INSTRUCTION(ctx, OPCODE_RECTF, 4); 5250 if (n) { 5251 n[1].f = a; 5252 n[2].f = b; 5253 n[3].f = c; 5254 n[4].f = d; 5255 } 5256 if (ctx->ExecuteFlag) { 5257 CALL_Rectf(ctx->Exec, (a, b, c, d)); 5258 } 5259} 5260 5261 5262static void GLAPIENTRY 5263save_Vertex2f(GLfloat x, GLfloat y) 5264{ 5265 save_Attr2fNV(VERT_ATTRIB_POS, x, y); 5266} 5267 5268static void GLAPIENTRY 5269save_Vertex2fv(const GLfloat * v) 5270{ 5271 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]); 5272} 5273 5274static void GLAPIENTRY 5275save_Vertex3f(GLfloat x, GLfloat y, GLfloat z) 5276{ 5277 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z); 5278} 5279 5280static void GLAPIENTRY 5281save_Vertex3fv(const GLfloat * v) 5282{ 5283 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]); 5284} 5285 5286static void GLAPIENTRY 5287save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 5288{ 5289 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w); 5290} 5291 5292static void GLAPIENTRY 5293save_Vertex4fv(const GLfloat * v) 5294{ 5295 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]); 5296} 5297 5298static void GLAPIENTRY 5299save_TexCoord1f(GLfloat x) 5300{ 5301 save_Attr1fNV(VERT_ATTRIB_TEX0, x); 5302} 5303 5304static void GLAPIENTRY 5305save_TexCoord1fv(const GLfloat * v) 5306{ 5307 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]); 5308} 5309 5310static void GLAPIENTRY 5311save_TexCoord2f(GLfloat x, GLfloat y) 5312{ 5313 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y); 5314} 5315 5316static void GLAPIENTRY 5317save_TexCoord2fv(const GLfloat * v) 5318{ 5319 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]); 5320} 5321 5322static void GLAPIENTRY 5323save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z) 5324{ 5325 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z); 5326} 5327 5328static void GLAPIENTRY 5329save_TexCoord3fv(const GLfloat * v) 5330{ 5331 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]); 5332} 5333 5334static void GLAPIENTRY 5335save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 5336{ 5337 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w); 5338} 5339 5340static void GLAPIENTRY 5341save_TexCoord4fv(const GLfloat * v) 5342{ 5343 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]); 5344} 5345 5346static void GLAPIENTRY 5347save_Normal3f(GLfloat x, GLfloat y, GLfloat z) 5348{ 5349 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z); 5350} 5351 5352static void GLAPIENTRY 5353save_Normal3fv(const GLfloat * v) 5354{ 5355 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]); 5356} 5357 5358static void GLAPIENTRY 5359save_FogCoordfEXT(GLfloat x) 5360{ 5361 save_Attr1fNV(VERT_ATTRIB_FOG, x); 5362} 5363 5364static void GLAPIENTRY 5365save_FogCoordfvEXT(const GLfloat * v) 5366{ 5367 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]); 5368} 5369 5370static void GLAPIENTRY 5371save_Color3f(GLfloat x, GLfloat y, GLfloat z) 5372{ 5373 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z); 5374} 5375 5376static void GLAPIENTRY 5377save_Color3fv(const GLfloat * v) 5378{ 5379 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]); 5380} 5381 5382static void GLAPIENTRY 5383save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 5384{ 5385 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w); 5386} 5387 5388static void GLAPIENTRY 5389save_Color4fv(const GLfloat * v) 5390{ 5391 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]); 5392} 5393 5394static void GLAPIENTRY 5395save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z) 5396{ 5397 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z); 5398} 5399 5400static void GLAPIENTRY 5401save_SecondaryColor3fvEXT(const GLfloat * v) 5402{ 5403 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]); 5404} 5405 5406 5407/* Just call the respective ATTR for texcoord 5408 */ 5409static void GLAPIENTRY 5410save_MultiTexCoord1f(GLenum target, GLfloat x) 5411{ 5412 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5413 save_Attr1fNV(attr, x); 5414} 5415 5416static void GLAPIENTRY 5417save_MultiTexCoord1fv(GLenum target, const GLfloat * v) 5418{ 5419 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5420 save_Attr1fNV(attr, v[0]); 5421} 5422 5423static void GLAPIENTRY 5424save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y) 5425{ 5426 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5427 save_Attr2fNV(attr, x, y); 5428} 5429 5430static void GLAPIENTRY 5431save_MultiTexCoord2fv(GLenum target, const GLfloat * v) 5432{ 5433 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5434 save_Attr2fNV(attr, v[0], v[1]); 5435} 5436 5437static void GLAPIENTRY 5438save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z) 5439{ 5440 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5441 save_Attr3fNV(attr, x, y, z); 5442} 5443 5444static void GLAPIENTRY 5445save_MultiTexCoord3fv(GLenum target, const GLfloat * v) 5446{ 5447 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5448 save_Attr3fNV(attr, v[0], v[1], v[2]); 5449} 5450 5451static void GLAPIENTRY 5452save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y, 5453 GLfloat z, GLfloat w) 5454{ 5455 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5456 save_Attr4fNV(attr, x, y, z, w); 5457} 5458 5459static void GLAPIENTRY 5460save_MultiTexCoord4fv(GLenum target, const GLfloat * v) 5461{ 5462 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 5463 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]); 5464} 5465 5466 5467/** 5468 * Record a GL_INVALID_VALUE error when a invalid vertex attribute 5469 * index is found. 5470 */ 5471static void 5472index_error(void) 5473{ 5474 GET_CURRENT_CONTEXT(ctx); 5475 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)"); 5476} 5477 5478 5479/* First level for NV_vertex_program: 5480 * 5481 * Check for errors at compile time?. 5482 */ 5483static void GLAPIENTRY 5484save_VertexAttrib1fNV(GLuint index, GLfloat x) 5485{ 5486 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5487 save_Attr1fNV(index, x); 5488 else 5489 index_error(); 5490} 5491 5492static void GLAPIENTRY 5493save_VertexAttrib1fvNV(GLuint index, const GLfloat * v) 5494{ 5495 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5496 save_Attr1fNV(index, v[0]); 5497 else 5498 index_error(); 5499} 5500 5501static void GLAPIENTRY 5502save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) 5503{ 5504 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5505 save_Attr2fNV(index, x, y); 5506 else 5507 index_error(); 5508} 5509 5510static void GLAPIENTRY 5511save_VertexAttrib2fvNV(GLuint index, const GLfloat * v) 5512{ 5513 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5514 save_Attr2fNV(index, v[0], v[1]); 5515 else 5516 index_error(); 5517} 5518 5519static void GLAPIENTRY 5520save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) 5521{ 5522 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5523 save_Attr3fNV(index, x, y, z); 5524 else 5525 index_error(); 5526} 5527 5528static void GLAPIENTRY 5529save_VertexAttrib3fvNV(GLuint index, const GLfloat * v) 5530{ 5531 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5532 save_Attr3fNV(index, v[0], v[1], v[2]); 5533 else 5534 index_error(); 5535} 5536 5537static void GLAPIENTRY 5538save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, 5539 GLfloat z, GLfloat w) 5540{ 5541 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5542 save_Attr4fNV(index, x, y, z, w); 5543 else 5544 index_error(); 5545} 5546 5547static void GLAPIENTRY 5548save_VertexAttrib4fvNV(GLuint index, const GLfloat * v) 5549{ 5550 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 5551 save_Attr4fNV(index, v[0], v[1], v[2], v[3]); 5552 else 5553 index_error(); 5554} 5555 5556 5557 5558 5559static void GLAPIENTRY 5560save_VertexAttrib1fARB(GLuint index, GLfloat x) 5561{ 5562 if (index < MAX_VERTEX_ATTRIBS) 5563 save_Attr1fARB(index, x); 5564 else 5565 index_error(); 5566} 5567 5568static void GLAPIENTRY 5569save_VertexAttrib1fvARB(GLuint index, const GLfloat * v) 5570{ 5571 if (index < MAX_VERTEX_ATTRIBS) 5572 save_Attr1fARB(index, v[0]); 5573 else 5574 index_error(); 5575} 5576 5577static void GLAPIENTRY 5578save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) 5579{ 5580 if (index < MAX_VERTEX_ATTRIBS) 5581 save_Attr2fARB(index, x, y); 5582 else 5583 index_error(); 5584} 5585 5586static void GLAPIENTRY 5587save_VertexAttrib2fvARB(GLuint index, const GLfloat * v) 5588{ 5589 if (index < MAX_VERTEX_ATTRIBS) 5590 save_Attr2fARB(index, v[0], v[1]); 5591 else 5592 index_error(); 5593} 5594 5595static void GLAPIENTRY 5596save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) 5597{ 5598 if (index < MAX_VERTEX_ATTRIBS) 5599 save_Attr3fARB(index, x, y, z); 5600 else 5601 index_error(); 5602} 5603 5604static void GLAPIENTRY 5605save_VertexAttrib3fvARB(GLuint index, const GLfloat * v) 5606{ 5607 if (index < MAX_VERTEX_ATTRIBS) 5608 save_Attr3fARB(index, v[0], v[1], v[2]); 5609 else 5610 index_error(); 5611} 5612 5613static void GLAPIENTRY 5614save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, 5615 GLfloat w) 5616{ 5617 if (index < MAX_VERTEX_ATTRIBS) 5618 save_Attr4fARB(index, x, y, z, w); 5619 else 5620 index_error(); 5621} 5622 5623static void GLAPIENTRY 5624save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) 5625{ 5626 if (index < MAX_VERTEX_ATTRIBS) 5627 save_Attr4fARB(index, v[0], v[1], v[2], v[3]); 5628 else 5629 index_error(); 5630} 5631 5632 5633#if FEATURE_EXT_framebuffer_blit 5634static void GLAPIENTRY 5635save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, 5636 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, 5637 GLbitfield mask, GLenum filter) 5638{ 5639 GET_CURRENT_CONTEXT(ctx); 5640 Node *n; 5641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 5642 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLIT_FRAMEBUFFER, 10); 5643 if (n) { 5644 n[1].i = srcX0; 5645 n[2].i = srcY0; 5646 n[3].i = srcX1; 5647 n[4].i = srcY1; 5648 n[5].i = dstX0; 5649 n[6].i = dstY0; 5650 n[7].i = dstX1; 5651 n[8].i = dstY1; 5652 n[9].i = mask; 5653 n[10].e = filter; 5654 } 5655 if (ctx->ExecuteFlag) { 5656 CALL_BlitFramebufferEXT(ctx->Exec, (srcX0, srcY0, srcX1, srcY1, 5657 dstX0, dstY0, dstX1, dstY1, 5658 mask, filter)); 5659 } 5660} 5661#endif 5662 5663 5664/** 5665 * Save an error-generating command into display list. 5666 * 5667 * KW: Will appear in the list before the vertex buffer containing the 5668 * command that provoked the error. I don't see this as a problem. 5669 */ 5670static void 5671save_error(GLcontext *ctx, GLenum error, const char *s) 5672{ 5673 Node *n; 5674 n = ALLOC_INSTRUCTION(ctx, OPCODE_ERROR, 2); 5675 if (n) { 5676 n[1].e = error; 5677 n[2].data = (void *) s; 5678 } 5679} 5680 5681 5682/** 5683 * Compile an error into current display list. 5684 */ 5685void 5686_mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) 5687{ 5688 if (ctx->CompileFlag) 5689 save_error(ctx, error, s); 5690 if (ctx->ExecuteFlag) 5691 _mesa_error(ctx, error, s); 5692} 5693 5694 5695/** 5696 * Test if ID names a display list. 5697 */ 5698static GLboolean 5699islist(GLcontext *ctx, GLuint list) 5700{ 5701 if (list > 0 && lookup_list(ctx, list)) { 5702 return GL_TRUE; 5703 } 5704 else { 5705 return GL_FALSE; 5706 } 5707} 5708 5709 5710 5711/**********************************************************************/ 5712/* Display list execution */ 5713/**********************************************************************/ 5714 5715 5716/* 5717 * Execute a display list. Note that the ListBase offset must have already 5718 * been added before calling this function. I.e. the list argument is 5719 * the absolute list number, not relative to ListBase. 5720 * \param list - display list number 5721 */ 5722static void 5723execute_list(GLcontext *ctx, GLuint list) 5724{ 5725 struct mesa_display_list *dlist; 5726 Node *n; 5727 GLboolean done; 5728 5729 if (list == 0 || !islist(ctx, list)) 5730 return; 5731 5732 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) { 5733 /* raise an error? */ 5734 return; 5735 } 5736 5737 dlist = lookup_list(ctx, list); 5738 if (!dlist) 5739 return; 5740 5741 ctx->ListState.CallStack[ctx->ListState.CallDepth++] = dlist; 5742 5743 if (ctx->Driver.BeginCallList) 5744 ctx->Driver.BeginCallList(ctx, dlist); 5745 5746 n = dlist->node; 5747 5748 done = GL_FALSE; 5749 while (!done) { 5750 OpCode opcode = n[0].opcode; 5751 int i = (int) n[0].opcode - (int) OPCODE_EXT_0; 5752 5753 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { 5754 /* this is a driver-extended opcode */ 5755 ctx->ListExt.Opcode[i].Execute(ctx, &n[1]); 5756 n += ctx->ListExt.Opcode[i].Size; 5757 } 5758 else { 5759 switch (opcode) { 5760 case OPCODE_ERROR: 5761 _mesa_error(ctx, n[1].e, (const char *) n[2].data); 5762 break; 5763 case OPCODE_ACCUM: 5764 CALL_Accum(ctx->Exec, (n[1].e, n[2].f)); 5765 break; 5766 case OPCODE_ALPHA_FUNC: 5767 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f)); 5768 break; 5769 case OPCODE_BIND_TEXTURE: 5770 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui)); 5771 break; 5772 case OPCODE_BITMAP: 5773 { 5774 const struct gl_pixelstore_attrib save = ctx->Unpack; 5775 ctx->Unpack = ctx->DefaultPacking; 5776 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i, 5777 n[3].f, n[4].f, n[5].f, n[6].f, 5778 (const GLubyte *) n[7].data)); 5779 ctx->Unpack = save; /* restore */ 5780 } 5781 break; 5782 case OPCODE_BLEND_COLOR: 5783 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 5784 break; 5785 case OPCODE_BLEND_EQUATION: 5786 CALL_BlendEquation(ctx->Exec, (n[1].e)); 5787 break; 5788 case OPCODE_BLEND_EQUATION_SEPARATE: 5789 CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e)); 5790 break; 5791 case OPCODE_BLEND_FUNC_SEPARATE: 5792 CALL_BlendFuncSeparateEXT(ctx->Exec, 5793 (n[1].e, n[2].e, n[3].e, n[4].e)); 5794 break; 5795 case OPCODE_CALL_LIST: 5796 /* Generated by glCallList(), don't add ListBase */ 5797 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) { 5798 execute_list(ctx, n[1].ui); 5799 } 5800 break; 5801 case OPCODE_CALL_LIST_OFFSET: 5802 /* Generated by glCallLists() so we must add ListBase */ 5803 if (n[2].b) { 5804 /* user specified a bad data type at compile time */ 5805 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); 5806 } 5807 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) { 5808 execute_list(ctx, ctx->List.ListBase + n[1].ui); 5809 } 5810 break; 5811 case OPCODE_CLEAR: 5812 CALL_Clear(ctx->Exec, (n[1].bf)); 5813 break; 5814 case OPCODE_CLEAR_COLOR: 5815 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 5816 break; 5817 case OPCODE_CLEAR_ACCUM: 5818 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 5819 break; 5820 case OPCODE_CLEAR_DEPTH: 5821 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f)); 5822 break; 5823 case OPCODE_CLEAR_INDEX: 5824 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui)); 5825 break; 5826 case OPCODE_CLEAR_STENCIL: 5827 CALL_ClearStencil(ctx->Exec, (n[1].i)); 5828 break; 5829 case OPCODE_CLIP_PLANE: 5830 { 5831 GLdouble eq[4]; 5832 eq[0] = n[2].f; 5833 eq[1] = n[3].f; 5834 eq[2] = n[4].f; 5835 eq[3] = n[5].f; 5836 CALL_ClipPlane(ctx->Exec, (n[1].e, eq)); 5837 } 5838 break; 5839 case OPCODE_COLOR_MASK: 5840 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b)); 5841 break; 5842 case OPCODE_COLOR_MATERIAL: 5843 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e)); 5844 break; 5845 case OPCODE_COLOR_TABLE: 5846 { 5847 const struct gl_pixelstore_attrib save = ctx->Unpack; 5848 ctx->Unpack = ctx->DefaultPacking; 5849 CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e, 5850 n[5].e, n[6].data)); 5851 ctx->Unpack = save; /* restore */ 5852 } 5853 break; 5854 case OPCODE_COLOR_TABLE_PARAMETER_FV: 5855 { 5856 GLfloat params[4]; 5857 params[0] = n[3].f; 5858 params[1] = n[4].f; 5859 params[2] = n[5].f; 5860 params[3] = n[6].f; 5861 CALL_ColorTableParameterfv(ctx->Exec, 5862 (n[1].e, n[2].e, params)); 5863 } 5864 break; 5865 case OPCODE_COLOR_TABLE_PARAMETER_IV: 5866 { 5867 GLint params[4]; 5868 params[0] = n[3].i; 5869 params[1] = n[4].i; 5870 params[2] = n[5].i; 5871 params[3] = n[6].i; 5872 CALL_ColorTableParameteriv(ctx->Exec, 5873 (n[1].e, n[2].e, params)); 5874 } 5875 break; 5876 case OPCODE_COLOR_SUB_TABLE: 5877 { 5878 const struct gl_pixelstore_attrib save = ctx->Unpack; 5879 ctx->Unpack = ctx->DefaultPacking; 5880 CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i, 5881 n[4].e, n[5].e, n[6].data)); 5882 ctx->Unpack = save; /* restore */ 5883 } 5884 break; 5885 case OPCODE_CONVOLUTION_FILTER_1D: 5886 { 5887 const struct gl_pixelstore_attrib save = ctx->Unpack; 5888 ctx->Unpack = ctx->DefaultPacking; 5889 CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 5890 n[4].e, n[5].e, 5891 n[6].data)); 5892 ctx->Unpack = save; /* restore */ 5893 } 5894 break; 5895 case OPCODE_CONVOLUTION_FILTER_2D: 5896 { 5897 const struct gl_pixelstore_attrib save = ctx->Unpack; 5898 ctx->Unpack = ctx->DefaultPacking; 5899 CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 5900 n[4].i, n[5].e, n[6].e, 5901 n[7].data)); 5902 ctx->Unpack = save; /* restore */ 5903 } 5904 break; 5905 case OPCODE_CONVOLUTION_PARAMETER_I: 5906 CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i)); 5907 break; 5908 case OPCODE_CONVOLUTION_PARAMETER_IV: 5909 { 5910 GLint params[4]; 5911 params[0] = n[3].i; 5912 params[1] = n[4].i; 5913 params[2] = n[5].i; 5914 params[3] = n[6].i; 5915 CALL_ConvolutionParameteriv(ctx->Exec, 5916 (n[1].e, n[2].e, params)); 5917 } 5918 break; 5919 case OPCODE_CONVOLUTION_PARAMETER_F: 5920 CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f)); 5921 break; 5922 case OPCODE_CONVOLUTION_PARAMETER_FV: 5923 { 5924 GLfloat params[4]; 5925 params[0] = n[3].f; 5926 params[1] = n[4].f; 5927 params[2] = n[5].f; 5928 params[3] = n[6].f; 5929 CALL_ConvolutionParameterfv(ctx->Exec, 5930 (n[1].e, n[2].e, params)); 5931 } 5932 break; 5933 case OPCODE_COPY_COLOR_SUB_TABLE: 5934 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i, 5935 n[3].i, n[4].i, n[5].i)); 5936 break; 5937 case OPCODE_COPY_COLOR_TABLE: 5938 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i, 5939 n[3].i, n[4].i, n[5].i)); 5940 break; 5941 case OPCODE_COPY_PIXELS: 5942 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i, 5943 (GLsizei) n[3].i, (GLsizei) n[4].i, 5944 n[5].e)); 5945 break; 5946 case OPCODE_COPY_TEX_IMAGE1D: 5947 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, 5948 n[5].i, n[6].i, n[7].i)); 5949 break; 5950 case OPCODE_COPY_TEX_IMAGE2D: 5951 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, 5952 n[5].i, n[6].i, n[7].i, n[8].i)); 5953 break; 5954 case OPCODE_COPY_TEX_SUB_IMAGE1D: 5955 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 5956 n[4].i, n[5].i, n[6].i)); 5957 break; 5958 case OPCODE_COPY_TEX_SUB_IMAGE2D: 5959 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 5960 n[4].i, n[5].i, n[6].i, n[7].i, 5961 n[8].i)); 5962 break; 5963 case OPCODE_COPY_TEX_SUB_IMAGE3D: 5964 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 5965 n[4].i, n[5].i, n[6].i, n[7].i, 5966 n[8].i, n[9].i)); 5967 break; 5968 case OPCODE_CULL_FACE: 5969 CALL_CullFace(ctx->Exec, (n[1].e)); 5970 break; 5971 case OPCODE_DEPTH_FUNC: 5972 CALL_DepthFunc(ctx->Exec, (n[1].e)); 5973 break; 5974 case OPCODE_DEPTH_MASK: 5975 CALL_DepthMask(ctx->Exec, (n[1].b)); 5976 break; 5977 case OPCODE_DEPTH_RANGE: 5978 CALL_DepthRange(ctx->Exec, 5979 ((GLclampd) n[1].f, (GLclampd) n[2].f)); 5980 break; 5981 case OPCODE_DISABLE: 5982 CALL_Disable(ctx->Exec, (n[1].e)); 5983 break; 5984 case OPCODE_DRAW_BUFFER: 5985 CALL_DrawBuffer(ctx->Exec, (n[1].e)); 5986 break; 5987 case OPCODE_DRAW_PIXELS: 5988 { 5989 const struct gl_pixelstore_attrib save = ctx->Unpack; 5990 ctx->Unpack = ctx->DefaultPacking; 5991 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e, 5992 n[5].data)); 5993 ctx->Unpack = save; /* restore */ 5994 } 5995 break; 5996 case OPCODE_ENABLE: 5997 CALL_Enable(ctx->Exec, (n[1].e)); 5998 break; 5999 case OPCODE_EVALMESH1: 6000 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i)); 6001 break; 6002 case OPCODE_EVALMESH2: 6003 CALL_EvalMesh2(ctx->Exec, 6004 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i)); 6005 break; 6006 case OPCODE_FOG: 6007 { 6008 GLfloat p[4]; 6009 p[0] = n[2].f; 6010 p[1] = n[3].f; 6011 p[2] = n[4].f; 6012 p[3] = n[5].f; 6013 CALL_Fogfv(ctx->Exec, (n[1].e, p)); 6014 } 6015 break; 6016 case OPCODE_FRONT_FACE: 6017 CALL_FrontFace(ctx->Exec, (n[1].e)); 6018 break; 6019 case OPCODE_FRUSTUM: 6020 CALL_Frustum(ctx->Exec, 6021 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f)); 6022 break; 6023 case OPCODE_HINT: 6024 CALL_Hint(ctx->Exec, (n[1].e, n[2].e)); 6025 break; 6026 case OPCODE_HISTOGRAM: 6027 CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b)); 6028 break; 6029 case OPCODE_INDEX_MASK: 6030 CALL_IndexMask(ctx->Exec, (n[1].ui)); 6031 break; 6032 case OPCODE_INIT_NAMES: 6033 CALL_InitNames(ctx->Exec, ()); 6034 break; 6035 case OPCODE_LIGHT: 6036 { 6037 GLfloat p[4]; 6038 p[0] = n[3].f; 6039 p[1] = n[4].f; 6040 p[2] = n[5].f; 6041 p[3] = n[6].f; 6042 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p)); 6043 } 6044 break; 6045 case OPCODE_LIGHT_MODEL: 6046 { 6047 GLfloat p[4]; 6048 p[0] = n[2].f; 6049 p[1] = n[3].f; 6050 p[2] = n[4].f; 6051 p[3] = n[5].f; 6052 CALL_LightModelfv(ctx->Exec, (n[1].e, p)); 6053 } 6054 break; 6055 case OPCODE_LINE_STIPPLE: 6056 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us)); 6057 break; 6058 case OPCODE_LINE_WIDTH: 6059 CALL_LineWidth(ctx->Exec, (n[1].f)); 6060 break; 6061 case OPCODE_LIST_BASE: 6062 CALL_ListBase(ctx->Exec, (n[1].ui)); 6063 break; 6064 case OPCODE_LOAD_IDENTITY: 6065 CALL_LoadIdentity(ctx->Exec, ()); 6066 break; 6067 case OPCODE_LOAD_MATRIX: 6068 if (sizeof(Node) == sizeof(GLfloat)) { 6069 CALL_LoadMatrixf(ctx->Exec, (&n[1].f)); 6070 } 6071 else { 6072 GLfloat m[16]; 6073 GLuint i; 6074 for (i = 0; i < 16; i++) { 6075 m[i] = n[1 + i].f; 6076 } 6077 CALL_LoadMatrixf(ctx->Exec, (m)); 6078 } 6079 break; 6080 case OPCODE_LOAD_NAME: 6081 CALL_LoadName(ctx->Exec, (n[1].ui)); 6082 break; 6083 case OPCODE_LOGIC_OP: 6084 CALL_LogicOp(ctx->Exec, (n[1].e)); 6085 break; 6086 case OPCODE_MAP1: 6087 { 6088 GLenum target = n[1].e; 6089 GLint ustride = _mesa_evaluator_components(target); 6090 GLint uorder = n[5].i; 6091 GLfloat u1 = n[2].f; 6092 GLfloat u2 = n[3].f; 6093 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder, 6094 (GLfloat *) n[6].data)); 6095 } 6096 break; 6097 case OPCODE_MAP2: 6098 { 6099 GLenum target = n[1].e; 6100 GLfloat u1 = n[2].f; 6101 GLfloat u2 = n[3].f; 6102 GLfloat v1 = n[4].f; 6103 GLfloat v2 = n[5].f; 6104 GLint ustride = n[6].i; 6105 GLint vstride = n[7].i; 6106 GLint uorder = n[8].i; 6107 GLint vorder = n[9].i; 6108 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder, 6109 v1, v2, vstride, vorder, 6110 (GLfloat *) n[10].data)); 6111 } 6112 break; 6113 case OPCODE_MAPGRID1: 6114 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f)); 6115 break; 6116 case OPCODE_MAPGRID2: 6117 CALL_MapGrid2f(ctx->Exec, 6118 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f)); 6119 break; 6120 case OPCODE_MATRIX_MODE: 6121 CALL_MatrixMode(ctx->Exec, (n[1].e)); 6122 break; 6123 case OPCODE_MIN_MAX: 6124 CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b)); 6125 break; 6126 case OPCODE_MULT_MATRIX: 6127 if (sizeof(Node) == sizeof(GLfloat)) { 6128 CALL_MultMatrixf(ctx->Exec, (&n[1].f)); 6129 } 6130 else { 6131 GLfloat m[16]; 6132 GLuint i; 6133 for (i = 0; i < 16; i++) { 6134 m[i] = n[1 + i].f; 6135 } 6136 CALL_MultMatrixf(ctx->Exec, (m)); 6137 } 6138 break; 6139 case OPCODE_ORTHO: 6140 CALL_Ortho(ctx->Exec, 6141 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f)); 6142 break; 6143 case OPCODE_PASSTHROUGH: 6144 CALL_PassThrough(ctx->Exec, (n[1].f)); 6145 break; 6146 case OPCODE_PIXEL_MAP: 6147 CALL_PixelMapfv(ctx->Exec, 6148 (n[1].e, n[2].i, (GLfloat *) n[3].data)); 6149 break; 6150 case OPCODE_PIXEL_TRANSFER: 6151 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f)); 6152 break; 6153 case OPCODE_PIXEL_ZOOM: 6154 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f)); 6155 break; 6156 case OPCODE_POINT_SIZE: 6157 CALL_PointSize(ctx->Exec, (n[1].f)); 6158 break; 6159 case OPCODE_POINT_PARAMETERS: 6160 { 6161 GLfloat params[3]; 6162 params[0] = n[2].f; 6163 params[1] = n[3].f; 6164 params[2] = n[4].f; 6165 CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params)); 6166 } 6167 break; 6168 case OPCODE_POLYGON_MODE: 6169 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e)); 6170 break; 6171 case OPCODE_POLYGON_STIPPLE: 6172 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); 6173 break; 6174 case OPCODE_POLYGON_OFFSET: 6175 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f)); 6176 break; 6177 case OPCODE_POP_ATTRIB: 6178 CALL_PopAttrib(ctx->Exec, ()); 6179 break; 6180 case OPCODE_POP_MATRIX: 6181 CALL_PopMatrix(ctx->Exec, ()); 6182 break; 6183 case OPCODE_POP_NAME: 6184 CALL_PopName(ctx->Exec, ()); 6185 break; 6186 case OPCODE_PRIORITIZE_TEXTURE: 6187 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f)); 6188 break; 6189 case OPCODE_PUSH_ATTRIB: 6190 CALL_PushAttrib(ctx->Exec, (n[1].bf)); 6191 break; 6192 case OPCODE_PUSH_MATRIX: 6193 CALL_PushMatrix(ctx->Exec, ()); 6194 break; 6195 case OPCODE_PUSH_NAME: 6196 CALL_PushName(ctx->Exec, (n[1].ui)); 6197 break; 6198 case OPCODE_RASTER_POS: 6199 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 6200 break; 6201 case OPCODE_READ_BUFFER: 6202 CALL_ReadBuffer(ctx->Exec, (n[1].e)); 6203 break; 6204 case OPCODE_RESET_HISTOGRAM: 6205 CALL_ResetHistogram(ctx->Exec, (n[1].e)); 6206 break; 6207 case OPCODE_RESET_MIN_MAX: 6208 CALL_ResetMinmax(ctx->Exec, (n[1].e)); 6209 break; 6210 case OPCODE_ROTATE: 6211 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 6212 break; 6213 case OPCODE_SCALE: 6214 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f)); 6215 break; 6216 case OPCODE_SCISSOR: 6217 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i)); 6218 break; 6219 case OPCODE_SHADE_MODEL: 6220 CALL_ShadeModel(ctx->Exec, (n[1].e)); 6221 break; 6222 case OPCODE_STENCIL_FUNC: 6223 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui)); 6224 break; 6225 case OPCODE_STENCIL_MASK: 6226 CALL_StencilMask(ctx->Exec, (n[1].ui)); 6227 break; 6228 case OPCODE_STENCIL_OP: 6229 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e)); 6230 break; 6231 case OPCODE_STENCIL_FUNC_SEPARATE: 6232 CALL_StencilFuncSeparate(ctx->Exec, 6233 (n[1].e, n[2].e, n[3].i, n[4].ui)); 6234 break; 6235 case OPCODE_STENCIL_MASK_SEPARATE: 6236 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui)); 6237 break; 6238 case OPCODE_STENCIL_OP_SEPARATE: 6239 CALL_StencilOpSeparate(ctx->Exec, 6240 (n[1].e, n[2].e, n[3].e, n[4].e)); 6241 break; 6242 case OPCODE_TEXENV: 6243 { 6244 GLfloat params[4]; 6245 params[0] = n[3].f; 6246 params[1] = n[4].f; 6247 params[2] = n[5].f; 6248 params[3] = n[6].f; 6249 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params)); 6250 } 6251 break; 6252 case OPCODE_TEXGEN: 6253 { 6254 GLfloat params[4]; 6255 params[0] = n[3].f; 6256 params[1] = n[4].f; 6257 params[2] = n[5].f; 6258 params[3] = n[6].f; 6259 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params)); 6260 } 6261 break; 6262 case OPCODE_TEXPARAMETER: 6263 { 6264 GLfloat params[4]; 6265 params[0] = n[3].f; 6266 params[1] = n[4].f; 6267 params[2] = n[5].f; 6268 params[3] = n[6].f; 6269 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params)); 6270 } 6271 break; 6272 case OPCODE_TEX_IMAGE1D: 6273 { 6274 const struct gl_pixelstore_attrib save = ctx->Unpack; 6275 ctx->Unpack = ctx->DefaultPacking; 6276 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */ 6277 n[2].i, /* level */ 6278 n[3].i, /* components */ 6279 n[4].i, /* width */ 6280 n[5].e, /* border */ 6281 n[6].e, /* format */ 6282 n[7].e, /* type */ 6283 n[8].data)); 6284 ctx->Unpack = save; /* restore */ 6285 } 6286 break; 6287 case OPCODE_TEX_IMAGE2D: 6288 { 6289 const struct gl_pixelstore_attrib save = ctx->Unpack; 6290 ctx->Unpack = ctx->DefaultPacking; 6291 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */ 6292 n[2].i, /* level */ 6293 n[3].i, /* components */ 6294 n[4].i, /* width */ 6295 n[5].i, /* height */ 6296 n[6].e, /* border */ 6297 n[7].e, /* format */ 6298 n[8].e, /* type */ 6299 n[9].data)); 6300 ctx->Unpack = save; /* restore */ 6301 } 6302 break; 6303 case OPCODE_TEX_IMAGE3D: 6304 { 6305 const struct gl_pixelstore_attrib save = ctx->Unpack; 6306 ctx->Unpack = ctx->DefaultPacking; 6307 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */ 6308 n[2].i, /* level */ 6309 n[3].i, /* components */ 6310 n[4].i, /* width */ 6311 n[5].i, /* height */ 6312 n[6].i, /* depth */ 6313 n[7].e, /* border */ 6314 n[8].e, /* format */ 6315 n[9].e, /* type */ 6316 n[10].data)); 6317 ctx->Unpack = save; /* restore */ 6318 } 6319 break; 6320 case OPCODE_TEX_SUB_IMAGE1D: 6321 { 6322 const struct gl_pixelstore_attrib save = ctx->Unpack; 6323 ctx->Unpack = ctx->DefaultPacking; 6324 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 6325 n[4].i, n[5].e, 6326 n[6].e, n[7].data)); 6327 ctx->Unpack = save; /* restore */ 6328 } 6329 break; 6330 case OPCODE_TEX_SUB_IMAGE2D: 6331 { 6332 const struct gl_pixelstore_attrib save = ctx->Unpack; 6333 ctx->Unpack = ctx->DefaultPacking; 6334 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 6335 n[4].i, n[5].e, 6336 n[6].i, n[7].e, n[8].e, 6337 n[9].data)); 6338 ctx->Unpack = save; /* restore */ 6339 } 6340 break; 6341 case OPCODE_TEX_SUB_IMAGE3D: 6342 { 6343 const struct gl_pixelstore_attrib save = ctx->Unpack; 6344 ctx->Unpack = ctx->DefaultPacking; 6345 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 6346 n[4].i, n[5].i, n[6].i, n[7].i, 6347 n[8].i, n[9].e, n[10].e, 6348 n[11].data)); 6349 ctx->Unpack = save; /* restore */ 6350 } 6351 break; 6352 case OPCODE_TRANSLATE: 6353 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f)); 6354 break; 6355 case OPCODE_VIEWPORT: 6356 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i, 6357 (GLsizei) n[3].i, (GLsizei) n[4].i)); 6358 break; 6359 case OPCODE_WINDOW_POS: 6360 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 6361 break; 6362 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ 6363 CALL_ActiveTextureARB(ctx->Exec, (n[1].e)); 6364 break; 6365 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */ 6366 CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, 6367 n[4].i, n[5].i, n[6].i, 6368 n[7].data)); 6369 break; 6370 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */ 6371 CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, 6372 n[4].i, n[5].i, n[6].i, 6373 n[7].i, n[8].data)); 6374 break; 6375 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */ 6376 CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, 6377 n[4].i, n[5].i, n[6].i, 6378 n[7].i, n[8].i, 6379 n[9].data)); 6380 break; 6381 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */ 6382 CALL_CompressedTexSubImage1DARB(ctx->Exec, 6383 (n[1].e, n[2].i, n[3].i, n[4].i, 6384 n[5].e, n[6].i, n[7].data)); 6385 break; 6386 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */ 6387 CALL_CompressedTexSubImage2DARB(ctx->Exec, 6388 (n[1].e, n[2].i, n[3].i, n[4].i, 6389 n[5].i, n[6].i, n[7].e, n[8].i, 6390 n[9].data)); 6391 break; 6392 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */ 6393 CALL_CompressedTexSubImage3DARB(ctx->Exec, 6394 (n[1].e, n[2].i, n[3].i, n[4].i, 6395 n[5].i, n[6].i, n[7].i, n[8].i, 6396 n[9].e, n[10].i, n[11].data)); 6397 break; 6398 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */ 6399 CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b)); 6400 break; 6401 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */ 6402 CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f)); 6403 break; 6404#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 6405 case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */ 6406 CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui)); 6407 break; 6408#endif 6409#if FEATURE_NV_vertex_program 6410 case OPCODE_EXECUTE_PROGRAM_NV: 6411 { 6412 GLfloat v[4]; 6413 v[0] = n[3].f; 6414 v[1] = n[4].f; 6415 v[2] = n[5].f; 6416 v[3] = n[6].f; 6417 CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v)); 6418 } 6419 break; 6420 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: 6421 CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui, 6422 (GLuint *) n[2].data)); 6423 break; 6424 case OPCODE_LOAD_PROGRAM_NV: 6425 CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i, 6426 (const GLubyte *) n[4].data)); 6427 break; 6428 case OPCODE_PROGRAM_PARAMETER4F_NV: 6429 CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f, 6430 n[4].f, n[5].f, n[6].f)); 6431 break; 6432 case OPCODE_TRACK_MATRIX_NV: 6433 CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e)); 6434 break; 6435#endif 6436 6437#if FEATURE_NV_fragment_program 6438 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB: 6439 CALL_ProgramLocalParameter4fARB(ctx->Exec, 6440 (n[1].e, n[2].ui, n[3].f, n[4].f, 6441 n[5].f, n[6].f)); 6442 break; 6443 case OPCODE_PROGRAM_NAMED_PARAMETER_NV: 6444 CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i, 6445 (const GLubyte *) n[3]. 6446 data, n[4].f, n[5].f, 6447 n[6].f, n[7].f)); 6448 break; 6449#endif 6450 6451 case OPCODE_ACTIVE_STENCIL_FACE_EXT: 6452 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e)); 6453 break; 6454 case OPCODE_DEPTH_BOUNDS_EXT: 6455 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f)); 6456 break; 6457#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 6458 case OPCODE_PROGRAM_STRING_ARB: 6459 CALL_ProgramStringARB(ctx->Exec, 6460 (n[1].e, n[2].e, n[3].i, n[4].data)); 6461 break; 6462 case OPCODE_PROGRAM_ENV_PARAMETER_ARB: 6463 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f, 6464 n[4].f, n[5].f, 6465 n[6].f)); 6466 break; 6467#endif 6468#if FEATURE_ARB_occlusion_query 6469 case OPCODE_BEGIN_QUERY_ARB: 6470 CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui)); 6471 break; 6472 case OPCODE_END_QUERY_ARB: 6473 CALL_EndQueryARB(ctx->Exec, (n[1].e)); 6474 break; 6475#endif 6476 case OPCODE_DRAW_BUFFERS_ARB: 6477 { 6478 GLenum buffers[MAX_DRAW_BUFFERS]; 6479 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS); 6480 for (i = 0; i < count; i++) 6481 buffers[i] = n[2 + i].e; 6482 CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers)); 6483 } 6484 break; 6485#if FEATURE_EXT_framebuffer_blit 6486 case OPCODE_BLIT_FRAMEBUFFER: 6487 CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i, 6488 n[5].i, n[6].i, n[7].i, n[8].i, 6489 n[9].i, n[10].e)); 6490 break; 6491#endif 6492#if FEATURE_ATI_fragment_shader 6493 case OPCODE_BIND_FRAGMENT_SHADER_ATI: 6494 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i)); 6495 break; 6496 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI: 6497 { 6498 GLfloat values[4]; 6499 GLuint i, dst = n[1].ui; 6500 6501 for (i = 0; i < 4; i++) 6502 values[i] = n[1 + i].f; 6503 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values)); 6504 } 6505 break; 6506#endif 6507 case OPCODE_ATTR_1F_NV: 6508 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f)); 6509 break; 6510 case OPCODE_ATTR_2F_NV: 6511 /* Really shouldn't have to do this - the Node structure 6512 * is convenient, but it would be better to store the data 6513 * packed appropriately so that it can be sent directly 6514 * on. With x86_64 becoming common, this will start to 6515 * matter more. 6516 */ 6517 if (sizeof(Node) == sizeof(GLfloat)) 6518 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f)); 6519 else 6520 CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f)); 6521 break; 6522 case OPCODE_ATTR_3F_NV: 6523 if (sizeof(Node) == sizeof(GLfloat)) 6524 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f)); 6525 else 6526 CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f, 6527 n[4].f)); 6528 break; 6529 case OPCODE_ATTR_4F_NV: 6530 if (sizeof(Node) == sizeof(GLfloat)) 6531 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f)); 6532 else 6533 CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f, 6534 n[4].f, n[5].f)); 6535 break; 6536 case OPCODE_ATTR_1F_ARB: 6537 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f)); 6538 break; 6539 case OPCODE_ATTR_2F_ARB: 6540 /* Really shouldn't have to do this - the Node structure 6541 * is convenient, but it would be better to store the data 6542 * packed appropriately so that it can be sent directly 6543 * on. With x86_64 becoming common, this will start to 6544 * matter more. 6545 */ 6546 if (sizeof(Node) == sizeof(GLfloat)) 6547 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f)); 6548 else 6549 CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f)); 6550 break; 6551 case OPCODE_ATTR_3F_ARB: 6552 if (sizeof(Node) == sizeof(GLfloat)) 6553 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f)); 6554 else 6555 CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f, 6556 n[4].f)); 6557 break; 6558 case OPCODE_ATTR_4F_ARB: 6559 if (sizeof(Node) == sizeof(GLfloat)) 6560 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f)); 6561 else 6562 CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f, 6563 n[4].f, n[5].f)); 6564 break; 6565 case OPCODE_MATERIAL: 6566 if (sizeof(Node) == sizeof(GLfloat)) 6567 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f)); 6568 else { 6569 GLfloat f[4]; 6570 f[0] = n[3].f; 6571 f[1] = n[4].f; 6572 f[2] = n[5].f; 6573 f[3] = n[6].f; 6574 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f)); 6575 } 6576 break; 6577 case OPCODE_BEGIN: 6578 CALL_Begin(ctx->Exec, (n[1].e)); 6579 break; 6580 case OPCODE_END: 6581 CALL_End(ctx->Exec, ()); 6582 break; 6583 case OPCODE_RECTF: 6584 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 6585 break; 6586 case OPCODE_EVAL_C1: 6587 CALL_EvalCoord1f(ctx->Exec, (n[1].f)); 6588 break; 6589 case OPCODE_EVAL_C2: 6590 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f)); 6591 break; 6592 case OPCODE_EVAL_P1: 6593 CALL_EvalPoint1(ctx->Exec, (n[1].i)); 6594 break; 6595 case OPCODE_EVAL_P2: 6596 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i)); 6597 break; 6598 6599 6600 6601 6602 case OPCODE_CONTINUE: 6603 n = (Node *) n[1].next; 6604 break; 6605 case OPCODE_END_OF_LIST: 6606 done = GL_TRUE; 6607 break; 6608 default: 6609 { 6610 char msg[1000]; 6611 _mesa_sprintf(msg, "Error in execute_list: opcode=%d", 6612 (int) opcode); 6613 _mesa_problem(ctx, msg); 6614 } 6615 done = GL_TRUE; 6616 } 6617 6618 /* increment n to point to next compiled command */ 6619 if (opcode != OPCODE_CONTINUE) { 6620 n += InstSize[opcode]; 6621 } 6622 } 6623 } 6624 6625 if (ctx->Driver.EndCallList) 6626 ctx->Driver.EndCallList(ctx); 6627 6628 ctx->ListState.CallStack[ctx->ListState.CallDepth--] = NULL; 6629} 6630 6631 6632 6633/**********************************************************************/ 6634/* GL functions */ 6635/**********************************************************************/ 6636 6637/** 6638 * Test if a display list number is valid. 6639 */ 6640GLboolean GLAPIENTRY 6641_mesa_IsList(GLuint list) 6642{ 6643 GET_CURRENT_CONTEXT(ctx); 6644 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 6645 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); 6646 return islist(ctx, list); 6647} 6648 6649 6650/** 6651 * Delete a sequence of consecutive display lists. 6652 */ 6653void GLAPIENTRY 6654_mesa_DeleteLists(GLuint list, GLsizei range) 6655{ 6656 GET_CURRENT_CONTEXT(ctx); 6657 GLuint i; 6658 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 6659 ASSERT_OUTSIDE_BEGIN_END(ctx); 6660 6661 if (range < 0) { 6662 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists"); 6663 return; 6664 } 6665 for (i = list; i < list + range; i++) { 6666 destroy_list(ctx, i); 6667 } 6668} 6669 6670 6671/** 6672 * Return a display list number, n, such that lists n through n+range-1 6673 * are free. 6674 */ 6675GLuint GLAPIENTRY 6676_mesa_GenLists(GLsizei range) 6677{ 6678 GET_CURRENT_CONTEXT(ctx); 6679 GLuint base; 6680 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 6681 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); 6682 6683 if (range < 0) { 6684 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists"); 6685 return 0; 6686 } 6687 if (range == 0) { 6688 return 0; 6689 } 6690 6691 /* 6692 * Make this an atomic operation 6693 */ 6694 _glthread_LOCK_MUTEX(ctx->Shared->Mutex); 6695 6696 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); 6697 if (base) { 6698 /* reserve the list IDs by with empty/dummy lists */ 6699 GLint i; 6700 for (i = 0; i < range; i++) { 6701 _mesa_HashInsert(ctx->Shared->DisplayList, base + i, 6702 make_list(base + i, 1)); 6703 } 6704 } 6705 6706 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); 6707 6708 return base; 6709} 6710 6711 6712/** 6713 * Begin a new display list. 6714 */ 6715void GLAPIENTRY 6716_mesa_NewList(GLuint list, GLenum mode) 6717{ 6718 GET_CURRENT_CONTEXT(ctx); 6719 GLint i; 6720 6721 FLUSH_CURRENT(ctx, 0); /* must be called before assert */ 6722 ASSERT_OUTSIDE_BEGIN_END(ctx); 6723 6724 if (MESA_VERBOSE & VERBOSE_API) 6725 _mesa_debug(ctx, "glNewList %u %s\n", list, 6726 _mesa_lookup_enum_by_nr(mode)); 6727 6728 if (list == 0) { 6729 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList"); 6730 return; 6731 } 6732 6733 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) { 6734 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList"); 6735 return; 6736 } 6737 6738 if (ctx->ListState.CurrentListPtr) { 6739 /* already compiling a display list */ 6740 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList"); 6741 return; 6742 } 6743 6744 ctx->CompileFlag = GL_TRUE; 6745 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); 6746 6747 /* Allocate new display list */ 6748 ctx->ListState.CurrentListNum = list; 6749 ctx->ListState.CurrentList = make_list(list, BLOCK_SIZE); 6750 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node; 6751 ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock; 6752 ctx->ListState.CurrentPos = 0; 6753 6754 /* Reset acumulated list state: 6755 */ 6756 for (i = 0; i < VERT_ATTRIB_MAX; i++) 6757 ctx->ListState.ActiveAttribSize[i] = 0; 6758 6759 for (i = 0; i < MAT_ATTRIB_MAX; i++) 6760 ctx->ListState.ActiveMaterialSize[i] = 0; 6761 6762 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 6763 ctx->Driver.NewList(ctx, list, mode); 6764 6765 ctx->CurrentDispatch = ctx->Save; 6766 _glapi_set_dispatch(ctx->CurrentDispatch); 6767} 6768 6769 6770/** 6771 * End definition of current display list. 6772 */ 6773void GLAPIENTRY 6774_mesa_EndList(void) 6775{ 6776 GET_CURRENT_CONTEXT(ctx); 6777 SAVE_FLUSH_VERTICES(ctx); 6778 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); 6779 6780 if (MESA_VERBOSE & VERBOSE_API) 6781 _mesa_debug(ctx, "glEndList\n"); 6782 6783 /* Check that a list is under construction */ 6784 if (!ctx->ListState.CurrentListPtr) { 6785 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); 6786 return; 6787 } 6788 6789 (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); 6790 6791 /* Destroy old list, if any */ 6792 destroy_list(ctx, ctx->ListState.CurrentListNum); 6793 /* Install the list */ 6794 _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, 6795 ctx->ListState.CurrentList); 6796 6797 6798 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) 6799 mesa_print_display_list(ctx->ListState.CurrentListNum); 6800 6801 ctx->Driver.EndList(ctx); 6802 6803 ctx->ListState.CurrentList = NULL; 6804 ctx->ListState.CurrentListNum = 0; 6805 ctx->ListState.CurrentListPtr = NULL; 6806 ctx->ExecuteFlag = GL_TRUE; 6807 ctx->CompileFlag = GL_FALSE; 6808 6809 ctx->CurrentDispatch = ctx->Exec; 6810 _glapi_set_dispatch(ctx->CurrentDispatch); 6811} 6812 6813 6814void GLAPIENTRY 6815_mesa_CallList(GLuint list) 6816{ 6817 GLboolean save_compile_flag; 6818 GET_CURRENT_CONTEXT(ctx); 6819 FLUSH_CURRENT(ctx, 0); 6820 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */ 6821 /* execute the display list, and restore the CompileFlag. */ 6822 6823 if (MESA_VERBOSE & VERBOSE_API) 6824 _mesa_debug(ctx, "glCallList %d\n", list); 6825 6826 if (list == 0) { 6827 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)"); 6828 return; 6829 } 6830 6831/* mesa_print_display_list( list ); */ 6832 6833 save_compile_flag = ctx->CompileFlag; 6834 if (save_compile_flag) { 6835 ctx->CompileFlag = GL_FALSE; 6836 } 6837 6838 execute_list(ctx, list); 6839 ctx->CompileFlag = save_compile_flag; 6840 6841 /* also restore API function pointers to point to "save" versions */ 6842 if (save_compile_flag) { 6843 ctx->CurrentDispatch = ctx->Save; 6844 _glapi_set_dispatch(ctx->CurrentDispatch); 6845 } 6846} 6847 6848 6849/** 6850 * Execute glCallLists: call multiple display lists. 6851 */ 6852void GLAPIENTRY 6853_mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) 6854{ 6855 GET_CURRENT_CONTEXT(ctx); 6856 GLuint list; 6857 GLint i; 6858 GLboolean save_compile_flag; 6859 6860 if (MESA_VERBOSE & VERBOSE_API) 6861 _mesa_debug(ctx, "glCallLists %d\n", n); 6862 6863 switch (type) { 6864 case GL_BYTE: 6865 case GL_UNSIGNED_BYTE: 6866 case GL_SHORT: 6867 case GL_UNSIGNED_SHORT: 6868 case GL_INT: 6869 case GL_UNSIGNED_INT: 6870 case GL_FLOAT: 6871 case GL_2_BYTES: 6872 case GL_3_BYTES: 6873 case GL_4_BYTES: 6874 /* OK */ 6875 break; 6876 default: 6877 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); 6878 return; 6879 } 6880 6881 /* Save the CompileFlag status, turn it off, execute display list, 6882 * and restore the CompileFlag. 6883 */ 6884 save_compile_flag = ctx->CompileFlag; 6885 ctx->CompileFlag = GL_FALSE; 6886 6887 for (i = 0; i < n; i++) { 6888 list = translate_id(i, type, lists); 6889 execute_list(ctx, ctx->List.ListBase + list); 6890 } 6891 6892 ctx->CompileFlag = save_compile_flag; 6893 6894 /* also restore API function pointers to point to "save" versions */ 6895 if (save_compile_flag) { 6896 ctx->CurrentDispatch = ctx->Save; 6897 _glapi_set_dispatch(ctx->CurrentDispatch); 6898 } 6899} 6900 6901 6902/** 6903 * Set the offset added to list numbers in glCallLists. 6904 */ 6905void GLAPIENTRY 6906_mesa_ListBase(GLuint base) 6907{ 6908 GET_CURRENT_CONTEXT(ctx); 6909 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 6910 ASSERT_OUTSIDE_BEGIN_END(ctx); 6911 ctx->List.ListBase = base; 6912} 6913 6914 6915/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. 6916 */ 6917static void GLAPIENTRY 6918exec_Finish(void) 6919{ 6920 GET_CURRENT_CONTEXT(ctx); 6921 FLUSH_VERTICES(ctx, 0); 6922 CALL_Finish(ctx->Exec, ()); 6923} 6924 6925static void GLAPIENTRY 6926exec_Flush(void) 6927{ 6928 GET_CURRENT_CONTEXT(ctx); 6929 FLUSH_VERTICES(ctx, 0); 6930 CALL_Flush(ctx->Exec, ()); 6931} 6932 6933static void GLAPIENTRY 6934exec_GetBooleanv(GLenum pname, GLboolean *params) 6935{ 6936 GET_CURRENT_CONTEXT(ctx); 6937 FLUSH_VERTICES(ctx, 0); 6938 CALL_GetBooleanv(ctx->Exec, (pname, params)); 6939} 6940 6941static void GLAPIENTRY 6942exec_GetClipPlane(GLenum plane, GLdouble * equation) 6943{ 6944 GET_CURRENT_CONTEXT(ctx); 6945 FLUSH_VERTICES(ctx, 0); 6946 CALL_GetClipPlane(ctx->Exec, (plane, equation)); 6947} 6948 6949static void GLAPIENTRY 6950exec_GetDoublev(GLenum pname, GLdouble *params) 6951{ 6952 GET_CURRENT_CONTEXT(ctx); 6953 FLUSH_VERTICES(ctx, 0); 6954 CALL_GetDoublev(ctx->Exec, (pname, params)); 6955} 6956 6957static GLenum GLAPIENTRY 6958exec_GetError(void) 6959{ 6960 GET_CURRENT_CONTEXT(ctx); 6961 FLUSH_VERTICES(ctx, 0); 6962 return CALL_GetError(ctx->Exec, ()); 6963} 6964 6965static void GLAPIENTRY 6966exec_GetFloatv(GLenum pname, GLfloat *params) 6967{ 6968 GET_CURRENT_CONTEXT(ctx); 6969 FLUSH_VERTICES(ctx, 0); 6970 CALL_GetFloatv(ctx->Exec, (pname, params)); 6971} 6972 6973static void GLAPIENTRY 6974exec_GetIntegerv(GLenum pname, GLint *params) 6975{ 6976 GET_CURRENT_CONTEXT(ctx); 6977 FLUSH_VERTICES(ctx, 0); 6978 CALL_GetIntegerv(ctx->Exec, (pname, params)); 6979} 6980 6981static void GLAPIENTRY 6982exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params) 6983{ 6984 GET_CURRENT_CONTEXT(ctx); 6985 FLUSH_VERTICES(ctx, 0); 6986 CALL_GetLightfv(ctx->Exec, (light, pname, params)); 6987} 6988 6989static void GLAPIENTRY 6990exec_GetLightiv(GLenum light, GLenum pname, GLint *params) 6991{ 6992 GET_CURRENT_CONTEXT(ctx); 6993 FLUSH_VERTICES(ctx, 0); 6994 CALL_GetLightiv(ctx->Exec, (light, pname, params)); 6995} 6996 6997static void GLAPIENTRY 6998exec_GetMapdv(GLenum target, GLenum query, GLdouble * v) 6999{ 7000 GET_CURRENT_CONTEXT(ctx); 7001 FLUSH_VERTICES(ctx, 0); 7002 CALL_GetMapdv(ctx->Exec, (target, query, v)); 7003} 7004 7005static void GLAPIENTRY 7006exec_GetMapfv(GLenum target, GLenum query, GLfloat * v) 7007{ 7008 GET_CURRENT_CONTEXT(ctx); 7009 FLUSH_VERTICES(ctx, 0); 7010 CALL_GetMapfv(ctx->Exec, (target, query, v)); 7011} 7012 7013static void GLAPIENTRY 7014exec_GetMapiv(GLenum target, GLenum query, GLint * v) 7015{ 7016 GET_CURRENT_CONTEXT(ctx); 7017 FLUSH_VERTICES(ctx, 0); 7018 CALL_GetMapiv(ctx->Exec, (target, query, v)); 7019} 7020 7021static void GLAPIENTRY 7022exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params) 7023{ 7024 GET_CURRENT_CONTEXT(ctx); 7025 FLUSH_VERTICES(ctx, 0); 7026 CALL_GetMaterialfv(ctx->Exec, (face, pname, params)); 7027} 7028 7029static void GLAPIENTRY 7030exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params) 7031{ 7032 GET_CURRENT_CONTEXT(ctx); 7033 FLUSH_VERTICES(ctx, 0); 7034 CALL_GetMaterialiv(ctx->Exec, (face, pname, params)); 7035} 7036 7037static void GLAPIENTRY 7038exec_GetPixelMapfv(GLenum map, GLfloat *values) 7039{ 7040 GET_CURRENT_CONTEXT(ctx); 7041 FLUSH_VERTICES(ctx, 0); 7042 CALL_GetPixelMapfv(ctx->Exec, (map, values)); 7043} 7044 7045static void GLAPIENTRY 7046exec_GetPixelMapuiv(GLenum map, GLuint *values) 7047{ 7048 GET_CURRENT_CONTEXT(ctx); 7049 FLUSH_VERTICES(ctx, 0); 7050 CALL_GetPixelMapuiv(ctx->Exec, (map, values)); 7051} 7052 7053static void GLAPIENTRY 7054exec_GetPixelMapusv(GLenum map, GLushort *values) 7055{ 7056 GET_CURRENT_CONTEXT(ctx); 7057 FLUSH_VERTICES(ctx, 0); 7058 CALL_GetPixelMapusv(ctx->Exec, (map, values)); 7059} 7060 7061static void GLAPIENTRY 7062exec_GetPolygonStipple(GLubyte * dest) 7063{ 7064 GET_CURRENT_CONTEXT(ctx); 7065 FLUSH_VERTICES(ctx, 0); 7066 CALL_GetPolygonStipple(ctx->Exec, (dest)); 7067} 7068 7069static const GLubyte *GLAPIENTRY 7070exec_GetString(GLenum name) 7071{ 7072 GET_CURRENT_CONTEXT(ctx); 7073 FLUSH_VERTICES(ctx, 0); 7074 return CALL_GetString(ctx->Exec, (name)); 7075} 7076 7077static void GLAPIENTRY 7078exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) 7079{ 7080 GET_CURRENT_CONTEXT(ctx); 7081 FLUSH_VERTICES(ctx, 0); 7082 CALL_GetTexEnvfv(ctx->Exec, (target, pname, params)); 7083} 7084 7085static void GLAPIENTRY 7086exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params) 7087{ 7088 GET_CURRENT_CONTEXT(ctx); 7089 FLUSH_VERTICES(ctx, 0); 7090 CALL_GetTexEnviv(ctx->Exec, (target, pname, params)); 7091} 7092 7093static void GLAPIENTRY 7094exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params) 7095{ 7096 GET_CURRENT_CONTEXT(ctx); 7097 FLUSH_VERTICES(ctx, 0); 7098 CALL_GetTexGendv(ctx->Exec, (coord, pname, params)); 7099} 7100 7101static void GLAPIENTRY 7102exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) 7103{ 7104 GET_CURRENT_CONTEXT(ctx); 7105 FLUSH_VERTICES(ctx, 0); 7106 CALL_GetTexGenfv(ctx->Exec, (coord, pname, params)); 7107} 7108 7109static void GLAPIENTRY 7110exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params) 7111{ 7112 GET_CURRENT_CONTEXT(ctx); 7113 FLUSH_VERTICES(ctx, 0); 7114 CALL_GetTexGeniv(ctx->Exec, (coord, pname, params)); 7115} 7116 7117static void GLAPIENTRY 7118exec_GetTexImage(GLenum target, GLint level, GLenum format, 7119 GLenum type, GLvoid * pixels) 7120{ 7121 GET_CURRENT_CONTEXT(ctx); 7122 FLUSH_VERTICES(ctx, 0); 7123 CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels)); 7124} 7125 7126static void GLAPIENTRY 7127exec_GetTexLevelParameterfv(GLenum target, GLint level, 7128 GLenum pname, GLfloat *params) 7129{ 7130 GET_CURRENT_CONTEXT(ctx); 7131 FLUSH_VERTICES(ctx, 0); 7132 CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params)); 7133} 7134 7135static void GLAPIENTRY 7136exec_GetTexLevelParameteriv(GLenum target, GLint level, 7137 GLenum pname, GLint *params) 7138{ 7139 GET_CURRENT_CONTEXT(ctx); 7140 FLUSH_VERTICES(ctx, 0); 7141 CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params)); 7142} 7143 7144static void GLAPIENTRY 7145exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) 7146{ 7147 GET_CURRENT_CONTEXT(ctx); 7148 FLUSH_VERTICES(ctx, 0); 7149 CALL_GetTexParameterfv(ctx->Exec, (target, pname, params)); 7150} 7151 7152static void GLAPIENTRY 7153exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params) 7154{ 7155 GET_CURRENT_CONTEXT(ctx); 7156 FLUSH_VERTICES(ctx, 0); 7157 CALL_GetTexParameteriv(ctx->Exec, (target, pname, params)); 7158} 7159 7160static GLboolean GLAPIENTRY 7161exec_IsEnabled(GLenum cap) 7162{ 7163 GET_CURRENT_CONTEXT(ctx); 7164 FLUSH_VERTICES(ctx, 0); 7165 return CALL_IsEnabled(ctx->Exec, (cap)); 7166} 7167 7168static void GLAPIENTRY 7169exec_PixelStoref(GLenum pname, GLfloat param) 7170{ 7171 GET_CURRENT_CONTEXT(ctx); 7172 FLUSH_VERTICES(ctx, 0); 7173 CALL_PixelStoref(ctx->Exec, (pname, param)); 7174} 7175 7176static void GLAPIENTRY 7177exec_PixelStorei(GLenum pname, GLint param) 7178{ 7179 GET_CURRENT_CONTEXT(ctx); 7180 FLUSH_VERTICES(ctx, 0); 7181 CALL_PixelStorei(ctx->Exec, (pname, param)); 7182} 7183 7184static void GLAPIENTRY 7185exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, 7186 GLenum format, GLenum type, GLvoid * pixels) 7187{ 7188 GET_CURRENT_CONTEXT(ctx); 7189 FLUSH_VERTICES(ctx, 0); 7190 CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels)); 7191} 7192 7193static GLint GLAPIENTRY 7194exec_RenderMode(GLenum mode) 7195{ 7196 GET_CURRENT_CONTEXT(ctx); 7197 FLUSH_VERTICES(ctx, 0); 7198 return CALL_RenderMode(ctx->Exec, (mode)); 7199} 7200 7201static void GLAPIENTRY 7202exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer) 7203{ 7204 GET_CURRENT_CONTEXT(ctx); 7205 FLUSH_VERTICES(ctx, 0); 7206 CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer)); 7207} 7208 7209static void GLAPIENTRY 7210exec_SelectBuffer(GLsizei size, GLuint * buffer) 7211{ 7212 GET_CURRENT_CONTEXT(ctx); 7213 FLUSH_VERTICES(ctx, 0); 7214 CALL_SelectBuffer(ctx->Exec, (size, buffer)); 7215} 7216 7217static GLboolean GLAPIENTRY 7218exec_AreTexturesResident(GLsizei n, const GLuint * texName, 7219 GLboolean * residences) 7220{ 7221 GET_CURRENT_CONTEXT(ctx); 7222 FLUSH_VERTICES(ctx, 0); 7223 return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences)); 7224} 7225 7226static void GLAPIENTRY 7227exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) 7228{ 7229 GET_CURRENT_CONTEXT(ctx); 7230 FLUSH_VERTICES(ctx, 0); 7231 CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr)); 7232} 7233 7234static void GLAPIENTRY 7235exec_DeleteTextures(GLsizei n, const GLuint * texName) 7236{ 7237 GET_CURRENT_CONTEXT(ctx); 7238 FLUSH_VERTICES(ctx, 0); 7239 CALL_DeleteTextures(ctx->Exec, (n, texName)); 7240} 7241 7242static void GLAPIENTRY 7243exec_DisableClientState(GLenum cap) 7244{ 7245 GET_CURRENT_CONTEXT(ctx); 7246 FLUSH_VERTICES(ctx, 0); 7247 CALL_DisableClientState(ctx->Exec, (cap)); 7248} 7249 7250static void GLAPIENTRY 7251exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr) 7252{ 7253 GET_CURRENT_CONTEXT(ctx); 7254 FLUSH_VERTICES(ctx, 0); 7255 CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr)); 7256} 7257 7258static void GLAPIENTRY 7259exec_EnableClientState(GLenum cap) 7260{ 7261 GET_CURRENT_CONTEXT(ctx); 7262 FLUSH_VERTICES(ctx, 0); 7263 CALL_EnableClientState(ctx->Exec, (cap)); 7264} 7265 7266static void GLAPIENTRY 7267exec_GenTextures(GLsizei n, GLuint * texName) 7268{ 7269 GET_CURRENT_CONTEXT(ctx); 7270 FLUSH_VERTICES(ctx, 0); 7271 CALL_GenTextures(ctx->Exec, (n, texName)); 7272} 7273 7274static void GLAPIENTRY 7275exec_GetPointerv(GLenum pname, GLvoid **params) 7276{ 7277 GET_CURRENT_CONTEXT(ctx); 7278 FLUSH_VERTICES(ctx, 0); 7279 CALL_GetPointerv(ctx->Exec, (pname, params)); 7280} 7281 7282static void GLAPIENTRY 7283exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) 7284{ 7285 GET_CURRENT_CONTEXT(ctx); 7286 FLUSH_VERTICES(ctx, 0); 7287 CALL_IndexPointer(ctx->Exec, (type, stride, ptr)); 7288} 7289 7290static void GLAPIENTRY 7291exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer) 7292{ 7293 GET_CURRENT_CONTEXT(ctx); 7294 FLUSH_VERTICES(ctx, 0); 7295 CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer)); 7296} 7297 7298static GLboolean GLAPIENTRY 7299exec_IsTexture(GLuint texture) 7300{ 7301 GET_CURRENT_CONTEXT(ctx); 7302 FLUSH_VERTICES(ctx, 0); 7303 return CALL_IsTexture(ctx->Exec, (texture)); 7304} 7305 7306static void GLAPIENTRY 7307exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr) 7308{ 7309 GET_CURRENT_CONTEXT(ctx); 7310 FLUSH_VERTICES(ctx, 0); 7311 CALL_NormalPointer(ctx->Exec, (type, stride, ptr)); 7312} 7313 7314static void GLAPIENTRY 7315exec_PopClientAttrib(void) 7316{ 7317 GET_CURRENT_CONTEXT(ctx); 7318 FLUSH_VERTICES(ctx, 0); 7319 CALL_PopClientAttrib(ctx->Exec, ()); 7320} 7321 7322static void GLAPIENTRY 7323exec_PushClientAttrib(GLbitfield mask) 7324{ 7325 GET_CURRENT_CONTEXT(ctx); 7326 FLUSH_VERTICES(ctx, 0); 7327 CALL_PushClientAttrib(ctx->Exec, (mask)); 7328} 7329 7330static void GLAPIENTRY 7331exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, 7332 const GLvoid *ptr) 7333{ 7334 GET_CURRENT_CONTEXT(ctx); 7335 FLUSH_VERTICES(ctx, 0); 7336 CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr)); 7337} 7338 7339static void GLAPIENTRY 7340exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img) 7341{ 7342 GET_CURRENT_CONTEXT(ctx); 7343 FLUSH_VERTICES(ctx, 0); 7344 CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img)); 7345} 7346 7347static void GLAPIENTRY 7348exec_VertexPointer(GLint size, GLenum type, GLsizei stride, 7349 const GLvoid *ptr) 7350{ 7351 GET_CURRENT_CONTEXT(ctx); 7352 FLUSH_VERTICES(ctx, 0); 7353 CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr)); 7354} 7355 7356static void GLAPIENTRY 7357exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, 7358 GLint x, GLint y, GLsizei width) 7359{ 7360 GET_CURRENT_CONTEXT(ctx); 7361 FLUSH_VERTICES(ctx, 0); 7362 CALL_CopyConvolutionFilter1D(ctx->Exec, 7363 (target, internalFormat, x, y, width)); 7364} 7365 7366static void GLAPIENTRY 7367exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, 7368 GLint x, GLint y, GLsizei width, GLsizei height) 7369{ 7370 GET_CURRENT_CONTEXT(ctx); 7371 FLUSH_VERTICES(ctx, 0); 7372 CALL_CopyConvolutionFilter2D(ctx->Exec, 7373 (target, internalFormat, x, y, width, 7374 height)); 7375} 7376 7377static void GLAPIENTRY 7378exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data) 7379{ 7380 GET_CURRENT_CONTEXT(ctx); 7381 FLUSH_VERTICES(ctx, 0); 7382 CALL_GetColorTable(ctx->Exec, (target, format, type, data)); 7383} 7384 7385static void GLAPIENTRY 7386exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) 7387{ 7388 GET_CURRENT_CONTEXT(ctx); 7389 FLUSH_VERTICES(ctx, 0); 7390 CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params)); 7391} 7392 7393static void GLAPIENTRY 7394exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) 7395{ 7396 GET_CURRENT_CONTEXT(ctx); 7397 FLUSH_VERTICES(ctx, 0); 7398 CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params)); 7399} 7400 7401static void GLAPIENTRY 7402exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, 7403 GLvoid * image) 7404{ 7405 GET_CURRENT_CONTEXT(ctx); 7406 FLUSH_VERTICES(ctx, 0); 7407 CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image)); 7408} 7409 7410static void GLAPIENTRY 7411exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) 7412{ 7413 GET_CURRENT_CONTEXT(ctx); 7414 FLUSH_VERTICES(ctx, 0); 7415 CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params)); 7416} 7417 7418static void GLAPIENTRY 7419exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) 7420{ 7421 GET_CURRENT_CONTEXT(ctx); 7422 FLUSH_VERTICES(ctx, 0); 7423 CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params)); 7424} 7425 7426static void GLAPIENTRY 7427exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, 7428 GLenum type, GLvoid *values) 7429{ 7430 GET_CURRENT_CONTEXT(ctx); 7431 FLUSH_VERTICES(ctx, 0); 7432 CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values)); 7433} 7434 7435static void GLAPIENTRY 7436exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) 7437{ 7438 GET_CURRENT_CONTEXT(ctx); 7439 FLUSH_VERTICES(ctx, 0); 7440 CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params)); 7441} 7442 7443static void GLAPIENTRY 7444exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) 7445{ 7446 GET_CURRENT_CONTEXT(ctx); 7447 FLUSH_VERTICES(ctx, 0); 7448 CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params)); 7449} 7450 7451static void GLAPIENTRY 7452exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, 7453 GLenum type, GLvoid *values) 7454{ 7455 GET_CURRENT_CONTEXT(ctx); 7456 FLUSH_VERTICES(ctx, 0); 7457 CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values)); 7458} 7459 7460static void GLAPIENTRY 7461exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) 7462{ 7463 GET_CURRENT_CONTEXT(ctx); 7464 FLUSH_VERTICES(ctx, 0); 7465 CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params)); 7466} 7467 7468static void GLAPIENTRY 7469exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) 7470{ 7471 GET_CURRENT_CONTEXT(ctx); 7472 FLUSH_VERTICES(ctx, 0); 7473 CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params)); 7474} 7475 7476static void GLAPIENTRY 7477exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, 7478 GLvoid *row, GLvoid *column, GLvoid *span) 7479{ 7480 GET_CURRENT_CONTEXT(ctx); 7481 FLUSH_VERTICES(ctx, 0); 7482 CALL_GetSeparableFilter(ctx->Exec, 7483 (target, format, type, row, column, span)); 7484} 7485 7486static void GLAPIENTRY 7487exec_SeparableFilter2D(GLenum target, GLenum internalFormat, 7488 GLsizei width, GLsizei height, GLenum format, 7489 GLenum type, const GLvoid *row, const GLvoid *column) 7490{ 7491 GET_CURRENT_CONTEXT(ctx); 7492 FLUSH_VERTICES(ctx, 0); 7493 CALL_SeparableFilter2D(ctx->Exec, 7494 (target, internalFormat, width, height, format, 7495 type, row, column)); 7496} 7497 7498static void GLAPIENTRY 7499exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, 7500 GLsizei count, const GLvoid *ptr) 7501{ 7502 GET_CURRENT_CONTEXT(ctx); 7503 FLUSH_VERTICES(ctx, 0); 7504 CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); 7505} 7506 7507static void GLAPIENTRY 7508exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) 7509{ 7510 GET_CURRENT_CONTEXT(ctx); 7511 FLUSH_VERTICES(ctx, 0); 7512 CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr)); 7513} 7514 7515static void GLAPIENTRY 7516exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, 7517 const GLvoid *ptr) 7518{ 7519 GET_CURRENT_CONTEXT(ctx); 7520 FLUSH_VERTICES(ctx, 0); 7521 CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr)); 7522} 7523 7524static void GLAPIENTRY 7525exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, 7526 const GLvoid *ptr) 7527{ 7528 GET_CURRENT_CONTEXT(ctx); 7529 FLUSH_VERTICES(ctx, 0); 7530 CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr)); 7531} 7532 7533static void GLAPIENTRY 7534exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, 7535 GLsizei count, const GLvoid *ptr) 7536{ 7537 GET_CURRENT_CONTEXT(ctx); 7538 FLUSH_VERTICES(ctx, 0); 7539 CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); 7540} 7541 7542static void GLAPIENTRY 7543exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, 7544 GLsizei count, const GLvoid *ptr) 7545{ 7546 GET_CURRENT_CONTEXT(ctx); 7547 FLUSH_VERTICES(ctx, 0); 7548 CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); 7549} 7550 7551static void GLAPIENTRY 7552exec_LockArraysEXT(GLint first, GLsizei count) 7553{ 7554 GET_CURRENT_CONTEXT(ctx); 7555 FLUSH_VERTICES(ctx, 0); 7556 CALL_LockArraysEXT(ctx->Exec, (first, count)); 7557} 7558 7559static void GLAPIENTRY 7560exec_UnlockArraysEXT(void) 7561{ 7562 GET_CURRENT_CONTEXT(ctx); 7563 FLUSH_VERTICES(ctx, 0); 7564 CALL_UnlockArraysEXT(ctx->Exec, ()); 7565} 7566 7567static void GLAPIENTRY 7568exec_ClientActiveTextureARB(GLenum target) 7569{ 7570 GET_CURRENT_CONTEXT(ctx); 7571 FLUSH_VERTICES(ctx, 0); 7572 CALL_ClientActiveTextureARB(ctx->Exec, (target)); 7573} 7574 7575static void GLAPIENTRY 7576exec_SecondaryColorPointerEXT(GLint size, GLenum type, 7577 GLsizei stride, const GLvoid *ptr) 7578{ 7579 GET_CURRENT_CONTEXT(ctx); 7580 FLUSH_VERTICES(ctx, 0); 7581 CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr)); 7582} 7583 7584static void GLAPIENTRY 7585exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) 7586{ 7587 GET_CURRENT_CONTEXT(ctx); 7588 FLUSH_VERTICES(ctx, 0); 7589 CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr)); 7590} 7591 7592/* GL_EXT_multi_draw_arrays */ 7593static void GLAPIENTRY 7594exec_MultiDrawArraysEXT(GLenum mode, GLint * first, 7595 GLsizei * count, GLsizei primcount) 7596{ 7597 GET_CURRENT_CONTEXT(ctx); 7598 FLUSH_VERTICES(ctx, 0); 7599 CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount)); 7600} 7601 7602/* GL_EXT_multi_draw_arrays */ 7603static void GLAPIENTRY 7604exec_MultiDrawElementsEXT(GLenum mode, const GLsizei * count, 7605 GLenum type, const GLvoid ** indices, 7606 GLsizei primcount) 7607{ 7608 GET_CURRENT_CONTEXT(ctx); 7609 FLUSH_VERTICES(ctx, 0); 7610 CALL_MultiDrawElementsEXT(ctx->Exec, 7611 (mode, count, type, indices, primcount)); 7612} 7613 7614/* GL_IBM_multimode_draw_arrays */ 7615static void GLAPIENTRY 7616exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first, 7617 const GLsizei * count, GLsizei primcount, 7618 GLint modestride) 7619{ 7620 GET_CURRENT_CONTEXT(ctx); 7621 FLUSH_VERTICES(ctx, 0); 7622 CALL_MultiModeDrawArraysIBM(ctx->Exec, 7623 (mode, first, count, primcount, modestride)); 7624} 7625 7626/* GL_IBM_multimode_draw_arrays */ 7627static void GLAPIENTRY 7628exec_MultiModeDrawElementsIBM(const GLenum * mode, 7629 const GLsizei * count, 7630 GLenum type, 7631 const GLvoid * const *indices, 7632 GLsizei primcount, GLint modestride) 7633{ 7634 GET_CURRENT_CONTEXT(ctx); 7635 FLUSH_VERTICES(ctx, 0); 7636 CALL_MultiModeDrawElementsIBM(ctx->Exec, 7637 (mode, count, type, indices, primcount, 7638 modestride)); 7639} 7640 7641 7642 7643/** 7644 * Setup the given dispatch table to point to Mesa's display list 7645 * building functions. 7646 * 7647 * This does not include any of the tnl functions - they are 7648 * initialized from _mesa_init_api_defaults and from the active vtxfmt 7649 * struct. 7650 */ 7651void 7652_mesa_init_dlist_table(struct _glapi_table *table) 7653{ 7654 _mesa_loopback_init_api_table(table); 7655 7656 /* GL 1.0 */ 7657 SET_Accum(table, save_Accum); 7658 SET_AlphaFunc(table, save_AlphaFunc); 7659 SET_Bitmap(table, save_Bitmap); 7660 SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */ 7661 SET_CallList(table, _mesa_save_CallList); 7662 SET_CallLists(table, _mesa_save_CallLists); 7663 SET_Clear(table, save_Clear); 7664 SET_ClearAccum(table, save_ClearAccum); 7665 SET_ClearColor(table, save_ClearColor); 7666 SET_ClearDepth(table, save_ClearDepth); 7667 SET_ClearIndex(table, save_ClearIndex); 7668 SET_ClearStencil(table, save_ClearStencil); 7669 SET_ClipPlane(table, save_ClipPlane); 7670 SET_ColorMask(table, save_ColorMask); 7671 SET_ColorMaterial(table, save_ColorMaterial); 7672 SET_CopyPixels(table, save_CopyPixels); 7673 SET_CullFace(table, save_CullFace); 7674 SET_DeleteLists(table, _mesa_DeleteLists); 7675 SET_DepthFunc(table, save_DepthFunc); 7676 SET_DepthMask(table, save_DepthMask); 7677 SET_DepthRange(table, save_DepthRange); 7678 SET_Disable(table, save_Disable); 7679 SET_DrawBuffer(table, save_DrawBuffer); 7680 SET_DrawPixels(table, save_DrawPixels); 7681 SET_Enable(table, save_Enable); 7682 SET_EndList(table, _mesa_EndList); 7683 SET_EvalMesh1(table, _mesa_save_EvalMesh1); 7684 SET_EvalMesh2(table, _mesa_save_EvalMesh2); 7685 SET_Finish(table, exec_Finish); 7686 SET_Flush(table, exec_Flush); 7687 SET_Fogf(table, save_Fogf); 7688 SET_Fogfv(table, save_Fogfv); 7689 SET_Fogi(table, save_Fogi); 7690 SET_Fogiv(table, save_Fogiv); 7691 SET_FrontFace(table, save_FrontFace); 7692 SET_Frustum(table, save_Frustum); 7693 SET_GenLists(table, _mesa_GenLists); 7694 SET_GetBooleanv(table, exec_GetBooleanv); 7695 SET_GetClipPlane(table, exec_GetClipPlane); 7696 SET_GetDoublev(table, exec_GetDoublev); 7697 SET_GetError(table, exec_GetError); 7698 SET_GetFloatv(table, exec_GetFloatv); 7699 SET_GetIntegerv(table, exec_GetIntegerv); 7700 SET_GetLightfv(table, exec_GetLightfv); 7701 SET_GetLightiv(table, exec_GetLightiv); 7702 SET_GetMapdv(table, exec_GetMapdv); 7703 SET_GetMapfv(table, exec_GetMapfv); 7704 SET_GetMapiv(table, exec_GetMapiv); 7705 SET_GetMaterialfv(table, exec_GetMaterialfv); 7706 SET_GetMaterialiv(table, exec_GetMaterialiv); 7707 SET_GetPixelMapfv(table, exec_GetPixelMapfv); 7708 SET_GetPixelMapuiv(table, exec_GetPixelMapuiv); 7709 SET_GetPixelMapusv(table, exec_GetPixelMapusv); 7710 SET_GetPolygonStipple(table, exec_GetPolygonStipple); 7711 SET_GetString(table, exec_GetString); 7712 SET_GetTexEnvfv(table, exec_GetTexEnvfv); 7713 SET_GetTexEnviv(table, exec_GetTexEnviv); 7714 SET_GetTexGendv(table, exec_GetTexGendv); 7715 SET_GetTexGenfv(table, exec_GetTexGenfv); 7716 SET_GetTexGeniv(table, exec_GetTexGeniv); 7717 SET_GetTexImage(table, exec_GetTexImage); 7718 SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv); 7719 SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv); 7720 SET_GetTexParameterfv(table, exec_GetTexParameterfv); 7721 SET_GetTexParameteriv(table, exec_GetTexParameteriv); 7722 SET_Hint(table, save_Hint); 7723 SET_IndexMask(table, save_IndexMask); 7724 SET_InitNames(table, save_InitNames); 7725 SET_IsEnabled(table, exec_IsEnabled); 7726 SET_IsList(table, _mesa_IsList); 7727 SET_LightModelf(table, save_LightModelf); 7728 SET_LightModelfv(table, save_LightModelfv); 7729 SET_LightModeli(table, save_LightModeli); 7730 SET_LightModeliv(table, save_LightModeliv); 7731 SET_Lightf(table, save_Lightf); 7732 SET_Lightfv(table, save_Lightfv); 7733 SET_Lighti(table, save_Lighti); 7734 SET_Lightiv(table, save_Lightiv); 7735 SET_LineStipple(table, save_LineStipple); 7736 SET_LineWidth(table, save_LineWidth); 7737 SET_ListBase(table, save_ListBase); 7738 SET_LoadIdentity(table, save_LoadIdentity); 7739 SET_LoadMatrixd(table, save_LoadMatrixd); 7740 SET_LoadMatrixf(table, save_LoadMatrixf); 7741 SET_LoadName(table, save_LoadName); 7742 SET_LogicOp(table, save_LogicOp); 7743 SET_Map1d(table, save_Map1d); 7744 SET_Map1f(table, save_Map1f); 7745 SET_Map2d(table, save_Map2d); 7746 SET_Map2f(table, save_Map2f); 7747 SET_MapGrid1d(table, save_MapGrid1d); 7748 SET_MapGrid1f(table, save_MapGrid1f); 7749 SET_MapGrid2d(table, save_MapGrid2d); 7750 SET_MapGrid2f(table, save_MapGrid2f); 7751 SET_MatrixMode(table, save_MatrixMode); 7752 SET_MultMatrixd(table, save_MultMatrixd); 7753 SET_MultMatrixf(table, save_MultMatrixf); 7754 SET_NewList(table, save_NewList); 7755 SET_Ortho(table, save_Ortho); 7756 SET_PassThrough(table, save_PassThrough); 7757 SET_PixelMapfv(table, save_PixelMapfv); 7758 SET_PixelMapuiv(table, save_PixelMapuiv); 7759 SET_PixelMapusv(table, save_PixelMapusv); 7760 SET_PixelStoref(table, exec_PixelStoref); 7761 SET_PixelStorei(table, exec_PixelStorei); 7762 SET_PixelTransferf(table, save_PixelTransferf); 7763 SET_PixelTransferi(table, save_PixelTransferi); 7764 SET_PixelZoom(table, save_PixelZoom); 7765 SET_PointSize(table, save_PointSize); 7766 SET_PolygonMode(table, save_PolygonMode); 7767 SET_PolygonOffset(table, save_PolygonOffset); 7768 SET_PolygonStipple(table, save_PolygonStipple); 7769 SET_PopAttrib(table, save_PopAttrib); 7770 SET_PopMatrix(table, save_PopMatrix); 7771 SET_PopName(table, save_PopName); 7772 SET_PushAttrib(table, save_PushAttrib); 7773 SET_PushMatrix(table, save_PushMatrix); 7774 SET_PushName(table, save_PushName); 7775 SET_RasterPos2d(table, save_RasterPos2d); 7776 SET_RasterPos2dv(table, save_RasterPos2dv); 7777 SET_RasterPos2f(table, save_RasterPos2f); 7778 SET_RasterPos2fv(table, save_RasterPos2fv); 7779 SET_RasterPos2i(table, save_RasterPos2i); 7780 SET_RasterPos2iv(table, save_RasterPos2iv); 7781 SET_RasterPos2s(table, save_RasterPos2s); 7782 SET_RasterPos2sv(table, save_RasterPos2sv); 7783 SET_RasterPos3d(table, save_RasterPos3d); 7784 SET_RasterPos3dv(table, save_RasterPos3dv); 7785 SET_RasterPos3f(table, save_RasterPos3f); 7786 SET_RasterPos3fv(table, save_RasterPos3fv); 7787 SET_RasterPos3i(table, save_RasterPos3i); 7788 SET_RasterPos3iv(table, save_RasterPos3iv); 7789 SET_RasterPos3s(table, save_RasterPos3s); 7790 SET_RasterPos3sv(table, save_RasterPos3sv); 7791 SET_RasterPos4d(table, save_RasterPos4d); 7792 SET_RasterPos4dv(table, save_RasterPos4dv); 7793 SET_RasterPos4f(table, save_RasterPos4f); 7794 SET_RasterPos4fv(table, save_RasterPos4fv); 7795 SET_RasterPos4i(table, save_RasterPos4i); 7796 SET_RasterPos4iv(table, save_RasterPos4iv); 7797 SET_RasterPos4s(table, save_RasterPos4s); 7798 SET_RasterPos4sv(table, save_RasterPos4sv); 7799 SET_ReadBuffer(table, save_ReadBuffer); 7800 SET_ReadPixels(table, exec_ReadPixels); 7801 SET_RenderMode(table, exec_RenderMode); 7802 SET_Rotated(table, save_Rotated); 7803 SET_Rotatef(table, save_Rotatef); 7804 SET_Scaled(table, save_Scaled); 7805 SET_Scalef(table, save_Scalef); 7806 SET_Scissor(table, save_Scissor); 7807 SET_FeedbackBuffer(table, exec_FeedbackBuffer); 7808 SET_SelectBuffer(table, exec_SelectBuffer); 7809 SET_ShadeModel(table, save_ShadeModel); 7810 SET_StencilFunc(table, save_StencilFunc); 7811 SET_StencilMask(table, save_StencilMask); 7812 SET_StencilOp(table, save_StencilOp); 7813 SET_TexEnvf(table, save_TexEnvf); 7814 SET_TexEnvfv(table, save_TexEnvfv); 7815 SET_TexEnvi(table, save_TexEnvi); 7816 SET_TexEnviv(table, save_TexEnviv); 7817 SET_TexGend(table, save_TexGend); 7818 SET_TexGendv(table, save_TexGendv); 7819 SET_TexGenf(table, save_TexGenf); 7820 SET_TexGenfv(table, save_TexGenfv); 7821 SET_TexGeni(table, save_TexGeni); 7822 SET_TexGeniv(table, save_TexGeniv); 7823 SET_TexImage1D(table, save_TexImage1D); 7824 SET_TexImage2D(table, save_TexImage2D); 7825 SET_TexParameterf(table, save_TexParameterf); 7826 SET_TexParameterfv(table, save_TexParameterfv); 7827 SET_TexParameteri(table, save_TexParameteri); 7828 SET_TexParameteriv(table, save_TexParameteriv); 7829 SET_Translated(table, save_Translated); 7830 SET_Translatef(table, save_Translatef); 7831 SET_Viewport(table, save_Viewport); 7832 7833 /* GL 1.1 */ 7834 SET_AreTexturesResident(table, exec_AreTexturesResident); 7835 SET_BindTexture(table, save_BindTexture); 7836 SET_ColorPointer(table, exec_ColorPointer); 7837 SET_CopyTexImage1D(table, save_CopyTexImage1D); 7838 SET_CopyTexImage2D(table, save_CopyTexImage2D); 7839 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D); 7840 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D); 7841 SET_DeleteTextures(table, exec_DeleteTextures); 7842 SET_DisableClientState(table, exec_DisableClientState); 7843 SET_EdgeFlagPointer(table, exec_EdgeFlagPointer); 7844 SET_EnableClientState(table, exec_EnableClientState); 7845 SET_GenTextures(table, exec_GenTextures); 7846 SET_GetPointerv(table, exec_GetPointerv); 7847 SET_IndexPointer(table, exec_IndexPointer); 7848 SET_InterleavedArrays(table, exec_InterleavedArrays); 7849 SET_IsTexture(table, exec_IsTexture); 7850 SET_NormalPointer(table, exec_NormalPointer); 7851 SET_PopClientAttrib(table, exec_PopClientAttrib); 7852 SET_PrioritizeTextures(table, save_PrioritizeTextures); 7853 SET_PushClientAttrib(table, exec_PushClientAttrib); 7854 SET_TexCoordPointer(table, exec_TexCoordPointer); 7855 SET_TexSubImage1D(table, save_TexSubImage1D); 7856 SET_TexSubImage2D(table, save_TexSubImage2D); 7857 SET_VertexPointer(table, exec_VertexPointer); 7858 7859 /* GL 1.2 */ 7860 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D); 7861 SET_TexImage3D(table, save_TexImage3D); 7862 SET_TexSubImage3D(table, save_TexSubImage3D); 7863 7864 /* GL 2.0 */ 7865 SET_StencilFuncSeparate(table, save_StencilFuncSeparate); 7866 SET_StencilMaskSeparate(table, save_StencilMaskSeparate); 7867 SET_StencilOpSeparate(table, save_StencilOpSeparate); 7868 7869 /* GL_ARB_imaging */ 7870 /* Not all are supported */ 7871 SET_BlendColor(table, save_BlendColor); 7872 SET_BlendEquation(table, save_BlendEquation); 7873 SET_ColorSubTable(table, save_ColorSubTable); 7874 SET_ColorTable(table, save_ColorTable); 7875 SET_ColorTableParameterfv(table, save_ColorTableParameterfv); 7876 SET_ColorTableParameteriv(table, save_ColorTableParameteriv); 7877 SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D); 7878 SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D); 7879 SET_ConvolutionParameterf(table, save_ConvolutionParameterf); 7880 SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv); 7881 SET_ConvolutionParameteri(table, save_ConvolutionParameteri); 7882 SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv); 7883 SET_CopyColorSubTable(table, save_CopyColorSubTable); 7884 SET_CopyColorTable(table, save_CopyColorTable); 7885 SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D); 7886 SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D); 7887 SET_GetColorTable(table, exec_GetColorTable); 7888 SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); 7889 SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); 7890 SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); 7891 SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); 7892 SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); 7893 SET_GetHistogram(table, exec_GetHistogram); 7894 SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); 7895 SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); 7896 SET_GetMinmax(table, exec_GetMinmax); 7897 SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); 7898 SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); 7899 SET_GetSeparableFilter(table, exec_GetSeparableFilter); 7900 SET_Histogram(table, save_Histogram); 7901 SET_Minmax(table, save_Minmax); 7902 SET_ResetHistogram(table, save_ResetHistogram); 7903 SET_ResetMinmax(table, save_ResetMinmax); 7904 SET_SeparableFilter2D(table, exec_SeparableFilter2D); 7905 7906 /* 2. GL_EXT_blend_color */ 7907#if 0 7908 SET_BlendColorEXT(table, save_BlendColorEXT); 7909#endif 7910 7911 /* 3. GL_EXT_polygon_offset */ 7912 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT); 7913 7914 /* 6. GL_EXT_texture3d */ 7915#if 0 7916 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D); 7917 SET_TexImage3DEXT(table, save_TexImage3DEXT); 7918 SET_TexSubImage3DEXT(table, save_TexSubImage3D); 7919#endif 7920 7921 /* 14. GL_SGI_color_table */ 7922#if 0 7923 SET_ColorTableSGI(table, save_ColorTable); 7924 SET_ColorSubTableSGI(table, save_ColorSubTable); 7925 SET_GetColorTableSGI(table, exec_GetColorTable); 7926 SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv); 7927 SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv); 7928#endif 7929 7930 /* 30. GL_EXT_vertex_array */ 7931 SET_ColorPointerEXT(table, exec_ColorPointerEXT); 7932 SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT); 7933 SET_IndexPointerEXT(table, exec_IndexPointerEXT); 7934 SET_NormalPointerEXT(table, exec_NormalPointerEXT); 7935 SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT); 7936 SET_VertexPointerEXT(table, exec_VertexPointerEXT); 7937 7938 /* 37. GL_EXT_blend_minmax */ 7939#if 0 7940 SET_BlendEquationEXT(table, save_BlendEquationEXT); 7941#endif 7942 7943 /* 54. GL_EXT_point_parameters */ 7944 SET_PointParameterfEXT(table, save_PointParameterfEXT); 7945 SET_PointParameterfvEXT(table, save_PointParameterfvEXT); 7946 7947 /* 97. GL_EXT_compiled_vertex_array */ 7948 SET_LockArraysEXT(table, exec_LockArraysEXT); 7949 SET_UnlockArraysEXT(table, exec_UnlockArraysEXT); 7950 7951 /* 145. GL_EXT_secondary_color */ 7952 SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT); 7953 7954 /* 148. GL_EXT_multi_draw_arrays */ 7955 SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT); 7956 SET_MultiDrawElementsEXT(table, exec_MultiDrawElementsEXT); 7957 7958 /* 149. GL_EXT_fog_coord */ 7959 SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT); 7960 7961 /* 173. GL_EXT_blend_func_separate */ 7962 SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT); 7963 7964 /* 196. GL_MESA_resize_buffers */ 7965 SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA); 7966 7967 /* 197. GL_MESA_window_pos */ 7968 SET_WindowPos2dMESA(table, save_WindowPos2dMESA); 7969 SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA); 7970 SET_WindowPos2fMESA(table, save_WindowPos2fMESA); 7971 SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA); 7972 SET_WindowPos2iMESA(table, save_WindowPos2iMESA); 7973 SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA); 7974 SET_WindowPos2sMESA(table, save_WindowPos2sMESA); 7975 SET_WindowPos2svMESA(table, save_WindowPos2svMESA); 7976 SET_WindowPos3dMESA(table, save_WindowPos3dMESA); 7977 SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA); 7978 SET_WindowPos3fMESA(table, save_WindowPos3fMESA); 7979 SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA); 7980 SET_WindowPos3iMESA(table, save_WindowPos3iMESA); 7981 SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA); 7982 SET_WindowPos3sMESA(table, save_WindowPos3sMESA); 7983 SET_WindowPos3svMESA(table, save_WindowPos3svMESA); 7984 SET_WindowPos4dMESA(table, save_WindowPos4dMESA); 7985 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA); 7986 SET_WindowPos4fMESA(table, save_WindowPos4fMESA); 7987 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA); 7988 SET_WindowPos4iMESA(table, save_WindowPos4iMESA); 7989 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA); 7990 SET_WindowPos4sMESA(table, save_WindowPos4sMESA); 7991 SET_WindowPos4svMESA(table, save_WindowPos4svMESA); 7992 7993 /* 200. GL_IBM_multimode_draw_arrays */ 7994 SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM); 7995 SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM); 7996 7997#if FEATURE_NV_vertex_program 7998 /* 233. GL_NV_vertex_program */ 7999 /* The following commands DO NOT go into display lists: 8000 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV, 8001 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib* 8002 */ 8003 SET_BindProgramNV(table, save_BindProgramNV); 8004 SET_DeleteProgramsNV(table, _mesa_DeletePrograms); 8005 SET_ExecuteProgramNV(table, save_ExecuteProgramNV); 8006 SET_GenProgramsNV(table, _mesa_GenPrograms); 8007 SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV); 8008 SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV); 8009 SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV); 8010 SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV); 8011 SET_GetProgramivNV(table, _mesa_GetProgramivNV); 8012 SET_GetProgramStringNV(table, _mesa_GetProgramStringNV); 8013 SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV); 8014 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); 8015 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); 8016 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); 8017 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); 8018 SET_IsProgramNV(table, _mesa_IsProgramARB); 8019 SET_LoadProgramNV(table, save_LoadProgramNV); 8020 SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV); 8021 SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV); 8022 SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV); 8023 SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV); 8024 SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV); 8025 SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV); 8026 SET_TrackMatrixNV(table, save_TrackMatrixNV); 8027 SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV); 8028#endif 8029 8030 /* 245. GL_ATI_fragment_shader */ 8031#if FEATURE_ATI_fragment_shader 8032 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI); 8033 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI); 8034#endif 8035 8036 /* 282. GL_NV_fragment_program */ 8037#if FEATURE_NV_fragment_program 8038 SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV); 8039 SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV); 8040 SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV); 8041 SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV); 8042 SET_GetProgramNamedParameterfvNV(table, 8043 _mesa_GetProgramNamedParameterfvNV); 8044 SET_GetProgramNamedParameterdvNV(table, 8045 _mesa_GetProgramNamedParameterdvNV); 8046 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB); 8047 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); 8048 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); 8049 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); 8050 SET_GetProgramLocalParameterdvARB(table, 8051 _mesa_GetProgramLocalParameterdvARB); 8052 SET_GetProgramLocalParameterfvARB(table, 8053 _mesa_GetProgramLocalParameterfvARB); 8054#endif 8055 8056 /* 262. GL_NV_point_sprite */ 8057 SET_PointParameteriNV(table, save_PointParameteriNV); 8058 SET_PointParameterivNV(table, save_PointParameterivNV); 8059 8060 /* 268. GL_EXT_stencil_two_side */ 8061 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT); 8062 8063 /* 273. GL_APPLE_vertex_array_object */ 8064 SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE); 8065 SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE); 8066 SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE); 8067 SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE); 8068 8069 /* ???. GL_EXT_depth_bounds_test */ 8070 SET_DepthBoundsEXT(table, save_DepthBoundsEXT); 8071 8072 /* ARB 1. GL_ARB_multitexture */ 8073 SET_ActiveTextureARB(table, save_ActiveTextureARB); 8074 SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB); 8075 8076 /* ARB 3. GL_ARB_transpose_matrix */ 8077 SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB); 8078 SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB); 8079 SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB); 8080 SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB); 8081 8082 /* ARB 5. GL_ARB_multisample */ 8083 SET_SampleCoverageARB(table, save_SampleCoverageARB); 8084 8085 /* ARB 12. GL_ARB_texture_compression */ 8086 SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB); 8087 SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB); 8088 SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB); 8089 SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB); 8090 SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB); 8091 SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB); 8092 SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB); 8093 8094 /* ARB 14. GL_ARB_point_parameters */ 8095 /* aliased with EXT_point_parameters functions */ 8096 8097 /* ARB 25. GL_ARB_window_pos */ 8098 /* aliased with MESA_window_pos functions */ 8099 8100 /* ARB 26. GL_ARB_vertex_program */ 8101 /* ARB 27. GL_ARB_fragment_program */ 8102#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 8103 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */ 8104 SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB); 8105 SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB); 8106 SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB); 8107 SET_ProgramStringARB(table, save_ProgramStringARB); 8108 SET_BindProgramNV(table, save_BindProgramNV); 8109 SET_DeleteProgramsNV(table, _mesa_DeletePrograms); 8110 SET_GenProgramsNV(table, _mesa_GenPrograms); 8111 SET_IsProgramNV(table, _mesa_IsProgramARB); 8112 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); 8113 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); 8114 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); 8115 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); 8116 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); 8117 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); 8118 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); 8119 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB); 8120 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB); 8121 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); 8122 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); 8123 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); 8124 SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB); 8125 SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB); 8126 SET_GetProgramLocalParameterdvARB(table, 8127 _mesa_GetProgramLocalParameterdvARB); 8128 SET_GetProgramLocalParameterfvARB(table, 8129 _mesa_GetProgramLocalParameterfvARB); 8130 SET_GetProgramivARB(table, _mesa_GetProgramivARB); 8131 SET_GetProgramStringARB(table, _mesa_GetProgramStringARB); 8132#endif 8133 8134 /* ARB 28. GL_ARB_vertex_buffer_object */ 8135#if FEATURE_ARB_vertex_buffer_object 8136 /* None of the extension's functions get compiled */ 8137 SET_BindBufferARB(table, _mesa_BindBufferARB); 8138 SET_BufferDataARB(table, _mesa_BufferDataARB); 8139 SET_BufferSubDataARB(table, _mesa_BufferSubDataARB); 8140 SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB); 8141 SET_GenBuffersARB(table, _mesa_GenBuffersARB); 8142 SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB); 8143 SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB); 8144 SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB); 8145 SET_IsBufferARB(table, _mesa_IsBufferARB); 8146 SET_MapBufferARB(table, _mesa_MapBufferARB); 8147 SET_UnmapBufferARB(table, _mesa_UnmapBufferARB); 8148#endif 8149 8150#if FEATURE_ARB_occlusion_query 8151 SET_BeginQueryARB(table, save_BeginQueryARB); 8152 SET_EndQueryARB(table, save_EndQueryARB); 8153 SET_GenQueriesARB(table, _mesa_GenQueriesARB); 8154 SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB); 8155 SET_IsQueryARB(table, _mesa_IsQueryARB); 8156 SET_GetQueryivARB(table, _mesa_GetQueryivARB); 8157 SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB); 8158 SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB); 8159#endif 8160 SET_DrawBuffersARB(table, save_DrawBuffersARB); 8161 8162#if FEATURE_EXT_framebuffer_blit 8163 SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT); 8164#endif 8165 8166 /* 299. GL_EXT_blend_equation_separate */ 8167 SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); 8168 8169 /* GL_EXT_gpu_program_parmaeters */ 8170#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 8171 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT); 8172 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); 8173#endif 8174} 8175 8176 8177 8178static const char * 8179enum_string(GLenum k) 8180{ 8181 return _mesa_lookup_enum_by_nr(k); 8182} 8183 8184 8185/** 8186 * Print the commands in a display list. For debugging only. 8187 * TODO: many commands aren't handled yet. 8188 */ 8189static void GLAPIENTRY 8190print_list(GLcontext *ctx, GLuint list) 8191{ 8192 struct mesa_display_list *dlist; 8193 Node *n; 8194 GLboolean done; 8195 8196 if (!islist(ctx, list)) { 8197 _mesa_printf("%u is not a display list ID\n", list); 8198 return; 8199 } 8200 8201 dlist = lookup_list(ctx, list); 8202 if (!dlist) 8203 return; 8204 8205 n = dlist->node; 8206 8207 _mesa_printf("START-LIST %u, address %p\n", list, (void *) n); 8208 8209 done = n ? GL_FALSE : GL_TRUE; 8210 while (!done) { 8211 OpCode opcode = n[0].opcode; 8212 GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; 8213 8214 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { 8215 /* this is a driver-extended opcode */ 8216 ctx->ListExt.Opcode[i].Print(ctx, &n[1]); 8217 n += ctx->ListExt.Opcode[i].Size; 8218 } 8219 else { 8220 switch (opcode) { 8221 case OPCODE_ACCUM: 8222 _mesa_printf("Accum %s %g\n", enum_string(n[1].e), n[2].f); 8223 break; 8224 case OPCODE_BITMAP: 8225 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, 8226 n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data); 8227 break; 8228 case OPCODE_CALL_LIST: 8229 _mesa_printf("CallList %d\n", (int) n[1].ui); 8230 break; 8231 case OPCODE_CALL_LIST_OFFSET: 8232 _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, 8233 ctx->List.ListBase, ctx->List.ListBase + n[1].ui); 8234 break; 8235 case OPCODE_COLOR_TABLE_PARAMETER_FV: 8236 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", 8237 enum_string(n[1].e), enum_string(n[2].e), 8238 n[3].f, n[4].f, n[5].f, n[6].f); 8239 break; 8240 case OPCODE_COLOR_TABLE_PARAMETER_IV: 8241 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", 8242 enum_string(n[1].e), enum_string(n[2].e), 8243 n[3].i, n[4].i, n[5].i, n[6].i); 8244 break; 8245 case OPCODE_DISABLE: 8246 _mesa_printf("Disable %s\n", enum_string(n[1].e)); 8247 break; 8248 case OPCODE_ENABLE: 8249 _mesa_printf("Enable %s\n", enum_string(n[1].e)); 8250 break; 8251 case OPCODE_FRUSTUM: 8252 _mesa_printf("Frustum %g %g %g %g %g %g\n", 8253 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); 8254 break; 8255 case OPCODE_LINE_STIPPLE: 8256 _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us); 8257 break; 8258 case OPCODE_LOAD_IDENTITY: 8259 _mesa_printf("LoadIdentity\n"); 8260 break; 8261 case OPCODE_LOAD_MATRIX: 8262 _mesa_printf("LoadMatrix\n"); 8263 _mesa_printf(" %8f %8f %8f %8f\n", 8264 n[1].f, n[5].f, n[9].f, n[13].f); 8265 _mesa_printf(" %8f %8f %8f %8f\n", 8266 n[2].f, n[6].f, n[10].f, n[14].f); 8267 _mesa_printf(" %8f %8f %8f %8f\n", 8268 n[3].f, n[7].f, n[11].f, n[15].f); 8269 _mesa_printf(" %8f %8f %8f %8f\n", 8270 n[4].f, n[8].f, n[12].f, n[16].f); 8271 break; 8272 case OPCODE_MULT_MATRIX: 8273 _mesa_printf("MultMatrix (or Rotate)\n"); 8274 _mesa_printf(" %8f %8f %8f %8f\n", 8275 n[1].f, n[5].f, n[9].f, n[13].f); 8276 _mesa_printf(" %8f %8f %8f %8f\n", 8277 n[2].f, n[6].f, n[10].f, n[14].f); 8278 _mesa_printf(" %8f %8f %8f %8f\n", 8279 n[3].f, n[7].f, n[11].f, n[15].f); 8280 _mesa_printf(" %8f %8f %8f %8f\n", 8281 n[4].f, n[8].f, n[12].f, n[16].f); 8282 break; 8283 case OPCODE_ORTHO: 8284 _mesa_printf("Ortho %g %g %g %g %g %g\n", 8285 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); 8286 break; 8287 case OPCODE_POP_ATTRIB: 8288 _mesa_printf("PopAttrib\n"); 8289 break; 8290 case OPCODE_POP_MATRIX: 8291 _mesa_printf("PopMatrix\n"); 8292 break; 8293 case OPCODE_POP_NAME: 8294 _mesa_printf("PopName\n"); 8295 break; 8296 case OPCODE_PUSH_ATTRIB: 8297 _mesa_printf("PushAttrib %x\n", n[1].bf); 8298 break; 8299 case OPCODE_PUSH_MATRIX: 8300 _mesa_printf("PushMatrix\n"); 8301 break; 8302 case OPCODE_PUSH_NAME: 8303 _mesa_printf("PushName %d\n", (int) n[1].ui); 8304 break; 8305 case OPCODE_RASTER_POS: 8306 _mesa_printf("RasterPos %g %g %g %g\n", 8307 n[1].f, n[2].f, n[3].f, n[4].f); 8308 break; 8309 case OPCODE_ROTATE: 8310 _mesa_printf("Rotate %g %g %g %g\n", 8311 n[1].f, n[2].f, n[3].f, n[4].f); 8312 break; 8313 case OPCODE_SCALE: 8314 _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); 8315 break; 8316 case OPCODE_TRANSLATE: 8317 _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); 8318 break; 8319 case OPCODE_BIND_TEXTURE: 8320 _mesa_printf("BindTexture %s %d\n", 8321 _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); 8322 break; 8323 case OPCODE_SHADE_MODEL: 8324 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); 8325 break; 8326 case OPCODE_MAP1: 8327 _mesa_printf("Map1 %s %.3f %.3f %d %d\n", 8328 _mesa_lookup_enum_by_nr(n[1].ui), 8329 n[2].f, n[3].f, n[4].i, n[5].i); 8330 break; 8331 case OPCODE_MAP2: 8332 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", 8333 _mesa_lookup_enum_by_nr(n[1].ui), 8334 n[2].f, n[3].f, n[4].f, n[5].f, 8335 n[6].i, n[7].i, n[8].i, n[9].i); 8336 break; 8337 case OPCODE_MAPGRID1: 8338 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); 8339 break; 8340 case OPCODE_MAPGRID2: 8341 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", 8342 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); 8343 break; 8344 case OPCODE_EVALMESH1: 8345 _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); 8346 break; 8347 case OPCODE_EVALMESH2: 8348 _mesa_printf("EvalMesh2 %d %d %d %d\n", 8349 n[1].i, n[2].i, n[3].i, n[4].i); 8350 break; 8351 8352 case OPCODE_ATTR_1F_NV: 8353 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); 8354 break; 8355 case OPCODE_ATTR_2F_NV: 8356 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n", 8357 n[1].i, n[2].f, n[3].f); 8358 break; 8359 case OPCODE_ATTR_3F_NV: 8360 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n", 8361 n[1].i, n[2].f, n[3].f, n[4].f); 8362 break; 8363 case OPCODE_ATTR_4F_NV: 8364 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n", 8365 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); 8366 break; 8367 case OPCODE_ATTR_1F_ARB: 8368 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); 8369 break; 8370 case OPCODE_ATTR_2F_ARB: 8371 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n", 8372 n[1].i, n[2].f, n[3].f); 8373 break; 8374 case OPCODE_ATTR_3F_ARB: 8375 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n", 8376 n[1].i, n[2].f, n[3].f, n[4].f); 8377 break; 8378 case OPCODE_ATTR_4F_ARB: 8379 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", 8380 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); 8381 break; 8382 8383 case OPCODE_MATERIAL: 8384 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n", 8385 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); 8386 break; 8387 case OPCODE_BEGIN: 8388 _mesa_printf("BEGIN %x\n", n[1].i); 8389 break; 8390 case OPCODE_END: 8391 _mesa_printf("END\n"); 8392 break; 8393 case OPCODE_RECTF: 8394 _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, 8395 n[4].f); 8396 break; 8397 case OPCODE_EVAL_C1: 8398 _mesa_printf("EVAL_C1 %f\n", n[1].f); 8399 break; 8400 case OPCODE_EVAL_C2: 8401 _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); 8402 break; 8403 case OPCODE_EVAL_P1: 8404 _mesa_printf("EVAL_P1 %d\n", n[1].i); 8405 break; 8406 case OPCODE_EVAL_P2: 8407 _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); 8408 break; 8409 8410 8411 8412 /* 8413 * meta opcodes/commands 8414 */ 8415 case OPCODE_ERROR: 8416 _mesa_printf("Error: %s %s\n", 8417 enum_string(n[1].e), (const char *) n[2].data); 8418 break; 8419 case OPCODE_CONTINUE: 8420 _mesa_printf("DISPLAY-LIST-CONTINUE\n"); 8421 n = (Node *) n[1].next; 8422 break; 8423 case OPCODE_END_OF_LIST: 8424 _mesa_printf("END-LIST %u\n", list); 8425 done = GL_TRUE; 8426 break; 8427 default: 8428 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { 8429 _mesa_printf 8430 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", 8431 opcode, (void *) n); 8432 return; 8433 } 8434 else { 8435 _mesa_printf("command %d, %u operands\n", opcode, 8436 InstSize[opcode]); 8437 } 8438 } 8439 /* increment n to point to next compiled command */ 8440 if (opcode != OPCODE_CONTINUE) { 8441 n += InstSize[opcode]; 8442 } 8443 } 8444 } 8445} 8446 8447 8448 8449/** 8450 * Clients may call this function to help debug display list problems. 8451 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed, 8452 * changed, or break in the future without notice. 8453 */ 8454void 8455mesa_print_display_list(GLuint list) 8456{ 8457 GET_CURRENT_CONTEXT(ctx); 8458 print_list(ctx, list); 8459} 8460 8461 8462/**********************************************************************/ 8463/***** Initialization *****/ 8464/**********************************************************************/ 8465 8466void 8467_mesa_save_vtxfmt_init(GLvertexformat * vfmt) 8468{ 8469 vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ 8470 vfmt->Begin = save_Begin; 8471 vfmt->CallList = _mesa_save_CallList; 8472 vfmt->CallLists = _mesa_save_CallLists; 8473 vfmt->Color3f = save_Color3f; 8474 vfmt->Color3fv = save_Color3fv; 8475 vfmt->Color4f = save_Color4f; 8476 vfmt->Color4fv = save_Color4fv; 8477 vfmt->EdgeFlag = save_EdgeFlag; 8478 vfmt->End = save_End; 8479 vfmt->EvalCoord1f = save_EvalCoord1f; 8480 vfmt->EvalCoord1fv = save_EvalCoord1fv; 8481 vfmt->EvalCoord2f = save_EvalCoord2f; 8482 vfmt->EvalCoord2fv = save_EvalCoord2fv; 8483 vfmt->EvalPoint1 = save_EvalPoint1; 8484 vfmt->EvalPoint2 = save_EvalPoint2; 8485 vfmt->FogCoordfEXT = save_FogCoordfEXT; 8486 vfmt->FogCoordfvEXT = save_FogCoordfvEXT; 8487 vfmt->Indexf = save_Indexf; 8488 vfmt->Indexfv = save_Indexfv; 8489 vfmt->Materialfv = save_Materialfv; 8490 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f; 8491 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv; 8492 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f; 8493 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv; 8494 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f; 8495 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv; 8496 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f; 8497 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv; 8498 vfmt->Normal3f = save_Normal3f; 8499 vfmt->Normal3fv = save_Normal3fv; 8500 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT; 8501 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT; 8502 vfmt->TexCoord1f = save_TexCoord1f; 8503 vfmt->TexCoord1fv = save_TexCoord1fv; 8504 vfmt->TexCoord2f = save_TexCoord2f; 8505 vfmt->TexCoord2fv = save_TexCoord2fv; 8506 vfmt->TexCoord3f = save_TexCoord3f; 8507 vfmt->TexCoord3fv = save_TexCoord3fv; 8508 vfmt->TexCoord4f = save_TexCoord4f; 8509 vfmt->TexCoord4fv = save_TexCoord4fv; 8510 vfmt->Vertex2f = save_Vertex2f; 8511 vfmt->Vertex2fv = save_Vertex2fv; 8512 vfmt->Vertex3f = save_Vertex3f; 8513 vfmt->Vertex3fv = save_Vertex3fv; 8514 vfmt->Vertex4f = save_Vertex4f; 8515 vfmt->Vertex4fv = save_Vertex4fv; 8516 vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV; 8517 vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV; 8518 vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV; 8519 vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV; 8520 vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV; 8521 vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV; 8522 vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV; 8523 vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV; 8524 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB; 8525 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB; 8526 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB; 8527 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB; 8528 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB; 8529 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB; 8530 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB; 8531 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB; 8532 8533 vfmt->EvalMesh1 = _mesa_save_EvalMesh1; 8534 vfmt->EvalMesh2 = _mesa_save_EvalMesh2; 8535 vfmt->Rectf = save_Rectf; 8536 8537 /* The driver is required to implement these as 8538 * 1) They can probably do a better job. 8539 * 2) A lot of new mechanisms would have to be added to this module 8540 * to support it. That code would probably never get used, 8541 * because of (1). 8542 */ 8543#if 0 8544 vfmt->DrawArrays = 0; 8545 vfmt->DrawElements = 0; 8546 vfmt->DrawRangeElements = 0; 8547#endif 8548} 8549 8550 8551/** 8552 * Initialize display list state for given context. 8553 */ 8554void 8555_mesa_init_display_list(GLcontext *ctx) 8556{ 8557 static GLboolean tableInitialized = GL_FALSE; 8558 8559 /* zero-out the instruction size table, just once */ 8560 if (!tableInitialized) { 8561 _mesa_bzero(InstSize, sizeof(InstSize)); 8562 tableInitialized = GL_TRUE; 8563 } 8564 8565 /* Display list */ 8566 ctx->ListState.CallDepth = 0; 8567 ctx->ExecuteFlag = GL_TRUE; 8568 ctx->CompileFlag = GL_FALSE; 8569 ctx->ListState.CurrentListPtr = NULL; 8570 ctx->ListState.CurrentBlock = NULL; 8571 ctx->ListState.CurrentListNum = 0; 8572 ctx->ListState.CurrentPos = 0; 8573 8574 /* Display List group */ 8575 ctx->List.ListBase = 0; 8576 8577 _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt); 8578} 8579