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