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