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