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