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