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