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