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