Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendlist.c
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 7.1 00004 * 00005 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a 00008 * copy of this software and associated documentation files (the "Software"), 00009 * to deal in the Software without restriction, including without limitation 00010 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 * and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 00031 #include "glheader.h" 00032 #include "imports.h" 00033 #include "api_arrayelt.h" 00034 #include "api_loopback.h" 00035 #include "config.h" 00036 #include "attrib.h" 00037 #include "blend.h" 00038 #include "buffers.h" 00039 #if FEATURE_ARB_vertex_buffer_object 00040 #include "bufferobj.h" 00041 #endif 00042 #include "arrayobj.h" 00043 #include "clip.h" 00044 #include "colortab.h" 00045 #include "context.h" 00046 #include "convolve.h" 00047 #include "depth.h" 00048 #include "dlist.h" 00049 #include "enable.h" 00050 #include "enums.h" 00051 #include "eval.h" 00052 #include "extensions.h" 00053 #include "feedback.h" 00054 #include "framebuffer.h" 00055 #include "get.h" 00056 #include "glapi/glapi.h" 00057 #include "hash.h" 00058 #include "histogram.h" 00059 #include "image.h" 00060 #include "light.h" 00061 #include "lines.h" 00062 #include "dlist.h" 00063 #include "macros.h" 00064 #include "matrix.h" 00065 #include "pixel.h" 00066 #include "points.h" 00067 #include "polygon.h" 00068 #include "queryobj.h" 00069 #include "state.h" 00070 #include "texobj.h" 00071 #include "teximage.h" 00072 #include "texstate.h" 00073 #include "mtypes.h" 00074 #include "varray.h" 00075 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 00076 #include "shader/arbprogram.h" 00077 #include "shader/program.h" 00078 #endif 00079 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program 00080 #include "shader/nvprogram.h" 00081 #include "shader/program.h" 00082 #endif 00083 #if FEATURE_ATI_fragment_shader 00084 #include "shader/atifragshader.h" 00085 #endif 00086 00087 #include "math/m_matrix.h" 00088 #include "math/m_xform.h" 00089 00090 #include "glapi/dispatch.h" 00091 00092 00102 #define SAVE_FLUSH_VERTICES(ctx) \ 00103 do { \ 00104 if (ctx->Driver.SaveNeedFlush) \ 00105 ctx->Driver.SaveFlushVertices(ctx); \ 00106 } while (0) 00107 00108 00116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \ 00117 do { \ 00118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ 00119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ 00120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ 00121 return retval; \ 00122 } \ 00123 } while (0) 00124 00131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \ 00132 do { \ 00133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ 00134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ 00135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ 00136 return; \ 00137 } \ 00138 } while (0) 00139 00146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \ 00147 do { \ 00148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \ 00149 SAVE_FLUSH_VERTICES(ctx); \ 00150 } while (0) 00151 00159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\ 00160 do { \ 00161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \ 00162 SAVE_FLUSH_VERTICES(ctx); \ 00163 } while (0) 00164 00165 00166 00173 typedef enum 00174 { 00175 OPCODE_INVALID = -1, /* Force signed enum */ 00176 OPCODE_ACCUM, 00177 OPCODE_ALPHA_FUNC, 00178 OPCODE_BIND_TEXTURE, 00179 OPCODE_BITMAP, 00180 OPCODE_BLEND_COLOR, 00181 OPCODE_BLEND_EQUATION, 00182 OPCODE_BLEND_EQUATION_SEPARATE, 00183 OPCODE_BLEND_FUNC_SEPARATE, 00184 OPCODE_CALL_LIST, 00185 OPCODE_CALL_LIST_OFFSET, 00186 OPCODE_CLEAR, 00187 OPCODE_CLEAR_ACCUM, 00188 OPCODE_CLEAR_COLOR, 00189 OPCODE_CLEAR_DEPTH, 00190 OPCODE_CLEAR_INDEX, 00191 OPCODE_CLEAR_STENCIL, 00192 OPCODE_CLIP_PLANE, 00193 OPCODE_COLOR_MASK, 00194 OPCODE_COLOR_MATERIAL, 00195 OPCODE_COLOR_TABLE, 00196 OPCODE_COLOR_TABLE_PARAMETER_FV, 00197 OPCODE_COLOR_TABLE_PARAMETER_IV, 00198 OPCODE_COLOR_SUB_TABLE, 00199 OPCODE_CONVOLUTION_FILTER_1D, 00200 OPCODE_CONVOLUTION_FILTER_2D, 00201 OPCODE_CONVOLUTION_PARAMETER_I, 00202 OPCODE_CONVOLUTION_PARAMETER_IV, 00203 OPCODE_CONVOLUTION_PARAMETER_F, 00204 OPCODE_CONVOLUTION_PARAMETER_FV, 00205 OPCODE_COPY_COLOR_SUB_TABLE, 00206 OPCODE_COPY_COLOR_TABLE, 00207 OPCODE_COPY_PIXELS, 00208 OPCODE_COPY_TEX_IMAGE1D, 00209 OPCODE_COPY_TEX_IMAGE2D, 00210 OPCODE_COPY_TEX_SUB_IMAGE1D, 00211 OPCODE_COPY_TEX_SUB_IMAGE2D, 00212 OPCODE_COPY_TEX_SUB_IMAGE3D, 00213 OPCODE_CULL_FACE, 00214 OPCODE_DEPTH_FUNC, 00215 OPCODE_DEPTH_MASK, 00216 OPCODE_DEPTH_RANGE, 00217 OPCODE_DISABLE, 00218 OPCODE_DRAW_BUFFER, 00219 OPCODE_DRAW_PIXELS, 00220 OPCODE_ENABLE, 00221 OPCODE_EVALMESH1, 00222 OPCODE_EVALMESH2, 00223 OPCODE_FOG, 00224 OPCODE_FRONT_FACE, 00225 OPCODE_FRUSTUM, 00226 OPCODE_HINT, 00227 OPCODE_HISTOGRAM, 00228 OPCODE_INDEX_MASK, 00229 OPCODE_INIT_NAMES, 00230 OPCODE_LIGHT, 00231 OPCODE_LIGHT_MODEL, 00232 OPCODE_LINE_STIPPLE, 00233 OPCODE_LINE_WIDTH, 00234 OPCODE_LIST_BASE, 00235 OPCODE_LOAD_IDENTITY, 00236 OPCODE_LOAD_MATRIX, 00237 OPCODE_LOAD_NAME, 00238 OPCODE_LOGIC_OP, 00239 OPCODE_MAP1, 00240 OPCODE_MAP2, 00241 OPCODE_MAPGRID1, 00242 OPCODE_MAPGRID2, 00243 OPCODE_MATRIX_MODE, 00244 OPCODE_MIN_MAX, 00245 OPCODE_MULT_MATRIX, 00246 OPCODE_ORTHO, 00247 OPCODE_PASSTHROUGH, 00248 OPCODE_PIXEL_MAP, 00249 OPCODE_PIXEL_TRANSFER, 00250 OPCODE_PIXEL_ZOOM, 00251 OPCODE_POINT_SIZE, 00252 OPCODE_POINT_PARAMETERS, 00253 OPCODE_POLYGON_MODE, 00254 OPCODE_POLYGON_STIPPLE, 00255 OPCODE_POLYGON_OFFSET, 00256 OPCODE_POP_ATTRIB, 00257 OPCODE_POP_MATRIX, 00258 OPCODE_POP_NAME, 00259 OPCODE_PRIORITIZE_TEXTURE, 00260 OPCODE_PUSH_ATTRIB, 00261 OPCODE_PUSH_MATRIX, 00262 OPCODE_PUSH_NAME, 00263 OPCODE_RASTER_POS, 00264 OPCODE_READ_BUFFER, 00265 OPCODE_RESET_HISTOGRAM, 00266 OPCODE_RESET_MIN_MAX, 00267 OPCODE_ROTATE, 00268 OPCODE_SCALE, 00269 OPCODE_SCISSOR, 00270 OPCODE_SELECT_TEXTURE_SGIS, 00271 OPCODE_SELECT_TEXTURE_COORD_SET, 00272 OPCODE_SHADE_MODEL, 00273 OPCODE_STENCIL_FUNC, 00274 OPCODE_STENCIL_MASK, 00275 OPCODE_STENCIL_OP, 00276 OPCODE_TEXENV, 00277 OPCODE_TEXGEN, 00278 OPCODE_TEXPARAMETER, 00279 OPCODE_TEX_IMAGE1D, 00280 OPCODE_TEX_IMAGE2D, 00281 OPCODE_TEX_IMAGE3D, 00282 OPCODE_TEX_SUB_IMAGE1D, 00283 OPCODE_TEX_SUB_IMAGE2D, 00284 OPCODE_TEX_SUB_IMAGE3D, 00285 OPCODE_TRANSLATE, 00286 OPCODE_VIEWPORT, 00287 OPCODE_WINDOW_POS, 00288 /* GL_ARB_multitexture */ 00289 OPCODE_ACTIVE_TEXTURE, 00290 /* GL_ARB_texture_compression */ 00291 OPCODE_COMPRESSED_TEX_IMAGE_1D, 00292 OPCODE_COMPRESSED_TEX_IMAGE_2D, 00293 OPCODE_COMPRESSED_TEX_IMAGE_3D, 00294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 00295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 00296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 00297 /* GL_ARB_multisample */ 00298 OPCODE_SAMPLE_COVERAGE, 00299 /* GL_ARB_window_pos */ 00300 OPCODE_WINDOW_POS_ARB, 00301 /* GL_NV_vertex_program */ 00302 OPCODE_BIND_PROGRAM_NV, 00303 OPCODE_EXECUTE_PROGRAM_NV, 00304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV, 00305 OPCODE_LOAD_PROGRAM_NV, 00306 OPCODE_TRACK_MATRIX_NV, 00307 /* GL_NV_fragment_program */ 00308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 00309 OPCODE_PROGRAM_NAMED_PARAMETER_NV, 00310 /* GL_EXT_stencil_two_side */ 00311 OPCODE_ACTIVE_STENCIL_FACE_EXT, 00312 /* GL_EXT_depth_bounds_test */ 00313 OPCODE_DEPTH_BOUNDS_EXT, 00314 /* GL_ARB_vertex/fragment_program */ 00315 OPCODE_PROGRAM_STRING_ARB, 00316 OPCODE_PROGRAM_ENV_PARAMETER_ARB, 00317 /* GL_ARB_occlusion_query */ 00318 OPCODE_BEGIN_QUERY_ARB, 00319 OPCODE_END_QUERY_ARB, 00320 /* GL_ARB_draw_buffers */ 00321 OPCODE_DRAW_BUFFERS_ARB, 00322 /* GL_ATI_fragment_shader */ 00323 OPCODE_BIND_FRAGMENT_SHADER_ATI, 00324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 00325 /* OpenGL 2.0 */ 00326 OPCODE_STENCIL_FUNC_SEPARATE, 00327 OPCODE_STENCIL_OP_SEPARATE, 00328 OPCODE_STENCIL_MASK_SEPARATE, 00329 00330 /* GL_EXT_framebuffer_blit */ 00331 OPCODE_BLIT_FRAMEBUFFER, 00332 00333 /* Vertex attributes -- fallback for when optimized display 00334 * list build isn't active. 00335 */ 00336 OPCODE_ATTR_1F_NV, 00337 OPCODE_ATTR_2F_NV, 00338 OPCODE_ATTR_3F_NV, 00339 OPCODE_ATTR_4F_NV, 00340 OPCODE_ATTR_1F_ARB, 00341 OPCODE_ATTR_2F_ARB, 00342 OPCODE_ATTR_3F_ARB, 00343 OPCODE_ATTR_4F_ARB, 00344 OPCODE_MATERIAL, 00345 OPCODE_BEGIN, 00346 OPCODE_END, 00347 OPCODE_RECTF, 00348 OPCODE_EVAL_C1, 00349 OPCODE_EVAL_C2, 00350 OPCODE_EVAL_P1, 00351 OPCODE_EVAL_P2, 00352 00353 /* The following three are meta instructions */ 00354 OPCODE_ERROR, /* raise compiled-in error */ 00355 OPCODE_CONTINUE, 00356 OPCODE_END_OF_LIST, 00357 OPCODE_EXT_0 00358 } OpCode; 00359 00360 00361 00373 union node 00374 { 00375 OpCode opcode; 00376 GLboolean b; 00377 GLbitfield bf; 00378 GLubyte ub; 00379 GLshort s; 00380 GLushort us; 00381 GLint i; 00382 GLuint ui; 00383 GLenum e; 00384 GLfloat f; 00385 GLvoid *data; 00386 void *next; /* If prev node's opcode==OPCODE_CONTINUE */ 00387 }; 00388 00389 00395 #define BLOCK_SIZE 256 00396 00397 00398 00403 static GLuint InstSize[OPCODE_END_OF_LIST + 1]; 00404 00405 void mesa_print_display_list(GLuint list); 00406 00407 00408 /**********************************************************************/ 00409 /***** Private *****/ 00410 /**********************************************************************/ 00411 00412 00417 static struct mesa_display_list * 00418 make_list(GLuint list, GLuint count) 00419 { 00420 struct mesa_display_list *dlist = CALLOC_STRUCT(mesa_display_list); 00421 dlist->id = list; 00422 dlist->node = (Node *) _mesa_malloc(sizeof(Node) * count); 00423 dlist->node[0].opcode = OPCODE_END_OF_LIST; 00424 return dlist; 00425 } 00426 00427 00431 static INLINE struct mesa_display_list * 00432 lookup_list(GLcontext *ctx, GLuint list) 00433 { 00434 return (struct mesa_display_list *) 00435 _mesa_HashLookup(ctx->Shared->DisplayList, list); 00436 } 00437 00438 00439 00444 void 00445 _mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist) 00446 { 00447 Node *n, *block; 00448 GLboolean done; 00449 00450 n = block = dlist->node; 00451 00452 done = block ? GL_FALSE : GL_TRUE; 00453 while (!done) { 00454 00455 /* check for extension opcodes first */ 00456 00457 GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; 00458 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { 00459 ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]); 00460 n += ctx->ListExt.Opcode[i].Size; 00461 } 00462 else { 00463 switch (n[0].opcode) { 00464 /* for some commands, we need to free malloc'd memory */ 00465 case OPCODE_MAP1: 00466 _mesa_free(n[6].data); 00467 n += InstSize[n[0].opcode]; 00468 break; 00469 case OPCODE_MAP2: 00470 _mesa_free(n[10].data); 00471 n += InstSize[n[0].opcode]; 00472 break; 00473 case OPCODE_DRAW_PIXELS: 00474 _mesa_free(n[5].data); 00475 n += InstSize[n[0].opcode]; 00476 break; 00477 case OPCODE_BITMAP: 00478 _mesa_free(n[7].data); 00479 n += InstSize[n[0].opcode]; 00480 break; 00481 case OPCODE_COLOR_TABLE: 00482 _mesa_free(n[6].data); 00483 n += InstSize[n[0].opcode]; 00484 break; 00485 case OPCODE_COLOR_SUB_TABLE: 00486 _mesa_free(n[6].data); 00487 n += InstSize[n[0].opcode]; 00488 break; 00489 case OPCODE_CONVOLUTION_FILTER_1D: 00490 _mesa_free(n[6].data); 00491 n += InstSize[n[0].opcode]; 00492 break; 00493 case OPCODE_CONVOLUTION_FILTER_2D: 00494 _mesa_free(n[7].data); 00495 n += InstSize[n[0].opcode]; 00496 break; 00497 case OPCODE_POLYGON_STIPPLE: 00498 _mesa_free(n[1].data); 00499 n += InstSize[n[0].opcode]; 00500 break; 00501 case OPCODE_TEX_IMAGE1D: 00502 _mesa_free(n[8].data); 00503 n += InstSize[n[0].opcode]; 00504 break; 00505 case OPCODE_TEX_IMAGE2D: 00506 _mesa_free(n[9].data); 00507 n += InstSize[n[0].opcode]; 00508 break; 00509 case OPCODE_TEX_IMAGE3D: 00510 _mesa_free(n[10].data); 00511 n += InstSize[n[0].opcode]; 00512 break; 00513 case OPCODE_TEX_SUB_IMAGE1D: 00514 _mesa_free(n[7].data); 00515 n += InstSize[n[0].opcode]; 00516 break; 00517 case OPCODE_TEX_SUB_IMAGE2D: 00518 _mesa_free(n[9].data); 00519 n += InstSize[n[0].opcode]; 00520 break; 00521 case OPCODE_TEX_SUB_IMAGE3D: 00522 _mesa_free(n[11].data); 00523 n += InstSize[n[0].opcode]; 00524 break; 00525 case OPCODE_COMPRESSED_TEX_IMAGE_1D: 00526 _mesa_free(n[7].data); 00527 n += InstSize[n[0].opcode]; 00528 break; 00529 case OPCODE_COMPRESSED_TEX_IMAGE_2D: 00530 _mesa_free(n[8].data); 00531 n += InstSize[n[0].opcode]; 00532 break; 00533 case OPCODE_COMPRESSED_TEX_IMAGE_3D: 00534 _mesa_free(n[9].data); 00535 n += InstSize[n[0].opcode]; 00536 break; 00537 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: 00538 _mesa_free(n[7].data); 00539 n += InstSize[n[0].opcode]; 00540 break; 00541 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: 00542 _mesa_free(n[9].data); 00543 n += InstSize[n[0].opcode]; 00544 break; 00545 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: 00546 _mesa_free(n[11].data); 00547 n += InstSize[n[0].opcode]; 00548 break; 00549 #if FEATURE_NV_vertex_program 00550 case OPCODE_LOAD_PROGRAM_NV: 00551 _mesa_free(n[4].data); /* program string */ 00552 n += InstSize[n[0].opcode]; 00553 break; 00554 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: 00555 _mesa_free(n[2].data); /* array of program ids */ 00556 n += InstSize[n[0].opcode]; 00557 break; 00558 #endif 00559 #if FEATURE_NV_fragment_program 00560 case OPCODE_PROGRAM_NAMED_PARAMETER_NV: 00561 _mesa_free(n[3].data); /* parameter name */ 00562 n += InstSize[n[0].opcode]; 00563 break; 00564 #endif 00565 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 00566 case OPCODE_PROGRAM_STRING_ARB: 00567 _mesa_free(n[4].data); /* program string */ 00568 n += InstSize[n[0].opcode]; 00569 break; 00570 #endif 00571 case OPCODE_CONTINUE: 00572 n = (Node *) n[1].next; 00573 _mesa_free(block); 00574 block = n; 00575 break; 00576 case OPCODE_END_OF_LIST: 00577 _mesa_free(block); 00578 done = GL_TRUE; 00579 break; 00580 default: 00581 /* Most frequent case */ 00582 n += InstSize[n[0].opcode]; 00583 break; 00584 } 00585 } 00586 } 00587 00588 _mesa_free(dlist); 00589 } 00590 00591 00596 static void 00597 destroy_list(GLcontext *ctx, GLuint list) 00598 { 00599 struct mesa_display_list *dlist; 00600 00601 if (list == 0) 00602 return; 00603 00604 dlist = lookup_list(ctx, list); 00605 if (!dlist) 00606 return; 00607 00608 _mesa_delete_list(ctx, dlist); 00609 _mesa_HashRemove(ctx->Shared->DisplayList, list); 00610 } 00611 00612 00613 /* 00614 * Translate the nth element of list from <type> to GLint. 00615 */ 00616 static GLint 00617 translate_id(GLsizei n, GLenum type, const GLvoid * list) 00618 { 00619 GLbyte *bptr; 00620 GLubyte *ubptr; 00621 GLshort *sptr; 00622 GLushort *usptr; 00623 GLint *iptr; 00624 GLuint *uiptr; 00625 GLfloat *fptr; 00626 00627 switch (type) { 00628 case GL_BYTE: 00629 bptr = (GLbyte *) list; 00630 return (GLint) bptr[n]; 00631 case GL_UNSIGNED_BYTE: 00632 ubptr = (GLubyte *) list; 00633 return (GLint) ubptr[n]; 00634 case GL_SHORT: 00635 sptr = (GLshort *) list; 00636 return (GLint) sptr[n]; 00637 case GL_UNSIGNED_SHORT: 00638 usptr = (GLushort *) list; 00639 return (GLint) usptr[n]; 00640 case GL_INT: 00641 iptr = (GLint *) list; 00642 return iptr[n]; 00643 case GL_UNSIGNED_INT: 00644 uiptr = (GLuint *) list; 00645 return (GLint) uiptr[n]; 00646 case GL_FLOAT: 00647 fptr = (GLfloat *) list; 00648 return (GLint) FLOORF(fptr[n]); 00649 case GL_2_BYTES: 00650 ubptr = ((GLubyte *) list) + 2 * n; 00651 return (GLint) ubptr[0] * 256 00652 + (GLint) ubptr[1]; 00653 case GL_3_BYTES: 00654 ubptr = ((GLubyte *) list) + 3 * n; 00655 return (GLint) ubptr[0] * 65536 00656 + (GLint) ubptr[1] * 256 00657 + (GLint) ubptr[2]; 00658 case GL_4_BYTES: 00659 ubptr = ((GLubyte *) list) + 4 * n; 00660 return (GLint) ubptr[0] * 16777216 00661 + (GLint) ubptr[1] * 65536 00662 + (GLint) ubptr[2] * 256 00663 + (GLint) ubptr[3]; 00664 default: 00665 return 0; 00666 } 00667 } 00668 00669 00670 00671 00672 /**********************************************************************/ 00673 /***** Public *****/ 00674 /**********************************************************************/ 00675 00680 static GLvoid * 00681 unpack_image(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, 00682 GLenum format, GLenum type, const GLvoid * pixels, 00683 const struct gl_pixelstore_attrib *unpack) 00684 { 00685 if (unpack->BufferObj->Name == 0) { 00686 /* no PBO */ 00687 return _mesa_unpack_image(dimensions, width, height, depth, format, 00688 type, pixels, unpack); 00689 } 00690 else 00691 if (_mesa_validate_pbo_access 00692 (dimensions, unpack, width, height, depth, format, type, pixels)) { 00693 const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels); 00694 return _mesa_unpack_image(dimensions, width, height, depth, format, 00695 type, src, unpack); 00696 } 00697 /* bad access! */ 00698 return NULL; 00699 } 00700 00701 00709 void * 00710 _mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes) 00711 { 00712 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node); 00713 Node *n; 00714 00715 if (opcode < (GLuint) OPCODE_EXT_0) { 00716 if (InstSize[opcode] == 0) { 00717 /* save instruction size now */ 00718 InstSize[opcode] = numNodes; 00719 } 00720 else { 00721 /* make sure instruction size agrees */ 00722 ASSERT(numNodes == InstSize[opcode]); 00723 } 00724 } 00725 00726 if (ctx->ListState.CurrentPos + numNodes + 2 > BLOCK_SIZE) { 00727 /* This block is full. Allocate a new block and chain to it */ 00728 Node *newblock; 00729 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; 00730 n[0].opcode = OPCODE_CONTINUE; 00731 newblock = (Node *) _mesa_malloc(sizeof(Node) * BLOCK_SIZE); 00732 if (!newblock) { 00733 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list"); 00734 return NULL; 00735 } 00736 n[1].next = (Node *) newblock; 00737 ctx->ListState.CurrentBlock = newblock; 00738 ctx->ListState.CurrentPos = 0; 00739 } 00740 00741 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; 00742 ctx->ListState.CurrentPos += numNodes; 00743 00744 n[0].opcode = (OpCode) opcode; 00745 00746 return (void *) (n + 1); /* return ptr to node following opcode */ 00747 } 00748 00749 00760 GLint 00761 _mesa_alloc_opcode(GLcontext *ctx, 00762 GLuint size, 00763 void (*execute) (GLcontext *, void *), 00764 void (*destroy) (GLcontext *, void *), 00765 void (*print) (GLcontext *, void *)) 00766 { 00767 if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) { 00768 const GLuint i = ctx->ListExt.NumOpcodes++; 00769 ctx->ListExt.Opcode[i].Size = 00770 1 + (size + sizeof(Node) - 1) / sizeof(Node); 00771 ctx->ListExt.Opcode[i].Execute = execute; 00772 ctx->ListExt.Opcode[i].Destroy = destroy; 00773 ctx->ListExt.Opcode[i].Print = print; 00774 return i + OPCODE_EXT_0; 00775 } 00776 return -1; 00777 } 00778 00779 00780 00788 #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \ 00789 ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1) 00790 00791 00792 00793 /* 00794 * Display List compilation functions 00795 */ 00796 static void GLAPIENTRY 00797 save_Accum(GLenum op, GLfloat value) 00798 { 00799 GET_CURRENT_CONTEXT(ctx); 00800 Node *n; 00801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00802 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACCUM, 2); 00803 if (n) { 00804 n[1].e = op; 00805 n[2].f = value; 00806 } 00807 if (ctx->ExecuteFlag) { 00808 CALL_Accum(ctx->Exec, (op, value)); 00809 } 00810 } 00811 00812 00813 static void GLAPIENTRY 00814 save_AlphaFunc(GLenum func, GLclampf ref) 00815 { 00816 GET_CURRENT_CONTEXT(ctx); 00817 Node *n; 00818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00819 n = ALLOC_INSTRUCTION(ctx, OPCODE_ALPHA_FUNC, 2); 00820 if (n) { 00821 n[1].e = func; 00822 n[2].f = (GLfloat) ref; 00823 } 00824 if (ctx->ExecuteFlag) { 00825 CALL_AlphaFunc(ctx->Exec, (func, ref)); 00826 } 00827 } 00828 00829 00830 static void GLAPIENTRY 00831 save_BindTexture(GLenum target, GLuint texture) 00832 { 00833 GET_CURRENT_CONTEXT(ctx); 00834 Node *n; 00835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00836 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_TEXTURE, 2); 00837 if (n) { 00838 n[1].e = target; 00839 n[2].ui = texture; 00840 } 00841 if (ctx->ExecuteFlag) { 00842 CALL_BindTexture(ctx->Exec, (target, texture)); 00843 } 00844 } 00845 00846 00847 static void GLAPIENTRY 00848 save_Bitmap(GLsizei width, GLsizei height, 00849 GLfloat xorig, GLfloat yorig, 00850 GLfloat xmove, GLfloat ymove, const GLubyte * pixels) 00851 { 00852 GET_CURRENT_CONTEXT(ctx); 00853 GLvoid *image = _mesa_unpack_bitmap(width, height, pixels, &ctx->Unpack); 00854 Node *n; 00855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00856 n = ALLOC_INSTRUCTION(ctx, OPCODE_BITMAP, 7); 00857 if (n) { 00858 n[1].i = (GLint) width; 00859 n[2].i = (GLint) height; 00860 n[3].f = xorig; 00861 n[4].f = yorig; 00862 n[5].f = xmove; 00863 n[6].f = ymove; 00864 n[7].data = image; 00865 } 00866 else if (image) { 00867 _mesa_free(image); 00868 } 00869 if (ctx->ExecuteFlag) { 00870 CALL_Bitmap(ctx->Exec, (width, height, 00871 xorig, yorig, xmove, ymove, pixels)); 00872 } 00873 } 00874 00875 00876 static void GLAPIENTRY 00877 save_BlendEquation(GLenum mode) 00878 { 00879 GET_CURRENT_CONTEXT(ctx); 00880 Node *n; 00881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00882 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION, 1); 00883 if (n) { 00884 n[1].e = mode; 00885 } 00886 if (ctx->ExecuteFlag) { 00887 CALL_BlendEquation(ctx->Exec, (mode)); 00888 } 00889 } 00890 00891 00892 static void GLAPIENTRY 00893 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA) 00894 { 00895 GET_CURRENT_CONTEXT(ctx); 00896 Node *n; 00897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00898 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2); 00899 if (n) { 00900 n[1].e = modeRGB; 00901 n[2].e = modeA; 00902 } 00903 if (ctx->ExecuteFlag) { 00904 CALL_BlendEquationSeparateEXT(ctx->Exec, (modeRGB, modeA)); 00905 } 00906 } 00907 00908 00909 static void GLAPIENTRY 00910 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, 00911 GLenum sfactorA, GLenum dfactorA) 00912 { 00913 GET_CURRENT_CONTEXT(ctx); 00914 Node *n; 00915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00916 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4); 00917 if (n) { 00918 n[1].e = sfactorRGB; 00919 n[2].e = dfactorRGB; 00920 n[3].e = sfactorA; 00921 n[4].e = dfactorA; 00922 } 00923 if (ctx->ExecuteFlag) { 00924 CALL_BlendFuncSeparateEXT(ctx->Exec, 00925 (sfactorRGB, dfactorRGB, sfactorA, dfactorA)); 00926 } 00927 } 00928 00929 00930 static void GLAPIENTRY 00931 save_BlendFunc(GLenum srcfactor, GLenum dstfactor) 00932 { 00933 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor); 00934 } 00935 00936 00937 static void GLAPIENTRY 00938 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) 00939 { 00940 GET_CURRENT_CONTEXT(ctx); 00941 Node *n; 00942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 00943 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_COLOR, 4); 00944 if (n) { 00945 n[1].f = red; 00946 n[2].f = green; 00947 n[3].f = blue; 00948 n[4].f = alpha; 00949 } 00950 if (ctx->ExecuteFlag) { 00951 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha)); 00952 } 00953 } 00954 00955 00956 void GLAPIENTRY 00957 _mesa_save_CallList(GLuint list) 00958 { 00959 GET_CURRENT_CONTEXT(ctx); 00960 Node *n; 00961 SAVE_FLUSH_VERTICES(ctx); 00962 00963 n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST, 1); 00964 if (n) { 00965 n[1].ui = list; 00966 } 00967 00968 /* After this, we don't know what begin/end state we're in: 00969 */ 00970 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 00971 00972 if (ctx->ExecuteFlag) { 00973 CALL_CallList(ctx->Exec, (list)); 00974 } 00975 } 00976 00977 00978 void GLAPIENTRY 00979 _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists) 00980 { 00981 GET_CURRENT_CONTEXT(ctx); 00982 GLint i; 00983 GLboolean typeErrorFlag; 00984 00985 SAVE_FLUSH_VERTICES(ctx); 00986 00987 switch (type) { 00988 case GL_BYTE: 00989 case GL_UNSIGNED_BYTE: 00990 case GL_SHORT: 00991 case GL_UNSIGNED_SHORT: 00992 case GL_INT: 00993 case GL_UNSIGNED_INT: 00994 case GL_FLOAT: 00995 case GL_2_BYTES: 00996 case GL_3_BYTES: 00997 case GL_4_BYTES: 00998 typeErrorFlag = GL_FALSE; 00999 break; 01000 default: 01001 typeErrorFlag = GL_TRUE; 01002 } 01003 01004 for (i = 0; i < n; i++) { 01005 GLint list = translate_id(i, type, lists); 01006 Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2); 01007 if (n) { 01008 n[1].i = list; 01009 n[2].b = typeErrorFlag; 01010 } 01011 } 01012 01013 /* After this, we don't know what begin/end state we're in: 01014 */ 01015 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 01016 01017 if (ctx->ExecuteFlag) { 01018 CALL_CallLists(ctx->Exec, (n, type, lists)); 01019 } 01020 } 01021 01022 01023 static void GLAPIENTRY 01024 save_Clear(GLbitfield mask) 01025 { 01026 GET_CURRENT_CONTEXT(ctx); 01027 Node *n; 01028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01029 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR, 1); 01030 if (n) { 01031 n[1].bf = mask; 01032 } 01033 if (ctx->ExecuteFlag) { 01034 CALL_Clear(ctx->Exec, (mask)); 01035 } 01036 } 01037 01038 01039 static void GLAPIENTRY 01040 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) 01041 { 01042 GET_CURRENT_CONTEXT(ctx); 01043 Node *n; 01044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01045 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_ACCUM, 4); 01046 if (n) { 01047 n[1].f = red; 01048 n[2].f = green; 01049 n[3].f = blue; 01050 n[4].f = alpha; 01051 } 01052 if (ctx->ExecuteFlag) { 01053 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha)); 01054 } 01055 } 01056 01057 01058 static void GLAPIENTRY 01059 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) 01060 { 01061 GET_CURRENT_CONTEXT(ctx); 01062 Node *n; 01063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01064 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_COLOR, 4); 01065 if (n) { 01066 n[1].f = red; 01067 n[2].f = green; 01068 n[3].f = blue; 01069 n[4].f = alpha; 01070 } 01071 if (ctx->ExecuteFlag) { 01072 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha)); 01073 } 01074 } 01075 01076 01077 static void GLAPIENTRY 01078 save_ClearDepth(GLclampd depth) 01079 { 01080 GET_CURRENT_CONTEXT(ctx); 01081 Node *n; 01082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01083 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_DEPTH, 1); 01084 if (n) { 01085 n[1].f = (GLfloat) depth; 01086 } 01087 if (ctx->ExecuteFlag) { 01088 CALL_ClearDepth(ctx->Exec, (depth)); 01089 } 01090 } 01091 01092 01093 static void GLAPIENTRY 01094 save_ClearIndex(GLfloat c) 01095 { 01096 GET_CURRENT_CONTEXT(ctx); 01097 Node *n; 01098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01099 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_INDEX, 1); 01100 if (n) { 01101 n[1].f = c; 01102 } 01103 if (ctx->ExecuteFlag) { 01104 CALL_ClearIndex(ctx->Exec, (c)); 01105 } 01106 } 01107 01108 01109 static void GLAPIENTRY 01110 save_ClearStencil(GLint s) 01111 { 01112 GET_CURRENT_CONTEXT(ctx); 01113 Node *n; 01114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01115 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_STENCIL, 1); 01116 if (n) { 01117 n[1].i = s; 01118 } 01119 if (ctx->ExecuteFlag) { 01120 CALL_ClearStencil(ctx->Exec, (s)); 01121 } 01122 } 01123 01124 01125 static void GLAPIENTRY 01126 save_ClipPlane(GLenum plane, const GLdouble * equ) 01127 { 01128 GET_CURRENT_CONTEXT(ctx); 01129 Node *n; 01130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01131 n = ALLOC_INSTRUCTION(ctx, OPCODE_CLIP_PLANE, 5); 01132 if (n) { 01133 n[1].e = plane; 01134 n[2].f = (GLfloat) equ[0]; 01135 n[3].f = (GLfloat) equ[1]; 01136 n[4].f = (GLfloat) equ[2]; 01137 n[5].f = (GLfloat) equ[3]; 01138 } 01139 if (ctx->ExecuteFlag) { 01140 CALL_ClipPlane(ctx->Exec, (plane, equ)); 01141 } 01142 } 01143 01144 01145 01146 static void GLAPIENTRY 01147 save_ColorMask(GLboolean red, GLboolean green, 01148 GLboolean blue, GLboolean alpha) 01149 { 01150 GET_CURRENT_CONTEXT(ctx); 01151 Node *n; 01152 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01153 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MASK, 4); 01154 if (n) { 01155 n[1].b = red; 01156 n[2].b = green; 01157 n[3].b = blue; 01158 n[4].b = alpha; 01159 } 01160 if (ctx->ExecuteFlag) { 01161 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha)); 01162 } 01163 } 01164 01165 01166 static void GLAPIENTRY 01167 save_ColorMaterial(GLenum face, GLenum mode) 01168 { 01169 GET_CURRENT_CONTEXT(ctx); 01170 Node *n; 01171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01172 01173 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MATERIAL, 2); 01174 if (n) { 01175 n[1].e = face; 01176 n[2].e = mode; 01177 } 01178 if (ctx->ExecuteFlag) { 01179 CALL_ColorMaterial(ctx->Exec, (face, mode)); 01180 } 01181 } 01182 01183 01184 static void GLAPIENTRY 01185 save_ColorTable(GLenum target, GLenum internalFormat, 01186 GLsizei width, GLenum format, GLenum type, 01187 const GLvoid * table) 01188 { 01189 GET_CURRENT_CONTEXT(ctx); 01190 if (_mesa_is_proxy_texture(target)) { 01191 /* execute immediately */ 01192 CALL_ColorTable(ctx->Exec, (target, internalFormat, width, 01193 format, type, table)); 01194 } 01195 else { 01196 GLvoid *image = unpack_image(1, width, 1, 1, format, type, table, 01197 &ctx->Unpack); 01198 Node *n; 01199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01200 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE, 6); 01201 if (n) { 01202 n[1].e = target; 01203 n[2].e = internalFormat; 01204 n[3].i = width; 01205 n[4].e = format; 01206 n[5].e = type; 01207 n[6].data = image; 01208 } 01209 else if (image) { 01210 _mesa_free(image); 01211 } 01212 if (ctx->ExecuteFlag) { 01213 CALL_ColorTable(ctx->Exec, (target, internalFormat, width, 01214 format, type, table)); 01215 } 01216 } 01217 } 01218 01219 01220 01221 static void GLAPIENTRY 01222 save_ColorTableParameterfv(GLenum target, GLenum pname, 01223 const GLfloat *params) 01224 { 01225 GET_CURRENT_CONTEXT(ctx); 01226 Node *n; 01227 01228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01229 01230 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6); 01231 if (n) { 01232 n[1].e = target; 01233 n[2].e = pname; 01234 n[3].f = params[0]; 01235 if (pname == GL_COLOR_TABLE_SGI || 01236 pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || 01237 pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || 01238 pname == GL_TEXTURE_COLOR_TABLE_SGI) { 01239 n[4].f = params[1]; 01240 n[5].f = params[2]; 01241 n[6].f = params[3]; 01242 } 01243 } 01244 01245 if (ctx->ExecuteFlag) { 01246 CALL_ColorTableParameterfv(ctx->Exec, (target, pname, params)); 01247 } 01248 } 01249 01250 01251 static void GLAPIENTRY 01252 save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) 01253 { 01254 GET_CURRENT_CONTEXT(ctx); 01255 Node *n; 01256 01257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01258 01259 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6); 01260 if (n) { 01261 n[1].e = target; 01262 n[2].e = pname; 01263 n[3].i = params[0]; 01264 if (pname == GL_COLOR_TABLE_SGI || 01265 pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || 01266 pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || 01267 pname == GL_TEXTURE_COLOR_TABLE_SGI) { 01268 n[4].i = params[1]; 01269 n[5].i = params[2]; 01270 n[6].i = params[3]; 01271 } 01272 } 01273 01274 if (ctx->ExecuteFlag) { 01275 CALL_ColorTableParameteriv(ctx->Exec, (target, pname, params)); 01276 } 01277 } 01278 01279 01280 01281 static void GLAPIENTRY 01282 save_ColorSubTable(GLenum target, GLsizei start, GLsizei count, 01283 GLenum format, GLenum type, const GLvoid * table) 01284 { 01285 GET_CURRENT_CONTEXT(ctx); 01286 GLvoid *image = unpack_image(1, count, 1, 1, format, type, table, 01287 &ctx->Unpack); 01288 Node *n; 01289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01290 n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_SUB_TABLE, 6); 01291 if (n) { 01292 n[1].e = target; 01293 n[2].i = start; 01294 n[3].i = count; 01295 n[4].e = format; 01296 n[5].e = type; 01297 n[6].data = image; 01298 } 01299 else if (image) { 01300 _mesa_free(image); 01301 } 01302 if (ctx->ExecuteFlag) { 01303 CALL_ColorSubTable(ctx->Exec, 01304 (target, start, count, format, type, table)); 01305 } 01306 } 01307 01308 01309 static void GLAPIENTRY 01310 save_CopyColorSubTable(GLenum target, GLsizei start, 01311 GLint x, GLint y, GLsizei width) 01312 { 01313 GET_CURRENT_CONTEXT(ctx); 01314 Node *n; 01315 01316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01317 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5); 01318 if (n) { 01319 n[1].e = target; 01320 n[2].i = start; 01321 n[3].i = x; 01322 n[4].i = y; 01323 n[5].i = width; 01324 } 01325 if (ctx->ExecuteFlag) { 01326 CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width)); 01327 } 01328 } 01329 01330 01331 static void GLAPIENTRY 01332 save_CopyColorTable(GLenum target, GLenum internalformat, 01333 GLint x, GLint y, GLsizei width) 01334 { 01335 GET_CURRENT_CONTEXT(ctx); 01336 Node *n; 01337 01338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01339 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_TABLE, 5); 01340 if (n) { 01341 n[1].e = target; 01342 n[2].e = internalformat; 01343 n[3].i = x; 01344 n[4].i = y; 01345 n[5].i = width; 01346 } 01347 if (ctx->ExecuteFlag) { 01348 CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width)); 01349 } 01350 } 01351 01352 01353 static void GLAPIENTRY 01354 save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, 01355 GLenum format, GLenum type, const GLvoid * filter) 01356 { 01357 GET_CURRENT_CONTEXT(ctx); 01358 GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter, 01359 &ctx->Unpack); 01360 Node *n; 01361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01362 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6); 01363 if (n) { 01364 n[1].e = target; 01365 n[2].e = internalFormat; 01366 n[3].i = width; 01367 n[4].e = format; 01368 n[5].e = type; 01369 n[6].data = image; 01370 } 01371 else if (image) { 01372 _mesa_free(image); 01373 } 01374 if (ctx->ExecuteFlag) { 01375 CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width, 01376 format, type, filter)); 01377 } 01378 } 01379 01380 01381 static void GLAPIENTRY 01382 save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, 01383 GLsizei width, GLsizei height, GLenum format, 01384 GLenum type, const GLvoid * filter) 01385 { 01386 GET_CURRENT_CONTEXT(ctx); 01387 GLvoid *image = unpack_image(2, width, height, 1, format, type, filter, 01388 &ctx->Unpack); 01389 Node *n; 01390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01391 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7); 01392 if (n) { 01393 n[1].e = target; 01394 n[2].e = internalFormat; 01395 n[3].i = width; 01396 n[4].i = height; 01397 n[5].e = format; 01398 n[6].e = type; 01399 n[7].data = image; 01400 } 01401 else if (image) { 01402 _mesa_free(image); 01403 } 01404 if (ctx->ExecuteFlag) { 01405 CALL_ConvolutionFilter2D(ctx->Exec, 01406 (target, internalFormat, width, height, format, 01407 type, filter)); 01408 } 01409 } 01410 01411 01412 static void GLAPIENTRY 01413 save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) 01414 { 01415 GET_CURRENT_CONTEXT(ctx); 01416 Node *n; 01417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01418 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3); 01419 if (n) { 01420 n[1].e = target; 01421 n[2].e = pname; 01422 n[3].i = param; 01423 } 01424 if (ctx->ExecuteFlag) { 01425 CALL_ConvolutionParameteri(ctx->Exec, (target, pname, param)); 01426 } 01427 } 01428 01429 01430 static void GLAPIENTRY 01431 save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) 01432 { 01433 GET_CURRENT_CONTEXT(ctx); 01434 Node *n; 01435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01436 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6); 01437 if (n) { 01438 n[1].e = target; 01439 n[2].e = pname; 01440 n[3].i = params[0]; 01441 if (pname == GL_CONVOLUTION_BORDER_COLOR || 01442 pname == GL_CONVOLUTION_FILTER_SCALE || 01443 pname == GL_CONVOLUTION_FILTER_BIAS) { 01444 n[4].i = params[1]; 01445 n[5].i = params[2]; 01446 n[6].i = params[3]; 01447 } 01448 else { 01449 n[4].i = n[5].i = n[6].i = 0; 01450 } 01451 } 01452 if (ctx->ExecuteFlag) { 01453 CALL_ConvolutionParameteriv(ctx->Exec, (target, pname, params)); 01454 } 01455 } 01456 01457 01458 static void GLAPIENTRY 01459 save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) 01460 { 01461 GET_CURRENT_CONTEXT(ctx); 01462 Node *n; 01463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01464 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3); 01465 if (n) { 01466 n[1].e = target; 01467 n[2].e = pname; 01468 n[3].f = param; 01469 } 01470 if (ctx->ExecuteFlag) { 01471 CALL_ConvolutionParameterf(ctx->Exec, (target, pname, param)); 01472 } 01473 } 01474 01475 01476 static void GLAPIENTRY 01477 save_ConvolutionParameterfv(GLenum target, GLenum pname, 01478 const GLfloat *params) 01479 { 01480 GET_CURRENT_CONTEXT(ctx); 01481 Node *n; 01482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01483 n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6); 01484 if (n) { 01485 n[1].e = target; 01486 n[2].e = pname; 01487 n[3].f = params[0]; 01488 if (pname == GL_CONVOLUTION_BORDER_COLOR || 01489 pname == GL_CONVOLUTION_FILTER_SCALE || 01490 pname == GL_CONVOLUTION_FILTER_BIAS) { 01491 n[4].f = params[1]; 01492 n[5].f = params[2]; 01493 n[6].f = params[3]; 01494 } 01495 else { 01496 n[4].f = n[5].f = n[6].f = 0.0F; 01497 } 01498 } 01499 if (ctx->ExecuteFlag) { 01500 CALL_ConvolutionParameterfv(ctx->Exec, (target, pname, params)); 01501 } 01502 } 01503 01504 01505 static void GLAPIENTRY 01506 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) 01507 { 01508 GET_CURRENT_CONTEXT(ctx); 01509 Node *n; 01510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01511 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_PIXELS, 5); 01512 if (n) { 01513 n[1].i = x; 01514 n[2].i = y; 01515 n[3].i = (GLint) width; 01516 n[4].i = (GLint) height; 01517 n[5].e = type; 01518 } 01519 if (ctx->ExecuteFlag) { 01520 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type)); 01521 } 01522 } 01523 01524 01525 01526 static void GLAPIENTRY 01527 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat, 01528 GLint x, GLint y, GLsizei width, GLint border) 01529 { 01530 GET_CURRENT_CONTEXT(ctx); 01531 Node *n; 01532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01533 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE1D, 7); 01534 if (n) { 01535 n[1].e = target; 01536 n[2].i = level; 01537 n[3].e = internalformat; 01538 n[4].i = x; 01539 n[5].i = y; 01540 n[6].i = width; 01541 n[7].i = border; 01542 } 01543 if (ctx->ExecuteFlag) { 01544 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat, 01545 x, y, width, border)); 01546 } 01547 } 01548 01549 01550 static void GLAPIENTRY 01551 save_CopyTexImage2D(GLenum target, GLint level, 01552 GLenum internalformat, 01553 GLint x, GLint y, GLsizei width, 01554 GLsizei height, GLint border) 01555 { 01556 GET_CURRENT_CONTEXT(ctx); 01557 Node *n; 01558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01559 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE2D, 8); 01560 if (n) { 01561 n[1].e = target; 01562 n[2].i = level; 01563 n[3].e = internalformat; 01564 n[4].i = x; 01565 n[5].i = y; 01566 n[6].i = width; 01567 n[7].i = height; 01568 n[8].i = border; 01569 } 01570 if (ctx->ExecuteFlag) { 01571 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat, 01572 x, y, width, height, border)); 01573 } 01574 } 01575 01576 01577 01578 static void GLAPIENTRY 01579 save_CopyTexSubImage1D(GLenum target, GLint level, 01580 GLint xoffset, GLint x, GLint y, GLsizei width) 01581 { 01582 GET_CURRENT_CONTEXT(ctx); 01583 Node *n; 01584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01585 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6); 01586 if (n) { 01587 n[1].e = target; 01588 n[2].i = level; 01589 n[3].i = xoffset; 01590 n[4].i = x; 01591 n[5].i = y; 01592 n[6].i = width; 01593 } 01594 if (ctx->ExecuteFlag) { 01595 CALL_CopyTexSubImage1D(ctx->Exec, 01596 (target, level, xoffset, x, y, width)); 01597 } 01598 } 01599 01600 01601 static void GLAPIENTRY 01602 save_CopyTexSubImage2D(GLenum target, GLint level, 01603 GLint xoffset, GLint yoffset, 01604 GLint x, GLint y, GLsizei width, GLint height) 01605 { 01606 GET_CURRENT_CONTEXT(ctx); 01607 Node *n; 01608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01609 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8); 01610 if (n) { 01611 n[1].e = target; 01612 n[2].i = level; 01613 n[3].i = xoffset; 01614 n[4].i = yoffset; 01615 n[5].i = x; 01616 n[6].i = y; 01617 n[7].i = width; 01618 n[8].i = height; 01619 } 01620 if (ctx->ExecuteFlag) { 01621 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset, 01622 x, y, width, height)); 01623 } 01624 } 01625 01626 01627 static void GLAPIENTRY 01628 save_CopyTexSubImage3D(GLenum target, GLint level, 01629 GLint xoffset, GLint yoffset, GLint zoffset, 01630 GLint x, GLint y, GLsizei width, GLint height) 01631 { 01632 GET_CURRENT_CONTEXT(ctx); 01633 Node *n; 01634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01635 n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9); 01636 if (n) { 01637 n[1].e = target; 01638 n[2].i = level; 01639 n[3].i = xoffset; 01640 n[4].i = yoffset; 01641 n[5].i = zoffset; 01642 n[6].i = x; 01643 n[7].i = y; 01644 n[8].i = width; 01645 n[9].i = height; 01646 } 01647 if (ctx->ExecuteFlag) { 01648 CALL_CopyTexSubImage3D(ctx->Exec, (target, level, 01649 xoffset, yoffset, zoffset, 01650 x, y, width, height)); 01651 } 01652 } 01653 01654 01655 static void GLAPIENTRY 01656 save_CullFace(GLenum mode) 01657 { 01658 GET_CURRENT_CONTEXT(ctx); 01659 Node *n; 01660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01661 n = ALLOC_INSTRUCTION(ctx, OPCODE_CULL_FACE, 1); 01662 if (n) { 01663 n[1].e = mode; 01664 } 01665 if (ctx->ExecuteFlag) { 01666 CALL_CullFace(ctx->Exec, (mode)); 01667 } 01668 } 01669 01670 01671 static void GLAPIENTRY 01672 save_DepthFunc(GLenum func) 01673 { 01674 GET_CURRENT_CONTEXT(ctx); 01675 Node *n; 01676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01677 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_FUNC, 1); 01678 if (n) { 01679 n[1].e = func; 01680 } 01681 if (ctx->ExecuteFlag) { 01682 CALL_DepthFunc(ctx->Exec, (func)); 01683 } 01684 } 01685 01686 01687 static void GLAPIENTRY 01688 save_DepthMask(GLboolean mask) 01689 { 01690 GET_CURRENT_CONTEXT(ctx); 01691 Node *n; 01692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01693 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_MASK, 1); 01694 if (n) { 01695 n[1].b = mask; 01696 } 01697 if (ctx->ExecuteFlag) { 01698 CALL_DepthMask(ctx->Exec, (mask)); 01699 } 01700 } 01701 01702 01703 static void GLAPIENTRY 01704 save_DepthRange(GLclampd nearval, GLclampd farval) 01705 { 01706 GET_CURRENT_CONTEXT(ctx); 01707 Node *n; 01708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01709 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_RANGE, 2); 01710 if (n) { 01711 n[1].f = (GLfloat) nearval; 01712 n[2].f = (GLfloat) farval; 01713 } 01714 if (ctx->ExecuteFlag) { 01715 CALL_DepthRange(ctx->Exec, (nearval, farval)); 01716 } 01717 } 01718 01719 01720 static void GLAPIENTRY 01721 save_Disable(GLenum cap) 01722 { 01723 GET_CURRENT_CONTEXT(ctx); 01724 Node *n; 01725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01726 n = ALLOC_INSTRUCTION(ctx, OPCODE_DISABLE, 1); 01727 if (n) { 01728 n[1].e = cap; 01729 } 01730 if (ctx->ExecuteFlag) { 01731 CALL_Disable(ctx->Exec, (cap)); 01732 } 01733 } 01734 01735 01736 static void GLAPIENTRY 01737 save_DrawBuffer(GLenum mode) 01738 { 01739 GET_CURRENT_CONTEXT(ctx); 01740 Node *n; 01741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01742 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFER, 1); 01743 if (n) { 01744 n[1].e = mode; 01745 } 01746 if (ctx->ExecuteFlag) { 01747 CALL_DrawBuffer(ctx->Exec, (mode)); 01748 } 01749 } 01750 01751 01752 static void GLAPIENTRY 01753 save_DrawPixels(GLsizei width, GLsizei height, 01754 GLenum format, GLenum type, const GLvoid * pixels) 01755 { 01756 GET_CURRENT_CONTEXT(ctx); 01757 GLvoid *image = unpack_image(2, width, height, 1, format, type, 01758 pixels, &ctx->Unpack); 01759 Node *n; 01760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01761 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_PIXELS, 5); 01762 if (n) { 01763 n[1].i = width; 01764 n[2].i = height; 01765 n[3].e = format; 01766 n[4].e = type; 01767 n[5].data = image; 01768 } 01769 else if (image) { 01770 _mesa_free(image); 01771 } 01772 if (ctx->ExecuteFlag) { 01773 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels)); 01774 } 01775 } 01776 01777 01778 01779 static void GLAPIENTRY 01780 save_Enable(GLenum cap) 01781 { 01782 GET_CURRENT_CONTEXT(ctx); 01783 Node *n; 01784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01785 n = ALLOC_INSTRUCTION(ctx, OPCODE_ENABLE, 1); 01786 if (n) { 01787 n[1].e = cap; 01788 } 01789 if (ctx->ExecuteFlag) { 01790 CALL_Enable(ctx->Exec, (cap)); 01791 } 01792 } 01793 01794 01795 01796 static void GLAPIENTRY 01797 _mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) 01798 { 01799 GET_CURRENT_CONTEXT(ctx); 01800 Node *n; 01801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01802 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH1, 3); 01803 if (n) { 01804 n[1].e = mode; 01805 n[2].i = i1; 01806 n[3].i = i2; 01807 } 01808 if (ctx->ExecuteFlag) { 01809 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2)); 01810 } 01811 } 01812 01813 01814 static void GLAPIENTRY 01815 _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) 01816 { 01817 GET_CURRENT_CONTEXT(ctx); 01818 Node *n; 01819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01820 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH2, 5); 01821 if (n) { 01822 n[1].e = mode; 01823 n[2].i = i1; 01824 n[3].i = i2; 01825 n[4].i = j1; 01826 n[5].i = j2; 01827 } 01828 if (ctx->ExecuteFlag) { 01829 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2)); 01830 } 01831 } 01832 01833 01834 01835 01836 static void GLAPIENTRY 01837 save_Fogfv(GLenum pname, const GLfloat *params) 01838 { 01839 GET_CURRENT_CONTEXT(ctx); 01840 Node *n; 01841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01842 n = ALLOC_INSTRUCTION(ctx, OPCODE_FOG, 5); 01843 if (n) { 01844 n[1].e = pname; 01845 n[2].f = params[0]; 01846 n[3].f = params[1]; 01847 n[4].f = params[2]; 01848 n[5].f = params[3]; 01849 } 01850 if (ctx->ExecuteFlag) { 01851 CALL_Fogfv(ctx->Exec, (pname, params)); 01852 } 01853 } 01854 01855 01856 static void GLAPIENTRY 01857 save_Fogf(GLenum pname, GLfloat param) 01858 { 01859 save_Fogfv(pname, ¶m); 01860 } 01861 01862 01863 static void GLAPIENTRY 01864 save_Fogiv(GLenum pname, const GLint *params) 01865 { 01866 GLfloat p[4]; 01867 switch (pname) { 01868 case GL_FOG_MODE: 01869 case GL_FOG_DENSITY: 01870 case GL_FOG_START: 01871 case GL_FOG_END: 01872 case GL_FOG_INDEX: 01873 p[0] = (GLfloat) *params; 01874 break; 01875 case GL_FOG_COLOR: 01876 p[0] = INT_TO_FLOAT(params[0]); 01877 p[1] = INT_TO_FLOAT(params[1]); 01878 p[2] = INT_TO_FLOAT(params[2]); 01879 p[3] = INT_TO_FLOAT(params[3]); 01880 break; 01881 default: 01882 /* Error will be caught later in gl_Fogfv */ 01883 ; 01884 } 01885 save_Fogfv(pname, p); 01886 } 01887 01888 01889 static void GLAPIENTRY 01890 save_Fogi(GLenum pname, GLint param) 01891 { 01892 save_Fogiv(pname, ¶m); 01893 } 01894 01895 01896 static void GLAPIENTRY 01897 save_FrontFace(GLenum mode) 01898 { 01899 GET_CURRENT_CONTEXT(ctx); 01900 Node *n; 01901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01902 n = ALLOC_INSTRUCTION(ctx, OPCODE_FRONT_FACE, 1); 01903 if (n) { 01904 n[1].e = mode; 01905 } 01906 if (ctx->ExecuteFlag) { 01907 CALL_FrontFace(ctx->Exec, (mode)); 01908 } 01909 } 01910 01911 01912 static void GLAPIENTRY 01913 save_Frustum(GLdouble left, GLdouble right, 01914 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) 01915 { 01916 GET_CURRENT_CONTEXT(ctx); 01917 Node *n; 01918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01919 n = ALLOC_INSTRUCTION(ctx, OPCODE_FRUSTUM, 6); 01920 if (n) { 01921 n[1].f = (GLfloat) left; 01922 n[2].f = (GLfloat) right; 01923 n[3].f = (GLfloat) bottom; 01924 n[4].f = (GLfloat) top; 01925 n[5].f = (GLfloat) nearval; 01926 n[6].f = (GLfloat) farval; 01927 } 01928 if (ctx->ExecuteFlag) { 01929 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval)); 01930 } 01931 } 01932 01933 01934 static void GLAPIENTRY 01935 save_Hint(GLenum target, GLenum mode) 01936 { 01937 GET_CURRENT_CONTEXT(ctx); 01938 Node *n; 01939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01940 n = ALLOC_INSTRUCTION(ctx, OPCODE_HINT, 2); 01941 if (n) { 01942 n[1].e = target; 01943 n[2].e = mode; 01944 } 01945 if (ctx->ExecuteFlag) { 01946 CALL_Hint(ctx->Exec, (target, mode)); 01947 } 01948 } 01949 01950 01951 static void GLAPIENTRY 01952 save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, 01953 GLboolean sink) 01954 { 01955 GET_CURRENT_CONTEXT(ctx); 01956 Node *n; 01957 01958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01959 n = ALLOC_INSTRUCTION(ctx, OPCODE_HISTOGRAM, 4); 01960 if (n) { 01961 n[1].e = target; 01962 n[2].i = width; 01963 n[3].e = internalFormat; 01964 n[4].b = sink; 01965 } 01966 if (ctx->ExecuteFlag) { 01967 CALL_Histogram(ctx->Exec, (target, width, internalFormat, sink)); 01968 } 01969 } 01970 01971 01972 static void GLAPIENTRY 01973 save_IndexMask(GLuint mask) 01974 { 01975 GET_CURRENT_CONTEXT(ctx); 01976 Node *n; 01977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01978 n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX_MASK, 1); 01979 if (n) { 01980 n[1].ui = mask; 01981 } 01982 if (ctx->ExecuteFlag) { 01983 CALL_IndexMask(ctx->Exec, (mask)); 01984 } 01985 } 01986 01987 01988 static void GLAPIENTRY 01989 save_InitNames(void) 01990 { 01991 GET_CURRENT_CONTEXT(ctx); 01992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 01993 (void) ALLOC_INSTRUCTION(ctx, OPCODE_INIT_NAMES, 0); 01994 if (ctx->ExecuteFlag) { 01995 CALL_InitNames(ctx->Exec, ()); 01996 } 01997 } 01998 01999 02000 static void GLAPIENTRY 02001 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params) 02002 { 02003 GET_CURRENT_CONTEXT(ctx); 02004 Node *n; 02005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02006 n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT, 6); 02007 if (n) { 02008 GLint i, nParams; 02009 n[1].e = light; 02010 n[2].e = pname; 02011 switch (pname) { 02012 case GL_AMBIENT: 02013 nParams = 4; 02014 break; 02015 case GL_DIFFUSE: 02016 nParams = 4; 02017 break; 02018 case GL_SPECULAR: 02019 nParams = 4; 02020 break; 02021 case GL_POSITION: 02022 nParams = 4; 02023 break; 02024 case GL_SPOT_DIRECTION: 02025 nParams = 3; 02026 break; 02027 case GL_SPOT_EXPONENT: 02028 nParams = 1; 02029 break; 02030 case GL_SPOT_CUTOFF: 02031 nParams = 1; 02032 break; 02033 case GL_CONSTANT_ATTENUATION: 02034 nParams = 1; 02035 break; 02036 case GL_LINEAR_ATTENUATION: 02037 nParams = 1; 02038 break; 02039 case GL_QUADRATIC_ATTENUATION: 02040 nParams = 1; 02041 break; 02042 default: 02043 nParams = 0; 02044 } 02045 for (i = 0; i < nParams; i++) { 02046 n[3 + i].f = params[i]; 02047 } 02048 } 02049 if (ctx->ExecuteFlag) { 02050 CALL_Lightfv(ctx->Exec, (light, pname, params)); 02051 } 02052 } 02053 02054 02055 static void GLAPIENTRY 02056 save_Lightf(GLenum light, GLenum pname, GLfloat params) 02057 { 02058 save_Lightfv(light, pname, ¶ms); 02059 } 02060 02061 02062 static void GLAPIENTRY 02063 save_Lightiv(GLenum light, GLenum pname, const GLint *params) 02064 { 02065 GLfloat fparam[4]; 02066 switch (pname) { 02067 case GL_AMBIENT: 02068 case GL_DIFFUSE: 02069 case GL_SPECULAR: 02070 fparam[0] = INT_TO_FLOAT(params[0]); 02071 fparam[1] = INT_TO_FLOAT(params[1]); 02072 fparam[2] = INT_TO_FLOAT(params[2]); 02073 fparam[3] = INT_TO_FLOAT(params[3]); 02074 break; 02075 case GL_POSITION: 02076 fparam[0] = (GLfloat) params[0]; 02077 fparam[1] = (GLfloat) params[1]; 02078 fparam[2] = (GLfloat) params[2]; 02079 fparam[3] = (GLfloat) params[3]; 02080 break; 02081 case GL_SPOT_DIRECTION: 02082 fparam[0] = (GLfloat) params[0]; 02083 fparam[1] = (GLfloat) params[1]; 02084 fparam[2] = (GLfloat) params[2]; 02085 break; 02086 case GL_SPOT_EXPONENT: 02087 case GL_SPOT_CUTOFF: 02088 case GL_CONSTANT_ATTENUATION: 02089 case GL_LINEAR_ATTENUATION: 02090 case GL_QUADRATIC_ATTENUATION: 02091 fparam[0] = (GLfloat) params[0]; 02092 break; 02093 default: 02094 /* error will be caught later in gl_Lightfv */ 02095 ; 02096 } 02097 save_Lightfv(light, pname, fparam); 02098 } 02099 02100 02101 static void GLAPIENTRY 02102 save_Lighti(GLenum light, GLenum pname, GLint param) 02103 { 02104 save_Lightiv(light, pname, ¶m); 02105 } 02106 02107 02108 static void GLAPIENTRY 02109 save_LightModelfv(GLenum pname, const GLfloat *params) 02110 { 02111 GET_CURRENT_CONTEXT(ctx); 02112 Node *n; 02113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02114 n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT_MODEL, 5); 02115 if (n) { 02116 n[1].e = pname; 02117 n[2].f = params[0]; 02118 n[3].f = params[1]; 02119 n[4].f = params[2]; 02120 n[5].f = params[3]; 02121 } 02122 if (ctx->ExecuteFlag) { 02123 CALL_LightModelfv(ctx->Exec, (pname, params)); 02124 } 02125 } 02126 02127 02128 static void GLAPIENTRY 02129 save_LightModelf(GLenum pname, GLfloat param) 02130 { 02131 save_LightModelfv(pname, ¶m); 02132 } 02133 02134 02135 static void GLAPIENTRY 02136 save_LightModeliv(GLenum pname, const GLint *params) 02137 { 02138 GLfloat fparam[4]; 02139 switch (pname) { 02140 case GL_LIGHT_MODEL_AMBIENT: 02141 fparam[0] = INT_TO_FLOAT(params[0]); 02142 fparam[1] = INT_TO_FLOAT(params[1]); 02143 fparam[2] = INT_TO_FLOAT(params[2]); 02144 fparam[3] = INT_TO_FLOAT(params[3]); 02145 break; 02146 case GL_LIGHT_MODEL_LOCAL_VIEWER: 02147 case GL_LIGHT_MODEL_TWO_SIDE: 02148 case GL_LIGHT_MODEL_COLOR_CONTROL: 02149 fparam[0] = (GLfloat) params[0]; 02150 break; 02151 default: 02152 /* Error will be caught later in gl_LightModelfv */ 02153 ; 02154 } 02155 save_LightModelfv(pname, fparam); 02156 } 02157 02158 02159 static void GLAPIENTRY 02160 save_LightModeli(GLenum pname, GLint param) 02161 { 02162 save_LightModeliv(pname, ¶m); 02163 } 02164 02165 02166 static void GLAPIENTRY 02167 save_LineStipple(GLint factor, GLushort pattern) 02168 { 02169 GET_CURRENT_CONTEXT(ctx); 02170 Node *n; 02171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02172 n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_STIPPLE, 2); 02173 if (n) { 02174 n[1].i = factor; 02175 n[2].us = pattern; 02176 } 02177 if (ctx->ExecuteFlag) { 02178 CALL_LineStipple(ctx->Exec, (factor, pattern)); 02179 } 02180 } 02181 02182 02183 static void GLAPIENTRY 02184 save_LineWidth(GLfloat width) 02185 { 02186 GET_CURRENT_CONTEXT(ctx); 02187 Node *n; 02188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02189 n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_WIDTH, 1); 02190 if (n) { 02191 n[1].f = width; 02192 } 02193 if (ctx->ExecuteFlag) { 02194 CALL_LineWidth(ctx->Exec, (width)); 02195 } 02196 } 02197 02198 02199 static void GLAPIENTRY 02200 save_ListBase(GLuint base) 02201 { 02202 GET_CURRENT_CONTEXT(ctx); 02203 Node *n; 02204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02205 n = ALLOC_INSTRUCTION(ctx, OPCODE_LIST_BASE, 1); 02206 if (n) { 02207 n[1].ui = base; 02208 } 02209 if (ctx->ExecuteFlag) { 02210 CALL_ListBase(ctx->Exec, (base)); 02211 } 02212 } 02213 02214 02215 static void GLAPIENTRY 02216 save_LoadIdentity(void) 02217 { 02218 GET_CURRENT_CONTEXT(ctx); 02219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02220 (void) ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_IDENTITY, 0); 02221 if (ctx->ExecuteFlag) { 02222 CALL_LoadIdentity(ctx->Exec, ()); 02223 } 02224 } 02225 02226 02227 static void GLAPIENTRY 02228 save_LoadMatrixf(const GLfloat * m) 02229 { 02230 GET_CURRENT_CONTEXT(ctx); 02231 Node *n; 02232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02233 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_MATRIX, 16); 02234 if (n) { 02235 GLuint i; 02236 for (i = 0; i < 16; i++) { 02237 n[1 + i].f = m[i]; 02238 } 02239 } 02240 if (ctx->ExecuteFlag) { 02241 CALL_LoadMatrixf(ctx->Exec, (m)); 02242 } 02243 } 02244 02245 02246 static void GLAPIENTRY 02247 save_LoadMatrixd(const GLdouble * m) 02248 { 02249 GLfloat f[16]; 02250 GLint i; 02251 for (i = 0; i < 16; i++) { 02252 f[i] = (GLfloat) m[i]; 02253 } 02254 save_LoadMatrixf(f); 02255 } 02256 02257 02258 static void GLAPIENTRY 02259 save_LoadName(GLuint name) 02260 { 02261 GET_CURRENT_CONTEXT(ctx); 02262 Node *n; 02263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02264 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_NAME, 1); 02265 if (n) { 02266 n[1].ui = name; 02267 } 02268 if (ctx->ExecuteFlag) { 02269 CALL_LoadName(ctx->Exec, (name)); 02270 } 02271 } 02272 02273 02274 static void GLAPIENTRY 02275 save_LogicOp(GLenum opcode) 02276 { 02277 GET_CURRENT_CONTEXT(ctx); 02278 Node *n; 02279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02280 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOGIC_OP, 1); 02281 if (n) { 02282 n[1].e = opcode; 02283 } 02284 if (ctx->ExecuteFlag) { 02285 CALL_LogicOp(ctx->Exec, (opcode)); 02286 } 02287 } 02288 02289 02290 static void GLAPIENTRY 02291 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, 02292 GLint order, const GLdouble * points) 02293 { 02294 GET_CURRENT_CONTEXT(ctx); 02295 Node *n; 02296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02297 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6); 02298 if (n) { 02299 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points); 02300 n[1].e = target; 02301 n[2].f = (GLfloat) u1; 02302 n[3].f = (GLfloat) u2; 02303 n[4].i = _mesa_evaluator_components(target); /* stride */ 02304 n[5].i = order; 02305 n[6].data = (void *) pnts; 02306 } 02307 if (ctx->ExecuteFlag) { 02308 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points)); 02309 } 02310 } 02311 02312 static void GLAPIENTRY 02313 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, 02314 GLint order, const GLfloat * points) 02315 { 02316 GET_CURRENT_CONTEXT(ctx); 02317 Node *n; 02318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02319 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6); 02320 if (n) { 02321 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points); 02322 n[1].e = target; 02323 n[2].f = u1; 02324 n[3].f = u2; 02325 n[4].i = _mesa_evaluator_components(target); /* stride */ 02326 n[5].i = order; 02327 n[6].data = (void *) pnts; 02328 } 02329 if (ctx->ExecuteFlag) { 02330 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points)); 02331 } 02332 } 02333 02334 02335 static void GLAPIENTRY 02336 save_Map2d(GLenum target, 02337 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, 02338 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, 02339 const GLdouble * points) 02340 { 02341 GET_CURRENT_CONTEXT(ctx); 02342 Node *n; 02343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02344 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10); 02345 if (n) { 02346 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder, 02347 vstride, vorder, points); 02348 n[1].e = target; 02349 n[2].f = (GLfloat) u1; 02350 n[3].f = (GLfloat) u2; 02351 n[4].f = (GLfloat) v1; 02352 n[5].f = (GLfloat) v2; 02353 /* XXX verify these strides are correct */ 02354 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */ 02355 n[7].i = _mesa_evaluator_components(target); /*vstride */ 02356 n[8].i = uorder; 02357 n[9].i = vorder; 02358 n[10].data = (void *) pnts; 02359 } 02360 if (ctx->ExecuteFlag) { 02361 CALL_Map2d(ctx->Exec, (target, 02362 u1, u2, ustride, uorder, 02363 v1, v2, vstride, vorder, points)); 02364 } 02365 } 02366 02367 02368 static void GLAPIENTRY 02369 save_Map2f(GLenum target, 02370 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, 02371 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, 02372 const GLfloat * points) 02373 { 02374 GET_CURRENT_CONTEXT(ctx); 02375 Node *n; 02376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02377 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10); 02378 if (n) { 02379 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder, 02380 vstride, vorder, points); 02381 n[1].e = target; 02382 n[2].f = u1; 02383 n[3].f = u2; 02384 n[4].f = v1; 02385 n[5].f = v2; 02386 /* XXX verify these strides are correct */ 02387 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */ 02388 n[7].i = _mesa_evaluator_components(target); /*vstride */ 02389 n[8].i = uorder; 02390 n[9].i = vorder; 02391 n[10].data = (void *) pnts; 02392 } 02393 if (ctx->ExecuteFlag) { 02394 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder, 02395 v1, v2, vstride, vorder, points)); 02396 } 02397 } 02398 02399 02400 static void GLAPIENTRY 02401 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2) 02402 { 02403 GET_CURRENT_CONTEXT(ctx); 02404 Node *n; 02405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02406 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID1, 3); 02407 if (n) { 02408 n[1].i = un; 02409 n[2].f = u1; 02410 n[3].f = u2; 02411 } 02412 if (ctx->ExecuteFlag) { 02413 CALL_MapGrid1f(ctx->Exec, (un, u1, u2)); 02414 } 02415 } 02416 02417 02418 static void GLAPIENTRY 02419 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2) 02420 { 02421 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2); 02422 } 02423 02424 02425 static void GLAPIENTRY 02426 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2, 02427 GLint vn, GLfloat v1, GLfloat v2) 02428 { 02429 GET_CURRENT_CONTEXT(ctx); 02430 Node *n; 02431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02432 n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID2, 6); 02433 if (n) { 02434 n[1].i = un; 02435 n[2].f = u1; 02436 n[3].f = u2; 02437 n[4].i = vn; 02438 n[5].f = v1; 02439 n[6].f = v2; 02440 } 02441 if (ctx->ExecuteFlag) { 02442 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2)); 02443 } 02444 } 02445 02446 02447 02448 static void GLAPIENTRY 02449 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2, 02450 GLint vn, GLdouble v1, GLdouble v2) 02451 { 02452 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2, 02453 vn, (GLfloat) v1, (GLfloat) v2); 02454 } 02455 02456 02457 static void GLAPIENTRY 02458 save_MatrixMode(GLenum mode) 02459 { 02460 GET_CURRENT_CONTEXT(ctx); 02461 Node *n; 02462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02463 n = ALLOC_INSTRUCTION(ctx, OPCODE_MATRIX_MODE, 1); 02464 if (n) { 02465 n[1].e = mode; 02466 } 02467 if (ctx->ExecuteFlag) { 02468 CALL_MatrixMode(ctx->Exec, (mode)); 02469 } 02470 } 02471 02472 02473 static void GLAPIENTRY 02474 save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) 02475 { 02476 GET_CURRENT_CONTEXT(ctx); 02477 Node *n; 02478 02479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02480 n = ALLOC_INSTRUCTION(ctx, OPCODE_MIN_MAX, 3); 02481 if (n) { 02482 n[1].e = target; 02483 n[2].e = internalFormat; 02484 n[3].b = sink; 02485 } 02486 if (ctx->ExecuteFlag) { 02487 CALL_Minmax(ctx->Exec, (target, internalFormat, sink)); 02488 } 02489 } 02490 02491 02492 static void GLAPIENTRY 02493 save_MultMatrixf(const GLfloat * m) 02494 { 02495 GET_CURRENT_CONTEXT(ctx); 02496 Node *n; 02497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02498 n = ALLOC_INSTRUCTION(ctx, OPCODE_MULT_MATRIX, 16); 02499 if (n) { 02500 GLuint i; 02501 for (i = 0; i < 16; i++) { 02502 n[1 + i].f = m[i]; 02503 } 02504 } 02505 if (ctx->ExecuteFlag) { 02506 CALL_MultMatrixf(ctx->Exec, (m)); 02507 } 02508 } 02509 02510 02511 static void GLAPIENTRY 02512 save_MultMatrixd(const GLdouble * m) 02513 { 02514 GLfloat f[16]; 02515 GLint i; 02516 for (i = 0; i < 16; i++) { 02517 f[i] = (GLfloat) m[i]; 02518 } 02519 save_MultMatrixf(f); 02520 } 02521 02522 02523 static void GLAPIENTRY 02524 save_NewList(GLuint list, GLenum mode) 02525 { 02526 GET_CURRENT_CONTEXT(ctx); 02527 /* It's an error to call this function while building a display list */ 02528 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList"); 02529 (void) list; 02530 (void) mode; 02531 } 02532 02533 02534 02535 static void GLAPIENTRY 02536 save_Ortho(GLdouble left, GLdouble right, 02537 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) 02538 { 02539 GET_CURRENT_CONTEXT(ctx); 02540 Node *n; 02541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02542 n = ALLOC_INSTRUCTION(ctx, OPCODE_ORTHO, 6); 02543 if (n) { 02544 n[1].f = (GLfloat) left; 02545 n[2].f = (GLfloat) right; 02546 n[3].f = (GLfloat) bottom; 02547 n[4].f = (GLfloat) top; 02548 n[5].f = (GLfloat) nearval; 02549 n[6].f = (GLfloat) farval; 02550 } 02551 if (ctx->ExecuteFlag) { 02552 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval)); 02553 } 02554 } 02555 02556 02557 static void GLAPIENTRY 02558 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) 02559 { 02560 GET_CURRENT_CONTEXT(ctx); 02561 Node *n; 02562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02563 n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_MAP, 3); 02564 if (n) { 02565 n[1].e = map; 02566 n[2].i = mapsize; 02567 n[3].data = (void *) _mesa_malloc(mapsize * sizeof(GLfloat)); 02568 MEMCPY(n[3].data, (void *) values, mapsize * sizeof(GLfloat)); 02569 } 02570 if (ctx->ExecuteFlag) { 02571 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values)); 02572 } 02573 } 02574 02575 02576 static void GLAPIENTRY 02577 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values) 02578 { 02579 GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; 02580 GLint i; 02581 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) { 02582 for (i = 0; i < mapsize; i++) { 02583 fvalues[i] = (GLfloat) values[i]; 02584 } 02585 } 02586 else { 02587 for (i = 0; i < mapsize; i++) { 02588 fvalues[i] = UINT_TO_FLOAT(values[i]); 02589 } 02590 } 02591 save_PixelMapfv(map, mapsize, fvalues); 02592 } 02593 02594 02595 static void GLAPIENTRY 02596 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values) 02597 { 02598 GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; 02599 GLint i; 02600 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) { 02601 for (i = 0; i < mapsize; i++) { 02602 fvalues[i] = (GLfloat) values[i]; 02603 } 02604 } 02605 else { 02606 for (i = 0; i < mapsize; i++) { 02607 fvalues[i] = USHORT_TO_FLOAT(values[i]); 02608 } 02609 } 02610 save_PixelMapfv(map, mapsize, fvalues); 02611 } 02612 02613 02614 static void GLAPIENTRY 02615 save_PixelTransferf(GLenum pname, GLfloat param) 02616 { 02617 GET_CURRENT_CONTEXT(ctx); 02618 Node *n; 02619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02620 n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_TRANSFER, 2); 02621 if (n) { 02622 n[1].e = pname; 02623 n[2].f = param; 02624 } 02625 if (ctx->ExecuteFlag) { 02626 CALL_PixelTransferf(ctx->Exec, (pname, param)); 02627 } 02628 } 02629 02630 02631 static void GLAPIENTRY 02632 save_PixelTransferi(GLenum pname, GLint param) 02633 { 02634 save_PixelTransferf(pname, (GLfloat) param); 02635 } 02636 02637 02638 static void GLAPIENTRY 02639 save_PixelZoom(GLfloat xfactor, GLfloat yfactor) 02640 { 02641 GET_CURRENT_CONTEXT(ctx); 02642 Node *n; 02643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02644 n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_ZOOM, 2); 02645 if (n) { 02646 n[1].f = xfactor; 02647 n[2].f = yfactor; 02648 } 02649 if (ctx->ExecuteFlag) { 02650 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor)); 02651 } 02652 } 02653 02654 02655 static void GLAPIENTRY 02656 save_PointParameterfvEXT(GLenum pname, const GLfloat *params) 02657 { 02658 GET_CURRENT_CONTEXT(ctx); 02659 Node *n; 02660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02661 n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_PARAMETERS, 4); 02662 if (n) { 02663 n[1].e = pname; 02664 n[2].f = params[0]; 02665 n[3].f = params[1]; 02666 n[4].f = params[2]; 02667 } 02668 if (ctx->ExecuteFlag) { 02669 CALL_PointParameterfvEXT(ctx->Exec, (pname, params)); 02670 } 02671 } 02672 02673 02674 static void GLAPIENTRY 02675 save_PointParameterfEXT(GLenum pname, GLfloat param) 02676 { 02677 save_PointParameterfvEXT(pname, ¶m); 02678 } 02679 02680 static void GLAPIENTRY 02681 save_PointParameteriNV(GLenum pname, GLint param) 02682 { 02683 GLfloat p = (GLfloat) param; 02684 save_PointParameterfvEXT(pname, &p); 02685 } 02686 02687 static void GLAPIENTRY 02688 save_PointParameterivNV(GLenum pname, const GLint * param) 02689 { 02690 GLfloat p = (GLfloat) param[0]; 02691 save_PointParameterfvEXT(pname, &p); 02692 } 02693 02694 02695 static void GLAPIENTRY 02696 save_PointSize(GLfloat size) 02697 { 02698 GET_CURRENT_CONTEXT(ctx); 02699 Node *n; 02700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02701 n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_SIZE, 1); 02702 if (n) { 02703 n[1].f = size; 02704 } 02705 if (ctx->ExecuteFlag) { 02706 CALL_PointSize(ctx->Exec, (size)); 02707 } 02708 } 02709 02710 02711 static void GLAPIENTRY 02712 save_PolygonMode(GLenum face, GLenum mode) 02713 { 02714 GET_CURRENT_CONTEXT(ctx); 02715 Node *n; 02716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02717 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_MODE, 2); 02718 if (n) { 02719 n[1].e = face; 02720 n[2].e = mode; 02721 } 02722 if (ctx->ExecuteFlag) { 02723 CALL_PolygonMode(ctx->Exec, (face, mode)); 02724 } 02725 } 02726 02727 02728 static void GLAPIENTRY 02729 save_PolygonStipple(const GLubyte * pattern) 02730 { 02731 GET_CURRENT_CONTEXT(ctx); 02732 GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, 02733 pattern, &ctx->Unpack); 02734 Node *n; 02735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02736 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); 02737 if (n) { 02738 n[1].data = image; 02739 } 02740 else if (image) { 02741 _mesa_free(image); 02742 } 02743 if (ctx->ExecuteFlag) { 02744 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern)); 02745 } 02746 } 02747 02748 02749 static void GLAPIENTRY 02750 save_PolygonOffset(GLfloat factor, GLfloat units) 02751 { 02752 GET_CURRENT_CONTEXT(ctx); 02753 Node *n; 02754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02755 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_OFFSET, 2); 02756 if (n) { 02757 n[1].f = factor; 02758 n[2].f = units; 02759 } 02760 if (ctx->ExecuteFlag) { 02761 CALL_PolygonOffset(ctx->Exec, (factor, units)); 02762 } 02763 } 02764 02765 02766 static void GLAPIENTRY 02767 save_PolygonOffsetEXT(GLfloat factor, GLfloat bias) 02768 { 02769 GET_CURRENT_CONTEXT(ctx); 02770 /* XXX mult by DepthMaxF here??? */ 02771 save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias); 02772 } 02773 02774 02775 static void GLAPIENTRY 02776 save_PopAttrib(void) 02777 { 02778 GET_CURRENT_CONTEXT(ctx); 02779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02780 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_ATTRIB, 0); 02781 if (ctx->ExecuteFlag) { 02782 CALL_PopAttrib(ctx->Exec, ()); 02783 } 02784 } 02785 02786 02787 static void GLAPIENTRY 02788 save_PopMatrix(void) 02789 { 02790 GET_CURRENT_CONTEXT(ctx); 02791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02792 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_MATRIX, 0); 02793 if (ctx->ExecuteFlag) { 02794 CALL_PopMatrix(ctx->Exec, ()); 02795 } 02796 } 02797 02798 02799 static void GLAPIENTRY 02800 save_PopName(void) 02801 { 02802 GET_CURRENT_CONTEXT(ctx); 02803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02804 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_NAME, 0); 02805 if (ctx->ExecuteFlag) { 02806 CALL_PopName(ctx->Exec, ()); 02807 } 02808 } 02809 02810 02811 static void GLAPIENTRY 02812 save_PrioritizeTextures(GLsizei num, const GLuint * textures, 02813 const GLclampf * priorities) 02814 { 02815 GET_CURRENT_CONTEXT(ctx); 02816 GLint i; 02817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02818 02819 for (i = 0; i < num; i++) { 02820 Node *n; 02821 n = ALLOC_INSTRUCTION(ctx, OPCODE_PRIORITIZE_TEXTURE, 2); 02822 if (n) { 02823 n[1].ui = textures[i]; 02824 n[2].f = priorities[i]; 02825 } 02826 } 02827 if (ctx->ExecuteFlag) { 02828 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities)); 02829 } 02830 } 02831 02832 02833 static void GLAPIENTRY 02834 save_PushAttrib(GLbitfield mask) 02835 { 02836 GET_CURRENT_CONTEXT(ctx); 02837 Node *n; 02838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02839 n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_ATTRIB, 1); 02840 if (n) { 02841 n[1].bf = mask; 02842 } 02843 if (ctx->ExecuteFlag) { 02844 CALL_PushAttrib(ctx->Exec, (mask)); 02845 } 02846 } 02847 02848 02849 static void GLAPIENTRY 02850 save_PushMatrix(void) 02851 { 02852 GET_CURRENT_CONTEXT(ctx); 02853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02854 (void) ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_MATRIX, 0); 02855 if (ctx->ExecuteFlag) { 02856 CALL_PushMatrix(ctx->Exec, ()); 02857 } 02858 } 02859 02860 02861 static void GLAPIENTRY 02862 save_PushName(GLuint name) 02863 { 02864 GET_CURRENT_CONTEXT(ctx); 02865 Node *n; 02866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02867 n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_NAME, 1); 02868 if (n) { 02869 n[1].ui = name; 02870 } 02871 if (ctx->ExecuteFlag) { 02872 CALL_PushName(ctx->Exec, (name)); 02873 } 02874 } 02875 02876 02877 static void GLAPIENTRY 02878 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 02879 { 02880 GET_CURRENT_CONTEXT(ctx); 02881 Node *n; 02882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 02883 n = ALLOC_INSTRUCTION(ctx, OPCODE_RASTER_POS, 4); 02884 if (n) { 02885 n[1].f = x; 02886 n[2].f = y; 02887 n[3].f = z; 02888 n[4].f = w; 02889 } 02890 if (ctx->ExecuteFlag) { 02891 CALL_RasterPos4f(ctx->Exec, (x, y, z, w)); 02892 } 02893 } 02894 02895 static void GLAPIENTRY 02896 save_RasterPos2d(GLdouble x, GLdouble y) 02897 { 02898 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 02899 } 02900 02901 static void GLAPIENTRY 02902 save_RasterPos2f(GLfloat x, GLfloat y) 02903 { 02904 save_RasterPos4f(x, y, 0.0F, 1.0F); 02905 } 02906 02907 static void GLAPIENTRY 02908 save_RasterPos2i(GLint x, GLint y) 02909 { 02910 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 02911 } 02912 02913 static void GLAPIENTRY 02914 save_RasterPos2s(GLshort x, GLshort y) 02915 { 02916 save_RasterPos4f(x, y, 0.0F, 1.0F); 02917 } 02918 02919 static void GLAPIENTRY 02920 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) 02921 { 02922 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 02923 } 02924 02925 static void GLAPIENTRY 02926 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) 02927 { 02928 save_RasterPos4f(x, y, z, 1.0F); 02929 } 02930 02931 static void GLAPIENTRY 02932 save_RasterPos3i(GLint x, GLint y, GLint z) 02933 { 02934 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 02935 } 02936 02937 static void GLAPIENTRY 02938 save_RasterPos3s(GLshort x, GLshort y, GLshort z) 02939 { 02940 save_RasterPos4f(x, y, z, 1.0F); 02941 } 02942 02943 static void GLAPIENTRY 02944 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) 02945 { 02946 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 02947 } 02948 02949 static void GLAPIENTRY 02950 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w) 02951 { 02952 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 02953 } 02954 02955 static void GLAPIENTRY 02956 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) 02957 { 02958 save_RasterPos4f(x, y, z, w); 02959 } 02960 02961 static void GLAPIENTRY 02962 save_RasterPos2dv(const GLdouble * v) 02963 { 02964 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 02965 } 02966 02967 static void GLAPIENTRY 02968 save_RasterPos2fv(const GLfloat * v) 02969 { 02970 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); 02971 } 02972 02973 static void GLAPIENTRY 02974 save_RasterPos2iv(const GLint * v) 02975 { 02976 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 02977 } 02978 02979 static void GLAPIENTRY 02980 save_RasterPos2sv(const GLshort * v) 02981 { 02982 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); 02983 } 02984 02985 static void GLAPIENTRY 02986 save_RasterPos3dv(const GLdouble * v) 02987 { 02988 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 02989 } 02990 02991 static void GLAPIENTRY 02992 save_RasterPos3fv(const GLfloat * v) 02993 { 02994 save_RasterPos4f(v[0], v[1], v[2], 1.0F); 02995 } 02996 02997 static void GLAPIENTRY 02998 save_RasterPos3iv(const GLint * v) 02999 { 03000 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 03001 } 03002 03003 static void GLAPIENTRY 03004 save_RasterPos3sv(const GLshort * v) 03005 { 03006 save_RasterPos4f(v[0], v[1], v[2], 1.0F); 03007 } 03008 03009 static void GLAPIENTRY 03010 save_RasterPos4dv(const GLdouble * v) 03011 { 03012 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 03013 (GLfloat) v[2], (GLfloat) v[3]); 03014 } 03015 03016 static void GLAPIENTRY 03017 save_RasterPos4fv(const GLfloat * v) 03018 { 03019 save_RasterPos4f(v[0], v[1], v[2], v[3]); 03020 } 03021 03022 static void GLAPIENTRY 03023 save_RasterPos4iv(const GLint * v) 03024 { 03025 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 03026 (GLfloat) v[2], (GLfloat) v[3]); 03027 } 03028 03029 static void GLAPIENTRY 03030 save_RasterPos4sv(const GLshort * v) 03031 { 03032 save_RasterPos4f(v[0], v[1], v[2], v[3]); 03033 } 03034 03035 03036 static void GLAPIENTRY 03037 save_PassThrough(GLfloat token) 03038 { 03039 GET_CURRENT_CONTEXT(ctx); 03040 Node *n; 03041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03042 n = ALLOC_INSTRUCTION(ctx, OPCODE_PASSTHROUGH, 1); 03043 if (n) { 03044 n[1].f = token; 03045 } 03046 if (ctx->ExecuteFlag) { 03047 CALL_PassThrough(ctx->Exec, (token)); 03048 } 03049 } 03050 03051 03052 static void GLAPIENTRY 03053 save_ReadBuffer(GLenum mode) 03054 { 03055 GET_CURRENT_CONTEXT(ctx); 03056 Node *n; 03057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03058 n = ALLOC_INSTRUCTION(ctx, OPCODE_READ_BUFFER, 1); 03059 if (n) { 03060 n[1].e = mode; 03061 } 03062 if (ctx->ExecuteFlag) { 03063 CALL_ReadBuffer(ctx->Exec, (mode)); 03064 } 03065 } 03066 03067 03068 static void GLAPIENTRY 03069 save_ResetHistogram(GLenum target) 03070 { 03071 GET_CURRENT_CONTEXT(ctx); 03072 Node *n; 03073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03074 n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_HISTOGRAM, 1); 03075 if (n) { 03076 n[1].e = target; 03077 } 03078 if (ctx->ExecuteFlag) { 03079 CALL_ResetHistogram(ctx->Exec, (target)); 03080 } 03081 } 03082 03083 03084 static void GLAPIENTRY 03085 save_ResetMinmax(GLenum target) 03086 { 03087 GET_CURRENT_CONTEXT(ctx); 03088 Node *n; 03089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03090 n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_MIN_MAX, 1); 03091 if (n) { 03092 n[1].e = target; 03093 } 03094 if (ctx->ExecuteFlag) { 03095 CALL_ResetMinmax(ctx->Exec, (target)); 03096 } 03097 } 03098 03099 03100 static void GLAPIENTRY 03101 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) 03102 { 03103 GET_CURRENT_CONTEXT(ctx); 03104 Node *n; 03105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03106 n = ALLOC_INSTRUCTION(ctx, OPCODE_ROTATE, 4); 03107 if (n) { 03108 n[1].f = angle; 03109 n[2].f = x; 03110 n[3].f = y; 03111 n[4].f = z; 03112 } 03113 if (ctx->ExecuteFlag) { 03114 CALL_Rotatef(ctx->Exec, (angle, x, y, z)); 03115 } 03116 } 03117 03118 03119 static void GLAPIENTRY 03120 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) 03121 { 03122 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); 03123 } 03124 03125 03126 static void GLAPIENTRY 03127 save_Scalef(GLfloat x, GLfloat y, GLfloat z) 03128 { 03129 GET_CURRENT_CONTEXT(ctx); 03130 Node *n; 03131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03132 n = ALLOC_INSTRUCTION(ctx, OPCODE_SCALE, 3); 03133 if (n) { 03134 n[1].f = x; 03135 n[2].f = y; 03136 n[3].f = z; 03137 } 03138 if (ctx->ExecuteFlag) { 03139 CALL_Scalef(ctx->Exec, (x, y, z)); 03140 } 03141 } 03142 03143 03144 static void GLAPIENTRY 03145 save_Scaled(GLdouble x, GLdouble y, GLdouble z) 03146 { 03147 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); 03148 } 03149 03150 03151 static void GLAPIENTRY 03152 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height) 03153 { 03154 GET_CURRENT_CONTEXT(ctx); 03155 Node *n; 03156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03157 n = ALLOC_INSTRUCTION(ctx, OPCODE_SCISSOR, 4); 03158 if (n) { 03159 n[1].i = x; 03160 n[2].i = y; 03161 n[3].i = width; 03162 n[4].i = height; 03163 } 03164 if (ctx->ExecuteFlag) { 03165 CALL_Scissor(ctx->Exec, (x, y, width, height)); 03166 } 03167 } 03168 03169 03170 static void GLAPIENTRY 03171 save_ShadeModel(GLenum mode) 03172 { 03173 GET_CURRENT_CONTEXT(ctx); 03174 Node *n; 03175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03176 n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1); 03177 if (n) { 03178 n[1].e = mode; 03179 } 03180 if (ctx->ExecuteFlag) { 03181 CALL_ShadeModel(ctx->Exec, (mode)); 03182 } 03183 } 03184 03185 03186 static void GLAPIENTRY 03187 save_StencilFunc(GLenum func, GLint ref, GLuint mask) 03188 { 03189 GET_CURRENT_CONTEXT(ctx); 03190 Node *n; 03191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03192 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC, 3); 03193 if (n) { 03194 n[1].e = func; 03195 n[2].i = ref; 03196 n[3].ui = mask; 03197 } 03198 if (ctx->ExecuteFlag) { 03199 CALL_StencilFunc(ctx->Exec, (func, ref, mask)); 03200 } 03201 } 03202 03203 03204 static void GLAPIENTRY 03205 save_StencilMask(GLuint mask) 03206 { 03207 GET_CURRENT_CONTEXT(ctx); 03208 Node *n; 03209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03210 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK, 1); 03211 if (n) { 03212 n[1].ui = mask; 03213 } 03214 if (ctx->ExecuteFlag) { 03215 CALL_StencilMask(ctx->Exec, (mask)); 03216 } 03217 } 03218 03219 03220 static void GLAPIENTRY 03221 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) 03222 { 03223 GET_CURRENT_CONTEXT(ctx); 03224 Node *n; 03225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03226 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP, 3); 03227 if (n) { 03228 n[1].e = fail; 03229 n[2].e = zfail; 03230 n[3].e = zpass; 03231 } 03232 if (ctx->ExecuteFlag) { 03233 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass)); 03234 } 03235 } 03236 03237 03238 static void GLAPIENTRY 03239 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) 03240 { 03241 GET_CURRENT_CONTEXT(ctx); 03242 Node *n; 03243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03244 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); 03245 if (n) { 03246 n[1].e = face; 03247 n[2].e = func; 03248 n[3].i = ref; 03249 n[4].ui = mask; 03250 } 03251 if (ctx->ExecuteFlag) { 03252 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask)); 03253 } 03254 } 03255 03256 03257 static void GLAPIENTRY 03258 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, 03259 GLuint mask) 03260 { 03261 GET_CURRENT_CONTEXT(ctx); 03262 Node *n; 03263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03264 /* GL_FRONT */ 03265 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); 03266 if (n) { 03267 n[1].e = GL_FRONT; 03268 n[2].e = frontfunc; 03269 n[3].i = ref; 03270 n[4].ui = mask; 03271 } 03272 /* GL_BACK */ 03273 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); 03274 if (n) { 03275 n[1].e = GL_BACK; 03276 n[2].e = backfunc; 03277 n[3].i = ref; 03278 n[4].ui = mask; 03279 } 03280 if (ctx->ExecuteFlag) { 03281 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask)); 03282 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask)); 03283 } 03284 } 03285 03286 03287 static void GLAPIENTRY 03288 save_StencilMaskSeparate(GLenum face, GLuint mask) 03289 { 03290 GET_CURRENT_CONTEXT(ctx); 03291 Node *n; 03292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03293 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2); 03294 if (n) { 03295 n[1].e = face; 03296 n[2].ui = mask; 03297 } 03298 if (ctx->ExecuteFlag) { 03299 CALL_StencilMaskSeparate(ctx->Exec, (face, mask)); 03300 } 03301 } 03302 03303 03304 static void GLAPIENTRY 03305 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) 03306 { 03307 GET_CURRENT_CONTEXT(ctx); 03308 Node *n; 03309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03310 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP_SEPARATE, 4); 03311 if (n) { 03312 n[1].e = face; 03313 n[2].e = fail; 03314 n[3].e = zfail; 03315 n[4].e = zpass; 03316 } 03317 if (ctx->ExecuteFlag) { 03318 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass)); 03319 } 03320 } 03321 03322 03323 static void GLAPIENTRY 03324 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params) 03325 { 03326 GET_CURRENT_CONTEXT(ctx); 03327 Node *n; 03328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03329 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXENV, 6); 03330 if (n) { 03331 n[1].e = target; 03332 n[2].e = pname; 03333 if (pname == GL_TEXTURE_ENV_COLOR) { 03334 n[3].f = params[0]; 03335 n[4].f = params[1]; 03336 n[5].f = params[2]; 03337 n[6].f = params[3]; 03338 } 03339 else { 03340 n[3].f = params[0]; 03341 n[4].f = n[5].f = n[6].f = 0.0F; 03342 } 03343 } 03344 if (ctx->ExecuteFlag) { 03345 CALL_TexEnvfv(ctx->Exec, (target, pname, params)); 03346 } 03347 } 03348 03349 03350 static void GLAPIENTRY 03351 save_TexEnvf(GLenum target, GLenum pname, GLfloat param) 03352 { 03353 save_TexEnvfv(target, pname, ¶m); 03354 } 03355 03356 03357 static void GLAPIENTRY 03358 save_TexEnvi(GLenum target, GLenum pname, GLint param) 03359 { 03360 GLfloat p[4]; 03361 p[0] = (GLfloat) param; 03362 p[1] = p[2] = p[3] = 0.0; 03363 save_TexEnvfv(target, pname, p); 03364 } 03365 03366 03367 static void GLAPIENTRY 03368 save_TexEnviv(GLenum target, GLenum pname, const GLint * param) 03369 { 03370 GLfloat p[4]; 03371 if (pname == GL_TEXTURE_ENV_COLOR) { 03372 p[0] = INT_TO_FLOAT(param[0]); 03373 p[1] = INT_TO_FLOAT(param[1]); 03374 p[2] = INT_TO_FLOAT(param[2]); 03375 p[3] = INT_TO_FLOAT(param[3]); 03376 } 03377 else { 03378 p[0] = (GLfloat) param[0]; 03379 p[1] = p[2] = p[3] = 0.0F; 03380 } 03381 save_TexEnvfv(target, pname, p); 03382 } 03383 03384 03385 static void GLAPIENTRY 03386 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) 03387 { 03388 GET_CURRENT_CONTEXT(ctx); 03389 Node *n; 03390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03391 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXGEN, 6); 03392 if (n) { 03393 n[1].e = coord; 03394 n[2].e = pname; 03395 n[3].f = params[0]; 03396 n[4].f = params[1]; 03397 n[5].f = params[2]; 03398 n[6].f = params[3]; 03399 } 03400 if (ctx->ExecuteFlag) { 03401 CALL_TexGenfv(ctx->Exec, (coord, pname, params)); 03402 } 03403 } 03404 03405 03406 static void GLAPIENTRY 03407 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params) 03408 { 03409 GLfloat p[4]; 03410 p[0] = (GLfloat) params[0]; 03411 p[1] = (GLfloat) params[1]; 03412 p[2] = (GLfloat) params[2]; 03413 p[3] = (GLfloat) params[3]; 03414 save_TexGenfv(coord, pname, p); 03415 } 03416 03417 03418 static void GLAPIENTRY 03419 save_TexGend(GLenum coord, GLenum pname, GLdouble param) 03420 { 03421 GLfloat p = (GLfloat) param; 03422 save_TexGenfv(coord, pname, &p); 03423 } 03424 03425 03426 static void GLAPIENTRY 03427 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params) 03428 { 03429 GLfloat p[4]; 03430 p[0] = (GLfloat) params[0]; 03431 p[1] = (GLfloat) params[1]; 03432 p[2] = (GLfloat) params[2]; 03433 p[3] = (GLfloat) params[3]; 03434 save_TexGenfv(coord, pname, p); 03435 } 03436 03437 03438 static void GLAPIENTRY 03439 save_TexGenf(GLenum coord, GLenum pname, GLfloat param) 03440 { 03441 save_TexGenfv(coord, pname, ¶m); 03442 } 03443 03444 03445 static void GLAPIENTRY 03446 save_TexGeni(GLenum coord, GLenum pname, GLint param) 03447 { 03448 save_TexGeniv(coord, pname, ¶m); 03449 } 03450 03451 03452 static void GLAPIENTRY 03453 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) 03454 { 03455 GET_CURRENT_CONTEXT(ctx); 03456 Node *n; 03457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03458 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXPARAMETER, 6); 03459 if (n) { 03460 n[1].e = target; 03461 n[2].e = pname; 03462 n[3].f = params[0]; 03463 n[4].f = params[1]; 03464 n[5].f = params[2]; 03465 n[6].f = params[3]; 03466 } 03467 if (ctx->ExecuteFlag) { 03468 CALL_TexParameterfv(ctx->Exec, (target, pname, params)); 03469 } 03470 } 03471 03472 03473 static void GLAPIENTRY 03474 save_TexParameterf(GLenum target, GLenum pname, GLfloat param) 03475 { 03476 save_TexParameterfv(target, pname, ¶m); 03477 } 03478 03479 03480 static void GLAPIENTRY 03481 save_TexParameteri(GLenum target, GLenum pname, GLint param) 03482 { 03483 GLfloat fparam[4]; 03484 fparam[0] = (GLfloat) param; 03485 fparam[1] = fparam[2] = fparam[3] = 0.0; 03486 save_TexParameterfv(target, pname, fparam); 03487 } 03488 03489 03490 static void GLAPIENTRY 03491 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params) 03492 { 03493 GLfloat fparam[4]; 03494 fparam[0] = (GLfloat) params[0]; 03495 fparam[1] = fparam[2] = fparam[3] = 0.0; 03496 save_TexParameterfv(target, pname, fparam); 03497 } 03498 03499 03500 static void GLAPIENTRY 03501 save_TexImage1D(GLenum target, 03502 GLint level, GLint components, 03503 GLsizei width, GLint border, 03504 GLenum format, GLenum type, const GLvoid * pixels) 03505 { 03506 GET_CURRENT_CONTEXT(ctx); 03507 if (target == GL_PROXY_TEXTURE_1D) { 03508 /* don't compile, execute immediately */ 03509 CALL_TexImage1D(ctx->Exec, (target, level, components, width, 03510 border, format, type, pixels)); 03511 } 03512 else { 03513 GLvoid *image = unpack_image(1, width, 1, 1, format, type, 03514 pixels, &ctx->Unpack); 03515 Node *n; 03516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03517 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8); 03518 if (n) { 03519 n[1].e = target; 03520 n[2].i = level; 03521 n[3].i = components; 03522 n[4].i = (GLint) width; 03523 n[5].i = border; 03524 n[6].e = format; 03525 n[7].e = type; 03526 n[8].data = image; 03527 } 03528 else if (image) { 03529 _mesa_free(image); 03530 } 03531 if (ctx->ExecuteFlag) { 03532 CALL_TexImage1D(ctx->Exec, (target, level, components, width, 03533 border, format, type, pixels)); 03534 } 03535 } 03536 } 03537 03538 03539 static void GLAPIENTRY 03540 save_TexImage2D(GLenum target, 03541 GLint level, GLint components, 03542 GLsizei width, GLsizei height, GLint border, 03543 GLenum format, GLenum type, const GLvoid * pixels) 03544 { 03545 GET_CURRENT_CONTEXT(ctx); 03546 if (target == GL_PROXY_TEXTURE_2D) { 03547 /* don't compile, execute immediately */ 03548 CALL_TexImage2D(ctx->Exec, (target, level, components, width, 03549 height, border, format, type, pixels)); 03550 } 03551 else { 03552 GLvoid *image = unpack_image(2, width, height, 1, format, type, 03553 pixels, &ctx->Unpack); 03554 Node *n; 03555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03556 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9); 03557 if (n) { 03558 n[1].e = target; 03559 n[2].i = level; 03560 n[3].i = components; 03561 n[4].i = (GLint) width; 03562 n[5].i = (GLint) height; 03563 n[6].i = border; 03564 n[7].e = format; 03565 n[8].e = type; 03566 n[9].data = image; 03567 } 03568 else if (image) { 03569 _mesa_free(image); 03570 } 03571 if (ctx->ExecuteFlag) { 03572 CALL_TexImage2D(ctx->Exec, (target, level, components, width, 03573 height, border, format, type, pixels)); 03574 } 03575 } 03576 } 03577 03578 03579 static void GLAPIENTRY 03580 save_TexImage3D(GLenum target, 03581 GLint level, GLint internalFormat, 03582 GLsizei width, GLsizei height, GLsizei depth, 03583 GLint border, 03584 GLenum format, GLenum type, const GLvoid * pixels) 03585 { 03586 GET_CURRENT_CONTEXT(ctx); 03587 if (target == GL_PROXY_TEXTURE_3D) { 03588 /* don't compile, execute immediately */ 03589 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width, 03590 height, depth, border, format, type, 03591 pixels)); 03592 } 03593 else { 03594 Node *n; 03595 GLvoid *image = unpack_image(3, width, height, depth, format, type, 03596 pixels, &ctx->Unpack); 03597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03598 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10); 03599 if (n) { 03600 n[1].e = target; 03601 n[2].i = level; 03602 n[3].i = (GLint) internalFormat; 03603 n[4].i = (GLint) width; 03604 n[5].i = (GLint) height; 03605 n[6].i = (GLint) depth; 03606 n[7].i = border; 03607 n[8].e = format; 03608 n[9].e = type; 03609 n[10].data = image; 03610 } 03611 else if (image) { 03612 _mesa_free(image); 03613 } 03614 if (ctx->ExecuteFlag) { 03615 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width, 03616 height, depth, border, format, type, 03617 pixels)); 03618 } 03619 } 03620 } 03621 03622 03623 static void GLAPIENTRY 03624 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset, 03625 GLsizei width, GLenum format, GLenum type, 03626 const GLvoid * pixels) 03627 { 03628 GET_CURRENT_CONTEXT(ctx); 03629 Node *n; 03630 GLvoid *image = unpack_image(1, width, 1, 1, format, type, 03631 pixels, &ctx->Unpack); 03632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03633 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7); 03634 if (n) { 03635 n[1].e = target; 03636 n[2].i = level; 03637 n[3].i = xoffset; 03638 n[4].i = (GLint) width; 03639 n[5].e = format; 03640 n[6].e = type; 03641 n[7].data = image; 03642 } 03643 else if (image) { 03644 _mesa_free(image); 03645 } 03646 if (ctx->ExecuteFlag) { 03647 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width, 03648 format, type, pixels)); 03649 } 03650 } 03651 03652 03653 static void GLAPIENTRY 03654 save_TexSubImage2D(GLenum target, GLint level, 03655 GLint xoffset, GLint yoffset, 03656 GLsizei width, GLsizei height, 03657 GLenum format, GLenum type, const GLvoid * pixels) 03658 { 03659 GET_CURRENT_CONTEXT(ctx); 03660 Node *n; 03661 GLvoid *image = unpack_image(2, width, height, 1, format, type, 03662 pixels, &ctx->Unpack); 03663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03664 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9); 03665 if (n) { 03666 n[1].e = target; 03667 n[2].i = level; 03668 n[3].i = xoffset; 03669 n[4].i = yoffset; 03670 n[5].i = (GLint) width; 03671 n[6].i = (GLint) height; 03672 n[7].e = format; 03673 n[8].e = type; 03674 n[9].data = image; 03675 } 03676 else if (image) { 03677 _mesa_free(image); 03678 } 03679 if (ctx->ExecuteFlag) { 03680 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset, 03681 width, height, format, type, pixels)); 03682 } 03683 } 03684 03685 03686 static void GLAPIENTRY 03687 save_TexSubImage3D(GLenum target, GLint level, 03688 GLint xoffset, GLint yoffset, GLint zoffset, 03689 GLsizei width, GLsizei height, GLsizei depth, 03690 GLenum format, GLenum type, const GLvoid * pixels) 03691 { 03692 GET_CURRENT_CONTEXT(ctx); 03693 Node *n; 03694 GLvoid *image = unpack_image(3, width, height, depth, format, type, 03695 pixels, &ctx->Unpack); 03696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03697 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11); 03698 if (n) { 03699 n[1].e = target; 03700 n[2].i = level; 03701 n[3].i = xoffset; 03702 n[4].i = yoffset; 03703 n[5].i = zoffset; 03704 n[6].i = (GLint) width; 03705 n[7].i = (GLint) height; 03706 n[8].i = (GLint) depth; 03707 n[9].e = format; 03708 n[10].e = type; 03709 n[11].data = image; 03710 } 03711 else if (image) { 03712 _mesa_free(image); 03713 } 03714 if (ctx->ExecuteFlag) { 03715 CALL_TexSubImage3D(ctx->Exec, (target, level, 03716 xoffset, yoffset, zoffset, 03717 width, height, depth, format, type, 03718 pixels)); 03719 } 03720 } 03721 03722 03723 static void GLAPIENTRY 03724 save_Translatef(GLfloat x, GLfloat y, GLfloat z) 03725 { 03726 GET_CURRENT_CONTEXT(ctx); 03727 Node *n; 03728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03729 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRANSLATE, 3); 03730 if (n) { 03731 n[1].f = x; 03732 n[2].f = y; 03733 n[3].f = z; 03734 } 03735 if (ctx->ExecuteFlag) { 03736 CALL_Translatef(ctx->Exec, (x, y, z)); 03737 } 03738 } 03739 03740 03741 static void GLAPIENTRY 03742 save_Translated(GLdouble x, GLdouble y, GLdouble z) 03743 { 03744 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); 03745 } 03746 03747 03748 03749 static void GLAPIENTRY 03750 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) 03751 { 03752 GET_CURRENT_CONTEXT(ctx); 03753 Node *n; 03754 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03755 n = ALLOC_INSTRUCTION(ctx, OPCODE_VIEWPORT, 4); 03756 if (n) { 03757 n[1].i = x; 03758 n[2].i = y; 03759 n[3].i = (GLint) width; 03760 n[4].i = (GLint) height; 03761 } 03762 if (ctx->ExecuteFlag) { 03763 CALL_Viewport(ctx->Exec, (x, y, width, height)); 03764 } 03765 } 03766 03767 03768 static void GLAPIENTRY 03769 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 03770 { 03771 GET_CURRENT_CONTEXT(ctx); 03772 Node *n; 03773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03774 n = ALLOC_INSTRUCTION(ctx, OPCODE_WINDOW_POS, 4); 03775 if (n) { 03776 n[1].f = x; 03777 n[2].f = y; 03778 n[3].f = z; 03779 n[4].f = w; 03780 } 03781 if (ctx->ExecuteFlag) { 03782 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w)); 03783 } 03784 } 03785 03786 static void GLAPIENTRY 03787 save_WindowPos2dMESA(GLdouble x, GLdouble y) 03788 { 03789 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 03790 } 03791 03792 static void GLAPIENTRY 03793 save_WindowPos2fMESA(GLfloat x, GLfloat y) 03794 { 03795 save_WindowPos4fMESA(x, y, 0.0F, 1.0F); 03796 } 03797 03798 static void GLAPIENTRY 03799 save_WindowPos2iMESA(GLint x, GLint y) 03800 { 03801 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); 03802 } 03803 03804 static void GLAPIENTRY 03805 save_WindowPos2sMESA(GLshort x, GLshort y) 03806 { 03807 save_WindowPos4fMESA(x, y, 0.0F, 1.0F); 03808 } 03809 03810 static void GLAPIENTRY 03811 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) 03812 { 03813 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 03814 } 03815 03816 static void GLAPIENTRY 03817 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) 03818 { 03819 save_WindowPos4fMESA(x, y, z, 1.0F); 03820 } 03821 03822 static void GLAPIENTRY 03823 save_WindowPos3iMESA(GLint x, GLint y, GLint z) 03824 { 03825 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); 03826 } 03827 03828 static void GLAPIENTRY 03829 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) 03830 { 03831 save_WindowPos4fMESA(x, y, z, 1.0F); 03832 } 03833 03834 static void GLAPIENTRY 03835 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) 03836 { 03837 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 03838 } 03839 03840 static void GLAPIENTRY 03841 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) 03842 { 03843 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); 03844 } 03845 03846 static void GLAPIENTRY 03847 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) 03848 { 03849 save_WindowPos4fMESA(x, y, z, w); 03850 } 03851 03852 static void GLAPIENTRY 03853 save_WindowPos2dvMESA(const GLdouble * v) 03854 { 03855 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 03856 } 03857 03858 static void GLAPIENTRY 03859 save_WindowPos2fvMESA(const GLfloat * v) 03860 { 03861 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); 03862 } 03863 03864 static void GLAPIENTRY 03865 save_WindowPos2ivMESA(const GLint * v) 03866 { 03867 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); 03868 } 03869 03870 static void GLAPIENTRY 03871 save_WindowPos2svMESA(const GLshort * v) 03872 { 03873 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); 03874 } 03875 03876 static void GLAPIENTRY 03877 save_WindowPos3dvMESA(const GLdouble * v) 03878 { 03879 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 03880 } 03881 03882 static void GLAPIENTRY 03883 save_WindowPos3fvMESA(const GLfloat * v) 03884 { 03885 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); 03886 } 03887 03888 static void GLAPIENTRY 03889 save_WindowPos3ivMESA(const GLint * v) 03890 { 03891 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); 03892 } 03893 03894 static void GLAPIENTRY 03895 save_WindowPos3svMESA(const GLshort * v) 03896 { 03897 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); 03898 } 03899 03900 static void GLAPIENTRY 03901 save_WindowPos4dvMESA(const GLdouble * v) 03902 { 03903 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 03904 (GLfloat) v[2], (GLfloat) v[3]); 03905 } 03906 03907 static void GLAPIENTRY 03908 save_WindowPos4fvMESA(const GLfloat * v) 03909 { 03910 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); 03911 } 03912 03913 static void GLAPIENTRY 03914 save_WindowPos4ivMESA(const GLint * v) 03915 { 03916 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 03917 (GLfloat) v[2], (GLfloat) v[3]); 03918 } 03919 03920 static void GLAPIENTRY 03921 save_WindowPos4svMESA(const GLshort * v) 03922 { 03923 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); 03924 } 03925 03926 03927 03928 /* GL_ARB_multitexture */ 03929 static void GLAPIENTRY 03930 save_ActiveTextureARB(GLenum target) 03931 { 03932 GET_CURRENT_CONTEXT(ctx); 03933 Node *n; 03934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 03935 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_TEXTURE, 1); 03936 if (n) { 03937 n[1].e = target; 03938 } 03939 if (ctx->ExecuteFlag) { 03940 CALL_ActiveTextureARB(ctx->Exec, (target)); 03941 } 03942 } 03943 03944 03945 /* GL_ARB_transpose_matrix */ 03946 03947 static void GLAPIENTRY 03948 save_LoadTransposeMatrixdARB(const GLdouble m[16]) 03949 { 03950 GLfloat tm[16]; 03951 _math_transposefd(tm, m); 03952 save_LoadMatrixf(tm); 03953 } 03954 03955 03956 static void GLAPIENTRY 03957 save_LoadTransposeMatrixfARB(const GLfloat m[16]) 03958 { 03959 GLfloat tm[16]; 03960 _math_transposef(tm, m); 03961 save_LoadMatrixf(tm); 03962 } 03963 03964 03965 static void GLAPIENTRY 03966 save_MultTransposeMatrixdARB(const GLdouble m[16]) 03967 { 03968 GLfloat tm[16]; 03969 _math_transposefd(tm, m); 03970 save_MultMatrixf(tm); 03971 } 03972 03973 03974 static void GLAPIENTRY 03975 save_MultTransposeMatrixfARB(const GLfloat m[16]) 03976 { 03977 GLfloat tm[16]; 03978 _math_transposef(tm, m); 03979 save_MultMatrixf(tm); 03980 } 03981 03982 03983 /* GL_ARB_texture_compression */ 03984 static void GLAPIENTRY 03985 save_CompressedTexImage1DARB(GLenum target, GLint level, 03986 GLenum internalFormat, GLsizei width, 03987 GLint border, GLsizei imageSize, 03988 const GLvoid * data) 03989 { 03990 GET_CURRENT_CONTEXT(ctx); 03991 if (target == GL_PROXY_TEXTURE_1D) { 03992 /* don't compile, execute immediately */ 03993 CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat, 03994 width, border, imageSize, 03995 data)); 03996 } 03997 else { 03998 Node *n; 03999 GLvoid *image; 04000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04001 /* make copy of image */ 04002 image = _mesa_malloc(imageSize); 04003 if (!image) { 04004 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); 04005 return; 04006 } 04007 MEMCPY(image, data, imageSize); 04008 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7); 04009 if (n) { 04010 n[1].e = target; 04011 n[2].i = level; 04012 n[3].e = internalFormat; 04013 n[4].i = (GLint) width; 04014 n[5].i = border; 04015 n[6].i = imageSize; 04016 n[7].data = image; 04017 } 04018 else if (image) { 04019 _mesa_free(image); 04020 } 04021 if (ctx->ExecuteFlag) { 04022 CALL_CompressedTexImage1DARB(ctx->Exec, 04023 (target, level, internalFormat, width, 04024 border, imageSize, data)); 04025 } 04026 } 04027 } 04028 04029 04030 static void GLAPIENTRY 04031 save_CompressedTexImage2DARB(GLenum target, GLint level, 04032 GLenum internalFormat, GLsizei width, 04033 GLsizei height, GLint border, GLsizei imageSize, 04034 const GLvoid * data) 04035 { 04036 GET_CURRENT_CONTEXT(ctx); 04037 if (target == GL_PROXY_TEXTURE_2D) { 04038 /* don't compile, execute immediately */ 04039 CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat, 04040 width, height, border, 04041 imageSize, data)); 04042 } 04043 else { 04044 Node *n; 04045 GLvoid *image; 04046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04047 /* make copy of image */ 04048 image = _mesa_malloc(imageSize); 04049 if (!image) { 04050 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); 04051 return; 04052 } 04053 MEMCPY(image, data, imageSize); 04054 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8); 04055 if (n) { 04056 n[1].e = target; 04057 n[2].i = level; 04058 n[3].e = internalFormat; 04059 n[4].i = (GLint) width; 04060 n[5].i = (GLint) height; 04061 n[6].i = border; 04062 n[7].i = imageSize; 04063 n[8].data = image; 04064 } 04065 else if (image) { 04066 _mesa_free(image); 04067 } 04068 if (ctx->ExecuteFlag) { 04069 CALL_CompressedTexImage2DARB(ctx->Exec, 04070 (target, level, internalFormat, width, 04071 height, border, imageSize, data)); 04072 } 04073 } 04074 } 04075 04076 04077 static void GLAPIENTRY 04078 save_CompressedTexImage3DARB(GLenum target, GLint level, 04079 GLenum internalFormat, GLsizei width, 04080 GLsizei height, GLsizei depth, GLint border, 04081 GLsizei imageSize, const GLvoid * data) 04082 { 04083 GET_CURRENT_CONTEXT(ctx); 04084 if (target == GL_PROXY_TEXTURE_3D) { 04085 /* don't compile, execute immediately */ 04086 CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat, 04087 width, height, depth, border, 04088 imageSize, data)); 04089 } 04090 else { 04091 Node *n; 04092 GLvoid *image; 04093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04094 /* make copy of image */ 04095 image = _mesa_malloc(imageSize); 04096 if (!image) { 04097 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); 04098 return; 04099 } 04100 MEMCPY(image, data, imageSize); 04101 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9); 04102 if (n) { 04103 n[1].e = target; 04104 n[2].i = level; 04105 n[3].e = internalFormat; 04106 n[4].i = (GLint) width; 04107 n[5].i = (GLint) height; 04108 n[6].i = (GLint) depth; 04109 n[7].i = border; 04110 n[8].i = imageSize; 04111 n[9].data = image; 04112 } 04113 else if (image) { 04114 _mesa_free(image); 04115 } 04116 if (ctx->ExecuteFlag) { 04117 CALL_CompressedTexImage3DARB(ctx->Exec, 04118 (target, level, internalFormat, width, 04119 height, depth, border, imageSize, 04120 data)); 04121 } 04122 } 04123 } 04124 04125 04126 static void GLAPIENTRY 04127 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, 04128 GLsizei width, GLenum format, 04129 GLsizei imageSize, const GLvoid * data) 04130 { 04131 Node *n; 04132 GLvoid *image; 04133 04134 GET_CURRENT_CONTEXT(ctx); 04135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04136 04137 /* make copy of image */ 04138 image = _mesa_malloc(imageSize); 04139 if (!image) { 04140 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); 04141 return; 04142 } 04143 MEMCPY(image, data, imageSize); 04144 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7); 04145 if (n) { 04146 n[1].e = target; 04147 n[2].i = level; 04148 n[3].i = xoffset; 04149 n[4].i = (GLint) width; 04150 n[5].e = format; 04151 n[6].i = imageSize; 04152 n[7].data = image; 04153 } 04154 else if (image) { 04155 _mesa_free(image); 04156 } 04157 if (ctx->ExecuteFlag) { 04158 CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset, 04159 width, format, imageSize, 04160 data)); 04161 } 04162 } 04163 04164 04165 static void GLAPIENTRY 04166 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, 04167 GLint yoffset, GLsizei width, GLsizei height, 04168 GLenum format, GLsizei imageSize, 04169 const GLvoid * data) 04170 { 04171 Node *n; 04172 GLvoid *image; 04173 04174 GET_CURRENT_CONTEXT(ctx); 04175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04176 04177 /* make copy of image */ 04178 image = _mesa_malloc(imageSize); 04179 if (!image) { 04180 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); 04181 return; 04182 } 04183 MEMCPY(image, data, imageSize); 04184 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9); 04185 if (n) { 04186 n[1].e = target; 04187 n[2].i = level; 04188 n[3].i = xoffset; 04189 n[4].i = yoffset; 04190 n[5].i = (GLint) width; 04191 n[6].i = (GLint) height; 04192 n[7].e = format; 04193 n[8].i = imageSize; 04194 n[9].data = image; 04195 } 04196 else if (image) { 04197 _mesa_free(image); 04198 } 04199 if (ctx->ExecuteFlag) { 04200 CALL_CompressedTexSubImage2DARB(ctx->Exec, 04201 (target, level, xoffset, yoffset, width, 04202 height, format, imageSize, data)); 04203 } 04204 } 04205 04206 04207 static void GLAPIENTRY 04208 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, 04209 GLint yoffset, GLint zoffset, GLsizei width, 04210 GLsizei height, GLsizei depth, GLenum format, 04211 GLsizei imageSize, const GLvoid * data) 04212 { 04213 Node *n; 04214 GLvoid *image; 04215 04216 GET_CURRENT_CONTEXT(ctx); 04217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04218 04219 /* make copy of image */ 04220 image = _mesa_malloc(imageSize); 04221 if (!image) { 04222 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); 04223 return; 04224 } 04225 MEMCPY(image, data, imageSize); 04226 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11); 04227 if (n) { 04228 n[1].e = target; 04229 n[2].i = level; 04230 n[3].i = xoffset; 04231 n[4].i = yoffset; 04232 n[5].i = zoffset; 04233 n[6].i = (GLint) width; 04234 n[7].i = (GLint) height; 04235 n[8].i = (GLint) depth; 04236 n[9].e = format; 04237 n[10].i = imageSize; 04238 n[11].data = image; 04239 } 04240 else if (image) { 04241 _mesa_free(image); 04242 } 04243 if (ctx->ExecuteFlag) { 04244 CALL_CompressedTexSubImage3DARB(ctx->Exec, 04245 (target, level, xoffset, yoffset, 04246 zoffset, width, height, depth, format, 04247 imageSize, data)); 04248 } 04249 } 04250 04251 04252 /* GL_ARB_multisample */ 04253 static void GLAPIENTRY 04254 save_SampleCoverageARB(GLclampf value, GLboolean invert) 04255 { 04256 GET_CURRENT_CONTEXT(ctx); 04257 Node *n; 04258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04259 n = ALLOC_INSTRUCTION(ctx, OPCODE_SAMPLE_COVERAGE, 2); 04260 if (n) { 04261 n[1].f = value; 04262 n[2].b = invert; 04263 } 04264 if (ctx->ExecuteFlag) { 04265 CALL_SampleCoverageARB(ctx->Exec, (value, invert)); 04266 } 04267 } 04268 04269 04270 /* 04271 * GL_NV_vertex_program 04272 */ 04273 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 04274 static void GLAPIENTRY 04275 save_BindProgramNV(GLenum target, GLuint id) 04276 { 04277 GET_CURRENT_CONTEXT(ctx); 04278 Node *n; 04279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04280 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_PROGRAM_NV, 2); 04281 if (n) { 04282 n[1].e = target; 04283 n[2].ui = id; 04284 } 04285 if (ctx->ExecuteFlag) { 04286 CALL_BindProgramNV(ctx->Exec, (target, id)); 04287 } 04288 } 04289 04290 static void GLAPIENTRY 04291 save_ProgramEnvParameter4fARB(GLenum target, GLuint index, 04292 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 04293 { 04294 GET_CURRENT_CONTEXT(ctx); 04295 Node *n; 04296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04297 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); 04298 if (n) { 04299 n[1].e = target; 04300 n[2].ui = index; 04301 n[3].f = x; 04302 n[4].f = y; 04303 n[5].f = z; 04304 n[6].f = w; 04305 } 04306 if (ctx->ExecuteFlag) { 04307 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); 04308 } 04309 } 04310 04311 04312 static void GLAPIENTRY 04313 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, 04314 const GLfloat *params) 04315 { 04316 save_ProgramEnvParameter4fARB(target, index, params[0], params[1], 04317 params[2], params[3]); 04318 } 04319 04320 04321 static void GLAPIENTRY 04322 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, 04323 const GLfloat * params) 04324 { 04325 GET_CURRENT_CONTEXT(ctx); 04326 Node *n; 04327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04328 04329 if (count > 0) { 04330 GLint i; 04331 const GLfloat * p = params; 04332 04333 for (i = 0 ; i < count ; i++) { 04334 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); 04335 if (n) { 04336 n[1].e = target; 04337 n[2].ui = index; 04338 n[3].f = p[0]; 04339 n[4].f = p[1]; 04340 n[5].f = p[2]; 04341 n[6].f = p[3]; 04342 p += 4; 04343 } 04344 } 04345 } 04346 04347 if (ctx->ExecuteFlag) { 04348 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params)); 04349 } 04350 } 04351 04352 04353 static void GLAPIENTRY 04354 save_ProgramEnvParameter4dARB(GLenum target, GLuint index, 04355 GLdouble x, GLdouble y, GLdouble z, GLdouble w) 04356 { 04357 save_ProgramEnvParameter4fARB(target, index, 04358 (GLfloat) x, 04359 (GLfloat) y, (GLfloat) z, (GLfloat) w); 04360 } 04361 04362 04363 static void GLAPIENTRY 04364 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, 04365 const GLdouble *params) 04366 { 04367 save_ProgramEnvParameter4fARB(target, index, 04368 (GLfloat) params[0], 04369 (GLfloat) params[1], 04370 (GLfloat) params[2], (GLfloat) params[3]); 04371 } 04372 04373 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */ 04374 04375 #if FEATURE_NV_vertex_program 04376 static void GLAPIENTRY 04377 save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) 04378 { 04379 GET_CURRENT_CONTEXT(ctx); 04380 Node *n; 04381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04382 n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); 04383 if (n) { 04384 n[1].e = target; 04385 n[2].ui = id; 04386 n[3].f = params[0]; 04387 n[4].f = params[1]; 04388 n[5].f = params[2]; 04389 n[6].f = params[3]; 04390 } 04391 if (ctx->ExecuteFlag) { 04392 CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); 04393 } 04394 } 04395 04396 04397 static void GLAPIENTRY 04398 save_ProgramParameters4dvNV(GLenum target, GLuint index, 04399 GLuint num, const GLdouble *params) 04400 { 04401 GLuint i; 04402 for (i = 0; i < num; i++) { 04403 save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i); 04404 } 04405 } 04406 04407 04408 static void GLAPIENTRY 04409 save_ProgramParameters4fvNV(GLenum target, GLuint index, 04410 GLuint num, const GLfloat *params) 04411 { 04412 GLuint i; 04413 for (i = 0; i < num; i++) { 04414 save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i); 04415 } 04416 } 04417 04418 04419 static void GLAPIENTRY 04420 save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, 04421 const GLubyte * program) 04422 { 04423 GET_CURRENT_CONTEXT(ctx); 04424 Node *n; 04425 GLubyte *programCopy; 04426 04427 programCopy = (GLubyte *) _mesa_malloc(len); 04428 if (!programCopy) { 04429 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); 04430 return; 04431 } 04432 _mesa_memcpy(programCopy, program, len); 04433 04434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04435 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4); 04436 if (n) { 04437 n[1].e = target; 04438 n[2].ui = id; 04439 n[3].i = len; 04440 n[4].data = programCopy; 04441 } 04442 if (ctx->ExecuteFlag) { 04443 CALL_LoadProgramNV(ctx->Exec, (target, id, len, program)); 04444 } 04445 } 04446 04447 04448 static void GLAPIENTRY 04449 save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids) 04450 { 04451 GET_CURRENT_CONTEXT(ctx); 04452 Node *n; 04453 GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); 04454 if (!idCopy) { 04455 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); 04456 return; 04457 } 04458 _mesa_memcpy(idCopy, ids, num * sizeof(GLuint)); 04459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04460 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2); 04461 if (n) { 04462 n[1].i = num; 04463 n[2].data = idCopy; 04464 } 04465 if (ctx->ExecuteFlag) { 04466 CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids)); 04467 } 04468 } 04469 04470 04471 static void GLAPIENTRY 04472 save_TrackMatrixNV(GLenum target, GLuint address, 04473 GLenum matrix, GLenum transform) 04474 { 04475 GET_CURRENT_CONTEXT(ctx); 04476 Node *n; 04477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04478 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 4); 04479 if (n) { 04480 n[1].e = target; 04481 n[2].ui = address; 04482 n[3].e = matrix; 04483 n[4].e = transform; 04484 } 04485 if (ctx->ExecuteFlag) { 04486 CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform)); 04487 } 04488 } 04489 #endif /* FEATURE_NV_vertex_program */ 04490 04491 04492 /* 04493 * GL_NV_fragment_program 04494 */ 04495 #if FEATURE_NV_fragment_program 04496 static void GLAPIENTRY 04497 save_ProgramLocalParameter4fARB(GLenum target, GLuint index, 04498 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 04499 { 04500 GET_CURRENT_CONTEXT(ctx); 04501 Node *n; 04502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04503 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 04504 if (n) { 04505 n[1].e = target; 04506 n[2].ui = index; 04507 n[3].f = x; 04508 n[4].f = y; 04509 n[5].f = z; 04510 n[6].f = w; 04511 } 04512 if (ctx->ExecuteFlag) { 04513 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); 04514 } 04515 } 04516 04517 04518 static void GLAPIENTRY 04519 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index, 04520 const GLfloat *params) 04521 { 04522 GET_CURRENT_CONTEXT(ctx); 04523 Node *n; 04524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04525 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 04526 if (n) { 04527 n[1].e = target; 04528 n[2].ui = index; 04529 n[3].f = params[0]; 04530 n[4].f = params[1]; 04531 n[5].f = params[2]; 04532 n[6].f = params[3]; 04533 } 04534 if (ctx->ExecuteFlag) { 04535 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params)); 04536 } 04537 } 04538 04539 04540 static void GLAPIENTRY 04541 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, 04542 const GLfloat *params) 04543 { 04544 GET_CURRENT_CONTEXT(ctx); 04545 Node *n; 04546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04547 04548 if (count > 0) { 04549 GLint i; 04550 const GLfloat * p = params; 04551 04552 for (i = 0 ; i < count ; i++) { 04553 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 04554 if (n) { 04555 n[1].e = target; 04556 n[2].ui = index; 04557 n[3].f = p[0]; 04558 n[4].f = p[1]; 04559 n[5].f = p[2]; 04560 n[6].f = p[3]; 04561 p += 4; 04562 } 04563 } 04564 } 04565 04566 if (ctx->ExecuteFlag) { 04567 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params)); 04568 } 04569 } 04570 04571 04572 static void GLAPIENTRY 04573 save_ProgramLocalParameter4dARB(GLenum target, GLuint index, 04574 GLdouble x, GLdouble y, 04575 GLdouble z, GLdouble w) 04576 { 04577 GET_CURRENT_CONTEXT(ctx); 04578 Node *n; 04579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04580 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 04581 if (n) { 04582 n[1].e = target; 04583 n[2].ui = index; 04584 n[3].f = (GLfloat) x; 04585 n[4].f = (GLfloat) y; 04586 n[5].f = (GLfloat) z; 04587 n[6].f = (GLfloat) w; 04588 } 04589 if (ctx->ExecuteFlag) { 04590 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w)); 04591 } 04592 } 04593 04594 04595 static void GLAPIENTRY 04596 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, 04597 const GLdouble *params) 04598 { 04599 GET_CURRENT_CONTEXT(ctx); 04600 Node *n; 04601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04602 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); 04603 if (n) { 04604 n[1].e = target; 04605 n[2].ui = index; 04606 n[3].f = (GLfloat) params[0]; 04607 n[4].f = (GLfloat) params[1]; 04608 n[5].f = (GLfloat) params[2]; 04609 n[6].f = (GLfloat) params[3]; 04610 } 04611 if (ctx->ExecuteFlag) { 04612 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params)); 04613 } 04614 } 04615 04616 static void GLAPIENTRY 04617 save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, 04618 GLfloat x, GLfloat y, GLfloat z, GLfloat w) 04619 { 04620 GET_CURRENT_CONTEXT(ctx); 04621 Node *n; 04622 GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); 04623 if (!nameCopy) { 04624 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); 04625 return; 04626 } 04627 _mesa_memcpy(nameCopy, name, len); 04628 04629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04630 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); 04631 if (n) { 04632 n[1].ui = id; 04633 n[2].i = len; 04634 n[3].data = nameCopy; 04635 n[4].f = x; 04636 n[5].f = y; 04637 n[6].f = z; 04638 n[7].f = w; 04639 } 04640 if (ctx->ExecuteFlag) { 04641 CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w)); 04642 } 04643 } 04644 04645 04646 static void GLAPIENTRY 04647 save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name, 04648 const float v[]) 04649 { 04650 save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]); 04651 } 04652 04653 04654 static void GLAPIENTRY 04655 save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name, 04656 GLdouble x, GLdouble y, GLdouble z, GLdouble w) 04657 { 04658 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y, 04659 (GLfloat) z, (GLfloat) w); 04660 } 04661 04662 04663 static void GLAPIENTRY 04664 save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, 04665 const double v[]) 04666 { 04667 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0], 04668 (GLfloat) v[1], (GLfloat) v[2], 04669 (GLfloat) v[3]); 04670 } 04671 04672 #endif /* FEATURE_NV_fragment_program */ 04673 04674 04675 04676 /* GL_EXT_stencil_two_side */ 04677 static void GLAPIENTRY 04678 save_ActiveStencilFaceEXT(GLenum face) 04679 { 04680 GET_CURRENT_CONTEXT(ctx); 04681 Node *n; 04682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04683 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1); 04684 if (n) { 04685 n[1].e = face; 04686 } 04687 if (ctx->ExecuteFlag) { 04688 CALL_ActiveStencilFaceEXT(ctx->Exec, (face)); 04689 } 04690 } 04691 04692 04693 /* GL_EXT_depth_bounds_test */ 04694 static void GLAPIENTRY 04695 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax) 04696 { 04697 GET_CURRENT_CONTEXT(ctx); 04698 Node *n; 04699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04700 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2); 04701 if (n) { 04702 n[1].f = (GLfloat) zmin; 04703 n[2].f = (GLfloat) zmax; 04704 } 04705 if (ctx->ExecuteFlag) { 04706 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax)); 04707 } 04708 } 04709 04710 04711 04712 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 04713 04714 static void GLAPIENTRY 04715 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, 04716 const GLvoid * string) 04717 { 04718 GET_CURRENT_CONTEXT(ctx); 04719 Node *n; 04720 GLubyte *programCopy; 04721 04722 programCopy = (GLubyte *) _mesa_malloc(len); 04723 if (!programCopy) { 04724 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); 04725 return; 04726 } 04727 _mesa_memcpy(programCopy, string, len); 04728 04729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04730 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4); 04731 if (n) { 04732 n[1].e = target; 04733 n[2].e = format; 04734 n[3].i = len; 04735 n[4].data = programCopy; 04736 } 04737 if (ctx->ExecuteFlag) { 04738 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string)); 04739 } 04740 } 04741 04742 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ 04743 04744 04745 #if FEATURE_ARB_occlusion_query 04746 04747 static void GLAPIENTRY 04748 save_BeginQueryARB(GLenum target, GLuint id) 04749 { 04750 GET_CURRENT_CONTEXT(ctx); 04751 Node *n; 04752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04753 n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN_QUERY_ARB, 2); 04754 if (n) { 04755 n[1].e = target; 04756 n[2].ui = id; 04757 } 04758 if (ctx->ExecuteFlag) { 04759 CALL_BeginQueryARB(ctx->Exec, (target, id)); 04760 } 04761 } 04762 04763 04764 static void GLAPIENTRY 04765 save_EndQueryARB(GLenum target) 04766 { 04767 GET_CURRENT_CONTEXT(ctx); 04768 Node *n; 04769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04770 n = ALLOC_INSTRUCTION(ctx, OPCODE_END_QUERY_ARB, 1); 04771 if (n) { 04772 n[1].e = target; 04773 } 04774 if (ctx->ExecuteFlag) { 04775 CALL_EndQueryARB(ctx->Exec, (target)); 04776 } 04777 } 04778 04779 #endif /* FEATURE_ARB_occlusion_query */ 04780 04781 04782 static void GLAPIENTRY 04783 save_DrawBuffersARB(GLsizei count, const GLenum * buffers) 04784 { 04785 GET_CURRENT_CONTEXT(ctx); 04786 Node *n; 04787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 04788 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS); 04789 if (n) { 04790 GLint i; 04791 n[1].i = count; 04792 if (count > MAX_DRAW_BUFFERS) 04793 count = MAX_DRAW_BUFFERS; 04794 for (i = 0; i < count; i++) { 04795 n[2 + i].e = buffers[i]; 04796 } 04797 } 04798 if (ctx->ExecuteFlag) { 04799 CALL_DrawBuffersARB(ctx->Exec, (count, buffers)); 04800 } 04801 } 04802 04803 #if FEATURE_ATI_fragment_shader 04804 static void GLAPIENTRY 04805 save_BindFragmentShaderATI(GLuint id) 04806 { 04807 GET_CURRENT_CONTEXT(ctx); 04808 Node *n; 04809 04810 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1); 04811 if (n) { 04812 n[1].ui = id; 04813 } 04814 if (ctx->ExecuteFlag) { 04815 CALL_BindFragmentShaderATI(ctx->Exec, (id)); 04816 } 04817 } 04818 04819 static void GLAPIENTRY 04820 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value) 04821 { 04822 GET_CURRENT_CONTEXT(ctx); 04823 Node *n; 04824 04825 n = ALLOC_INSTRUCTION(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5); 04826 if (n) { 04827 n[1].ui = dst; 04828 n[2].f = value[0]; 04829 n[3].f = value[1]; 04830 n[4].f = value[2]; 04831 n[5].f = value[3]; 04832 } 04833 if (ctx->ExecuteFlag) { 04834 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value)); 04835 } 04836 } 04837 #endif 04838 04839 static void 04840 save_Attr1fNV(GLenum attr, GLfloat x) 04841 { 04842 GET_CURRENT_CONTEXT(ctx); 04843 Node *n; 04844 SAVE_FLUSH_VERTICES(ctx); 04845 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_NV, 2); 04846 if (n) { 04847 n[1].e = attr; 04848 n[2].f = x; 04849 } 04850 04851 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 04852 ctx->ListState.ActiveAttribSize[attr] = 1; 04853 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); 04854 04855 if (ctx->ExecuteFlag) { 04856 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x)); 04857 } 04858 } 04859 04860 static void 04861 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y) 04862 { 04863 GET_CURRENT_CONTEXT(ctx); 04864 Node *n; 04865 SAVE_FLUSH_VERTICES(ctx); 04866 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_NV, 3); 04867 if (n) { 04868 n[1].e = attr; 04869 n[2].f = x; 04870 n[3].f = y; 04871 } 04872 04873 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 04874 ctx->ListState.ActiveAttribSize[attr] = 2; 04875 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); 04876 04877 if (ctx->ExecuteFlag) { 04878 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y)); 04879 } 04880 } 04881 04882 static void 04883 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z) 04884 { 04885 GET_CURRENT_CONTEXT(ctx); 04886 Node *n; 04887 SAVE_FLUSH_VERTICES(ctx); 04888 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_NV, 4); 04889 if (n) { 04890 n[1].e = attr; 04891 n[2].f = x; 04892 n[3].f = y; 04893 n[4].f = z; 04894 } 04895 04896 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 04897 ctx->ListState.ActiveAttribSize[attr] = 3; 04898 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); 04899 04900 if (ctx->ExecuteFlag) { 04901 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z)); 04902 } 04903 } 04904 04905 static void 04906 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 04907 { 04908 GET_CURRENT_CONTEXT(ctx); 04909 Node *n; 04910 SAVE_FLUSH_VERTICES(ctx); 04911 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_NV, 5); 04912 if (n) { 04913 n[1].e = attr; 04914 n[2].f = x; 04915 n[3].f = y; 04916 n[4].f = z; 04917 n[5].f = w; 04918 } 04919 04920 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); 04921 ctx->ListState.ActiveAttribSize[attr] = 4; 04922 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); 04923 04924 if (ctx->ExecuteFlag) { 04925 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w)); 04926 } 04927 } 04928 04929 04930 static void 04931 save_Attr1fARB(GLenum attr, GLfloat x) 04932 { 04933 GET_CURRENT_CONTEXT(ctx); 04934 Node *n; 04935 SAVE_FLUSH_VERTICES(ctx); 04936 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_ARB, 2); 04937 if (n) { 04938 n[1].e = attr; 04939 n[2].f = x; 04940 } 04941 04942 ASSERT(attr < MAX_VERTEX_ATTRIBS); 04943 ctx->ListState.ActiveAttribSize[attr] = 1; 04944 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); 04945 04946 if (ctx->ExecuteFlag) { 04947 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x)); 04948 } 04949 } 04950 04951 static void 04952 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y) 04953 { 04954 GET_CURRENT_CONTEXT(ctx); 04955 Node *n; 04956 SAVE_FLUSH_VERTICES(ctx); 04957 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_ARB, 3); 04958 if (n) { 04959 n[1].e = attr; 04960 n[2].f = x; 04961 n[3].f = y; 04962 } 04963 04964 ASSERT(attr < MAX_VERTEX_ATTRIBS); 04965 ctx->ListState.ActiveAttribSize[attr] = 2; 04966 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); 04967 04968 if (ctx->ExecuteFlag) { 04969 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y)); 04970 } 04971 } 04972 04973 static void 04974 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z) 04975 { 04976 GET_CURRENT_CONTEXT(ctx); 04977 Node *n; 04978 SAVE_FLUSH_VERTICES(ctx); 04979 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_ARB, 4); 04980 if (n) { 04981 n[1].e = attr; 04982 n[2].f = x; 04983 n[3].f = y; 04984 n[4].f = z; 04985 } 04986 04987 ASSERT(attr < MAX_VERTEX_ATTRIBS); 04988 ctx->ListState.ActiveAttribSize[attr] = 3; 04989 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); 04990 04991 if (ctx->ExecuteFlag) { 04992 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z)); 04993 } 04994 } 04995 04996 static void 04997 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 04998 { 04999 GET_CURRENT_CONTEXT(ctx); 05000 Node *n; 05001 SAVE_FLUSH_VERTICES(ctx); 05002 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_ARB, 5); 05003 if (n) { 05004 n[1].e = attr; 05005 n[2].f = x; 05006 n[3].f = y; 05007 n[4].f = z; 05008 n[5].f = w; 05009 } 05010 05011 ASSERT(attr < MAX_VERTEX_ATTRIBS); 05012 ctx->ListState.ActiveAttribSize[attr] = 4; 05013 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); 05014 05015 if (ctx->ExecuteFlag) { 05016 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w)); 05017 } 05018 } 05019 05020 05021 static void GLAPIENTRY 05022 save_EvalCoord1f(GLfloat x) 05023 { 05024 GET_CURRENT_CONTEXT(ctx); 05025 Node *n; 05026 SAVE_FLUSH_VERTICES(ctx); 05027 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C1, 1); 05028 if (n) { 05029 n[1].f = x; 05030 } 05031 if (ctx->ExecuteFlag) { 05032 CALL_EvalCoord1f(ctx->Exec, (x)); 05033 } 05034 } 05035 05036 static void GLAPIENTRY 05037 save_EvalCoord1fv(const GLfloat * v) 05038 { 05039 save_EvalCoord1f(v[0]); 05040 } 05041 05042 static void GLAPIENTRY 05043 save_EvalCoord2f(GLfloat x, GLfloat y) 05044 { 05045 GET_CURRENT_CONTEXT(ctx); 05046 Node *n; 05047 SAVE_FLUSH_VERTICES(ctx); 05048 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C2, 2); 05049 if (n) { 05050 n[1].f = x; 05051 n[2].f = y; 05052 } 05053 if (ctx->ExecuteFlag) { 05054 CALL_EvalCoord2f(ctx->Exec, (x, y)); 05055 } 05056 } 05057 05058 static void GLAPIENTRY 05059 save_EvalCoord2fv(const GLfloat * v) 05060 { 05061 save_EvalCoord2f(v[0], v[1]); 05062 } 05063 05064 05065 static void GLAPIENTRY 05066 save_EvalPoint1(GLint x) 05067 { 05068 GET_CURRENT_CONTEXT(ctx); 05069 Node *n; 05070 SAVE_FLUSH_VERTICES(ctx); 05071 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P1, 1); 05072 if (n) { 05073 n[1].i = x; 05074 } 05075 if (ctx->ExecuteFlag) { 05076 CALL_EvalPoint1(ctx->Exec, (x)); 05077 } 05078 } 05079 05080 static void GLAPIENTRY 05081 save_EvalPoint2(GLint x, GLint y) 05082 { 05083 GET_CURRENT_CONTEXT(ctx); 05084 Node *n; 05085 SAVE_FLUSH_VERTICES(ctx); 05086 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P2, 2); 05087 if (n) { 05088 n[1].i = x; 05089 n[2].i = y; 05090 } 05091 if (ctx->ExecuteFlag) { 05092 CALL_EvalPoint2(ctx->Exec, (x, y)); 05093 } 05094 } 05095 05096 static void GLAPIENTRY 05097 save_Indexf(GLfloat x) 05098 { 05099 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x); 05100 } 05101 05102 static void GLAPIENTRY 05103 save_Indexfv(const GLfloat * v) 05104 { 05105 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]); 05106 } 05107 05108 static void GLAPIENTRY 05109 save_EdgeFlag(GLboolean x) 05110 { 05111 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0); 05112 } 05113 05114 static void GLAPIENTRY 05115 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param) 05116 { 05117 GET_CURRENT_CONTEXT(ctx); 05118 Node *n; 05119 int args, i; 05120 05121 SAVE_FLUSH_VERTICES(ctx); 05122 05123 switch (face) { 05124 case GL_BACK: 05125 case GL_FRONT: 05126 case GL_FRONT_AND_BACK: 05127 break; 05128 default: 05129 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(face)"); 05130 return; 05131 } 05132 05133 switch (pname) { 05134 case GL_EMISSION: 05135 case GL_AMBIENT: 05136 case GL_DIFFUSE: 05137 case GL_SPECULAR: 05138 case GL_AMBIENT_AND_DIFFUSE: 05139 args = 4; 05140 break; 05141 case GL_SHININESS: 05142 args = 1; 05143 break; 05144 case GL_COLOR_INDEXES: 05145 args = 3; 05146 break; 05147 default: 05148 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)"); 05149 return; 05150 } 05151 05152 n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6); 05153 if (n) { 05154 n[1].e = face; 05155 n[2].e = pname; 05156 for (i = 0; i < args; i++) 05157 n[3 + i].f = param[i]; 05158 } 05159 05160 { 05161 GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL); 05162 for (i = 0; i < MAT_ATTRIB_MAX; i++) 05163 if (bitmask & (1 << i)) { 05164 ctx->ListState.ActiveMaterialSize[i] = args; 05165 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param); 05166 } 05167 } 05168 05169 if (ctx->ExecuteFlag) { 05170 CALL_Materialfv(ctx->Exec, (face, pname, param)); 05171 } 05172 } 05173 05174 static void GLAPIENTRY 05175 save_Begin(GLenum mode) 05176 { 05177 GET_CURRENT_CONTEXT(ctx); 05178 Node *n; 05179 GLboolean error = GL_FALSE; 05180 05181 if ( /*mode < GL_POINTS || */ mode > GL_POLYGON) { 05182 _mesa_compile_error(ctx, GL_INVALID_ENUM, "Begin (mode)"); 05183 error = GL_TRUE; 05184 } 05185 else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) { 05186 /* Typically the first begin. This may raise an error on 05187 * playback, depending on whether CallList is issued from inside 05188 * a begin/end or not. 05189 */ 05190 ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; 05191 } 05192 else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) { 05193 ctx->Driver.CurrentSavePrimitive = mode; 05194 } 05195 else { 05196 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin"); 05197 error = GL_TRUE; 05198 } 05199 05200 if (!error) { 05201 /* Give the driver an opportunity to hook in an optimized 05202 * display list compiler. 05203 */ 05204 if (ctx->Driver.NotifySaveBegin(ctx, mode)) 05205 return; 05206 05207 SAVE_FLUSH_VERTICES(ctx); 05208 n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN, 1); 05209 if (n) { 05210 n[1].e = mode; 05211 } 05212 } 05213 05214 if (ctx->ExecuteFlag) { 05215 CALL_Begin(ctx->Exec, (mode)); 05216 } 05217 } 05218 05219 static void GLAPIENTRY 05220 save_End(void) 05221 { 05222 GET_CURRENT_CONTEXT(ctx); 05223 SAVE_FLUSH_VERTICES(ctx); 05224 (void) ALLOC_INSTRUCTION(ctx, OPCODE_END, 0); 05225 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; 05226 if (ctx->ExecuteFlag) { 05227 CALL_End(ctx->Exec, ()); 05228 } 05229 } 05230 05231 static void GLAPIENTRY 05232 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d) 05233 { 05234 GET_CURRENT_CONTEXT(ctx); 05235 Node *n; 05236 SAVE_FLUSH_VERTICES(ctx); 05237 n = ALLOC_INSTRUCTION(ctx, OPCODE_RECTF, 4); 05238 if (n) { 05239 n[1].f = a; 05240 n[2].f = b; 05241 n[3].f = c; 05242 n[4].f = d; 05243 } 05244 if (ctx->ExecuteFlag) { 05245 CALL_Rectf(ctx->Exec, (a, b, c, d)); 05246 } 05247 } 05248 05249 05250 static void GLAPIENTRY 05251 save_Vertex2f(GLfloat x, GLfloat y) 05252 { 05253 save_Attr2fNV(VERT_ATTRIB_POS, x, y); 05254 } 05255 05256 static void GLAPIENTRY 05257 save_Vertex2fv(const GLfloat * v) 05258 { 05259 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]); 05260 } 05261 05262 static void GLAPIENTRY 05263 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z) 05264 { 05265 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z); 05266 } 05267 05268 static void GLAPIENTRY 05269 save_Vertex3fv(const GLfloat * v) 05270 { 05271 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]); 05272 } 05273 05274 static void GLAPIENTRY 05275 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 05276 { 05277 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w); 05278 } 05279 05280 static void GLAPIENTRY 05281 save_Vertex4fv(const GLfloat * v) 05282 { 05283 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]); 05284 } 05285 05286 static void GLAPIENTRY 05287 save_TexCoord1f(GLfloat x) 05288 { 05289 save_Attr1fNV(VERT_ATTRIB_TEX0, x); 05290 } 05291 05292 static void GLAPIENTRY 05293 save_TexCoord1fv(const GLfloat * v) 05294 { 05295 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]); 05296 } 05297 05298 static void GLAPIENTRY 05299 save_TexCoord2f(GLfloat x, GLfloat y) 05300 { 05301 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y); 05302 } 05303 05304 static void GLAPIENTRY 05305 save_TexCoord2fv(const GLfloat * v) 05306 { 05307 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]); 05308 } 05309 05310 static void GLAPIENTRY 05311 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z) 05312 { 05313 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z); 05314 } 05315 05316 static void GLAPIENTRY 05317 save_TexCoord3fv(const GLfloat * v) 05318 { 05319 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]); 05320 } 05321 05322 static void GLAPIENTRY 05323 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 05324 { 05325 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w); 05326 } 05327 05328 static void GLAPIENTRY 05329 save_TexCoord4fv(const GLfloat * v) 05330 { 05331 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]); 05332 } 05333 05334 static void GLAPIENTRY 05335 save_Normal3f(GLfloat x, GLfloat y, GLfloat z) 05336 { 05337 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z); 05338 } 05339 05340 static void GLAPIENTRY 05341 save_Normal3fv(const GLfloat * v) 05342 { 05343 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]); 05344 } 05345 05346 static void GLAPIENTRY 05347 save_FogCoordfEXT(GLfloat x) 05348 { 05349 save_Attr1fNV(VERT_ATTRIB_FOG, x); 05350 } 05351 05352 static void GLAPIENTRY 05353 save_FogCoordfvEXT(const GLfloat * v) 05354 { 05355 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]); 05356 } 05357 05358 static void GLAPIENTRY 05359 save_Color3f(GLfloat x, GLfloat y, GLfloat z) 05360 { 05361 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z); 05362 } 05363 05364 static void GLAPIENTRY 05365 save_Color3fv(const GLfloat * v) 05366 { 05367 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]); 05368 } 05369 05370 static void GLAPIENTRY 05371 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) 05372 { 05373 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w); 05374 } 05375 05376 static void GLAPIENTRY 05377 save_Color4fv(const GLfloat * v) 05378 { 05379 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]); 05380 } 05381 05382 static void GLAPIENTRY 05383 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z) 05384 { 05385 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z); 05386 } 05387 05388 static void GLAPIENTRY 05389 save_SecondaryColor3fvEXT(const GLfloat * v) 05390 { 05391 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]); 05392 } 05393 05394 05395 /* Just call the respective ATTR for texcoord 05396 */ 05397 static void GLAPIENTRY 05398 save_MultiTexCoord1f(GLenum target, GLfloat x) 05399 { 05400 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05401 save_Attr1fNV(attr, x); 05402 } 05403 05404 static void GLAPIENTRY 05405 save_MultiTexCoord1fv(GLenum target, const GLfloat * v) 05406 { 05407 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05408 save_Attr1fNV(attr, v[0]); 05409 } 05410 05411 static void GLAPIENTRY 05412 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y) 05413 { 05414 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05415 save_Attr2fNV(attr, x, y); 05416 } 05417 05418 static void GLAPIENTRY 05419 save_MultiTexCoord2fv(GLenum target, const GLfloat * v) 05420 { 05421 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05422 save_Attr2fNV(attr, v[0], v[1]); 05423 } 05424 05425 static void GLAPIENTRY 05426 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z) 05427 { 05428 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05429 save_Attr3fNV(attr, x, y, z); 05430 } 05431 05432 static void GLAPIENTRY 05433 save_MultiTexCoord3fv(GLenum target, const GLfloat * v) 05434 { 05435 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05436 save_Attr3fNV(attr, v[0], v[1], v[2]); 05437 } 05438 05439 static void GLAPIENTRY 05440 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y, 05441 GLfloat z, GLfloat w) 05442 { 05443 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05444 save_Attr4fNV(attr, x, y, z, w); 05445 } 05446 05447 static void GLAPIENTRY 05448 save_MultiTexCoord4fv(GLenum target, const GLfloat * v) 05449 { 05450 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; 05451 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]); 05452 } 05453 05454 05459 static void 05460 index_error(void) 05461 { 05462 GET_CURRENT_CONTEXT(ctx); 05463 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)"); 05464 } 05465 05466 05467 /* First level for NV_vertex_program: 05468 * 05469 * Check for errors at compile time?. 05470 */ 05471 static void GLAPIENTRY 05472 save_VertexAttrib1fNV(GLuint index, GLfloat x) 05473 { 05474 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05475 save_Attr1fNV(index, x); 05476 else 05477 index_error(); 05478 } 05479 05480 static void GLAPIENTRY 05481 save_VertexAttrib1fvNV(GLuint index, const GLfloat * v) 05482 { 05483 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05484 save_Attr1fNV(index, v[0]); 05485 else 05486 index_error(); 05487 } 05488 05489 static void GLAPIENTRY 05490 save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) 05491 { 05492 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05493 save_Attr2fNV(index, x, y); 05494 else 05495 index_error(); 05496 } 05497 05498 static void GLAPIENTRY 05499 save_VertexAttrib2fvNV(GLuint index, const GLfloat * v) 05500 { 05501 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05502 save_Attr2fNV(index, v[0], v[1]); 05503 else 05504 index_error(); 05505 } 05506 05507 static void GLAPIENTRY 05508 save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) 05509 { 05510 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05511 save_Attr3fNV(index, x, y, z); 05512 else 05513 index_error(); 05514 } 05515 05516 static void GLAPIENTRY 05517 save_VertexAttrib3fvNV(GLuint index, const GLfloat * v) 05518 { 05519 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05520 save_Attr3fNV(index, v[0], v[1], v[2]); 05521 else 05522 index_error(); 05523 } 05524 05525 static void GLAPIENTRY 05526 save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, 05527 GLfloat z, GLfloat w) 05528 { 05529 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05530 save_Attr4fNV(index, x, y, z, w); 05531 else 05532 index_error(); 05533 } 05534 05535 static void GLAPIENTRY 05536 save_VertexAttrib4fvNV(GLuint index, const GLfloat * v) 05537 { 05538 if (index < MAX_VERTEX_PROGRAM_ATTRIBS) 05539 save_Attr4fNV(index, v[0], v[1], v[2], v[3]); 05540 else 05541 index_error(); 05542 } 05543 05544 05545 05546 05547 static void GLAPIENTRY 05548 save_VertexAttrib1fARB(GLuint index, GLfloat x) 05549 { 05550 if (index < MAX_VERTEX_ATTRIBS) 05551 save_Attr1fARB(index, x); 05552 else 05553 index_error(); 05554 } 05555 05556 static void GLAPIENTRY 05557 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v) 05558 { 05559 if (index < MAX_VERTEX_ATTRIBS) 05560 save_Attr1fARB(index, v[0]); 05561 else 05562 index_error(); 05563 } 05564 05565 static void GLAPIENTRY 05566 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) 05567 { 05568 if (index < MAX_VERTEX_ATTRIBS) 05569 save_Attr2fARB(index, x, y); 05570 else 05571 index_error(); 05572 } 05573 05574 static void GLAPIENTRY 05575 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v) 05576 { 05577 if (index < MAX_VERTEX_ATTRIBS) 05578 save_Attr2fARB(index, v[0], v[1]); 05579 else 05580 index_error(); 05581 } 05582 05583 static void GLAPIENTRY 05584 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) 05585 { 05586 if (index < MAX_VERTEX_ATTRIBS) 05587 save_Attr3fARB(index, x, y, z); 05588 else 05589 index_error(); 05590 } 05591 05592 static void GLAPIENTRY 05593 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v) 05594 { 05595 if (index < MAX_VERTEX_ATTRIBS) 05596 save_Attr3fARB(index, v[0], v[1], v[2]); 05597 else 05598 index_error(); 05599 } 05600 05601 static void GLAPIENTRY 05602 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, 05603 GLfloat w) 05604 { 05605 if (index < MAX_VERTEX_ATTRIBS) 05606 save_Attr4fARB(index, x, y, z, w); 05607 else 05608 index_error(); 05609 } 05610 05611 static void GLAPIENTRY 05612 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) 05613 { 05614 if (index < MAX_VERTEX_ATTRIBS) 05615 save_Attr4fARB(index, v[0], v[1], v[2], v[3]); 05616 else 05617 index_error(); 05618 } 05619 05620 05621 /* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ 05622 05623 static void GLAPIENTRY 05624 exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name) 05625 { 05626 GET_CURRENT_CONTEXT(ctx); 05627 FLUSH_VERTICES(ctx, 0); 05628 CALL_BindAttribLocationARB(ctx->Exec, (program, index, name)); 05629 } 05630 05631 static GLint GLAPIENTRY 05632 exec_GetAttribLocationARB(GLuint program, const GLchar *name) 05633 { 05634 GET_CURRENT_CONTEXT(ctx); 05635 FLUSH_VERTICES(ctx, 0); 05636 return CALL_GetAttribLocationARB(ctx->Exec, (program, name)); 05637 } 05638 /* XXX more shader functions needed here */ 05639 05640 05641 05642 #if FEATURE_EXT_framebuffer_blit 05643 static void GLAPIENTRY 05644 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, 05645 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, 05646 GLbitfield mask, GLenum filter) 05647 { 05648 GET_CURRENT_CONTEXT(ctx); 05649 Node *n; 05650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); 05651 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLIT_FRAMEBUFFER, 10); 05652 if (n) { 05653 n[1].i = srcX0; 05654 n[2].i = srcY0; 05655 n[3].i = srcX1; 05656 n[4].i = srcY1; 05657 n[5].i = dstX0; 05658 n[6].i = dstY0; 05659 n[7].i = dstX1; 05660 n[8].i = dstY1; 05661 n[9].i = mask; 05662 n[10].e = filter; 05663 } 05664 if (ctx->ExecuteFlag) { 05665 CALL_BlitFramebufferEXT(ctx->Exec, (srcX0, srcY0, srcX1, srcY1, 05666 dstX0, dstY0, dstX1, dstY1, 05667 mask, filter)); 05668 } 05669 } 05670 #endif 05671 05672 05679 static void 05680 save_error(GLcontext *ctx, GLenum error, const char *s) 05681 { 05682 Node *n; 05683 n = ALLOC_INSTRUCTION(ctx, OPCODE_ERROR, 2); 05684 if (n) { 05685 n[1].e = error; 05686 n[2].data = (void *) s; 05687 } 05688 } 05689 05690 05694 void 05695 _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) 05696 { 05697 if (ctx->CompileFlag) 05698 save_error(ctx, error, s); 05699 if (ctx->ExecuteFlag) 05700 _mesa_error(ctx, error, s); 05701 } 05702 05703 05707 static GLboolean 05708 islist(GLcontext *ctx, GLuint list) 05709 { 05710 if (list > 0 && lookup_list(ctx, list)) { 05711 return GL_TRUE; 05712 } 05713 else { 05714 return GL_FALSE; 05715 } 05716 } 05717 05718 05719 05720 /**********************************************************************/ 05721 /* Display list execution */ 05722 /**********************************************************************/ 05723 05724 05725 /* 05726 * Execute a display list. Note that the ListBase offset must have already 05727 * been added before calling this function. I.e. the list argument is 05728 * the absolute list number, not relative to ListBase. 05729 * \param list - display list number 05730 */ 05731 static void 05732 execute_list(GLcontext *ctx, GLuint list) 05733 { 05734 struct mesa_display_list *dlist; 05735 Node *n; 05736 GLboolean done; 05737 05738 if (list == 0 || !islist(ctx, list)) 05739 return; 05740 05741 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) { 05742 /* raise an error? */ 05743 return; 05744 } 05745 05746 dlist = lookup_list(ctx, list); 05747 if (!dlist) 05748 return; 05749 05750 ctx->ListState.CallDepth++; 05751 05752 if (ctx->Driver.BeginCallList) 05753 ctx->Driver.BeginCallList(ctx, dlist); 05754 05755 n = dlist->node; 05756 05757 done = GL_FALSE; 05758 while (!done) { 05759 OpCode opcode = n[0].opcode; 05760 int i = (int) n[0].opcode - (int) OPCODE_EXT_0; 05761 05762 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { 05763 /* this is a driver-extended opcode */ 05764 ctx->ListExt.Opcode[i].Execute(ctx, &n[1]); 05765 n += ctx->ListExt.Opcode[i].Size; 05766 } 05767 else { 05768 switch (opcode) { 05769 case OPCODE_ERROR: 05770 _mesa_error(ctx, n[1].e, (const char *) n[2].data); 05771 break; 05772 case OPCODE_ACCUM: 05773 CALL_Accum(ctx->Exec, (n[1].e, n[2].f)); 05774 break; 05775 case OPCODE_ALPHA_FUNC: 05776 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f)); 05777 break; 05778 case OPCODE_BIND_TEXTURE: 05779 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui)); 05780 break; 05781 case OPCODE_BITMAP: 05782 { 05783 const struct gl_pixelstore_attrib save = ctx->Unpack; 05784 ctx->Unpack = ctx->DefaultPacking; 05785 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i, 05786 n[3].f, n[4].f, n[5].f, n[6].f, 05787 (const GLubyte *) n[7].data)); 05788 ctx->Unpack = save; /* restore */ 05789 } 05790 break; 05791 case OPCODE_BLEND_COLOR: 05792 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 05793 break; 05794 case OPCODE_BLEND_EQUATION: 05795 CALL_BlendEquation(ctx->Exec, (n[1].e)); 05796 break; 05797 case OPCODE_BLEND_EQUATION_SEPARATE: 05798 CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e)); 05799 break; 05800 case OPCODE_BLEND_FUNC_SEPARATE: 05801 CALL_BlendFuncSeparateEXT(ctx->Exec, 05802 (n[1].e, n[2].e, n[3].e, n[4].e)); 05803 break; 05804 case OPCODE_CALL_LIST: 05805 /* Generated by glCallList(), don't add ListBase */ 05806 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) { 05807 execute_list(ctx, n[1].ui); 05808 } 05809 break; 05810 case OPCODE_CALL_LIST_OFFSET: 05811 /* Generated by glCallLists() so we must add ListBase */ 05812 if (n[2].b) { 05813 /* user specified a bad data type at compile time */ 05814 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); 05815 } 05816 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) { 05817 GLuint list = (GLuint) (ctx->List.ListBase + n[1].i); 05818 execute_list(ctx, list); 05819 } 05820 break; 05821 case OPCODE_CLEAR: 05822 CALL_Clear(ctx->Exec, (n[1].bf)); 05823 break; 05824 case OPCODE_CLEAR_COLOR: 05825 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 05826 break; 05827 case OPCODE_CLEAR_ACCUM: 05828 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 05829 break; 05830 case OPCODE_CLEAR_DEPTH: 05831 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f)); 05832 break; 05833 case OPCODE_CLEAR_INDEX: 05834 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui)); 05835 break; 05836 case OPCODE_CLEAR_STENCIL: 05837 CALL_ClearStencil(ctx->Exec, (n[1].i)); 05838 break; 05839 case OPCODE_CLIP_PLANE: 05840 { 05841 GLdouble eq[4]; 05842 eq[0] = n[2].f; 05843 eq[1] = n[3].f; 05844 eq[2] = n[4].f; 05845 eq[3] = n[5].f; 05846 CALL_ClipPlane(ctx->Exec, (n[1].e, eq)); 05847 } 05848 break; 05849 case OPCODE_COLOR_MASK: 05850 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b)); 05851 break; 05852 case OPCODE_COLOR_MATERIAL: 05853 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e)); 05854 break; 05855 case OPCODE_COLOR_TABLE: 05856 { 05857 const struct gl_pixelstore_attrib save = ctx->Unpack; 05858 ctx->Unpack = ctx->DefaultPacking; 05859 CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e, 05860 n[5].e, n[6].data)); 05861 ctx->Unpack = save; /* restore */ 05862 } 05863 break; 05864 case OPCODE_COLOR_TABLE_PARAMETER_FV: 05865 { 05866 GLfloat params[4]; 05867 params[0] = n[3].f; 05868 params[1] = n[4].f; 05869 params[2] = n[5].f; 05870 params[3] = n[6].f; 05871 CALL_ColorTableParameterfv(ctx->Exec, 05872 (n[1].e, n[2].e, params)); 05873 } 05874 break; 05875 case OPCODE_COLOR_TABLE_PARAMETER_IV: 05876 { 05877 GLint params[4]; 05878 params[0] = n[3].i; 05879 params[1] = n[4].i; 05880 params[2] = n[5].i; 05881 params[3] = n[6].i; 05882 CALL_ColorTableParameteriv(ctx->Exec, 05883 (n[1].e, n[2].e, params)); 05884 } 05885 break; 05886 case OPCODE_COLOR_SUB_TABLE: 05887 { 05888 const struct gl_pixelstore_attrib save = ctx->Unpack; 05889 ctx->Unpack = ctx->DefaultPacking; 05890 CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i, 05891 n[4].e, n[5].e, n[6].data)); 05892 ctx->Unpack = save; /* restore */ 05893 } 05894 break; 05895 case OPCODE_CONVOLUTION_FILTER_1D: 05896 { 05897 const struct gl_pixelstore_attrib save = ctx->Unpack; 05898 ctx->Unpack = ctx->DefaultPacking; 05899 CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 05900 n[4].e, n[5].e, 05901 n[6].data)); 05902 ctx->Unpack = save; /* restore */ 05903 } 05904 break; 05905 case OPCODE_CONVOLUTION_FILTER_2D: 05906 { 05907 const struct gl_pixelstore_attrib save = ctx->Unpack; 05908 ctx->Unpack = ctx->DefaultPacking; 05909 CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 05910 n[4].i, n[5].e, n[6].e, 05911 n[7].data)); 05912 ctx->Unpack = save; /* restore */ 05913 } 05914 break; 05915 case OPCODE_CONVOLUTION_PARAMETER_I: 05916 CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i)); 05917 break; 05918 case OPCODE_CONVOLUTION_PARAMETER_IV: 05919 { 05920 GLint params[4]; 05921 params[0] = n[3].i; 05922 params[1] = n[4].i; 05923 params[2] = n[5].i; 05924 params[3] = n[6].i; 05925 CALL_ConvolutionParameteriv(ctx->Exec, 05926 (n[1].e, n[2].e, params)); 05927 } 05928 break; 05929 case OPCODE_CONVOLUTION_PARAMETER_F: 05930 CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f)); 05931 break; 05932 case OPCODE_CONVOLUTION_PARAMETER_FV: 05933 { 05934 GLfloat params[4]; 05935 params[0] = n[3].f; 05936 params[1] = n[4].f; 05937 params[2] = n[5].f; 05938 params[3] = n[6].f; 05939 CALL_ConvolutionParameterfv(ctx->Exec, 05940 (n[1].e, n[2].e, params)); 05941 } 05942 break; 05943 case OPCODE_COPY_COLOR_SUB_TABLE: 05944 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i, 05945 n[3].i, n[4].i, n[5].i)); 05946 break; 05947 case OPCODE_COPY_COLOR_TABLE: 05948 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i, 05949 n[3].i, n[4].i, n[5].i)); 05950 break; 05951 case OPCODE_COPY_PIXELS: 05952 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i, 05953 (GLsizei) n[3].i, (GLsizei) n[4].i, 05954 n[5].e)); 05955 break; 05956 case OPCODE_COPY_TEX_IMAGE1D: 05957 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, 05958 n[5].i, n[6].i, n[7].i)); 05959 break; 05960 case OPCODE_COPY_TEX_IMAGE2D: 05961 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, 05962 n[5].i, n[6].i, n[7].i, n[8].i)); 05963 break; 05964 case OPCODE_COPY_TEX_SUB_IMAGE1D: 05965 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 05966 n[4].i, n[5].i, n[6].i)); 05967 break; 05968 case OPCODE_COPY_TEX_SUB_IMAGE2D: 05969 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 05970 n[4].i, n[5].i, n[6].i, n[7].i, 05971 n[8].i)); 05972 break; 05973 case OPCODE_COPY_TEX_SUB_IMAGE3D: 05974 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 05975 n[4].i, n[5].i, n[6].i, n[7].i, 05976 n[8].i, n[9].i)); 05977 break; 05978 case OPCODE_CULL_FACE: 05979 CALL_CullFace(ctx->Exec, (n[1].e)); 05980 break; 05981 case OPCODE_DEPTH_FUNC: 05982 CALL_DepthFunc(ctx->Exec, (n[1].e)); 05983 break; 05984 case OPCODE_DEPTH_MASK: 05985 CALL_DepthMask(ctx->Exec, (n[1].b)); 05986 break; 05987 case OPCODE_DEPTH_RANGE: 05988 CALL_DepthRange(ctx->Exec, 05989 ((GLclampd) n[1].f, (GLclampd) n[2].f)); 05990 break; 05991 case OPCODE_DISABLE: 05992 CALL_Disable(ctx->Exec, (n[1].e)); 05993 break; 05994 case OPCODE_DRAW_BUFFER: 05995 CALL_DrawBuffer(ctx->Exec, (n[1].e)); 05996 break; 05997 case OPCODE_DRAW_PIXELS: 05998 { 05999 const struct gl_pixelstore_attrib save = ctx->Unpack; 06000 ctx->Unpack = ctx->DefaultPacking; 06001 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e, 06002 n[5].data)); 06003 ctx->Unpack = save; /* restore */ 06004 } 06005 break; 06006 case OPCODE_ENABLE: 06007 CALL_Enable(ctx->Exec, (n[1].e)); 06008 break; 06009 case OPCODE_EVALMESH1: 06010 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i)); 06011 break; 06012 case OPCODE_EVALMESH2: 06013 CALL_EvalMesh2(ctx->Exec, 06014 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i)); 06015 break; 06016 case OPCODE_FOG: 06017 { 06018 GLfloat p[4]; 06019 p[0] = n[2].f; 06020 p[1] = n[3].f; 06021 p[2] = n[4].f; 06022 p[3] = n[5].f; 06023 CALL_Fogfv(ctx->Exec, (n[1].e, p)); 06024 } 06025 break; 06026 case OPCODE_FRONT_FACE: 06027 CALL_FrontFace(ctx->Exec, (n[1].e)); 06028 break; 06029 case OPCODE_FRUSTUM: 06030 CALL_Frustum(ctx->Exec, 06031 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f)); 06032 break; 06033 case OPCODE_HINT: 06034 CALL_Hint(ctx->Exec, (n[1].e, n[2].e)); 06035 break; 06036 case OPCODE_HISTOGRAM: 06037 CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b)); 06038 break; 06039 case OPCODE_INDEX_MASK: 06040 CALL_IndexMask(ctx->Exec, (n[1].ui)); 06041 break; 06042 case OPCODE_INIT_NAMES: 06043 CALL_InitNames(ctx->Exec, ()); 06044 break; 06045 case OPCODE_LIGHT: 06046 { 06047 GLfloat p[4]; 06048 p[0] = n[3].f; 06049 p[1] = n[4].f; 06050 p[2] = n[5].f; 06051 p[3] = n[6].f; 06052 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p)); 06053 } 06054 break; 06055 case OPCODE_LIGHT_MODEL: 06056 { 06057 GLfloat p[4]; 06058 p[0] = n[2].f; 06059 p[1] = n[3].f; 06060 p[2] = n[4].f; 06061 p[3] = n[5].f; 06062 CALL_LightModelfv(ctx->Exec, (n[1].e, p)); 06063 } 06064 break; 06065 case OPCODE_LINE_STIPPLE: 06066 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us)); 06067 break; 06068 case OPCODE_LINE_WIDTH: 06069 CALL_LineWidth(ctx->Exec, (n[1].f)); 06070 break; 06071 case OPCODE_LIST_BASE: 06072 CALL_ListBase(ctx->Exec, (n[1].ui)); 06073 break; 06074 case OPCODE_LOAD_IDENTITY: 06075 CALL_LoadIdentity(ctx->Exec, ()); 06076 break; 06077 case OPCODE_LOAD_MATRIX: 06078 if (sizeof(Node) == sizeof(GLfloat)) { 06079 CALL_LoadMatrixf(ctx->Exec, (&n[1].f)); 06080 } 06081 else { 06082 GLfloat m[16]; 06083 GLuint i; 06084 for (i = 0; i < 16; i++) { 06085 m[i] = n[1 + i].f; 06086 } 06087 CALL_LoadMatrixf(ctx->Exec, (m)); 06088 } 06089 break; 06090 case OPCODE_LOAD_NAME: 06091 CALL_LoadName(ctx->Exec, (n[1].ui)); 06092 break; 06093 case OPCODE_LOGIC_OP: 06094 CALL_LogicOp(ctx->Exec, (n[1].e)); 06095 break; 06096 case OPCODE_MAP1: 06097 { 06098 GLenum target = n[1].e; 06099 GLint ustride = _mesa_evaluator_components(target); 06100 GLint uorder = n[5].i; 06101 GLfloat u1 = n[2].f; 06102 GLfloat u2 = n[3].f; 06103 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder, 06104 (GLfloat *) n[6].data)); 06105 } 06106 break; 06107 case OPCODE_MAP2: 06108 { 06109 GLenum target = n[1].e; 06110 GLfloat u1 = n[2].f; 06111 GLfloat u2 = n[3].f; 06112 GLfloat v1 = n[4].f; 06113 GLfloat v2 = n[5].f; 06114 GLint ustride = n[6].i; 06115 GLint vstride = n[7].i; 06116 GLint uorder = n[8].i; 06117 GLint vorder = n[9].i; 06118 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder, 06119 v1, v2, vstride, vorder, 06120 (GLfloat *) n[10].data)); 06121 } 06122 break; 06123 case OPCODE_MAPGRID1: 06124 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f)); 06125 break; 06126 case OPCODE_MAPGRID2: 06127 CALL_MapGrid2f(ctx->Exec, 06128 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f)); 06129 break; 06130 case OPCODE_MATRIX_MODE: 06131 CALL_MatrixMode(ctx->Exec, (n[1].e)); 06132 break; 06133 case OPCODE_MIN_MAX: 06134 CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b)); 06135 break; 06136 case OPCODE_MULT_MATRIX: 06137 if (sizeof(Node) == sizeof(GLfloat)) { 06138 CALL_MultMatrixf(ctx->Exec, (&n[1].f)); 06139 } 06140 else { 06141 GLfloat m[16]; 06142 GLuint i; 06143 for (i = 0; i < 16; i++) { 06144 m[i] = n[1 + i].f; 06145 } 06146 CALL_MultMatrixf(ctx->Exec, (m)); 06147 } 06148 break; 06149 case OPCODE_ORTHO: 06150 CALL_Ortho(ctx->Exec, 06151 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f)); 06152 break; 06153 case OPCODE_PASSTHROUGH: 06154 CALL_PassThrough(ctx->Exec, (n[1].f)); 06155 break; 06156 case OPCODE_PIXEL_MAP: 06157 CALL_PixelMapfv(ctx->Exec, 06158 (n[1].e, n[2].i, (GLfloat *) n[3].data)); 06159 break; 06160 case OPCODE_PIXEL_TRANSFER: 06161 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f)); 06162 break; 06163 case OPCODE_PIXEL_ZOOM: 06164 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f)); 06165 break; 06166 case OPCODE_POINT_SIZE: 06167 CALL_PointSize(ctx->Exec, (n[1].f)); 06168 break; 06169 case OPCODE_POINT_PARAMETERS: 06170 { 06171 GLfloat params[3]; 06172 params[0] = n[2].f; 06173 params[1] = n[3].f; 06174 params[2] = n[4].f; 06175 CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params)); 06176 } 06177 break; 06178 case OPCODE_POLYGON_MODE: 06179 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e)); 06180 break; 06181 case OPCODE_POLYGON_STIPPLE: 06182 { 06183 const struct gl_pixelstore_attrib save = ctx->Unpack; 06184 ctx->Unpack = ctx->DefaultPacking; 06185 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); 06186 ctx->Unpack = save; /* restore */ 06187 } 06188 break; 06189 case OPCODE_POLYGON_OFFSET: 06190 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f)); 06191 break; 06192 case OPCODE_POP_ATTRIB: 06193 CALL_PopAttrib(ctx->Exec, ()); 06194 break; 06195 case OPCODE_POP_MATRIX: 06196 CALL_PopMatrix(ctx->Exec, ()); 06197 break; 06198 case OPCODE_POP_NAME: 06199 CALL_PopName(ctx->Exec, ()); 06200 break; 06201 case OPCODE_PRIORITIZE_TEXTURE: 06202 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f)); 06203 break; 06204 case OPCODE_PUSH_ATTRIB: 06205 CALL_PushAttrib(ctx->Exec, (n[1].bf)); 06206 break; 06207 case OPCODE_PUSH_MATRIX: 06208 CALL_PushMatrix(ctx->Exec, ()); 06209 break; 06210 case OPCODE_PUSH_NAME: 06211 CALL_PushName(ctx->Exec, (n[1].ui)); 06212 break; 06213 case OPCODE_RASTER_POS: 06214 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 06215 break; 06216 case OPCODE_READ_BUFFER: 06217 CALL_ReadBuffer(ctx->Exec, (n[1].e)); 06218 break; 06219 case OPCODE_RESET_HISTOGRAM: 06220 CALL_ResetHistogram(ctx->Exec, (n[1].e)); 06221 break; 06222 case OPCODE_RESET_MIN_MAX: 06223 CALL_ResetMinmax(ctx->Exec, (n[1].e)); 06224 break; 06225 case OPCODE_ROTATE: 06226 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 06227 break; 06228 case OPCODE_SCALE: 06229 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f)); 06230 break; 06231 case OPCODE_SCISSOR: 06232 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i)); 06233 break; 06234 case OPCODE_SHADE_MODEL: 06235 CALL_ShadeModel(ctx->Exec, (n[1].e)); 06236 break; 06237 case OPCODE_STENCIL_FUNC: 06238 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui)); 06239 break; 06240 case OPCODE_STENCIL_MASK: 06241 CALL_StencilMask(ctx->Exec, (n[1].ui)); 06242 break; 06243 case OPCODE_STENCIL_OP: 06244 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e)); 06245 break; 06246 case OPCODE_STENCIL_FUNC_SEPARATE: 06247 CALL_StencilFuncSeparate(ctx->Exec, 06248 (n[1].e, n[2].e, n[3].i, n[4].ui)); 06249 break; 06250 case OPCODE_STENCIL_MASK_SEPARATE: 06251 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui)); 06252 break; 06253 case OPCODE_STENCIL_OP_SEPARATE: 06254 CALL_StencilOpSeparate(ctx->Exec, 06255 (n[1].e, n[2].e, n[3].e, n[4].e)); 06256 break; 06257 case OPCODE_TEXENV: 06258 { 06259 GLfloat params[4]; 06260 params[0] = n[3].f; 06261 params[1] = n[4].f; 06262 params[2] = n[5].f; 06263 params[3] = n[6].f; 06264 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params)); 06265 } 06266 break; 06267 case OPCODE_TEXGEN: 06268 { 06269 GLfloat params[4]; 06270 params[0] = n[3].f; 06271 params[1] = n[4].f; 06272 params[2] = n[5].f; 06273 params[3] = n[6].f; 06274 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params)); 06275 } 06276 break; 06277 case OPCODE_TEXPARAMETER: 06278 { 06279 GLfloat params[4]; 06280 params[0] = n[3].f; 06281 params[1] = n[4].f; 06282 params[2] = n[5].f; 06283 params[3] = n[6].f; 06284 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params)); 06285 } 06286 break; 06287 case OPCODE_TEX_IMAGE1D: 06288 { 06289 const struct gl_pixelstore_attrib save = ctx->Unpack; 06290 ctx->Unpack = ctx->DefaultPacking; 06291 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */ 06292 n[2].i, /* level */ 06293 n[3].i, /* components */ 06294 n[4].i, /* width */ 06295 n[5].e, /* border */ 06296 n[6].e, /* format */ 06297 n[7].e, /* type */ 06298 n[8].data)); 06299 ctx->Unpack = save; /* restore */ 06300 } 06301 break; 06302 case OPCODE_TEX_IMAGE2D: 06303 { 06304 const struct gl_pixelstore_attrib save = ctx->Unpack; 06305 ctx->Unpack = ctx->DefaultPacking; 06306 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */ 06307 n[2].i, /* level */ 06308 n[3].i, /* components */ 06309 n[4].i, /* width */ 06310 n[5].i, /* height */ 06311 n[6].e, /* border */ 06312 n[7].e, /* format */ 06313 n[8].e, /* type */ 06314 n[9].data)); 06315 ctx->Unpack = save; /* restore */ 06316 } 06317 break; 06318 case OPCODE_TEX_IMAGE3D: 06319 { 06320 const struct gl_pixelstore_attrib save = ctx->Unpack; 06321 ctx->Unpack = ctx->DefaultPacking; 06322 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */ 06323 n[2].i, /* level */ 06324 n[3].i, /* components */ 06325 n[4].i, /* width */ 06326 n[5].i, /* height */ 06327 n[6].i, /* depth */ 06328 n[7].e, /* border */ 06329 n[8].e, /* format */ 06330 n[9].e, /* type */ 06331 n[10].data)); 06332 ctx->Unpack = save; /* restore */ 06333 } 06334 break; 06335 case OPCODE_TEX_SUB_IMAGE1D: 06336 { 06337 const struct gl_pixelstore_attrib save = ctx->Unpack; 06338 ctx->Unpack = ctx->DefaultPacking; 06339 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 06340 n[4].i, n[5].e, 06341 n[6].e, n[7].data)); 06342 ctx->Unpack = save; /* restore */ 06343 } 06344 break; 06345 case OPCODE_TEX_SUB_IMAGE2D: 06346 { 06347 const struct gl_pixelstore_attrib save = ctx->Unpack; 06348 ctx->Unpack = ctx->DefaultPacking; 06349 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 06350 n[4].i, n[5].e, 06351 n[6].i, n[7].e, n[8].e, 06352 n[9].data)); 06353 ctx->Unpack = save; /* restore */ 06354 } 06355 break; 06356 case OPCODE_TEX_SUB_IMAGE3D: 06357 { 06358 const struct gl_pixelstore_attrib save = ctx->Unpack; 06359 ctx->Unpack = ctx->DefaultPacking; 06360 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i, 06361 n[4].i, n[5].i, n[6].i, n[7].i, 06362 n[8].i, n[9].e, n[10].e, 06363 n[11].data)); 06364 ctx->Unpack = save; /* restore */ 06365 } 06366 break; 06367 case OPCODE_TRANSLATE: 06368 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f)); 06369 break; 06370 case OPCODE_VIEWPORT: 06371 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i, 06372 (GLsizei) n[3].i, (GLsizei) n[4].i)); 06373 break; 06374 case OPCODE_WINDOW_POS: 06375 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 06376 break; 06377 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ 06378 CALL_ActiveTextureARB(ctx->Exec, (n[1].e)); 06379 break; 06380 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */ 06381 CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, 06382 n[4].i, n[5].i, n[6].i, 06383 n[7].data)); 06384 break; 06385 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */ 06386 CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, 06387 n[4].i, n[5].i, n[6].i, 06388 n[7].i, n[8].data)); 06389 break; 06390 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */ 06391 CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, 06392 n[4].i, n[5].i, n[6].i, 06393 n[7].i, n[8].i, 06394 n[9].data)); 06395 break; 06396 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */ 06397 CALL_CompressedTexSubImage1DARB(ctx->Exec, 06398 (n[1].e, n[2].i, n[3].i, n[4].i, 06399 n[5].e, n[6].i, n[7].data)); 06400 break; 06401 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */ 06402 CALL_CompressedTexSubImage2DARB(ctx->Exec, 06403 (n[1].e, n[2].i, n[3].i, n[4].i, 06404 n[5].i, n[6].i, n[7].e, n[8].i, 06405 n[9].data)); 06406 break; 06407 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */ 06408 CALL_CompressedTexSubImage3DARB(ctx->Exec, 06409 (n[1].e, n[2].i, n[3].i, n[4].i, 06410 n[5].i, n[6].i, n[7].i, n[8].i, 06411 n[9].e, n[10].i, n[11].data)); 06412 break; 06413 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */ 06414 CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b)); 06415 break; 06416 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */ 06417 CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f)); 06418 break; 06419 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 06420 case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */ 06421 CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui)); 06422 break; 06423 #endif 06424 #if FEATURE_NV_vertex_program 06425 case OPCODE_EXECUTE_PROGRAM_NV: 06426 { 06427 GLfloat v[4]; 06428 v[0] = n[3].f; 06429 v[1] = n[4].f; 06430 v[2] = n[5].f; 06431 v[3] = n[6].f; 06432 CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v)); 06433 } 06434 break; 06435 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: 06436 CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui, 06437 (GLuint *) n[2].data)); 06438 break; 06439 case OPCODE_LOAD_PROGRAM_NV: 06440 CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i, 06441 (const GLubyte *) n[4].data)); 06442 break; 06443 case OPCODE_TRACK_MATRIX_NV: 06444 CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e)); 06445 break; 06446 #endif 06447 06448 #if FEATURE_NV_fragment_program 06449 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB: 06450 CALL_ProgramLocalParameter4fARB(ctx->Exec, 06451 (n[1].e, n[2].ui, n[3].f, n[4].f, 06452 n[5].f, n[6].f)); 06453 break; 06454 case OPCODE_PROGRAM_NAMED_PARAMETER_NV: 06455 CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i, 06456 (const GLubyte *) n[3]. 06457 data, n[4].f, n[5].f, 06458 n[6].f, n[7].f)); 06459 break; 06460 #endif 06461 06462 case OPCODE_ACTIVE_STENCIL_FACE_EXT: 06463 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e)); 06464 break; 06465 case OPCODE_DEPTH_BOUNDS_EXT: 06466 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f)); 06467 break; 06468 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 06469 case OPCODE_PROGRAM_STRING_ARB: 06470 CALL_ProgramStringARB(ctx->Exec, 06471 (n[1].e, n[2].e, n[3].i, n[4].data)); 06472 break; 06473 #endif 06474 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program 06475 case OPCODE_PROGRAM_ENV_PARAMETER_ARB: 06476 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f, 06477 n[4].f, n[5].f, 06478 n[6].f)); 06479 break; 06480 #endif 06481 #if FEATURE_ARB_occlusion_query 06482 case OPCODE_BEGIN_QUERY_ARB: 06483 CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui)); 06484 break; 06485 case OPCODE_END_QUERY_ARB: 06486 CALL_EndQueryARB(ctx->Exec, (n[1].e)); 06487 break; 06488 #endif 06489 case OPCODE_DRAW_BUFFERS_ARB: 06490 { 06491 GLenum buffers[MAX_DRAW_BUFFERS]; 06492 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS); 06493 for (i = 0; i < count; i++) 06494 buffers[i] = n[2 + i].e; 06495 CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers)); 06496 } 06497 break; 06498 #if FEATURE_EXT_framebuffer_blit 06499 case OPCODE_BLIT_FRAMEBUFFER: 06500 CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i, 06501 n[5].i, n[6].i, n[7].i, n[8].i, 06502 n[9].i, n[10].e)); 06503 break; 06504 #endif 06505 #if FEATURE_ATI_fragment_shader 06506 case OPCODE_BIND_FRAGMENT_SHADER_ATI: 06507 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i)); 06508 break; 06509 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI: 06510 { 06511 GLfloat values[4]; 06512 GLuint i, dst = n[1].ui; 06513 06514 for (i = 0; i < 4; i++) 06515 values[i] = n[1 + i].f; 06516 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values)); 06517 } 06518 break; 06519 #endif 06520 case OPCODE_ATTR_1F_NV: 06521 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f)); 06522 break; 06523 case OPCODE_ATTR_2F_NV: 06524 /* Really shouldn't have to do this - the Node structure 06525 * is convenient, but it would be better to store the data 06526 * packed appropriately so that it can be sent directly 06527 * on. With x86_64 becoming common, this will start to 06528 * matter more. 06529 */ 06530 if (sizeof(Node) == sizeof(GLfloat)) 06531 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f)); 06532 else 06533 CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f)); 06534 break; 06535 case OPCODE_ATTR_3F_NV: 06536 if (sizeof(Node) == sizeof(GLfloat)) 06537 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f)); 06538 else 06539 CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f, 06540 n[4].f)); 06541 break; 06542 case OPCODE_ATTR_4F_NV: 06543 if (sizeof(Node) == sizeof(GLfloat)) 06544 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f)); 06545 else 06546 CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f, 06547 n[4].f, n[5].f)); 06548 break; 06549 case OPCODE_ATTR_1F_ARB: 06550 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f)); 06551 break; 06552 case OPCODE_ATTR_2F_ARB: 06553 /* Really shouldn't have to do this - the Node structure 06554 * is convenient, but it would be better to store the data 06555 * packed appropriately so that it can be sent directly 06556 * on. With x86_64 becoming common, this will start to 06557 * matter more. 06558 */ 06559 if (sizeof(Node) == sizeof(GLfloat)) 06560 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f)); 06561 else 06562 CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f)); 06563 break; 06564 case OPCODE_ATTR_3F_ARB: 06565 if (sizeof(Node) == sizeof(GLfloat)) 06566 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f)); 06567 else 06568 CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f, 06569 n[4].f)); 06570 break; 06571 case OPCODE_ATTR_4F_ARB: 06572 if (sizeof(Node) == sizeof(GLfloat)) 06573 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f)); 06574 else 06575 CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f, 06576 n[4].f, n[5].f)); 06577 break; 06578 case OPCODE_MATERIAL: 06579 if (sizeof(Node) == sizeof(GLfloat)) 06580 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f)); 06581 else { 06582 GLfloat f[4]; 06583 f[0] = n[3].f; 06584 f[1] = n[4].f; 06585 f[2] = n[5].f; 06586 f[3] = n[6].f; 06587 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f)); 06588 } 06589 break; 06590 case OPCODE_BEGIN: 06591 CALL_Begin(ctx->Exec, (n[1].e)); 06592 break; 06593 case OPCODE_END: 06594 CALL_End(ctx->Exec, ()); 06595 break; 06596 case OPCODE_RECTF: 06597 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); 06598 break; 06599 case OPCODE_EVAL_C1: 06600 CALL_EvalCoord1f(ctx->Exec, (n[1].f)); 06601 break; 06602 case OPCODE_EVAL_C2: 06603 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f)); 06604 break; 06605 case OPCODE_EVAL_P1: 06606 CALL_EvalPoint1(ctx->Exec, (n[1].i)); 06607 break; 06608 case OPCODE_EVAL_P2: 06609 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i)); 06610 break; 06611 06612 case OPCODE_CONTINUE: 06613 n = (Node *) n[1].next; 06614 break; 06615 case OPCODE_END_OF_LIST: 06616 done = GL_TRUE; 06617 break; 06618 default: 06619 { 06620 char msg[1000]; 06621 _mesa_sprintf(msg, "Error in execute_list: opcode=%d", 06622 (int) opcode); 06623 _mesa_problem(ctx, msg); 06624 } 06625 done = GL_TRUE; 06626 } 06627 06628 /* increment n to point to next compiled command */ 06629 if (opcode != OPCODE_CONTINUE) { 06630 n += InstSize[opcode]; 06631 } 06632 } 06633 } 06634 06635 if (ctx->Driver.EndCallList) 06636 ctx->Driver.EndCallList(ctx); 06637 06638 ctx->ListState.CallDepth--; 06639 } 06640 06641 06642 06643 /**********************************************************************/ 06644 /* GL functions */ 06645 /**********************************************************************/ 06646 06650 GLboolean GLAPIENTRY 06651 _mesa_IsList(GLuint list) 06652 { 06653 GET_CURRENT_CONTEXT(ctx); 06654 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 06655 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); 06656 return islist(ctx, list); 06657 } 06658 06659 06663 void GLAPIENTRY 06664 _mesa_DeleteLists(GLuint list, GLsizei range) 06665 { 06666 GET_CURRENT_CONTEXT(ctx); 06667 GLuint i; 06668 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 06669 ASSERT_OUTSIDE_BEGIN_END(ctx); 06670 06671 if (range < 0) { 06672 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists"); 06673 return; 06674 } 06675 for (i = list; i < list + range; i++) { 06676 destroy_list(ctx, i); 06677 } 06678 } 06679 06680 06685 GLuint GLAPIENTRY 06686 _mesa_GenLists(GLsizei range) 06687 { 06688 GET_CURRENT_CONTEXT(ctx); 06689 GLuint base; 06690 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 06691 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); 06692 06693 if (range < 0) { 06694 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists"); 06695 return 0; 06696 } 06697 if (range == 0) { 06698 return 0; 06699 } 06700 06701 /* 06702 * Make this an atomic operation 06703 */ 06704 _glthread_LOCK_MUTEX(ctx->Shared->Mutex); 06705 06706 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); 06707 if (base) { 06708 /* reserve the list IDs by with empty/dummy lists */ 06709 GLint i; 06710 for (i = 0; i < range; i++) { 06711 _mesa_HashInsert(ctx->Shared->DisplayList, base + i, 06712 make_list(base + i, 1)); 06713 } 06714 } 06715 06716 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); 06717 06718 return base; 06719 } 06720 06721 06725 void GLAPIENTRY 06726 _mesa_NewList(GLuint list, GLenum mode) 06727 { 06728 GET_CURRENT_CONTEXT(ctx); 06729 GLint i; 06730 06731 FLUSH_CURRENT(ctx, 0); /* must be called before assert */ 06732 ASSERT_OUTSIDE_BEGIN_END(ctx); 06733 06734 if (MESA_VERBOSE & VERBOSE_API) 06735 _mesa_debug(ctx, "glNewList %u %s\n", list, 06736 _mesa_lookup_enum_by_nr(mode)); 06737 06738 if (list == 0) { 06739 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList"); 06740 return; 06741 } 06742 06743 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) { 06744 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList"); 06745 return; 06746 } 06747 06748 if (ctx->ListState.CurrentListPtr) { 06749 /* already compiling a display list */ 06750 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList"); 06751 return; 06752 } 06753 06754 ctx->CompileFlag = GL_TRUE; 06755 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); 06756 06757 /* Allocate new display list */ 06758 ctx->ListState.CurrentListNum = list; 06759 ctx->ListState.CurrentList = make_list(list, BLOCK_SIZE); 06760 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node; 06761 ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock; 06762 ctx->ListState.CurrentPos = 0; 06763 06764 /* Reset acumulated list state: 06765 */ 06766 for (i = 0; i < VERT_ATTRIB_MAX; i++) 06767 ctx->ListState.ActiveAttribSize[i] = 0; 06768 06769 for (i = 0; i < MAT_ATTRIB_MAX; i++) 06770 ctx->ListState.ActiveMaterialSize[i] = 0; 06771 06772 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 06773 ctx->Driver.NewList(ctx, list, mode); 06774 06775 ctx->CurrentDispatch = ctx->Save; 06776 _glapi_set_dispatch(ctx->CurrentDispatch); 06777 } 06778 06779 06783 void GLAPIENTRY 06784 _mesa_EndList(void) 06785 { 06786 GET_CURRENT_CONTEXT(ctx); 06787 SAVE_FLUSH_VERTICES(ctx); 06788 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); 06789 06790 if (MESA_VERBOSE & VERBOSE_API) 06791 _mesa_debug(ctx, "glEndList\n"); 06792 06793 /* Check that a list is under construction */ 06794 if (!ctx->ListState.CurrentListPtr) { 06795 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); 06796 return; 06797 } 06798 06799 /* Call before emitting END_OF_LIST, in case the driver wants to 06800 * emit opcodes itself. 06801 */ 06802 ctx->Driver.EndList(ctx); 06803 06804 (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); 06805 06806 /* Destroy old list, if any */ 06807 destroy_list(ctx, ctx->ListState.CurrentListNum); 06808 /* Install the list */ 06809 _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, 06810 ctx->ListState.CurrentList); 06811 06812 06813 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) 06814 mesa_print_display_list(ctx->ListState.CurrentListNum); 06815 06816 ctx->ListState.CurrentList = NULL; 06817 ctx->ListState.CurrentListNum = 0; 06818 ctx->ListState.CurrentListPtr = NULL; 06819 ctx->ExecuteFlag = GL_TRUE; 06820 ctx->CompileFlag = GL_FALSE; 06821 06822 ctx->CurrentDispatch = ctx->Exec; 06823 _glapi_set_dispatch(ctx->CurrentDispatch); 06824 } 06825 06826 06827 void GLAPIENTRY 06828 _mesa_CallList(GLuint list) 06829 { 06830 GLboolean save_compile_flag; 06831 GET_CURRENT_CONTEXT(ctx); 06832 FLUSH_CURRENT(ctx, 0); 06833 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */ 06834 /* execute the display list, and restore the CompileFlag. */ 06835 06836 if (MESA_VERBOSE & VERBOSE_API) 06837 _mesa_debug(ctx, "glCallList %d\n", list); 06838 06839 if (list == 0) { 06840 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)"); 06841 return; 06842 } 06843 06844 /* mesa_print_display_list( list ); */ 06845 06846 save_compile_flag = ctx->CompileFlag; 06847 if (save_compile_flag) { 06848 ctx->CompileFlag = GL_FALSE; 06849 } 06850 06851 execute_list(ctx, list); 06852 ctx->CompileFlag = save_compile_flag; 06853 06854 /* also restore API function pointers to point to "save" versions */ 06855 if (save_compile_flag) { 06856 ctx->CurrentDispatch = ctx->Save; 06857 _glapi_set_dispatch(ctx->CurrentDispatch); 06858 } 06859 } 06860 06861 06865 void GLAPIENTRY 06866 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) 06867 { 06868 GET_CURRENT_CONTEXT(ctx); 06869 GLint i; 06870 GLboolean save_compile_flag; 06871 06872 if (MESA_VERBOSE & VERBOSE_API) 06873 _mesa_debug(ctx, "glCallLists %d\n", n); 06874 06875 switch (type) { 06876 case GL_BYTE: 06877 case GL_UNSIGNED_BYTE: 06878 case GL_SHORT: 06879 case GL_UNSIGNED_SHORT: 06880 case GL_INT: 06881 case GL_UNSIGNED_INT: 06882 case GL_FLOAT: 06883 case GL_2_BYTES: 06884 case GL_3_BYTES: 06885 case GL_4_BYTES: 06886 /* OK */ 06887 break; 06888 default: 06889 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); 06890 return; 06891 } 06892 06893 /* Save the CompileFlag status, turn it off, execute display list, 06894 * and restore the CompileFlag. 06895 */ 06896 save_compile_flag = ctx->CompileFlag; 06897 ctx->CompileFlag = GL_FALSE; 06898 06899 for (i = 0; i < n; i++) { 06900 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists)); 06901 execute_list(ctx, list); 06902 } 06903 06904 ctx->CompileFlag = save_compile_flag; 06905 06906 /* also restore API function pointers to point to "save" versions */ 06907 if (save_compile_flag) { 06908 ctx->CurrentDispatch = ctx->Save; 06909 _glapi_set_dispatch(ctx->CurrentDispatch); 06910 } 06911 } 06912 06913 06917 void GLAPIENTRY 06918 _mesa_ListBase(GLuint base) 06919 { 06920 GET_CURRENT_CONTEXT(ctx); 06921 FLUSH_VERTICES(ctx, 0); /* must be called before assert */ 06922 ASSERT_OUTSIDE_BEGIN_END(ctx); 06923 ctx->List.ListBase = base; 06924 } 06925 06926 06927 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. 06928 */ 06929 static void GLAPIENTRY 06930 exec_Finish(void) 06931 { 06932 GET_CURRENT_CONTEXT(ctx); 06933 FLUSH_VERTICES(ctx, 0); 06934 CALL_Finish(ctx->Exec, ()); 06935 } 06936 06937 static void GLAPIENTRY 06938 exec_Flush(void) 06939 { 06940 GET_CURRENT_CONTEXT(ctx); 06941 FLUSH_VERTICES(ctx, 0); 06942 CALL_Flush(ctx->Exec, ()); 06943 } 06944 06945 static void GLAPIENTRY 06946 exec_GetBooleanv(GLenum pname, GLboolean *params) 06947 { 06948 GET_CURRENT_CONTEXT(ctx); 06949 FLUSH_VERTICES(ctx, 0); 06950 CALL_GetBooleanv(ctx->Exec, (pname, params)); 06951 } 06952 06953 static void GLAPIENTRY 06954 exec_GetClipPlane(GLenum plane, GLdouble * equation) 06955 { 06956 GET_CURRENT_CONTEXT(ctx); 06957 FLUSH_VERTICES(ctx, 0); 06958 CALL_GetClipPlane(ctx->Exec, (plane, equation)); 06959 } 06960 06961 static void GLAPIENTRY 06962 exec_GetDoublev(GLenum pname, GLdouble *params) 06963 { 06964 GET_CURRENT_CONTEXT(ctx); 06965 FLUSH_VERTICES(ctx, 0); 06966 CALL_GetDoublev(ctx->Exec, (pname, params)); 06967 } 06968 06969 static GLenum GLAPIENTRY 06970 exec_GetError(void) 06971 { 06972 GET_CURRENT_CONTEXT(ctx); 06973 FLUSH_VERTICES(ctx, 0); 06974 return CALL_GetError(ctx->Exec, ()); 06975 } 06976 06977 static void GLAPIENTRY 06978 exec_GetFloatv(GLenum pname, GLfloat *params) 06979 { 06980 GET_CURRENT_CONTEXT(ctx); 06981 FLUSH_VERTICES(ctx, 0); 06982 CALL_GetFloatv(ctx->Exec, (pname, params)); 06983 } 06984 06985 static void GLAPIENTRY 06986 exec_GetIntegerv(GLenum pname, GLint *params) 06987 { 06988 GET_CURRENT_CONTEXT(ctx); 06989 FLUSH_VERTICES(ctx, 0); 06990 CALL_GetIntegerv(ctx->Exec, (pname, params)); 06991 } 06992 06993 static void GLAPIENTRY 06994 exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params) 06995 { 06996 GET_CURRENT_CONTEXT(ctx); 06997 FLUSH_VERTICES(ctx, 0); 06998 CALL_GetLightfv(ctx->Exec, (light, pname, params)); 06999 } 07000 07001 static void GLAPIENTRY 07002 exec_GetLightiv(GLenum light, GLenum pname, GLint *params) 07003 { 07004 GET_CURRENT_CONTEXT(ctx); 07005 FLUSH_VERTICES(ctx, 0); 07006 CALL_GetLightiv(ctx->Exec, (light, pname, params)); 07007 } 07008 07009 static void GLAPIENTRY 07010 exec_GetMapdv(GLenum target, GLenum query, GLdouble * v) 07011 { 07012 GET_CURRENT_CONTEXT(ctx); 07013 FLUSH_VERTICES(ctx, 0); 07014 CALL_GetMapdv(ctx->Exec, (target, query, v)); 07015 } 07016 07017 static void GLAPIENTRY 07018 exec_GetMapfv(GLenum target, GLenum query, GLfloat * v) 07019 { 07020 GET_CURRENT_CONTEXT(ctx); 07021 FLUSH_VERTICES(ctx, 0); 07022 CALL_GetMapfv(ctx->Exec, (target, query, v)); 07023 } 07024 07025 static void GLAPIENTRY 07026 exec_GetMapiv(GLenum target, GLenum query, GLint * v) 07027 { 07028 GET_CURRENT_CONTEXT(ctx); 07029 FLUSH_VERTICES(ctx, 0); 07030 CALL_GetMapiv(ctx->Exec, (target, query, v)); 07031 } 07032 07033 static void GLAPIENTRY 07034 exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params) 07035 { 07036 GET_CURRENT_CONTEXT(ctx); 07037 FLUSH_VERTICES(ctx, 0); 07038 CALL_GetMaterialfv(ctx->Exec, (face, pname, params)); 07039 } 07040 07041 static void GLAPIENTRY 07042 exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params) 07043 { 07044 GET_CURRENT_CONTEXT(ctx); 07045 FLUSH_VERTICES(ctx, 0); 07046 CALL_GetMaterialiv(ctx->Exec, (face, pname, params)); 07047 } 07048 07049 static void GLAPIENTRY 07050 exec_GetPixelMapfv(GLenum map, GLfloat *values) 07051 { 07052 GET_CURRENT_CONTEXT(ctx); 07053 FLUSH_VERTICES(ctx, 0); 07054 CALL_GetPixelMapfv(ctx->Exec, (map, values)); 07055 } 07056 07057 static void GLAPIENTRY 07058 exec_GetPixelMapuiv(GLenum map, GLuint *values) 07059 { 07060 GET_CURRENT_CONTEXT(ctx); 07061 FLUSH_VERTICES(ctx, 0); 07062 CALL_GetPixelMapuiv(ctx->Exec, (map, values)); 07063 } 07064 07065 static void GLAPIENTRY 07066 exec_GetPixelMapusv(GLenum map, GLushort *values) 07067 { 07068 GET_CURRENT_CONTEXT(ctx); 07069 FLUSH_VERTICES(ctx, 0); 07070 CALL_GetPixelMapusv(ctx->Exec, (map, values)); 07071 } 07072 07073 static void GLAPIENTRY 07074 exec_GetPolygonStipple(GLubyte * dest) 07075 { 07076 GET_CURRENT_CONTEXT(ctx); 07077 FLUSH_VERTICES(ctx, 0); 07078 CALL_GetPolygonStipple(ctx->Exec, (dest)); 07079 } 07080 07081 static const GLubyte *GLAPIENTRY 07082 exec_GetString(GLenum name) 07083 { 07084 GET_CURRENT_CONTEXT(ctx); 07085 FLUSH_VERTICES(ctx, 0); 07086 return CALL_GetString(ctx->Exec, (name)); 07087 } 07088 07089 static void GLAPIENTRY 07090 exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) 07091 { 07092 GET_CURRENT_CONTEXT(ctx); 07093 FLUSH_VERTICES(ctx, 0); 07094 CALL_GetTexEnvfv(ctx->Exec, (target, pname, params)); 07095 } 07096 07097 static void GLAPIENTRY 07098 exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params) 07099 { 07100 GET_CURRENT_CONTEXT(ctx); 07101 FLUSH_VERTICES(ctx, 0); 07102 CALL_GetTexEnviv(ctx->Exec, (target, pname, params)); 07103 } 07104 07105 static void GLAPIENTRY 07106 exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params) 07107 { 07108 GET_CURRENT_CONTEXT(ctx); 07109 FLUSH_VERTICES(ctx, 0); 07110 CALL_GetTexGendv(ctx->Exec, (coord, pname, params)); 07111 } 07112 07113 static void GLAPIENTRY 07114 exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) 07115 { 07116 GET_CURRENT_CONTEXT(ctx); 07117 FLUSH_VERTICES(ctx, 0); 07118 CALL_GetTexGenfv(ctx->Exec, (coord, pname, params)); 07119 } 07120 07121 static void GLAPIENTRY 07122 exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params) 07123 { 07124 GET_CURRENT_CONTEXT(ctx); 07125 FLUSH_VERTICES(ctx, 0); 07126 CALL_GetTexGeniv(ctx->Exec, (coord, pname, params)); 07127 } 07128 07129 static void GLAPIENTRY 07130 exec_GetTexImage(GLenum target, GLint level, GLenum format, 07131 GLenum type, GLvoid * pixels) 07132 { 07133 GET_CURRENT_CONTEXT(ctx); 07134 FLUSH_VERTICES(ctx, 0); 07135 CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels)); 07136 } 07137 07138 static void GLAPIENTRY 07139 exec_GetTexLevelParameterfv(GLenum target, GLint level, 07140 GLenum pname, GLfloat *params) 07141 { 07142 GET_CURRENT_CONTEXT(ctx); 07143 FLUSH_VERTICES(ctx, 0); 07144 CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params)); 07145 } 07146 07147 static void GLAPIENTRY 07148 exec_GetTexLevelParameteriv(GLenum target, GLint level, 07149 GLenum pname, GLint *params) 07150 { 07151 GET_CURRENT_CONTEXT(ctx); 07152 FLUSH_VERTICES(ctx, 0); 07153 CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params)); 07154 } 07155 07156 static void GLAPIENTRY 07157 exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) 07158 { 07159 GET_CURRENT_CONTEXT(ctx); 07160 FLUSH_VERTICES(ctx, 0); 07161 CALL_GetTexParameterfv(ctx->Exec, (target, pname, params)); 07162 } 07163 07164 static void GLAPIENTRY 07165 exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params) 07166 { 07167 GET_CURRENT_CONTEXT(ctx); 07168 FLUSH_VERTICES(ctx, 0); 07169 CALL_GetTexParameteriv(ctx->Exec, (target, pname, params)); 07170 } 07171 07172 static GLboolean GLAPIENTRY 07173 exec_IsEnabled(GLenum cap) 07174 { 07175 GET_CURRENT_CONTEXT(ctx); 07176 FLUSH_VERTICES(ctx, 0); 07177 return CALL_IsEnabled(ctx->Exec, (cap)); 07178 } 07179 07180 static void GLAPIENTRY 07181 exec_PixelStoref(GLenum pname, GLfloat param) 07182 { 07183 GET_CURRENT_CONTEXT(ctx); 07184 FLUSH_VERTICES(ctx, 0); 07185 CALL_PixelStoref(ctx->Exec, (pname, param)); 07186 } 07187 07188 static void GLAPIENTRY 07189 exec_PixelStorei(GLenum pname, GLint param) 07190 { 07191 GET_CURRENT_CONTEXT(ctx); 07192 FLUSH_VERTICES(ctx, 0); 07193 CALL_PixelStorei(ctx->Exec, (pname, param)); 07194 } 07195 07196 static void GLAPIENTRY 07197 exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, 07198 GLenum format, GLenum type, GLvoid * pixels) 07199 { 07200 GET_CURRENT_CONTEXT(ctx); 07201 FLUSH_VERTICES(ctx, 0); 07202 CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels)); 07203 } 07204 07205 static GLint GLAPIENTRY 07206 exec_RenderMode(GLenum mode) 07207 { 07208 GET_CURRENT_CONTEXT(ctx); 07209 FLUSH_VERTICES(ctx, 0); 07210 return CALL_RenderMode(ctx->Exec, (mode)); 07211 } 07212 07213 static void GLAPIENTRY 07214 exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer) 07215 { 07216 GET_CURRENT_CONTEXT(ctx); 07217 FLUSH_VERTICES(ctx, 0); 07218 CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer)); 07219 } 07220 07221 static void GLAPIENTRY 07222 exec_SelectBuffer(GLsizei size, GLuint * buffer) 07223 { 07224 GET_CURRENT_CONTEXT(ctx); 07225 FLUSH_VERTICES(ctx, 0); 07226 CALL_SelectBuffer(ctx->Exec, (size, buffer)); 07227 } 07228 07229 static GLboolean GLAPIENTRY 07230 exec_AreTexturesResident(GLsizei n, const GLuint * texName, 07231 GLboolean * residences) 07232 { 07233 GET_CURRENT_CONTEXT(ctx); 07234 FLUSH_VERTICES(ctx, 0); 07235 return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences)); 07236 } 07237 07238 static void GLAPIENTRY 07239 exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) 07240 { 07241 GET_CURRENT_CONTEXT(ctx); 07242 FLUSH_VERTICES(ctx, 0); 07243 CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr)); 07244 } 07245 07246 static void GLAPIENTRY 07247 exec_DeleteTextures(GLsizei n, const GLuint * texName) 07248 { 07249 GET_CURRENT_CONTEXT(ctx); 07250 FLUSH_VERTICES(ctx, 0); 07251 CALL_DeleteTextures(ctx->Exec, (n, texName)); 07252 } 07253 07254 static void GLAPIENTRY 07255 exec_DisableClientState(GLenum cap) 07256 { 07257 GET_CURRENT_CONTEXT(ctx); 07258 FLUSH_VERTICES(ctx, 0); 07259 CALL_DisableClientState(ctx->Exec, (cap)); 07260 } 07261 07262 static void GLAPIENTRY 07263 exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr) 07264 { 07265 GET_CURRENT_CONTEXT(ctx); 07266 FLUSH_VERTICES(ctx, 0); 07267 CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr)); 07268 } 07269 07270 static void GLAPIENTRY 07271 exec_EnableClientState(GLenum cap) 07272 { 07273 GET_CURRENT_CONTEXT(ctx); 07274 FLUSH_VERTICES(ctx, 0); 07275 CALL_EnableClientState(ctx->Exec, (cap)); 07276 } 07277 07278 static void GLAPIENTRY 07279 exec_GenTextures(GLsizei n, GLuint * texName) 07280 { 07281 GET_CURRENT_CONTEXT(ctx); 07282 FLUSH_VERTICES(ctx, 0); 07283 CALL_GenTextures(ctx->Exec, (n, texName)); 07284 } 07285 07286 static void GLAPIENTRY 07287 exec_GetPointerv(GLenum pname, GLvoid **params) 07288 { 07289 GET_CURRENT_CONTEXT(ctx); 07290 FLUSH_VERTICES(ctx, 0); 07291 CALL_GetPointerv(ctx->Exec, (pname, params)); 07292 } 07293 07294 static void GLAPIENTRY 07295 exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) 07296 { 07297 GET_CURRENT_CONTEXT(ctx); 07298 FLUSH_VERTICES(ctx, 0); 07299 CALL_IndexPointer(ctx->Exec, (type, stride, ptr)); 07300 } 07301 07302 static void GLAPIENTRY 07303 exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer) 07304 { 07305 GET_CURRENT_CONTEXT(ctx); 07306 FLUSH_VERTICES(ctx, 0); 07307 CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer)); 07308 } 07309 07310 static GLboolean GLAPIENTRY 07311 exec_IsTexture(GLuint texture) 07312 { 07313 GET_CURRENT_CONTEXT(ctx); 07314 FLUSH_VERTICES(ctx, 0); 07315 return CALL_IsTexture(ctx->Exec, (texture)); 07316 } 07317 07318 static void GLAPIENTRY 07319 exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr) 07320 { 07321 GET_CURRENT_CONTEXT(ctx); 07322 FLUSH_VERTICES(ctx, 0); 07323 CALL_NormalPointer(ctx->Exec, (type, stride, ptr)); 07324 } 07325 07326 static void GLAPIENTRY 07327 exec_PopClientAttrib(void) 07328 { 07329 GET_CURRENT_CONTEXT(ctx); 07330 FLUSH_VERTICES(ctx, 0); 07331 CALL_PopClientAttrib(ctx->Exec, ()); 07332 } 07333 07334 static void GLAPIENTRY 07335 exec_PushClientAttrib(GLbitfield mask) 07336 { 07337 GET_CURRENT_CONTEXT(ctx); 07338 FLUSH_VERTICES(ctx, 0); 07339 CALL_PushClientAttrib(ctx->Exec, (mask)); 07340 } 07341 07342 static void GLAPIENTRY 07343 exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, 07344 const GLvoid *ptr) 07345 { 07346 GET_CURRENT_CONTEXT(ctx); 07347 FLUSH_VERTICES(ctx, 0); 07348 CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr)); 07349 } 07350 07351 static void GLAPIENTRY 07352 exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img) 07353 { 07354 GET_CURRENT_CONTEXT(ctx); 07355 FLUSH_VERTICES(ctx, 0); 07356 CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img)); 07357 } 07358 07359 static void GLAPIENTRY 07360 exec_VertexPointer(GLint size, GLenum type, GLsizei stride, 07361 const GLvoid *ptr) 07362 { 07363 GET_CURRENT_CONTEXT(ctx); 07364 FLUSH_VERTICES(ctx, 0); 07365 CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr)); 07366 } 07367 07368 static void GLAPIENTRY 07369 exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, 07370 GLint x, GLint y, GLsizei width) 07371 { 07372 GET_CURRENT_CONTEXT(ctx); 07373 FLUSH_VERTICES(ctx, 0); 07374 CALL_CopyConvolutionFilter1D(ctx->Exec, 07375 (target, internalFormat, x, y, width)); 07376 } 07377 07378 static void GLAPIENTRY 07379 exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, 07380 GLint x, GLint y, GLsizei width, GLsizei height) 07381 { 07382 GET_CURRENT_CONTEXT(ctx); 07383 FLUSH_VERTICES(ctx, 0); 07384 CALL_CopyConvolutionFilter2D(ctx->Exec, 07385 (target, internalFormat, x, y, width, 07386 height)); 07387 } 07388 07389 static void GLAPIENTRY 07390 exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data) 07391 { 07392 GET_CURRENT_CONTEXT(ctx); 07393 FLUSH_VERTICES(ctx, 0); 07394 CALL_GetColorTable(ctx->Exec, (target, format, type, data)); 07395 } 07396 07397 static void GLAPIENTRY 07398 exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) 07399 { 07400 GET_CURRENT_CONTEXT(ctx); 07401 FLUSH_VERTICES(ctx, 0); 07402 CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params)); 07403 } 07404 07405 static void GLAPIENTRY 07406 exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) 07407 { 07408 GET_CURRENT_CONTEXT(ctx); 07409 FLUSH_VERTICES(ctx, 0); 07410 CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params)); 07411 } 07412 07413 static void GLAPIENTRY 07414 exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, 07415 GLvoid * image) 07416 { 07417 GET_CURRENT_CONTEXT(ctx); 07418 FLUSH_VERTICES(ctx, 0); 07419 CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image)); 07420 } 07421 07422 static void GLAPIENTRY 07423 exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) 07424 { 07425 GET_CURRENT_CONTEXT(ctx); 07426 FLUSH_VERTICES(ctx, 0); 07427 CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params)); 07428 } 07429 07430 static void GLAPIENTRY 07431 exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) 07432 { 07433 GET_CURRENT_CONTEXT(ctx); 07434 FLUSH_VERTICES(ctx, 0); 07435 CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params)); 07436 } 07437 07438 static void GLAPIENTRY 07439 exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, 07440 GLenum type, GLvoid *values) 07441 { 07442 GET_CURRENT_CONTEXT(ctx); 07443 FLUSH_VERTICES(ctx, 0); 07444 CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values)); 07445 } 07446 07447 static void GLAPIENTRY 07448 exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) 07449 { 07450 GET_CURRENT_CONTEXT(ctx); 07451 FLUSH_VERTICES(ctx, 0); 07452 CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params)); 07453 } 07454 07455 static void GLAPIENTRY 07456 exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) 07457 { 07458 GET_CURRENT_CONTEXT(ctx); 07459 FLUSH_VERTICES(ctx, 0); 07460 CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params)); 07461 } 07462 07463 static void GLAPIENTRY 07464 exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, 07465 GLenum type, GLvoid *values) 07466 { 07467 GET_CURRENT_CONTEXT(ctx); 07468 FLUSH_VERTICES(ctx, 0); 07469 CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values)); 07470 } 07471 07472 static void GLAPIENTRY 07473 exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) 07474 { 07475 GET_CURRENT_CONTEXT(ctx); 07476 FLUSH_VERTICES(ctx, 0); 07477 CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params)); 07478 } 07479 07480 static void GLAPIENTRY 07481 exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) 07482 { 07483 GET_CURRENT_CONTEXT(ctx); 07484 FLUSH_VERTICES(ctx, 0); 07485 CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params)); 07486 } 07487 07488 static void GLAPIENTRY 07489 exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, 07490 GLvoid *row, GLvoid *column, GLvoid *span) 07491 { 07492 GET_CURRENT_CONTEXT(ctx); 07493 FLUSH_VERTICES(ctx, 0); 07494 CALL_GetSeparableFilter(ctx->Exec, 07495 (target, format, type, row, column, span)); 07496 } 07497 07498 static void GLAPIENTRY 07499 exec_SeparableFilter2D(GLenum target, GLenum internalFormat, 07500 GLsizei width, GLsizei height, GLenum format, 07501 GLenum type, const GLvoid *row, const GLvoid *column) 07502 { 07503 GET_CURRENT_CONTEXT(ctx); 07504 FLUSH_VERTICES(ctx, 0); 07505 CALL_SeparableFilter2D(ctx->Exec, 07506 (target, internalFormat, width, height, format, 07507 type, row, column)); 07508 } 07509 07510 static void GLAPIENTRY 07511 exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, 07512 GLsizei count, const GLvoid *ptr) 07513 { 07514 GET_CURRENT_CONTEXT(ctx); 07515 FLUSH_VERTICES(ctx, 0); 07516 CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); 07517 } 07518 07519 static void GLAPIENTRY 07520 exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) 07521 { 07522 GET_CURRENT_CONTEXT(ctx); 07523 FLUSH_VERTICES(ctx, 0); 07524 CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr)); 07525 } 07526 07527 static void GLAPIENTRY 07528 exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, 07529 const GLvoid *ptr) 07530 { 07531 GET_CURRENT_CONTEXT(ctx); 07532 FLUSH_VERTICES(ctx, 0); 07533 CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr)); 07534 } 07535 07536 static void GLAPIENTRY 07537 exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, 07538 const GLvoid *ptr) 07539 { 07540 GET_CURRENT_CONTEXT(ctx); 07541 FLUSH_VERTICES(ctx, 0); 07542 CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr)); 07543 } 07544 07545 static void GLAPIENTRY 07546 exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, 07547 GLsizei count, const GLvoid *ptr) 07548 { 07549 GET_CURRENT_CONTEXT(ctx); 07550 FLUSH_VERTICES(ctx, 0); 07551 CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); 07552 } 07553 07554 static void GLAPIENTRY 07555 exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, 07556 GLsizei count, const GLvoid *ptr) 07557 { 07558 GET_CURRENT_CONTEXT(ctx); 07559 FLUSH_VERTICES(ctx, 0); 07560 CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); 07561 } 07562 07563 static void GLAPIENTRY 07564 exec_LockArraysEXT(GLint first, GLsizei count) 07565 { 07566 GET_CURRENT_CONTEXT(ctx); 07567 FLUSH_VERTICES(ctx, 0); 07568 CALL_LockArraysEXT(ctx->Exec, (first, count)); 07569 } 07570 07571 static void GLAPIENTRY 07572 exec_UnlockArraysEXT(void) 07573 { 07574 GET_CURRENT_CONTEXT(ctx); 07575 FLUSH_VERTICES(ctx, 0); 07576 CALL_UnlockArraysEXT(ctx->Exec, ()); 07577 } 07578 07579 static void GLAPIENTRY 07580 exec_ClientActiveTextureARB(GLenum target) 07581 { 07582 GET_CURRENT_CONTEXT(ctx); 07583 FLUSH_VERTICES(ctx, 0); 07584 CALL_ClientActiveTextureARB(ctx->Exec, (target)); 07585 } 07586 07587 static void GLAPIENTRY 07588 exec_SecondaryColorPointerEXT(GLint size, GLenum type, 07589 GLsizei stride, const GLvoid *ptr) 07590 { 07591 GET_CURRENT_CONTEXT(ctx); 07592 FLUSH_VERTICES(ctx, 0); 07593 CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr)); 07594 } 07595 07596 static void GLAPIENTRY 07597 exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) 07598 { 07599 GET_CURRENT_CONTEXT(ctx); 07600 FLUSH_VERTICES(ctx, 0); 07601 CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr)); 07602 } 07603 07604 /* GL_EXT_multi_draw_arrays */ 07605 static void GLAPIENTRY 07606 exec_MultiDrawArraysEXT(GLenum mode, GLint * first, 07607 GLsizei * count, GLsizei primcount) 07608 { 07609 GET_CURRENT_CONTEXT(ctx); 07610 FLUSH_VERTICES(ctx, 0); 07611 CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount)); 07612 } 07613 07614 /* GL_EXT_multi_draw_arrays */ 07615 static void GLAPIENTRY 07616 exec_MultiDrawElementsEXT(GLenum mode, const GLsizei * count, 07617 GLenum type, const GLvoid ** indices, 07618 GLsizei primcount) 07619 { 07620 GET_CURRENT_CONTEXT(ctx); 07621 FLUSH_VERTICES(ctx, 0); 07622 CALL_MultiDrawElementsEXT(ctx->Exec, 07623 (mode, count, type, indices, primcount)); 07624 } 07625 07626 /* GL_IBM_multimode_draw_arrays */ 07627 static void GLAPIENTRY 07628 exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first, 07629 const GLsizei * count, GLsizei primcount, 07630 GLint modestride) 07631 { 07632 GET_CURRENT_CONTEXT(ctx); 07633 FLUSH_VERTICES(ctx, 0); 07634 CALL_MultiModeDrawArraysIBM(ctx->Exec, 07635 (mode, first, count, primcount, modestride)); 07636 } 07637 07638 /* GL_IBM_multimode_draw_arrays */ 07639 static void GLAPIENTRY 07640 exec_MultiModeDrawElementsIBM(const GLenum * mode, 07641 const GLsizei * count, 07642 GLenum type, 07643 const GLvoid * const *indices, 07644 GLsizei primcount, GLint modestride) 07645 { 07646 GET_CURRENT_CONTEXT(ctx); 07647 FLUSH_VERTICES(ctx, 0); 07648 CALL_MultiModeDrawElementsIBM(ctx->Exec, 07649 (mode, count, type, indices, primcount, 07650 modestride)); 07651 } 07652 07653 07654 07663 void 07664 _mesa_init_dlist_table(struct _glapi_table *table) 07665 { 07666 _mesa_loopback_init_api_table(table); 07667 07668 /* GL 1.0 */ 07669 SET_Accum(table, save_Accum); 07670 SET_AlphaFunc(table, save_AlphaFunc); 07671 SET_Bitmap(table, save_Bitmap); 07672 SET_BlendFunc(table, save_BlendFunc); 07673 SET_CallList(table, _mesa_save_CallList); 07674 SET_CallLists(table, _mesa_save_CallLists); 07675 SET_Clear(table, save_Clear); 07676 SET_ClearAccum(table, save_ClearAccum); 07677 SET_ClearColor(table, save_ClearColor); 07678 SET_ClearDepth(table, save_ClearDepth); 07679 SET_ClearIndex(table, save_ClearIndex); 07680 SET_ClearStencil(table, save_ClearStencil); 07681 SET_ClipPlane(table, save_ClipPlane); 07682 SET_ColorMask(table, save_ColorMask); 07683 SET_ColorMaterial(table, save_ColorMaterial); 07684 SET_CopyPixels(table, save_CopyPixels); 07685 SET_CullFace(table, save_CullFace); 07686 SET_DeleteLists(table, _mesa_DeleteLists); 07687 SET_DepthFunc(table, save_DepthFunc); 07688 SET_DepthMask(table, save_DepthMask); 07689 SET_DepthRange(table, save_DepthRange); 07690 SET_Disable(table, save_Disable); 07691 SET_DrawBuffer(table, save_DrawBuffer); 07692 SET_DrawPixels(table, save_DrawPixels); 07693 SET_Enable(table, save_Enable); 07694 SET_EndList(table, _mesa_EndList); 07695 SET_EvalMesh1(table, _mesa_save_EvalMesh1); 07696 SET_EvalMesh2(table, _mesa_save_EvalMesh2); 07697 SET_Finish(table, exec_Finish); 07698 SET_Flush(table, exec_Flush); 07699 SET_Fogf(table, save_Fogf); 07700 SET_Fogfv(table, save_Fogfv); 07701 SET_Fogi(table, save_Fogi); 07702 SET_Fogiv(table, save_Fogiv); 07703 SET_FrontFace(table, save_FrontFace); 07704 SET_Frustum(table, save_Frustum); 07705 SET_GenLists(table, _mesa_GenLists); 07706 SET_GetBooleanv(table, exec_GetBooleanv); 07707 SET_GetClipPlane(table, exec_GetClipPlane); 07708 SET_GetDoublev(table, exec_GetDoublev); 07709 SET_GetError(table, exec_GetError); 07710 SET_GetFloatv(table, exec_GetFloatv); 07711 SET_GetIntegerv(table, exec_GetIntegerv); 07712 SET_GetLightfv(table, exec_GetLightfv); 07713 SET_GetLightiv(table, exec_GetLightiv); 07714 SET_GetMapdv(table, exec_GetMapdv); 07715 SET_GetMapfv(table, exec_GetMapfv); 07716 SET_GetMapiv(table, exec_GetMapiv); 07717 SET_GetMaterialfv(table, exec_GetMaterialfv); 07718 SET_GetMaterialiv(table, exec_GetMaterialiv); 07719 SET_GetPixelMapfv(table, exec_GetPixelMapfv); 07720 SET_GetPixelMapuiv(table, exec_GetPixelMapuiv); 07721 SET_GetPixelMapusv(table, exec_GetPixelMapusv); 07722 SET_GetPolygonStipple(table, exec_GetPolygonStipple); 07723 SET_GetString(table, exec_GetString); 07724 SET_GetTexEnvfv(table, exec_GetTexEnvfv); 07725 SET_GetTexEnviv(table, exec_GetTexEnviv); 07726 SET_GetTexGendv(table, exec_GetTexGendv); 07727 SET_GetTexGenfv(table, exec_GetTexGenfv); 07728 SET_GetTexGeniv(table, exec_GetTexGeniv); 07729 SET_GetTexImage(table, exec_GetTexImage); 07730 SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv); 07731 SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv); 07732 SET_GetTexParameterfv(table, exec_GetTexParameterfv); 07733 SET_GetTexParameteriv(table, exec_GetTexParameteriv); 07734 SET_Hint(table, save_Hint); 07735 SET_IndexMask(table, save_IndexMask); 07736 SET_InitNames(table, save_InitNames); 07737 SET_IsEnabled(table, exec_IsEnabled); 07738 SET_IsList(table, _mesa_IsList); 07739 SET_LightModelf(table, save_LightModelf); 07740 SET_LightModelfv(table, save_LightModelfv); 07741 SET_LightModeli(table, save_LightModeli); 07742 SET_LightModeliv(table, save_LightModeliv); 07743 SET_Lightf(table, save_Lightf); 07744 SET_Lightfv(table, save_Lightfv); 07745 SET_Lighti(table, save_Lighti); 07746 SET_Lightiv(table, save_Lightiv); 07747 SET_LineStipple(table, save_LineStipple); 07748 SET_LineWidth(table, save_LineWidth); 07749 SET_ListBase(table, save_ListBase); 07750 SET_LoadIdentity(table, save_LoadIdentity); 07751 SET_LoadMatrixd(table, save_LoadMatrixd); 07752 SET_LoadMatrixf(table, save_LoadMatrixf); 07753 SET_LoadName(table, save_LoadName); 07754 SET_LogicOp(table, save_LogicOp); 07755 SET_Map1d(table, save_Map1d); 07756 SET_Map1f(table, save_Map1f); 07757 SET_Map2d(table, save_Map2d); 07758 SET_Map2f(table, save_Map2f); 07759 SET_MapGrid1d(table, save_MapGrid1d); 07760 SET_MapGrid1f(table, save_MapGrid1f); 07761 SET_MapGrid2d(table, save_MapGrid2d); 07762 SET_MapGrid2f(table, save_MapGrid2f); 07763 SET_MatrixMode(table, save_MatrixMode); 07764 SET_MultMatrixd(table, save_MultMatrixd); 07765 SET_MultMatrixf(table, save_MultMatrixf); 07766 SET_NewList(table, save_NewList); 07767 SET_Ortho(table, save_Ortho); 07768 SET_PassThrough(table, save_PassThrough); 07769 SET_PixelMapfv(table, save_PixelMapfv); 07770 SET_PixelMapuiv(table, save_PixelMapuiv); 07771 SET_PixelMapusv(table, save_PixelMapusv); 07772 SET_PixelStoref(table, exec_PixelStoref); 07773 SET_PixelStorei(table, exec_PixelStorei); 07774 SET_PixelTransferf(table, save_PixelTransferf); 07775 SET_PixelTransferi(table, save_PixelTransferi); 07776 SET_PixelZoom(table, save_PixelZoom); 07777 SET_PointSize(table, save_PointSize); 07778 SET_PolygonMode(table, save_PolygonMode); 07779 SET_PolygonOffset(table, save_PolygonOffset); 07780 SET_PolygonStipple(table, save_PolygonStipple); 07781 SET_PopAttrib(table, save_PopAttrib); 07782 SET_PopMatrix(table, save_PopMatrix); 07783 SET_PopName(table, save_PopName); 07784 SET_PushAttrib(table, save_PushAttrib); 07785 SET_PushMatrix(table, save_PushMatrix); 07786 SET_PushName(table, save_PushName); 07787 SET_RasterPos2d(table, save_RasterPos2d); 07788 SET_RasterPos2dv(table, save_RasterPos2dv); 07789 SET_RasterPos2f(table, save_RasterPos2f); 07790 SET_RasterPos2fv(table, save_RasterPos2fv); 07791 SET_RasterPos2i(table, save_RasterPos2i); 07792 SET_RasterPos2iv(table, save_RasterPos2iv); 07793 SET_RasterPos2s(table, save_RasterPos2s); 07794 SET_RasterPos2sv(table, save_RasterPos2sv); 07795 SET_RasterPos3d(table, save_RasterPos3d); 07796 SET_RasterPos3dv(table, save_RasterPos3dv); 07797 SET_RasterPos3f(table, save_RasterPos3f); 07798 SET_RasterPos3fv(table, save_RasterPos3fv); 07799 SET_RasterPos3i(table, save_RasterPos3i); 07800 SET_RasterPos3iv(table, save_RasterPos3iv); 07801 SET_RasterPos3s(table, save_RasterPos3s); 07802 SET_RasterPos3sv(table, save_RasterPos3sv); 07803 SET_RasterPos4d(table, save_RasterPos4d); 07804 SET_RasterPos4dv(table, save_RasterPos4dv); 07805 SET_RasterPos4f(table, save_RasterPos4f); 07806 SET_RasterPos4fv(table, save_RasterPos4fv); 07807 SET_RasterPos4i(table, save_RasterPos4i); 07808 SET_RasterPos4iv(table, save_RasterPos4iv); 07809 SET_RasterPos4s(table, save_RasterPos4s); 07810 SET_RasterPos4sv(table, save_RasterPos4sv); 07811 SET_ReadBuffer(table, save_ReadBuffer); 07812 SET_ReadPixels(table, exec_ReadPixels); 07813 SET_RenderMode(table, exec_RenderMode); 07814 SET_Rotated(table, save_Rotated); 07815 SET_Rotatef(table, save_Rotatef); 07816 SET_Scaled(table, save_Scaled); 07817 SET_Scalef(table, save_Scalef); 07818 SET_Scissor(table, save_Scissor); 07819 SET_FeedbackBuffer(table, exec_FeedbackBuffer); 07820 SET_SelectBuffer(table, exec_SelectBuffer); 07821 SET_ShadeModel(table, save_ShadeModel); 07822 SET_StencilFunc(table, save_StencilFunc); 07823 SET_StencilMask(table, save_StencilMask); 07824 SET_StencilOp(table, save_StencilOp); 07825 SET_TexEnvf(table, save_TexEnvf); 07826 SET_TexEnvfv(table, save_TexEnvfv); 07827 SET_TexEnvi(table, save_TexEnvi); 07828 SET_TexEnviv(table, save_TexEnviv); 07829 SET_TexGend(table, save_TexGend); 07830 SET_TexGendv(table, save_TexGendv); 07831 SET_TexGenf(table, save_TexGenf); 07832 SET_TexGenfv(table, save_TexGenfv); 07833 SET_TexGeni(table, save_TexGeni); 07834 SET_TexGeniv(table, save_TexGeniv); 07835 SET_TexImage1D(table, save_TexImage1D); 07836 SET_TexImage2D(table, save_TexImage2D); 07837 SET_TexParameterf(table, save_TexParameterf); 07838 SET_TexParameterfv(table, save_TexParameterfv); 07839 SET_TexParameteri(table, save_TexParameteri); 07840 SET_TexParameteriv(table, save_TexParameteriv); 07841 SET_Translated(table, save_Translated); 07842 SET_Translatef(table, save_Translatef); 07843 SET_Viewport(table, save_Viewport); 07844 07845 /* GL 1.1 */ 07846 SET_AreTexturesResident(table, exec_AreTexturesResident); 07847 SET_BindTexture(table, save_BindTexture); 07848 SET_ColorPointer(table, exec_ColorPointer); 07849 SET_CopyTexImage1D(table, save_CopyTexImage1D); 07850 SET_CopyTexImage2D(table, save_CopyTexImage2D); 07851 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D); 07852 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D); 07853 SET_DeleteTextures(table, exec_DeleteTextures); 07854 SET_DisableClientState(table, exec_DisableClientState); 07855 SET_EdgeFlagPointer(table, exec_EdgeFlagPointer); 07856 SET_EnableClientState(table, exec_EnableClientState); 07857 SET_GenTextures(table, exec_GenTextures); 07858 SET_GetPointerv(table, exec_GetPointerv); 07859 SET_IndexPointer(table, exec_IndexPointer); 07860 SET_InterleavedArrays(table, exec_InterleavedArrays); 07861 SET_IsTexture(table, exec_IsTexture); 07862 SET_NormalPointer(table, exec_NormalPointer); 07863 SET_PopClientAttrib(table, exec_PopClientAttrib); 07864 SET_PrioritizeTextures(table, save_PrioritizeTextures); 07865 SET_PushClientAttrib(table, exec_PushClientAttrib); 07866 SET_TexCoordPointer(table, exec_TexCoordPointer); 07867 SET_TexSubImage1D(table, save_TexSubImage1D); 07868 SET_TexSubImage2D(table, save_TexSubImage2D); 07869 SET_VertexPointer(table, exec_VertexPointer); 07870 07871 /* GL 1.2 */ 07872 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D); 07873 SET_TexImage3D(table, save_TexImage3D); 07874 SET_TexSubImage3D(table, save_TexSubImage3D); 07875 07876 /* GL 2.0 */ 07877 SET_StencilFuncSeparate(table, save_StencilFuncSeparate); 07878 SET_StencilMaskSeparate(table, save_StencilMaskSeparate); 07879 SET_StencilOpSeparate(table, save_StencilOpSeparate); 07880 07881 /* ATI_separate_stencil */ 07882 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI); 07883 07884 /* GL_ARB_imaging */ 07885 /* Not all are supported */ 07886 SET_BlendColor(table, save_BlendColor); 07887 SET_BlendEquation(table, save_BlendEquation); 07888 SET_ColorSubTable(table, save_ColorSubTable); 07889 SET_ColorTable(table, save_ColorTable); 07890 SET_ColorTableParameterfv(table, save_ColorTableParameterfv); 07891 SET_ColorTableParameteriv(table, save_ColorTableParameteriv); 07892 SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D); 07893 SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D); 07894 SET_ConvolutionParameterf(table, save_ConvolutionParameterf); 07895 SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv); 07896 SET_ConvolutionParameteri(table, save_ConvolutionParameteri); 07897 SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv); 07898 SET_CopyColorSubTable(table, save_CopyColorSubTable); 07899 SET_CopyColorTable(table, save_CopyColorTable); 07900 SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D); 07901 SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D); 07902 SET_GetColorTable(table, exec_GetColorTable); 07903 SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); 07904 SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); 07905 SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); 07906 SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); 07907 SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); 07908 SET_GetHistogram(table, exec_GetHistogram); 07909 SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); 07910 SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); 07911 SET_GetMinmax(table, exec_GetMinmax); 07912 SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); 07913 SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); 07914 SET_GetSeparableFilter(table, exec_GetSeparableFilter); 07915 SET_Histogram(table, save_Histogram); 07916 SET_Minmax(table, save_Minmax); 07917 SET_ResetHistogram(table, save_ResetHistogram); 07918 SET_ResetMinmax(table, save_ResetMinmax); 07919 SET_SeparableFilter2D(table, exec_SeparableFilter2D); 07920 07921 /* 2. GL_EXT_blend_color */ 07922 #if 0 07923 SET_BlendColorEXT(table, save_BlendColorEXT); 07924 #endif 07925 07926 /* 3. GL_EXT_polygon_offset */ 07927 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT); 07928 07929 /* 6. GL_EXT_texture3d */ 07930 #if 0 07931 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D); 07932 SET_TexImage3DEXT(table, save_TexImage3DEXT); 07933 SET_TexSubImage3DEXT(table, save_TexSubImage3D); 07934 #endif 07935 07936 /* 14. GL_SGI_color_table */ 07937 #if 0 07938 SET_ColorTableSGI(table, save_ColorTable); 07939 SET_ColorSubTableSGI(table, save_ColorSubTable); 07940 SET_GetColorTableSGI(table, exec_GetColorTable); 07941 SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv); 07942 SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv); 07943 #endif 07944 07945 /* 30. GL_EXT_vertex_array */ 07946 SET_ColorPointerEXT(table, exec_ColorPointerEXT); 07947 SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT); 07948 SET_IndexPointerEXT(table, exec_IndexPointerEXT); 07949 SET_NormalPointerEXT(table, exec_NormalPointerEXT); 07950 SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT); 07951 SET_VertexPointerEXT(table, exec_VertexPointerEXT); 07952 07953 /* 37. GL_EXT_blend_minmax */ 07954 #if 0 07955 SET_BlendEquationEXT(table, save_BlendEquationEXT); 07956 #endif 07957 07958 /* 54. GL_EXT_point_parameters */ 07959 SET_PointParameterfEXT(table, save_PointParameterfEXT); 07960 SET_PointParameterfvEXT(table, save_PointParameterfvEXT); 07961 07962 /* 97. GL_EXT_compiled_vertex_array */ 07963 SET_LockArraysEXT(table, exec_LockArraysEXT); 07964 SET_UnlockArraysEXT(table, exec_UnlockArraysEXT); 07965 07966 /* 145. GL_EXT_secondary_color */ 07967 SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT); 07968 07969 /* 148. GL_EXT_multi_draw_arrays */ 07970 SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT); 07971 SET_MultiDrawElementsEXT(table, exec_MultiDrawElementsEXT); 07972 07973 /* 149. GL_EXT_fog_coord */ 07974 SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT); 07975 07976 /* 173. GL_EXT_blend_func_separate */ 07977 SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT); 07978 07979 /* 196. GL_MESA_resize_buffers */ 07980 SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA); 07981 07982 /* 197. GL_MESA_window_pos */ 07983 SET_WindowPos2dMESA(table, save_WindowPos2dMESA); 07984 SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA); 07985 SET_WindowPos2fMESA(table, save_WindowPos2fMESA); 07986 SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA); 07987 SET_WindowPos2iMESA(table, save_WindowPos2iMESA); 07988 SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA); 07989 SET_WindowPos2sMESA(table, save_WindowPos2sMESA); 07990 SET_WindowPos2svMESA(table, save_WindowPos2svMESA); 07991 SET_WindowPos3dMESA(table, save_WindowPos3dMESA); 07992 SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA); 07993 SET_WindowPos3fMESA(table, save_WindowPos3fMESA); 07994 SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA); 07995 SET_WindowPos3iMESA(table, save_WindowPos3iMESA); 07996 SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA); 07997 SET_WindowPos3sMESA(table, save_WindowPos3sMESA); 07998 SET_WindowPos3svMESA(table, save_WindowPos3svMESA); 07999 SET_WindowPos4dMESA(table, save_WindowPos4dMESA); 08000 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA); 08001 SET_WindowPos4fMESA(table, save_WindowPos4fMESA); 08002 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA); 08003 SET_WindowPos4iMESA(table, save_WindowPos4iMESA); 08004 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA); 08005 SET_WindowPos4sMESA(table, save_WindowPos4sMESA); 08006 SET_WindowPos4svMESA(table, save_WindowPos4svMESA); 08007 08008 /* 200. GL_IBM_multimode_draw_arrays */ 08009 SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM); 08010 SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM); 08011 08012 #if FEATURE_NV_vertex_program 08013 /* 233. GL_NV_vertex_program */ 08014 /* The following commands DO NOT go into display lists: 08015 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV, 08016 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib* 08017 */ 08018 SET_BindProgramNV(table, save_BindProgramNV); 08019 SET_DeleteProgramsNV(table, _mesa_DeletePrograms); 08020 SET_ExecuteProgramNV(table, save_ExecuteProgramNV); 08021 SET_GenProgramsNV(table, _mesa_GenPrograms); 08022 SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV); 08023 SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV); 08024 SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV); 08025 SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV); 08026 SET_GetProgramivNV(table, _mesa_GetProgramivNV); 08027 SET_GetProgramStringNV(table, _mesa_GetProgramStringNV); 08028 SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV); 08029 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); 08030 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); 08031 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); 08032 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); 08033 SET_IsProgramNV(table, _mesa_IsProgramARB); 08034 SET_LoadProgramNV(table, save_LoadProgramNV); 08035 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); 08036 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); 08037 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); 08038 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB); 08039 SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV); 08040 SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV); 08041 SET_TrackMatrixNV(table, save_TrackMatrixNV); 08042 SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV); 08043 #endif 08044 08045 /* 245. GL_ATI_fragment_shader */ 08046 #if FEATURE_ATI_fragment_shader 08047 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI); 08048 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI); 08049 #endif 08050 08051 /* 282. GL_NV_fragment_program */ 08052 #if FEATURE_NV_fragment_program 08053 SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV); 08054 SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV); 08055 SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV); 08056 SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV); 08057 SET_GetProgramNamedParameterfvNV(table, 08058 _mesa_GetProgramNamedParameterfvNV); 08059 SET_GetProgramNamedParameterdvNV(table, 08060 _mesa_GetProgramNamedParameterdvNV); 08061 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB); 08062 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); 08063 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); 08064 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); 08065 SET_GetProgramLocalParameterdvARB(table, 08066 _mesa_GetProgramLocalParameterdvARB); 08067 SET_GetProgramLocalParameterfvARB(table, 08068 _mesa_GetProgramLocalParameterfvARB); 08069 #endif 08070 08071 /* 262. GL_NV_point_sprite */ 08072 SET_PointParameteriNV(table, save_PointParameteriNV); 08073 SET_PointParameterivNV(table, save_PointParameterivNV); 08074 08075 /* 268. GL_EXT_stencil_two_side */ 08076 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT); 08077 08078 /* 273. GL_APPLE_vertex_array_object */ 08079 SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE); 08080 SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE); 08081 SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE); 08082 SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE); 08083 08084 /* ???. GL_EXT_depth_bounds_test */ 08085 SET_DepthBoundsEXT(table, save_DepthBoundsEXT); 08086 08087 /* ARB 1. GL_ARB_multitexture */ 08088 SET_ActiveTextureARB(table, save_ActiveTextureARB); 08089 SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB); 08090 08091 /* ARB 3. GL_ARB_transpose_matrix */ 08092 SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB); 08093 SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB); 08094 SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB); 08095 SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB); 08096 08097 /* ARB 5. GL_ARB_multisample */ 08098 SET_SampleCoverageARB(table, save_SampleCoverageARB); 08099 08100 /* ARB 12. GL_ARB_texture_compression */ 08101 SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB); 08102 SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB); 08103 SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB); 08104 SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB); 08105 SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB); 08106 SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB); 08107 SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB); 08108 08109 /* ARB 14. GL_ARB_point_parameters */ 08110 /* aliased with EXT_point_parameters functions */ 08111 08112 /* ARB 25. GL_ARB_window_pos */ 08113 /* aliased with MESA_window_pos functions */ 08114 08115 /* ARB 26. GL_ARB_vertex_program */ 08116 /* ARB 27. GL_ARB_fragment_program */ 08117 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 08118 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */ 08119 SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB); 08120 SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB); 08121 SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB); 08122 SET_ProgramStringARB(table, save_ProgramStringARB); 08123 SET_BindProgramNV(table, save_BindProgramNV); 08124 SET_DeleteProgramsNV(table, _mesa_DeletePrograms); 08125 SET_GenProgramsNV(table, _mesa_GenPrograms); 08126 SET_IsProgramNV(table, _mesa_IsProgramARB); 08127 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); 08128 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); 08129 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); 08130 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); 08131 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); 08132 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); 08133 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); 08134 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB); 08135 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB); 08136 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); 08137 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); 08138 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); 08139 SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB); 08140 SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB); 08141 SET_GetProgramLocalParameterdvARB(table, 08142 _mesa_GetProgramLocalParameterdvARB); 08143 SET_GetProgramLocalParameterfvARB(table, 08144 _mesa_GetProgramLocalParameterfvARB); 08145 SET_GetProgramivARB(table, _mesa_GetProgramivARB); 08146 SET_GetProgramStringARB(table, _mesa_GetProgramStringARB); 08147 #endif 08148 08149 /* ARB 28. GL_ARB_vertex_buffer_object */ 08150 #if FEATURE_ARB_vertex_buffer_object 08151 /* None of the extension's functions get compiled */ 08152 SET_BindBufferARB(table, _mesa_BindBufferARB); 08153 SET_BufferDataARB(table, _mesa_BufferDataARB); 08154 SET_BufferSubDataARB(table, _mesa_BufferSubDataARB); 08155 SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB); 08156 SET_GenBuffersARB(table, _mesa_GenBuffersARB); 08157 SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB); 08158 SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB); 08159 SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB); 08160 SET_IsBufferARB(table, _mesa_IsBufferARB); 08161 SET_MapBufferARB(table, _mesa_MapBufferARB); 08162 SET_UnmapBufferARB(table, _mesa_UnmapBufferARB); 08163 #endif 08164 08165 #if FEATURE_ARB_occlusion_query 08166 SET_BeginQueryARB(table, save_BeginQueryARB); 08167 SET_EndQueryARB(table, save_EndQueryARB); 08168 SET_GenQueriesARB(table, _mesa_GenQueriesARB); 08169 SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB); 08170 SET_IsQueryARB(table, _mesa_IsQueryARB); 08171 SET_GetQueryivARB(table, _mesa_GetQueryivARB); 08172 SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB); 08173 SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB); 08174 #endif 08175 SET_DrawBuffersARB(table, save_DrawBuffersARB); 08176 08177 #if FEATURE_EXT_framebuffer_blit 08178 SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT); 08179 #endif 08180 08181 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ 08182 SET_BindAttribLocationARB(table, exec_BindAttribLocationARB); 08183 SET_GetAttribLocationARB(table, exec_GetAttribLocationARB); 08184 /* XXX additional functions need to be implemented here! */ 08185 08186 /* 299. GL_EXT_blend_equation_separate */ 08187 SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); 08188 08189 /* GL_EXT_gpu_program_parmaeters */ 08190 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program 08191 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT); 08192 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); 08193 #endif 08194 } 08195 08196 08197 08198 static const char * 08199 enum_string(GLenum k) 08200 { 08201 return _mesa_lookup_enum_by_nr(k); 08202 } 08203 08204 08209 static void GLAPIENTRY 08210 print_list(GLcontext *ctx, GLuint list) 08211 { 08212 struct mesa_display_list *dlist; 08213 Node *n; 08214 GLboolean done; 08215 08216 if (!islist(ctx, list)) { 08217 _mesa_printf("%u is not a display list ID\n", list); 08218 return; 08219 } 08220 08221 dlist = lookup_list(ctx, list); 08222 if (!dlist) 08223 return; 08224 08225 n = dlist->node; 08226 08227 _mesa_printf("START-LIST %u, address %p\n", list, (void *) n); 08228 08229 done = n ? GL_FALSE : GL_TRUE; 08230 while (!done) { 08231 OpCode opcode = n[0].opcode; 08232 GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; 08233 08234 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { 08235 /* this is a driver-extended opcode */ 08236 ctx->ListExt.Opcode[i].Print(ctx, &n[1]); 08237 n += ctx->ListExt.Opcode[i].Size; 08238 } 08239 else { 08240 switch (opcode) { 08241 case OPCODE_ACCUM: 08242 _mesa_printf("Accum %s %g\n", enum_string(n[1].e), n[2].f); 08243 break; 08244 case OPCODE_BITMAP: 08245 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, 08246 n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data); 08247 break; 08248 case OPCODE_CALL_LIST: 08249 _mesa_printf("CallList %d\n", (int) n[1].ui); 08250 break; 08251 case OPCODE_CALL_LIST_OFFSET: 08252 _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, 08253 ctx->List.ListBase, ctx->List.ListBase + n[1].ui); 08254 break; 08255 case OPCODE_COLOR_TABLE_PARAMETER_FV: 08256 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", 08257 enum_string(n[1].e), enum_string(n[2].e), 08258 n[3].f, n[4].f, n[5].f, n[6].f); 08259 break; 08260 case OPCODE_COLOR_TABLE_PARAMETER_IV: 08261 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", 08262 enum_string(n[1].e), enum_string(n[2].e), 08263 n[3].i, n[4].i, n[5].i, n[6].i); 08264 break; 08265 case OPCODE_DISABLE: 08266 _mesa_printf("Disable %s\n", enum_string(n[1].e)); 08267 break; 08268 case OPCODE_ENABLE: 08269 _mesa_printf("Enable %s\n", enum_string(n[1].e)); 08270 break; 08271 case OPCODE_FRUSTUM: 08272 _mesa_printf("Frustum %g %g %g %g %g %g\n", 08273 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); 08274 break; 08275 case OPCODE_LINE_STIPPLE: 08276 _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us); 08277 break; 08278 case OPCODE_LOAD_IDENTITY: 08279 _mesa_printf("LoadIdentity\n"); 08280 break; 08281 case OPCODE_LOAD_MATRIX: 08282 _mesa_printf("LoadMatrix\n"); 08283 _mesa_printf(" %8f %8f %8f %8f\n", 08284 n[1].f, n[5].f, n[9].f, n[13].f); 08285 _mesa_printf(" %8f %8f %8f %8f\n", 08286 n[2].f, n[6].f, n[10].f, n[14].f); 08287 _mesa_printf(" %8f %8f %8f %8f\n", 08288 n[3].f, n[7].f, n[11].f, n[15].f); 08289 _mesa_printf(" %8f %8f %8f %8f\n", 08290 n[4].f, n[8].f, n[12].f, n[16].f); 08291 break; 08292 case OPCODE_MULT_MATRIX: 08293 _mesa_printf("MultMatrix (or Rotate)\n"); 08294 _mesa_printf(" %8f %8f %8f %8f\n", 08295 n[1].f, n[5].f, n[9].f, n[13].f); 08296 _mesa_printf(" %8f %8f %8f %8f\n", 08297 n[2].f, n[6].f, n[10].f, n[14].f); 08298 _mesa_printf(" %8f %8f %8f %8f\n", 08299 n[3].f, n[7].f, n[11].f, n[15].f); 08300 _mesa_printf(" %8f %8f %8f %8f\n", 08301 n[4].f, n[8].f, n[12].f, n[16].f); 08302 break; 08303 case OPCODE_ORTHO: 08304 _mesa_printf("Ortho %g %g %g %g %g %g\n", 08305 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); 08306 break; 08307 case OPCODE_POP_ATTRIB: 08308 _mesa_printf("PopAttrib\n"); 08309 break; 08310 case OPCODE_POP_MATRIX: 08311 _mesa_printf("PopMatrix\n"); 08312 break; 08313 case OPCODE_POP_NAME: 08314 _mesa_printf("PopName\n"); 08315 break; 08316 case OPCODE_PUSH_ATTRIB: 08317 _mesa_printf("PushAttrib %x\n", n[1].bf); 08318 break; 08319 case OPCODE_PUSH_MATRIX: 08320 _mesa_printf("PushMatrix\n"); 08321 break; 08322 case OPCODE_PUSH_NAME: 08323 _mesa_printf("PushName %d\n", (int) n[1].ui); 08324 break; 08325 case OPCODE_RASTER_POS: 08326 _mesa_printf("RasterPos %g %g %g %g\n", 08327 n[1].f, n[2].f, n[3].f, n[4].f); 08328 break; 08329 case OPCODE_ROTATE: 08330 _mesa_printf("Rotate %g %g %g %g\n", 08331 n[1].f, n[2].f, n[3].f, n[4].f); 08332 break; 08333 case OPCODE_SCALE: 08334 _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); 08335 break; 08336 case OPCODE_TRANSLATE: 08337 _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); 08338 break; 08339 case OPCODE_BIND_TEXTURE: 08340 _mesa_printf("BindTexture %s %d\n", 08341 _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); 08342 break; 08343 case OPCODE_SHADE_MODEL: 08344 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); 08345 break; 08346 case OPCODE_MAP1: 08347 _mesa_printf("Map1 %s %.3f %.3f %d %d\n", 08348 _mesa_lookup_enum_by_nr(n[1].ui), 08349 n[2].f, n[3].f, n[4].i, n[5].i); 08350 break; 08351 case OPCODE_MAP2: 08352 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", 08353 _mesa_lookup_enum_by_nr(n[1].ui), 08354 n[2].f, n[3].f, n[4].f, n[5].f, 08355 n[6].i, n[7].i, n[8].i, n[9].i); 08356 break; 08357 case OPCODE_MAPGRID1: 08358 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); 08359 break; 08360 case OPCODE_MAPGRID2: 08361 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", 08362 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); 08363 break; 08364 case OPCODE_EVALMESH1: 08365 _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); 08366 break; 08367 case OPCODE_EVALMESH2: 08368 _mesa_printf("EvalMesh2 %d %d %d %d\n", 08369 n[1].i, n[2].i, n[3].i, n[4].i); 08370 break; 08371 08372 case OPCODE_ATTR_1F_NV: 08373 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); 08374 break; 08375 case OPCODE_ATTR_2F_NV: 08376 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n", 08377 n[1].i, n[2].f, n[3].f); 08378 break; 08379 case OPCODE_ATTR_3F_NV: 08380 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n", 08381 n[1].i, n[2].f, n[3].f, n[4].f); 08382 break; 08383 case OPCODE_ATTR_4F_NV: 08384 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n", 08385 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); 08386 break; 08387 case OPCODE_ATTR_1F_ARB: 08388 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); 08389 break; 08390 case OPCODE_ATTR_2F_ARB: 08391 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n", 08392 n[1].i, n[2].f, n[3].f); 08393 break; 08394 case OPCODE_ATTR_3F_ARB: 08395 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n", 08396 n[1].i, n[2].f, n[3].f, n[4].f); 08397 break; 08398 case OPCODE_ATTR_4F_ARB: 08399 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", 08400 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); 08401 break; 08402 08403 case OPCODE_MATERIAL: 08404 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n", 08405 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); 08406 break; 08407 case OPCODE_BEGIN: 08408 _mesa_printf("BEGIN %x\n", n[1].i); 08409 break; 08410 case OPCODE_END: 08411 _mesa_printf("END\n"); 08412 break; 08413 case OPCODE_RECTF: 08414 _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, 08415 n[4].f); 08416 break; 08417 case OPCODE_EVAL_C1: 08418 _mesa_printf("EVAL_C1 %f\n", n[1].f); 08419 break; 08420 case OPCODE_EVAL_C2: 08421 _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); 08422 break; 08423 case OPCODE_EVAL_P1: 08424 _mesa_printf("EVAL_P1 %d\n", n[1].i); 08425 break; 08426 case OPCODE_EVAL_P2: 08427 _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); 08428 break; 08429 08430 /* 08431 * meta opcodes/commands 08432 */ 08433 case OPCODE_ERROR: 08434 _mesa_printf("Error: %s %s\n", 08435 enum_string(n[1].e), (const char *) n[2].data); 08436 break; 08437 case OPCODE_CONTINUE: 08438 _mesa_printf("DISPLAY-LIST-CONTINUE\n"); 08439 n = (Node *) n[1].next; 08440 break; 08441 case OPCODE_END_OF_LIST: 08442 _mesa_printf("END-LIST %u\n", list); 08443 done = GL_TRUE; 08444 break; 08445 default: 08446 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { 08447 _mesa_printf 08448 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", 08449 opcode, (void *) n); 08450 return; 08451 } 08452 else { 08453 _mesa_printf("command %d, %u operands\n", opcode, 08454 InstSize[opcode]); 08455 } 08456 } 08457 /* increment n to point to next compiled command */ 08458 if (opcode != OPCODE_CONTINUE) { 08459 n += InstSize[opcode]; 08460 } 08461 } 08462 } 08463 } 08464 08465 08466 08472 void 08473 mesa_print_display_list(GLuint list) 08474 { 08475 GET_CURRENT_CONTEXT(ctx); 08476 print_list(ctx, list); 08477 } 08478 08479 08480 /**********************************************************************/ 08481 /***** Initialization *****/ 08482 /**********************************************************************/ 08483 08484 void 08485 _mesa_save_vtxfmt_init(GLvertexformat * vfmt) 08486 { 08487 vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ 08488 vfmt->Begin = save_Begin; 08489 vfmt->CallList = _mesa_save_CallList; 08490 vfmt->CallLists = _mesa_save_CallLists; 08491 vfmt->Color3f = save_Color3f; 08492 vfmt->Color3fv = save_Color3fv; 08493 vfmt->Color4f = save_Color4f; 08494 vfmt->Color4fv = save_Color4fv; 08495 vfmt->EdgeFlag = save_EdgeFlag; 08496 vfmt->End = save_End; 08497 vfmt->EvalCoord1f = save_EvalCoord1f; 08498 vfmt->EvalCoord1fv = save_EvalCoord1fv; 08499 vfmt->EvalCoord2f = save_EvalCoord2f; 08500 vfmt->EvalCoord2fv = save_EvalCoord2fv; 08501 vfmt->EvalPoint1 = save_EvalPoint1; 08502 vfmt->EvalPoint2 = save_EvalPoint2; 08503 vfmt->FogCoordfEXT = save_FogCoordfEXT; 08504 vfmt->FogCoordfvEXT = save_FogCoordfvEXT; 08505 vfmt->Indexf = save_Indexf; 08506 vfmt->Indexfv = save_Indexfv; 08507 vfmt->Materialfv = save_Materialfv; 08508 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f; 08509 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv; 08510 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f; 08511 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv; 08512 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f; 08513 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv; 08514 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f; 08515 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv; 08516 vfmt->Normal3f = save_Normal3f; 08517 vfmt->Normal3fv = save_Normal3fv; 08518 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT; 08519 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT; 08520 vfmt->TexCoord1f = save_TexCoord1f; 08521 vfmt->TexCoord1fv = save_TexCoord1fv; 08522 vfmt->TexCoord2f = save_TexCoord2f; 08523 vfmt->TexCoord2fv = save_TexCoord2fv; 08524 vfmt->TexCoord3f = save_TexCoord3f; 08525 vfmt->TexCoord3fv = save_TexCoord3fv; 08526 vfmt->TexCoord4f = save_TexCoord4f; 08527 vfmt->TexCoord4fv = save_TexCoord4fv; 08528 vfmt->Vertex2f = save_Vertex2f; 08529 vfmt->Vertex2fv = save_Vertex2fv; 08530 vfmt->Vertex3f = save_Vertex3f; 08531 vfmt->Vertex3fv = save_Vertex3fv; 08532 vfmt->Vertex4f = save_Vertex4f; 08533 vfmt->Vertex4fv = save_Vertex4fv; 08534 vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV; 08535 vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV; 08536 vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV; 08537 vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV; 08538 vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV; 08539 vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV; 08540 vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV; 08541 vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV; 08542 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB; 08543 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB; 08544 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB; 08545 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB; 08546 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB; 08547 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB; 08548 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB; 08549 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB; 08550 08551 vfmt->EvalMesh1 = _mesa_save_EvalMesh1; 08552 vfmt->EvalMesh2 = _mesa_save_EvalMesh2; 08553 vfmt->Rectf = save_Rectf; 08554 08555 /* The driver is required to implement these as 08556 * 1) They can probably do a better job. 08557 * 2) A lot of new mechanisms would have to be added to this module 08558 * to support it. That code would probably never get used, 08559 * because of (1). 08560 */ 08561 #if 0 08562 vfmt->DrawArrays = 0; 08563 vfmt->DrawElements = 0; 08564 vfmt->DrawRangeElements = 0; 08565 #endif 08566 } 08567 08568 08572 void 08573 _mesa_init_display_list(GLcontext *ctx) 08574 { 08575 static GLboolean tableInitialized = GL_FALSE; 08576 08577 /* zero-out the instruction size table, just once */ 08578 if (!tableInitialized) { 08579 _mesa_bzero(InstSize, sizeof(InstSize)); 08580 tableInitialized = GL_TRUE; 08581 } 08582 08583 /* Display list */ 08584 ctx->ListState.CallDepth = 0; 08585 ctx->ExecuteFlag = GL_TRUE; 08586 ctx->CompileFlag = GL_FALSE; 08587 ctx->ListState.CurrentListPtr = NULL; 08588 ctx->ListState.CurrentBlock = NULL; 08589 ctx->ListState.CurrentListNum = 0; 08590 ctx->ListState.CurrentPos = 0; 08591 08592 /* Display List group */ 08593 ctx->List.ListBase = 0; 08594 08595 _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt); 08596 } Generated on Sat May 26 2012 04:19:02 for ReactOS by
1.7.6.1
|