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