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