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