mesa: fix a bad cast in put_values_z24.
[mesa.git] / src / mesa / main / dlist.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * \file dlist.c
28 * Display lists management functions.
29 */
30
31 #include "glheader.h"
32 #include "imports.h"
33 #include "api_arrayelt.h"
34 #include "api_loopback.h"
35 #include "config.h"
36 #include "attrib.h"
37 #include "blend.h"
38 #include "buffers.h"
39 #if FEATURE_ARB_vertex_buffer_object
40 #include "bufferobj.h"
41 #endif
42 #include "arrayobj.h"
43 #include "clip.h"
44 #include "colormac.h"
45 #include "colortab.h"
46 #include "context.h"
47 #include "convolve.h"
48 #include "depth.h"
49 #include "dlist.h"
50 #include "enable.h"
51 #include "enums.h"
52 #include "eval.h"
53 #include "extensions.h"
54 #include "feedback.h"
55 #include "get.h"
56 #include "glapi/glapi.h"
57 #include "hash.h"
58 #include "histogram.h"
59 #include "image.h"
60 #include "light.h"
61 #include "lines.h"
62 #include "dlist.h"
63 #include "macros.h"
64 #include "matrix.h"
65 #include "pixel.h"
66 #include "points.h"
67 #include "polygon.h"
68 #include "queryobj.h"
69 #include "state.h"
70 #include "texobj.h"
71 #include "teximage.h"
72 #include "texstate.h"
73 #include "mtypes.h"
74 #include "varray.h"
75 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
76 #include "shader/arbprogram.h"
77 #include "shader/program.h"
78 #endif
79 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
80 #include "shader/nvprogram.h"
81 #include "shader/program.h"
82 #endif
83 #if FEATURE_ATI_fragment_shader
84 #include "shader/atifragshader.h"
85 #endif
86
87 #include "math/m_matrix.h"
88 #include "math/m_xform.h"
89
90 #include "glapi/dispatch.h"
91
92
93 /**
94 * Flush vertices.
95 *
96 * \param ctx GL context.
97 *
98 * Checks if dd_function_table::SaveNeedFlush is marked to flush
99 * stored (save) vertices, and calls
100 * dd_function_table::SaveFlushVertices if so.
101 */
102 #define SAVE_FLUSH_VERTICES(ctx) \
103 do { \
104 if (ctx->Driver.SaveNeedFlush) \
105 ctx->Driver.SaveFlushVertices(ctx); \
106 } while (0)
107
108
109 /**
110 * Macro to assert that the API call was made outside the
111 * glBegin()/glEnd() pair, with return value.
112 *
113 * \param ctx GL context.
114 * \param retval value to return value in case the assertion fails.
115 */
116 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
117 do { \
118 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
119 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
120 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
121 return retval; \
122 } \
123 } while (0)
124
125 /**
126 * Macro to assert that the API call was made outside the
127 * glBegin()/glEnd() pair.
128 *
129 * \param ctx GL context.
130 */
131 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
132 do { \
133 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
134 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
135 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
136 return; \
137 } \
138 } while (0)
139
140 /**
141 * Macro to assert that the API call was made outside the
142 * glBegin()/glEnd() pair and flush the vertices.
143 *
144 * \param ctx GL context.
145 */
146 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
147 do { \
148 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
149 SAVE_FLUSH_VERTICES(ctx); \
150 } while (0)
151
152 /**
153 * Macro to assert that the API call was made outside the
154 * glBegin()/glEnd() pair and flush the vertices, with return value.
155 *
156 * \param ctx GL context.
157 * \param retval value to return value in case the assertion fails.
158 */
159 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
160 do { \
161 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
162 SAVE_FLUSH_VERTICES(ctx); \
163 } while (0)
164
165
166
167 /**
168 * Display list opcodes.
169 *
170 * The fact that these identifiers are assigned consecutive
171 * integer values starting at 0 is very important, see InstSize array usage)
172 */
173 typedef enum
174 {
175 OPCODE_INVALID = -1, /* Force signed enum */
176 OPCODE_ACCUM,
177 OPCODE_ALPHA_FUNC,
178 OPCODE_BIND_TEXTURE,
179 OPCODE_BITMAP,
180 OPCODE_BLEND_COLOR,
181 OPCODE_BLEND_EQUATION,
182 OPCODE_BLEND_EQUATION_SEPARATE,
183 OPCODE_BLEND_FUNC_SEPARATE,
184 OPCODE_CALL_LIST,
185 OPCODE_CALL_LIST_OFFSET,
186 OPCODE_CLEAR,
187 OPCODE_CLEAR_ACCUM,
188 OPCODE_CLEAR_COLOR,
189 OPCODE_CLEAR_DEPTH,
190 OPCODE_CLEAR_INDEX,
191 OPCODE_CLEAR_STENCIL,
192 OPCODE_CLIP_PLANE,
193 OPCODE_COLOR_MASK,
194 OPCODE_COLOR_MATERIAL,
195 OPCODE_COLOR_TABLE,
196 OPCODE_COLOR_TABLE_PARAMETER_FV,
197 OPCODE_COLOR_TABLE_PARAMETER_IV,
198 OPCODE_COLOR_SUB_TABLE,
199 OPCODE_CONVOLUTION_FILTER_1D,
200 OPCODE_CONVOLUTION_FILTER_2D,
201 OPCODE_CONVOLUTION_PARAMETER_I,
202 OPCODE_CONVOLUTION_PARAMETER_IV,
203 OPCODE_CONVOLUTION_PARAMETER_F,
204 OPCODE_CONVOLUTION_PARAMETER_FV,
205 OPCODE_COPY_COLOR_SUB_TABLE,
206 OPCODE_COPY_COLOR_TABLE,
207 OPCODE_COPY_PIXELS,
208 OPCODE_COPY_TEX_IMAGE1D,
209 OPCODE_COPY_TEX_IMAGE2D,
210 OPCODE_COPY_TEX_SUB_IMAGE1D,
211 OPCODE_COPY_TEX_SUB_IMAGE2D,
212 OPCODE_COPY_TEX_SUB_IMAGE3D,
213 OPCODE_CULL_FACE,
214 OPCODE_DEPTH_FUNC,
215 OPCODE_DEPTH_MASK,
216 OPCODE_DEPTH_RANGE,
217 OPCODE_DISABLE,
218 OPCODE_DRAW_BUFFER,
219 OPCODE_DRAW_PIXELS,
220 OPCODE_ENABLE,
221 OPCODE_EVALMESH1,
222 OPCODE_EVALMESH2,
223 OPCODE_FOG,
224 OPCODE_FRONT_FACE,
225 OPCODE_FRUSTUM,
226 OPCODE_HINT,
227 OPCODE_HISTOGRAM,
228 OPCODE_INDEX_MASK,
229 OPCODE_INIT_NAMES,
230 OPCODE_LIGHT,
231 OPCODE_LIGHT_MODEL,
232 OPCODE_LINE_STIPPLE,
233 OPCODE_LINE_WIDTH,
234 OPCODE_LIST_BASE,
235 OPCODE_LOAD_IDENTITY,
236 OPCODE_LOAD_MATRIX,
237 OPCODE_LOAD_NAME,
238 OPCODE_LOGIC_OP,
239 OPCODE_MAP1,
240 OPCODE_MAP2,
241 OPCODE_MAPGRID1,
242 OPCODE_MAPGRID2,
243 OPCODE_MATRIX_MODE,
244 OPCODE_MIN_MAX,
245 OPCODE_MULT_MATRIX,
246 OPCODE_ORTHO,
247 OPCODE_PASSTHROUGH,
248 OPCODE_PIXEL_MAP,
249 OPCODE_PIXEL_TRANSFER,
250 OPCODE_PIXEL_ZOOM,
251 OPCODE_POINT_SIZE,
252 OPCODE_POINT_PARAMETERS,
253 OPCODE_POLYGON_MODE,
254 OPCODE_POLYGON_STIPPLE,
255 OPCODE_POLYGON_OFFSET,
256 OPCODE_POP_ATTRIB,
257 OPCODE_POP_MATRIX,
258 OPCODE_POP_NAME,
259 OPCODE_PRIORITIZE_TEXTURE,
260 OPCODE_PUSH_ATTRIB,
261 OPCODE_PUSH_MATRIX,
262 OPCODE_PUSH_NAME,
263 OPCODE_RASTER_POS,
264 OPCODE_READ_BUFFER,
265 OPCODE_RESET_HISTOGRAM,
266 OPCODE_RESET_MIN_MAX,
267 OPCODE_ROTATE,
268 OPCODE_SCALE,
269 OPCODE_SCISSOR,
270 OPCODE_SELECT_TEXTURE_SGIS,
271 OPCODE_SELECT_TEXTURE_COORD_SET,
272 OPCODE_SHADE_MODEL,
273 OPCODE_STENCIL_FUNC,
274 OPCODE_STENCIL_MASK,
275 OPCODE_STENCIL_OP,
276 OPCODE_TEXENV,
277 OPCODE_TEXGEN,
278 OPCODE_TEXPARAMETER,
279 OPCODE_TEX_IMAGE1D,
280 OPCODE_TEX_IMAGE2D,
281 OPCODE_TEX_IMAGE3D,
282 OPCODE_TEX_SUB_IMAGE1D,
283 OPCODE_TEX_SUB_IMAGE2D,
284 OPCODE_TEX_SUB_IMAGE3D,
285 OPCODE_TRANSLATE,
286 OPCODE_VIEWPORT,
287 OPCODE_WINDOW_POS,
288 /* GL_ARB_multitexture */
289 OPCODE_ACTIVE_TEXTURE,
290 /* GL_ARB_texture_compression */
291 OPCODE_COMPRESSED_TEX_IMAGE_1D,
292 OPCODE_COMPRESSED_TEX_IMAGE_2D,
293 OPCODE_COMPRESSED_TEX_IMAGE_3D,
294 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
295 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
296 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
297 /* GL_ARB_multisample */
298 OPCODE_SAMPLE_COVERAGE,
299 /* GL_ARB_window_pos */
300 OPCODE_WINDOW_POS_ARB,
301 /* GL_NV_vertex_program */
302 OPCODE_BIND_PROGRAM_NV,
303 OPCODE_EXECUTE_PROGRAM_NV,
304 OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
305 OPCODE_LOAD_PROGRAM_NV,
306 OPCODE_TRACK_MATRIX_NV,
307 /* GL_NV_fragment_program */
308 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
309 OPCODE_PROGRAM_NAMED_PARAMETER_NV,
310 /* GL_EXT_stencil_two_side */
311 OPCODE_ACTIVE_STENCIL_FACE_EXT,
312 /* GL_EXT_depth_bounds_test */
313 OPCODE_DEPTH_BOUNDS_EXT,
314 /* GL_ARB_vertex/fragment_program */
315 OPCODE_PROGRAM_STRING_ARB,
316 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
317 /* GL_ARB_occlusion_query */
318 OPCODE_BEGIN_QUERY_ARB,
319 OPCODE_END_QUERY_ARB,
320 /* GL_ARB_draw_buffers */
321 OPCODE_DRAW_BUFFERS_ARB,
322 /* GL_ATI_fragment_shader */
323 OPCODE_BIND_FRAGMENT_SHADER_ATI,
324 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
325 /* OpenGL 2.0 */
326 OPCODE_STENCIL_FUNC_SEPARATE,
327 OPCODE_STENCIL_OP_SEPARATE,
328 OPCODE_STENCIL_MASK_SEPARATE,
329
330 /* GL_EXT_framebuffer_blit */
331 OPCODE_BLIT_FRAMEBUFFER,
332
333 /* Vertex attributes -- fallback for when optimized display
334 * list build isn't active.
335 */
336 OPCODE_ATTR_1F_NV,
337 OPCODE_ATTR_2F_NV,
338 OPCODE_ATTR_3F_NV,
339 OPCODE_ATTR_4F_NV,
340 OPCODE_ATTR_1F_ARB,
341 OPCODE_ATTR_2F_ARB,
342 OPCODE_ATTR_3F_ARB,
343 OPCODE_ATTR_4F_ARB,
344 OPCODE_MATERIAL,
345 OPCODE_BEGIN,
346 OPCODE_END,
347 OPCODE_RECTF,
348 OPCODE_EVAL_C1,
349 OPCODE_EVAL_C2,
350 OPCODE_EVAL_P1,
351 OPCODE_EVAL_P2,
352
353 /* The following three are meta instructions */
354 OPCODE_ERROR, /* raise compiled-in error */
355 OPCODE_CONTINUE,
356 OPCODE_END_OF_LIST,
357 OPCODE_EXT_0
358 } OpCode;
359
360
361
362 /**
363 * Display list node.
364 *
365 * Display list instructions are stored as sequences of "nodes". Nodes
366 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
367 * are linked together with a pointer.
368 *
369 * Each instruction in the display list is stored as a sequence of
370 * contiguous nodes in memory.
371 * Each node is the union of a variety of data types.
372 */
373 union node
374 {
375 OpCode opcode;
376 GLboolean b;
377 GLbitfield bf;
378 GLubyte ub;
379 GLshort s;
380 GLushort us;
381 GLint i;
382 GLuint ui;
383 GLenum e;
384 GLfloat f;
385 GLvoid *data;
386 void *next; /* If prev node's opcode==OPCODE_CONTINUE */
387 };
388
389
390 /**
391 * How many nodes to allocate at a time.
392 *
393 * \note Reduced now that we hold vertices etc. elsewhere.
394 */
395 #define BLOCK_SIZE 256
396
397
398
399 /**
400 * Number of nodes of storage needed for each instruction.
401 * Sizes for dynamically allocated opcodes are stored in the context struct.
402 */
403 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
404
405 void mesa_print_display_list(GLuint list);
406
407
408 /**********************************************************************/
409 /***** Private *****/
410 /**********************************************************************/
411
412
413 /**
414 * Make an empty display list. This is used by glGenLists() to
415 * reserve display list IDs.
416 */
417 static struct mesa_display_list *
418 make_list(GLuint list, GLuint count)
419 {
420 struct mesa_display_list *dlist = CALLOC_STRUCT(mesa_display_list);
421 dlist->id = list;
422 dlist->node = (Node *) _mesa_malloc(sizeof(Node) * count);
423 dlist->node[0].opcode = OPCODE_END_OF_LIST;
424 return dlist;
425 }
426
427
428 /**
429 * Lookup function to just encapsulate casting.
430 */
431 static INLINE struct mesa_display_list *
432 lookup_list(GLcontext *ctx, GLuint list)
433 {
434 return (struct mesa_display_list *)
435 _mesa_HashLookup(ctx->Shared->DisplayList, list);
436 }
437
438
439
440 /**
441 * Delete the named display list, but don't remove from hash table.
442 * \param dlist - display list pointer
443 */
444 void
445 _mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist)
446 {
447 Node *n, *block;
448 GLboolean done;
449
450 n = block = dlist->node;
451
452 done = block ? GL_FALSE : GL_TRUE;
453 while (!done) {
454
455 /* check for extension opcodes first */
456
457 GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
458 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
459 ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]);
460 n += ctx->ListExt.Opcode[i].Size;
461 }
462 else {
463 switch (n[0].opcode) {
464 /* for some commands, we need to free malloc'd memory */
465 case OPCODE_MAP1:
466 _mesa_free(n[6].data);
467 n += InstSize[n[0].opcode];
468 break;
469 case OPCODE_MAP2:
470 _mesa_free(n[10].data);
471 n += InstSize[n[0].opcode];
472 break;
473 case OPCODE_DRAW_PIXELS:
474 _mesa_free(n[5].data);
475 n += InstSize[n[0].opcode];
476 break;
477 case OPCODE_BITMAP:
478 _mesa_free(n[7].data);
479 n += InstSize[n[0].opcode];
480 break;
481 case OPCODE_COLOR_TABLE:
482 _mesa_free(n[6].data);
483 n += InstSize[n[0].opcode];
484 break;
485 case OPCODE_COLOR_SUB_TABLE:
486 _mesa_free(n[6].data);
487 n += InstSize[n[0].opcode];
488 break;
489 case OPCODE_CONVOLUTION_FILTER_1D:
490 _mesa_free(n[6].data);
491 n += InstSize[n[0].opcode];
492 break;
493 case OPCODE_CONVOLUTION_FILTER_2D:
494 _mesa_free(n[7].data);
495 n += InstSize[n[0].opcode];
496 break;
497 case OPCODE_POLYGON_STIPPLE:
498 _mesa_free(n[1].data);
499 n += InstSize[n[0].opcode];
500 break;
501 case OPCODE_TEX_IMAGE1D:
502 _mesa_free(n[8].data);
503 n += InstSize[n[0].opcode];
504 break;
505 case OPCODE_TEX_IMAGE2D:
506 _mesa_free(n[9].data);
507 n += InstSize[n[0].opcode];
508 break;
509 case OPCODE_TEX_IMAGE3D:
510 _mesa_free(n[10].data);
511 n += InstSize[n[0].opcode];
512 break;
513 case OPCODE_TEX_SUB_IMAGE1D:
514 _mesa_free(n[7].data);
515 n += InstSize[n[0].opcode];
516 break;
517 case OPCODE_TEX_SUB_IMAGE2D:
518 _mesa_free(n[9].data);
519 n += InstSize[n[0].opcode];
520 break;
521 case OPCODE_TEX_SUB_IMAGE3D:
522 _mesa_free(n[11].data);
523 n += InstSize[n[0].opcode];
524 break;
525 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
526 _mesa_free(n[7].data);
527 n += InstSize[n[0].opcode];
528 break;
529 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
530 _mesa_free(n[8].data);
531 n += InstSize[n[0].opcode];
532 break;
533 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
534 _mesa_free(n[9].data);
535 n += InstSize[n[0].opcode];
536 break;
537 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
538 _mesa_free(n[7].data);
539 n += InstSize[n[0].opcode];
540 break;
541 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
542 _mesa_free(n[9].data);
543 n += InstSize[n[0].opcode];
544 break;
545 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
546 _mesa_free(n[11].data);
547 n += InstSize[n[0].opcode];
548 break;
549 #if FEATURE_NV_vertex_program
550 case OPCODE_LOAD_PROGRAM_NV:
551 _mesa_free(n[4].data); /* program string */
552 n += InstSize[n[0].opcode];
553 break;
554 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
555 _mesa_free(n[2].data); /* array of program ids */
556 n += InstSize[n[0].opcode];
557 break;
558 #endif
559 #if FEATURE_NV_fragment_program
560 case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
561 _mesa_free(n[3].data); /* parameter name */
562 n += InstSize[n[0].opcode];
563 break;
564 #endif
565 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
566 case OPCODE_PROGRAM_STRING_ARB:
567 _mesa_free(n[4].data); /* program string */
568 n += InstSize[n[0].opcode];
569 break;
570 #endif
571 case OPCODE_CONTINUE:
572 n = (Node *) n[1].next;
573 _mesa_free(block);
574 block = n;
575 break;
576 case OPCODE_END_OF_LIST:
577 _mesa_free(block);
578 done = GL_TRUE;
579 break;
580 default:
581 /* Most frequent case */
582 n += InstSize[n[0].opcode];
583 break;
584 }
585 }
586 }
587
588 _mesa_free(dlist);
589 }
590
591
592 /**
593 * Destroy a display list and remove from hash table.
594 * \param list - display list number
595 */
596 static void
597 destroy_list(GLcontext *ctx, GLuint list)
598 {
599 struct mesa_display_list *dlist;
600
601 if (list == 0)
602 return;
603
604 dlist = lookup_list(ctx, list);
605 if (!dlist)
606 return;
607
608 _mesa_delete_list(ctx, dlist);
609 _mesa_HashRemove(ctx->Shared->DisplayList, list);
610 }
611
612
613 /*
614 * Translate the nth element of list from type to 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 static void GLAPIENTRY
2719 save_PolygonStipple(const GLubyte * pattern)
2720 {
2721 GET_CURRENT_CONTEXT(ctx);
2722 GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
2723 pattern, &ctx->Unpack);
2724 Node *n;
2725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2726 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1);
2727 if (n) {
2728 n[1].data = image;
2729 }
2730 else if (image) {
2731 _mesa_free(image);
2732 }
2733 if (ctx->ExecuteFlag) {
2734 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
2735 }
2736 }
2737
2738
2739 static void GLAPIENTRY
2740 save_PolygonOffset(GLfloat factor, GLfloat units)
2741 {
2742 GET_CURRENT_CONTEXT(ctx);
2743 Node *n;
2744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2745 n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_OFFSET, 2);
2746 if (n) {
2747 n[1].f = factor;
2748 n[2].f = units;
2749 }
2750 if (ctx->ExecuteFlag) {
2751 CALL_PolygonOffset(ctx->Exec, (factor, units));
2752 }
2753 }
2754
2755
2756 static void GLAPIENTRY
2757 save_PolygonOffsetEXT(GLfloat factor, GLfloat bias)
2758 {
2759 GET_CURRENT_CONTEXT(ctx);
2760 /* XXX mult by DepthMaxF here??? */
2761 save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias);
2762 }
2763
2764
2765 static void GLAPIENTRY
2766 save_PopAttrib(void)
2767 {
2768 GET_CURRENT_CONTEXT(ctx);
2769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2770 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_ATTRIB, 0);
2771 if (ctx->ExecuteFlag) {
2772 CALL_PopAttrib(ctx->Exec, ());
2773 }
2774 }
2775
2776
2777 static void GLAPIENTRY
2778 save_PopMatrix(void)
2779 {
2780 GET_CURRENT_CONTEXT(ctx);
2781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2782 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_MATRIX, 0);
2783 if (ctx->ExecuteFlag) {
2784 CALL_PopMatrix(ctx->Exec, ());
2785 }
2786 }
2787
2788
2789 static void GLAPIENTRY
2790 save_PopName(void)
2791 {
2792 GET_CURRENT_CONTEXT(ctx);
2793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2794 (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_NAME, 0);
2795 if (ctx->ExecuteFlag) {
2796 CALL_PopName(ctx->Exec, ());
2797 }
2798 }
2799
2800
2801 static void GLAPIENTRY
2802 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
2803 const GLclampf * priorities)
2804 {
2805 GET_CURRENT_CONTEXT(ctx);
2806 GLint i;
2807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2808
2809 for (i = 0; i < num; i++) {
2810 Node *n;
2811 n = ALLOC_INSTRUCTION(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
2812 if (n) {
2813 n[1].ui = textures[i];
2814 n[2].f = priorities[i];
2815 }
2816 }
2817 if (ctx->ExecuteFlag) {
2818 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
2819 }
2820 }
2821
2822
2823 static void GLAPIENTRY
2824 save_PushAttrib(GLbitfield mask)
2825 {
2826 GET_CURRENT_CONTEXT(ctx);
2827 Node *n;
2828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2829 n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_ATTRIB, 1);
2830 if (n) {
2831 n[1].bf = mask;
2832 }
2833 if (ctx->ExecuteFlag) {
2834 CALL_PushAttrib(ctx->Exec, (mask));
2835 }
2836 }
2837
2838
2839 static void GLAPIENTRY
2840 save_PushMatrix(void)
2841 {
2842 GET_CURRENT_CONTEXT(ctx);
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2844 (void) ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_MATRIX, 0);
2845 if (ctx->ExecuteFlag) {
2846 CALL_PushMatrix(ctx->Exec, ());
2847 }
2848 }
2849
2850
2851 static void GLAPIENTRY
2852 save_PushName(GLuint name)
2853 {
2854 GET_CURRENT_CONTEXT(ctx);
2855 Node *n;
2856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2857 n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_NAME, 1);
2858 if (n) {
2859 n[1].ui = name;
2860 }
2861 if (ctx->ExecuteFlag) {
2862 CALL_PushName(ctx->Exec, (name));
2863 }
2864 }
2865
2866
2867 static void GLAPIENTRY
2868 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2869 {
2870 GET_CURRENT_CONTEXT(ctx);
2871 Node *n;
2872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2873 n = ALLOC_INSTRUCTION(ctx, OPCODE_RASTER_POS, 4);
2874 if (n) {
2875 n[1].f = x;
2876 n[2].f = y;
2877 n[3].f = z;
2878 n[4].f = w;
2879 }
2880 if (ctx->ExecuteFlag) {
2881 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
2882 }
2883 }
2884
2885 static void GLAPIENTRY
2886 save_RasterPos2d(GLdouble x, GLdouble y)
2887 {
2888 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
2889 }
2890
2891 static void GLAPIENTRY
2892 save_RasterPos2f(GLfloat x, GLfloat y)
2893 {
2894 save_RasterPos4f(x, y, 0.0F, 1.0F);
2895 }
2896
2897 static void GLAPIENTRY
2898 save_RasterPos2i(GLint x, GLint y)
2899 {
2900 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
2901 }
2902
2903 static void GLAPIENTRY
2904 save_RasterPos2s(GLshort x, GLshort y)
2905 {
2906 save_RasterPos4f(x, y, 0.0F, 1.0F);
2907 }
2908
2909 static void GLAPIENTRY
2910 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
2911 {
2912 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
2913 }
2914
2915 static void GLAPIENTRY
2916 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
2917 {
2918 save_RasterPos4f(x, y, z, 1.0F);
2919 }
2920
2921 static void GLAPIENTRY
2922 save_RasterPos3i(GLint x, GLint y, GLint z)
2923 {
2924 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
2925 }
2926
2927 static void GLAPIENTRY
2928 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
2929 {
2930 save_RasterPos4f(x, y, z, 1.0F);
2931 }
2932
2933 static void GLAPIENTRY
2934 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
2935 {
2936 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
2937 }
2938
2939 static void GLAPIENTRY
2940 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
2941 {
2942 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
2943 }
2944
2945 static void GLAPIENTRY
2946 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
2947 {
2948 save_RasterPos4f(x, y, z, w);
2949 }
2950
2951 static void GLAPIENTRY
2952 save_RasterPos2dv(const GLdouble * v)
2953 {
2954 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
2955 }
2956
2957 static void GLAPIENTRY
2958 save_RasterPos2fv(const GLfloat * v)
2959 {
2960 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
2961 }
2962
2963 static void GLAPIENTRY
2964 save_RasterPos2iv(const GLint * v)
2965 {
2966 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
2967 }
2968
2969 static void GLAPIENTRY
2970 save_RasterPos2sv(const GLshort * v)
2971 {
2972 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
2973 }
2974
2975 static void GLAPIENTRY
2976 save_RasterPos3dv(const GLdouble * v)
2977 {
2978 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
2979 }
2980
2981 static void GLAPIENTRY
2982 save_RasterPos3fv(const GLfloat * v)
2983 {
2984 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
2985 }
2986
2987 static void GLAPIENTRY
2988 save_RasterPos3iv(const GLint * v)
2989 {
2990 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
2991 }
2992
2993 static void GLAPIENTRY
2994 save_RasterPos3sv(const GLshort * v)
2995 {
2996 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
2997 }
2998
2999 static void GLAPIENTRY
3000 save_RasterPos4dv(const GLdouble * v)
3001 {
3002 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3003 (GLfloat) v[2], (GLfloat) v[3]);
3004 }
3005
3006 static void GLAPIENTRY
3007 save_RasterPos4fv(const GLfloat * v)
3008 {
3009 save_RasterPos4f(v[0], v[1], v[2], v[3]);
3010 }
3011
3012 static void GLAPIENTRY
3013 save_RasterPos4iv(const GLint * v)
3014 {
3015 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
3016 (GLfloat) v[2], (GLfloat) v[3]);
3017 }
3018
3019 static void GLAPIENTRY
3020 save_RasterPos4sv(const GLshort * v)
3021 {
3022 save_RasterPos4f(v[0], v[1], v[2], v[3]);
3023 }
3024
3025
3026 static void GLAPIENTRY
3027 save_PassThrough(GLfloat token)
3028 {
3029 GET_CURRENT_CONTEXT(ctx);
3030 Node *n;
3031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3032 n = ALLOC_INSTRUCTION(ctx, OPCODE_PASSTHROUGH, 1);
3033 if (n) {
3034 n[1].f = token;
3035 }
3036 if (ctx->ExecuteFlag) {
3037 CALL_PassThrough(ctx->Exec, (token));
3038 }
3039 }
3040
3041
3042 static void GLAPIENTRY
3043 save_ReadBuffer(GLenum mode)
3044 {
3045 GET_CURRENT_CONTEXT(ctx);
3046 Node *n;
3047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3048 n = ALLOC_INSTRUCTION(ctx, OPCODE_READ_BUFFER, 1);
3049 if (n) {
3050 n[1].e = mode;
3051 }
3052 if (ctx->ExecuteFlag) {
3053 CALL_ReadBuffer(ctx->Exec, (mode));
3054 }
3055 }
3056
3057
3058 static void GLAPIENTRY
3059 save_ResetHistogram(GLenum target)
3060 {
3061 GET_CURRENT_CONTEXT(ctx);
3062 Node *n;
3063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3064 n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_HISTOGRAM, 1);
3065 if (n) {
3066 n[1].e = target;
3067 }
3068 if (ctx->ExecuteFlag) {
3069 CALL_ResetHistogram(ctx->Exec, (target));
3070 }
3071 }
3072
3073
3074 static void GLAPIENTRY
3075 save_ResetMinmax(GLenum target)
3076 {
3077 GET_CURRENT_CONTEXT(ctx);
3078 Node *n;
3079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3080 n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_MIN_MAX, 1);
3081 if (n) {
3082 n[1].e = target;
3083 }
3084 if (ctx->ExecuteFlag) {
3085 CALL_ResetMinmax(ctx->Exec, (target));
3086 }
3087 }
3088
3089
3090 static void GLAPIENTRY
3091 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
3092 {
3093 GET_CURRENT_CONTEXT(ctx);
3094 Node *n;
3095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3096 n = ALLOC_INSTRUCTION(ctx, OPCODE_ROTATE, 4);
3097 if (n) {
3098 n[1].f = angle;
3099 n[2].f = x;
3100 n[3].f = y;
3101 n[4].f = z;
3102 }
3103 if (ctx->ExecuteFlag) {
3104 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
3105 }
3106 }
3107
3108
3109 static void GLAPIENTRY
3110 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
3111 {
3112 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
3113 }
3114
3115
3116 static void GLAPIENTRY
3117 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
3118 {
3119 GET_CURRENT_CONTEXT(ctx);
3120 Node *n;
3121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3122 n = ALLOC_INSTRUCTION(ctx, OPCODE_SCALE, 3);
3123 if (n) {
3124 n[1].f = x;
3125 n[2].f = y;
3126 n[3].f = z;
3127 }
3128 if (ctx->ExecuteFlag) {
3129 CALL_Scalef(ctx->Exec, (x, y, z));
3130 }
3131 }
3132
3133
3134 static void GLAPIENTRY
3135 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
3136 {
3137 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
3138 }
3139
3140
3141 static void GLAPIENTRY
3142 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
3143 {
3144 GET_CURRENT_CONTEXT(ctx);
3145 Node *n;
3146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3147 n = ALLOC_INSTRUCTION(ctx, OPCODE_SCISSOR, 4);
3148 if (n) {
3149 n[1].i = x;
3150 n[2].i = y;
3151 n[3].i = width;
3152 n[4].i = height;
3153 }
3154 if (ctx->ExecuteFlag) {
3155 CALL_Scissor(ctx->Exec, (x, y, width, height));
3156 }
3157 }
3158
3159
3160 static void GLAPIENTRY
3161 save_ShadeModel(GLenum mode)
3162 {
3163 GET_CURRENT_CONTEXT(ctx);
3164 Node *n;
3165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3166 n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1);
3167 if (n) {
3168 n[1].e = mode;
3169 }
3170 if (ctx->ExecuteFlag) {
3171 CALL_ShadeModel(ctx->Exec, (mode));
3172 }
3173 }
3174
3175
3176 static void GLAPIENTRY
3177 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
3178 {
3179 GET_CURRENT_CONTEXT(ctx);
3180 Node *n;
3181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3182 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC, 3);
3183 if (n) {
3184 n[1].e = func;
3185 n[2].i = ref;
3186 n[3].ui = mask;
3187 }
3188 if (ctx->ExecuteFlag) {
3189 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
3190 }
3191 }
3192
3193
3194 static void GLAPIENTRY
3195 save_StencilMask(GLuint mask)
3196 {
3197 GET_CURRENT_CONTEXT(ctx);
3198 Node *n;
3199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3200 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK, 1);
3201 if (n) {
3202 n[1].ui = mask;
3203 }
3204 if (ctx->ExecuteFlag) {
3205 CALL_StencilMask(ctx->Exec, (mask));
3206 }
3207 }
3208
3209
3210 static void GLAPIENTRY
3211 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
3212 {
3213 GET_CURRENT_CONTEXT(ctx);
3214 Node *n;
3215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3216 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP, 3);
3217 if (n) {
3218 n[1].e = fail;
3219 n[2].e = zfail;
3220 n[3].e = zpass;
3221 }
3222 if (ctx->ExecuteFlag) {
3223 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
3224 }
3225 }
3226
3227
3228 static void GLAPIENTRY
3229 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
3230 {
3231 GET_CURRENT_CONTEXT(ctx);
3232 Node *n;
3233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3234 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
3235 if (n) {
3236 n[1].e = face;
3237 n[2].e = func;
3238 n[3].i = ref;
3239 n[4].ui = mask;
3240 }
3241 if (ctx->ExecuteFlag) {
3242 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
3243 }
3244 }
3245
3246
3247 static void GLAPIENTRY
3248 save_StencilMaskSeparate(GLenum face, GLuint mask)
3249 {
3250 GET_CURRENT_CONTEXT(ctx);
3251 Node *n;
3252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3253 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
3254 if (n) {
3255 n[1].e = face;
3256 n[2].ui = mask;
3257 }
3258 if (ctx->ExecuteFlag) {
3259 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
3260 }
3261 }
3262
3263
3264 static void GLAPIENTRY
3265 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3266 {
3267 GET_CURRENT_CONTEXT(ctx);
3268 Node *n;
3269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3270 n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
3271 if (n) {
3272 n[1].e = face;
3273 n[2].e = fail;
3274 n[3].e = zfail;
3275 n[4].e = zpass;
3276 }
3277 if (ctx->ExecuteFlag) {
3278 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
3279 }
3280 }
3281
3282
3283 static void GLAPIENTRY
3284 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
3285 {
3286 GET_CURRENT_CONTEXT(ctx);
3287 Node *n;
3288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3289 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXENV, 6);
3290 if (n) {
3291 n[1].e = target;
3292 n[2].e = pname;
3293 if (pname == GL_TEXTURE_ENV_COLOR) {
3294 n[3].f = params[0];
3295 n[4].f = params[1];
3296 n[5].f = params[2];
3297 n[6].f = params[3];
3298 }
3299 else {
3300 n[3].f = params[0];
3301 n[4].f = n[5].f = n[6].f = 0.0F;
3302 }
3303 }
3304 if (ctx->ExecuteFlag) {
3305 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
3306 }
3307 }
3308
3309
3310 static void GLAPIENTRY
3311 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
3312 {
3313 save_TexEnvfv(target, pname, &param);
3314 }
3315
3316
3317 static void GLAPIENTRY
3318 save_TexEnvi(GLenum target, GLenum pname, GLint param)
3319 {
3320 GLfloat p[4];
3321 p[0] = (GLfloat) param;
3322 p[1] = p[2] = p[3] = 0.0;
3323 save_TexEnvfv(target, pname, p);
3324 }
3325
3326
3327 static void GLAPIENTRY
3328 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
3329 {
3330 GLfloat p[4];
3331 if (pname == GL_TEXTURE_ENV_COLOR) {
3332 p[0] = INT_TO_FLOAT(param[0]);
3333 p[1] = INT_TO_FLOAT(param[1]);
3334 p[2] = INT_TO_FLOAT(param[2]);
3335 p[3] = INT_TO_FLOAT(param[3]);
3336 }
3337 else {
3338 p[0] = (GLfloat) param[0];
3339 p[1] = p[2] = p[3] = 0.0F;
3340 }
3341 save_TexEnvfv(target, pname, p);
3342 }
3343
3344
3345 static void GLAPIENTRY
3346 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
3347 {
3348 GET_CURRENT_CONTEXT(ctx);
3349 Node *n;
3350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3351 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXGEN, 6);
3352 if (n) {
3353 n[1].e = coord;
3354 n[2].e = pname;
3355 n[3].f = params[0];
3356 n[4].f = params[1];
3357 n[5].f = params[2];
3358 n[6].f = params[3];
3359 }
3360 if (ctx->ExecuteFlag) {
3361 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
3362 }
3363 }
3364
3365
3366 static void GLAPIENTRY
3367 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
3368 {
3369 GLfloat p[4];
3370 p[0] = (GLfloat) params[0];
3371 p[1] = (GLfloat) params[1];
3372 p[2] = (GLfloat) params[2];
3373 p[3] = (GLfloat) params[3];
3374 save_TexGenfv(coord, pname, p);
3375 }
3376
3377
3378 static void GLAPIENTRY
3379 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
3380 {
3381 GLfloat p = (GLfloat) param;
3382 save_TexGenfv(coord, pname, &p);
3383 }
3384
3385
3386 static void GLAPIENTRY
3387 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
3388 {
3389 GLfloat p[4];
3390 p[0] = (GLfloat) params[0];
3391 p[1] = (GLfloat) params[1];
3392 p[2] = (GLfloat) params[2];
3393 p[3] = (GLfloat) params[3];
3394 save_TexGenfv(coord, pname, p);
3395 }
3396
3397
3398 static void GLAPIENTRY
3399 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
3400 {
3401 save_TexGenfv(coord, pname, &param);
3402 }
3403
3404
3405 static void GLAPIENTRY
3406 save_TexGeni(GLenum coord, GLenum pname, GLint param)
3407 {
3408 save_TexGeniv(coord, pname, &param);
3409 }
3410
3411
3412 static void GLAPIENTRY
3413 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
3414 {
3415 GET_CURRENT_CONTEXT(ctx);
3416 Node *n;
3417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3418 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXPARAMETER, 6);
3419 if (n) {
3420 n[1].e = target;
3421 n[2].e = pname;
3422 n[3].f = params[0];
3423 n[4].f = params[1];
3424 n[5].f = params[2];
3425 n[6].f = params[3];
3426 }
3427 if (ctx->ExecuteFlag) {
3428 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
3429 }
3430 }
3431
3432
3433 static void GLAPIENTRY
3434 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
3435 {
3436 save_TexParameterfv(target, pname, &param);
3437 }
3438
3439
3440 static void GLAPIENTRY
3441 save_TexParameteri(GLenum target, GLenum pname, GLint param)
3442 {
3443 GLfloat fparam[4];
3444 fparam[0] = (GLfloat) param;
3445 fparam[1] = fparam[2] = fparam[3] = 0.0;
3446 save_TexParameterfv(target, pname, fparam);
3447 }
3448
3449
3450 static void GLAPIENTRY
3451 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
3452 {
3453 GLfloat fparam[4];
3454 fparam[0] = (GLfloat) params[0];
3455 fparam[1] = fparam[2] = fparam[3] = 0.0;
3456 save_TexParameterfv(target, pname, fparam);
3457 }
3458
3459
3460 static void GLAPIENTRY
3461 save_TexImage1D(GLenum target,
3462 GLint level, GLint components,
3463 GLsizei width, GLint border,
3464 GLenum format, GLenum type, const GLvoid * pixels)
3465 {
3466 GET_CURRENT_CONTEXT(ctx);
3467 if (target == GL_PROXY_TEXTURE_1D) {
3468 /* don't compile, execute immediately */
3469 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
3470 border, format, type, pixels));
3471 }
3472 else {
3473 GLvoid *image = unpack_image(1, width, 1, 1, format, type,
3474 pixels, &ctx->Unpack);
3475 Node *n;
3476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3477 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8);
3478 if (n) {
3479 n[1].e = target;
3480 n[2].i = level;
3481 n[3].i = components;
3482 n[4].i = (GLint) width;
3483 n[5].i = border;
3484 n[6].e = format;
3485 n[7].e = type;
3486 n[8].data = image;
3487 }
3488 else if (image) {
3489 _mesa_free(image);
3490 }
3491 if (ctx->ExecuteFlag) {
3492 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
3493 border, format, type, pixels));
3494 }
3495 }
3496 }
3497
3498
3499 static void GLAPIENTRY
3500 save_TexImage2D(GLenum target,
3501 GLint level, GLint components,
3502 GLsizei width, GLsizei height, GLint border,
3503 GLenum format, GLenum type, const GLvoid * pixels)
3504 {
3505 GET_CURRENT_CONTEXT(ctx);
3506 if (target == GL_PROXY_TEXTURE_2D) {
3507 /* don't compile, execute immediately */
3508 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
3509 height, border, format, type, pixels));
3510 }
3511 else {
3512 GLvoid *image = unpack_image(2, width, height, 1, format, type,
3513 pixels, &ctx->Unpack);
3514 Node *n;
3515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3516 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9);
3517 if (n) {
3518 n[1].e = target;
3519 n[2].i = level;
3520 n[3].i = components;
3521 n[4].i = (GLint) width;
3522 n[5].i = (GLint) height;
3523 n[6].i = border;
3524 n[7].e = format;
3525 n[8].e = type;
3526 n[9].data = image;
3527 }
3528 else if (image) {
3529 _mesa_free(image);
3530 }
3531 if (ctx->ExecuteFlag) {
3532 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
3533 height, border, format, type, pixels));
3534 }
3535 }
3536 }
3537
3538
3539 static void GLAPIENTRY
3540 save_TexImage3D(GLenum target,
3541 GLint level, GLint internalFormat,
3542 GLsizei width, GLsizei height, GLsizei depth,
3543 GLint border,
3544 GLenum format, GLenum type, const GLvoid * pixels)
3545 {
3546 GET_CURRENT_CONTEXT(ctx);
3547 if (target == GL_PROXY_TEXTURE_3D) {
3548 /* don't compile, execute immediately */
3549 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
3550 height, depth, border, format, type,
3551 pixels));
3552 }
3553 else {
3554 Node *n;
3555 GLvoid *image = unpack_image(3, width, height, depth, format, type,
3556 pixels, &ctx->Unpack);
3557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3558 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10);
3559 if (n) {
3560 n[1].e = target;
3561 n[2].i = level;
3562 n[3].i = (GLint) internalFormat;
3563 n[4].i = (GLint) width;
3564 n[5].i = (GLint) height;
3565 n[6].i = (GLint) depth;
3566 n[7].i = border;
3567 n[8].e = format;
3568 n[9].e = type;
3569 n[10].data = image;
3570 }
3571 else if (image) {
3572 _mesa_free(image);
3573 }
3574 if (ctx->ExecuteFlag) {
3575 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
3576 height, depth, border, format, type,
3577 pixels));
3578 }
3579 }
3580 }
3581
3582
3583 static void GLAPIENTRY
3584 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
3585 GLsizei width, GLenum format, GLenum type,
3586 const GLvoid * pixels)
3587 {
3588 GET_CURRENT_CONTEXT(ctx);
3589 Node *n;
3590 GLvoid *image = unpack_image(1, width, 1, 1, format, type,
3591 pixels, &ctx->Unpack);
3592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3593 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
3594 if (n) {
3595 n[1].e = target;
3596 n[2].i = level;
3597 n[3].i = xoffset;
3598 n[4].i = (GLint) width;
3599 n[5].e = format;
3600 n[6].e = type;
3601 n[7].data = image;
3602 }
3603 else if (image) {
3604 _mesa_free(image);
3605 }
3606 if (ctx->ExecuteFlag) {
3607 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
3608 format, type, pixels));
3609 }
3610 }
3611
3612
3613 static void GLAPIENTRY
3614 save_TexSubImage2D(GLenum target, GLint level,
3615 GLint xoffset, GLint yoffset,
3616 GLsizei width, GLsizei height,
3617 GLenum format, GLenum type, const GLvoid * pixels)
3618 {
3619 GET_CURRENT_CONTEXT(ctx);
3620 Node *n;
3621 GLvoid *image = unpack_image(2, width, height, 1, format, type,
3622 pixels, &ctx->Unpack);
3623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3624 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
3625 if (n) {
3626 n[1].e = target;
3627 n[2].i = level;
3628 n[3].i = xoffset;
3629 n[4].i = yoffset;
3630 n[5].i = (GLint) width;
3631 n[6].i = (GLint) height;
3632 n[7].e = format;
3633 n[8].e = type;
3634 n[9].data = image;
3635 }
3636 else if (image) {
3637 _mesa_free(image);
3638 }
3639 if (ctx->ExecuteFlag) {
3640 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
3641 width, height, format, type, pixels));
3642 }
3643 }
3644
3645
3646 static void GLAPIENTRY
3647 save_TexSubImage3D(GLenum target, GLint level,
3648 GLint xoffset, GLint yoffset, GLint zoffset,
3649 GLsizei width, GLsizei height, GLsizei depth,
3650 GLenum format, GLenum type, const GLvoid * pixels)
3651 {
3652 GET_CURRENT_CONTEXT(ctx);
3653 Node *n;
3654 GLvoid *image = unpack_image(3, width, height, depth, format, type,
3655 pixels, &ctx->Unpack);
3656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3657 n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
3658 if (n) {
3659 n[1].e = target;
3660 n[2].i = level;
3661 n[3].i = xoffset;
3662 n[4].i = yoffset;
3663 n[5].i = zoffset;
3664 n[6].i = (GLint) width;
3665 n[7].i = (GLint) height;
3666 n[8].i = (GLint) depth;
3667 n[9].e = format;
3668 n[10].e = type;
3669 n[11].data = image;
3670 }
3671 else if (image) {
3672 _mesa_free(image);
3673 }
3674 if (ctx->ExecuteFlag) {
3675 CALL_TexSubImage3D(ctx->Exec, (target, level,
3676 xoffset, yoffset, zoffset,
3677 width, height, depth, format, type,
3678 pixels));
3679 }
3680 }
3681
3682
3683 static void GLAPIENTRY
3684 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
3685 {
3686 GET_CURRENT_CONTEXT(ctx);
3687 Node *n;
3688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3689 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRANSLATE, 3);
3690 if (n) {
3691 n[1].f = x;
3692 n[2].f = y;
3693 n[3].f = z;
3694 }
3695 if (ctx->ExecuteFlag) {
3696 CALL_Translatef(ctx->Exec, (x, y, z));
3697 }
3698 }
3699
3700
3701 static void GLAPIENTRY
3702 save_Translated(GLdouble x, GLdouble y, GLdouble z)
3703 {
3704 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
3705 }
3706
3707
3708
3709 static void GLAPIENTRY
3710 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
3711 {
3712 GET_CURRENT_CONTEXT(ctx);
3713 Node *n;
3714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3715 n = ALLOC_INSTRUCTION(ctx, OPCODE_VIEWPORT, 4);
3716 if (n) {
3717 n[1].i = x;
3718 n[2].i = y;
3719 n[3].i = (GLint) width;
3720 n[4].i = (GLint) height;
3721 }
3722 if (ctx->ExecuteFlag) {
3723 CALL_Viewport(ctx->Exec, (x, y, width, height));
3724 }
3725 }
3726
3727
3728 static void GLAPIENTRY
3729 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3730 {
3731 GET_CURRENT_CONTEXT(ctx);
3732 Node *n;
3733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3734 n = ALLOC_INSTRUCTION(ctx, OPCODE_WINDOW_POS, 4);
3735 if (n) {
3736 n[1].f = x;
3737 n[2].f = y;
3738 n[3].f = z;
3739 n[4].f = w;
3740 }
3741 if (ctx->ExecuteFlag) {
3742 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
3743 }
3744 }
3745
3746 static void GLAPIENTRY
3747 save_WindowPos2dMESA(GLdouble x, GLdouble y)
3748 {
3749 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3750 }
3751
3752 static void GLAPIENTRY
3753 save_WindowPos2fMESA(GLfloat x, GLfloat y)
3754 {
3755 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
3756 }
3757
3758 static void GLAPIENTRY
3759 save_WindowPos2iMESA(GLint x, GLint y)
3760 {
3761 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
3762 }
3763
3764 static void GLAPIENTRY
3765 save_WindowPos2sMESA(GLshort x, GLshort y)
3766 {
3767 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
3768 }
3769
3770 static void GLAPIENTRY
3771 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
3772 {
3773 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3774 }
3775
3776 static void GLAPIENTRY
3777 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
3778 {
3779 save_WindowPos4fMESA(x, y, z, 1.0F);
3780 }
3781
3782 static void GLAPIENTRY
3783 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
3784 {
3785 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
3786 }
3787
3788 static void GLAPIENTRY
3789 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
3790 {
3791 save_WindowPos4fMESA(x, y, z, 1.0F);
3792 }
3793
3794 static void GLAPIENTRY
3795 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
3796 {
3797 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3798 }
3799
3800 static void GLAPIENTRY
3801 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
3802 {
3803 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
3804 }
3805
3806 static void GLAPIENTRY
3807 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
3808 {
3809 save_WindowPos4fMESA(x, y, z, w);
3810 }
3811
3812 static void GLAPIENTRY
3813 save_WindowPos2dvMESA(const GLdouble * v)
3814 {
3815 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3816 }
3817
3818 static void GLAPIENTRY
3819 save_WindowPos2fvMESA(const GLfloat * v)
3820 {
3821 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
3822 }
3823
3824 static void GLAPIENTRY
3825 save_WindowPos2ivMESA(const GLint * v)
3826 {
3827 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
3828 }
3829
3830 static void GLAPIENTRY
3831 save_WindowPos2svMESA(const GLshort * v)
3832 {
3833 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
3834 }
3835
3836 static void GLAPIENTRY
3837 save_WindowPos3dvMESA(const GLdouble * v)
3838 {
3839 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3840 }
3841
3842 static void GLAPIENTRY
3843 save_WindowPos3fvMESA(const GLfloat * v)
3844 {
3845 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
3846 }
3847
3848 static void GLAPIENTRY
3849 save_WindowPos3ivMESA(const GLint * v)
3850 {
3851 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
3852 }
3853
3854 static void GLAPIENTRY
3855 save_WindowPos3svMESA(const GLshort * v)
3856 {
3857 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
3858 }
3859
3860 static void GLAPIENTRY
3861 save_WindowPos4dvMESA(const GLdouble * v)
3862 {
3863 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
3864 (GLfloat) v[2], (GLfloat) v[3]);
3865 }
3866
3867 static void GLAPIENTRY
3868 save_WindowPos4fvMESA(const GLfloat * v)
3869 {
3870 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
3871 }
3872
3873 static void GLAPIENTRY
3874 save_WindowPos4ivMESA(const GLint * v)
3875 {
3876 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
3877 (GLfloat) v[2], (GLfloat) v[3]);
3878 }
3879
3880 static void GLAPIENTRY
3881 save_WindowPos4svMESA(const GLshort * v)
3882 {
3883 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
3884 }
3885
3886
3887
3888 /* GL_ARB_multitexture */
3889 static void GLAPIENTRY
3890 save_ActiveTextureARB(GLenum target)
3891 {
3892 GET_CURRENT_CONTEXT(ctx);
3893 Node *n;
3894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3895 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_TEXTURE, 1);
3896 if (n) {
3897 n[1].e = target;
3898 }
3899 if (ctx->ExecuteFlag) {
3900 CALL_ActiveTextureARB(ctx->Exec, (target));
3901 }
3902 }
3903
3904
3905 /* GL_ARB_transpose_matrix */
3906
3907 static void GLAPIENTRY
3908 save_LoadTransposeMatrixdARB(const GLdouble m[16])
3909 {
3910 GLfloat tm[16];
3911 _math_transposefd(tm, m);
3912 save_LoadMatrixf(tm);
3913 }
3914
3915
3916 static void GLAPIENTRY
3917 save_LoadTransposeMatrixfARB(const GLfloat m[16])
3918 {
3919 GLfloat tm[16];
3920 _math_transposef(tm, m);
3921 save_LoadMatrixf(tm);
3922 }
3923
3924
3925 static void GLAPIENTRY
3926 save_MultTransposeMatrixdARB(const GLdouble m[16])
3927 {
3928 GLfloat tm[16];
3929 _math_transposefd(tm, m);
3930 save_MultMatrixf(tm);
3931 }
3932
3933
3934 static void GLAPIENTRY
3935 save_MultTransposeMatrixfARB(const GLfloat m[16])
3936 {
3937 GLfloat tm[16];
3938 _math_transposef(tm, m);
3939 save_MultMatrixf(tm);
3940 }
3941
3942
3943 /* GL_ARB_texture_compression */
3944 static void GLAPIENTRY
3945 save_CompressedTexImage1DARB(GLenum target, GLint level,
3946 GLenum internalFormat, GLsizei width,
3947 GLint border, GLsizei imageSize,
3948 const GLvoid * data)
3949 {
3950 GET_CURRENT_CONTEXT(ctx);
3951 if (target == GL_PROXY_TEXTURE_1D) {
3952 /* don't compile, execute immediately */
3953 CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat,
3954 width, border, imageSize,
3955 data));
3956 }
3957 else {
3958 Node *n;
3959 GLvoid *image;
3960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3961 /* make copy of image */
3962 image = _mesa_malloc(imageSize);
3963 if (!image) {
3964 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB");
3965 return;
3966 }
3967 MEMCPY(image, data, imageSize);
3968 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
3969 if (n) {
3970 n[1].e = target;
3971 n[2].i = level;
3972 n[3].e = internalFormat;
3973 n[4].i = (GLint) width;
3974 n[5].i = border;
3975 n[6].i = imageSize;
3976 n[7].data = image;
3977 }
3978 else if (image) {
3979 _mesa_free(image);
3980 }
3981 if (ctx->ExecuteFlag) {
3982 CALL_CompressedTexImage1DARB(ctx->Exec,
3983 (target, level, internalFormat, width,
3984 border, imageSize, data));
3985 }
3986 }
3987 }
3988
3989
3990 static void GLAPIENTRY
3991 save_CompressedTexImage2DARB(GLenum target, GLint level,
3992 GLenum internalFormat, GLsizei width,
3993 GLsizei height, GLint border, GLsizei imageSize,
3994 const GLvoid * data)
3995 {
3996 GET_CURRENT_CONTEXT(ctx);
3997 if (target == GL_PROXY_TEXTURE_2D) {
3998 /* don't compile, execute immediately */
3999 CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat,
4000 width, height, border,
4001 imageSize, data));
4002 }
4003 else {
4004 Node *n;
4005 GLvoid *image;
4006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4007 /* make copy of image */
4008 image = _mesa_malloc(imageSize);
4009 if (!image) {
4010 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
4011 return;
4012 }
4013 MEMCPY(image, data, imageSize);
4014 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
4015 if (n) {
4016 n[1].e = target;
4017 n[2].i = level;
4018 n[3].e = internalFormat;
4019 n[4].i = (GLint) width;
4020 n[5].i = (GLint) height;
4021 n[6].i = border;
4022 n[7].i = imageSize;
4023 n[8].data = image;
4024 }
4025 else if (image) {
4026 _mesa_free(image);
4027 }
4028 if (ctx->ExecuteFlag) {
4029 CALL_CompressedTexImage2DARB(ctx->Exec,
4030 (target, level, internalFormat, width,
4031 height, border, imageSize, data));
4032 }
4033 }
4034 }
4035
4036
4037 static void GLAPIENTRY
4038 save_CompressedTexImage3DARB(GLenum target, GLint level,
4039 GLenum internalFormat, GLsizei width,
4040 GLsizei height, GLsizei depth, GLint border,
4041 GLsizei imageSize, const GLvoid * data)
4042 {
4043 GET_CURRENT_CONTEXT(ctx);
4044 if (target == GL_PROXY_TEXTURE_3D) {
4045 /* don't compile, execute immediately */
4046 CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat,
4047 width, height, depth, border,
4048 imageSize, data));
4049 }
4050 else {
4051 Node *n;
4052 GLvoid *image;
4053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4054 /* make copy of image */
4055 image = _mesa_malloc(imageSize);
4056 if (!image) {
4057 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB");
4058 return;
4059 }
4060 MEMCPY(image, data, imageSize);
4061 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
4062 if (n) {
4063 n[1].e = target;
4064 n[2].i = level;
4065 n[3].e = internalFormat;
4066 n[4].i = (GLint) width;
4067 n[5].i = (GLint) height;
4068 n[6].i = (GLint) depth;
4069 n[7].i = border;
4070 n[8].i = imageSize;
4071 n[9].data = image;
4072 }
4073 else if (image) {
4074 _mesa_free(image);
4075 }
4076 if (ctx->ExecuteFlag) {
4077 CALL_CompressedTexImage3DARB(ctx->Exec,
4078 (target, level, internalFormat, width,
4079 height, depth, border, imageSize,
4080 data));
4081 }
4082 }
4083 }
4084
4085
4086 static void GLAPIENTRY
4087 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
4088 GLsizei width, GLenum format,
4089 GLsizei imageSize, const GLvoid * data)
4090 {
4091 Node *n;
4092 GLvoid *image;
4093
4094 GET_CURRENT_CONTEXT(ctx);
4095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4096
4097 /* make copy of image */
4098 image = _mesa_malloc(imageSize);
4099 if (!image) {
4100 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB");
4101 return;
4102 }
4103 MEMCPY(image, data, imageSize);
4104 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
4105 if (n) {
4106 n[1].e = target;
4107 n[2].i = level;
4108 n[3].i = xoffset;
4109 n[4].i = (GLint) width;
4110 n[5].e = format;
4111 n[6].i = imageSize;
4112 n[7].data = image;
4113 }
4114 else if (image) {
4115 _mesa_free(image);
4116 }
4117 if (ctx->ExecuteFlag) {
4118 CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
4119 width, format, imageSize,
4120 data));
4121 }
4122 }
4123
4124
4125 static void GLAPIENTRY
4126 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
4127 GLint yoffset, GLsizei width, GLsizei height,
4128 GLenum format, GLsizei imageSize,
4129 const GLvoid * data)
4130 {
4131 Node *n;
4132 GLvoid *image;
4133
4134 GET_CURRENT_CONTEXT(ctx);
4135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4136
4137 /* make copy of image */
4138 image = _mesa_malloc(imageSize);
4139 if (!image) {
4140 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB");
4141 return;
4142 }
4143 MEMCPY(image, data, imageSize);
4144 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
4145 if (n) {
4146 n[1].e = target;
4147 n[2].i = level;
4148 n[3].i = xoffset;
4149 n[4].i = yoffset;
4150 n[5].i = (GLint) width;
4151 n[6].i = (GLint) height;
4152 n[7].e = format;
4153 n[8].i = imageSize;
4154 n[9].data = image;
4155 }
4156 else if (image) {
4157 _mesa_free(image);
4158 }
4159 if (ctx->ExecuteFlag) {
4160 CALL_CompressedTexSubImage2DARB(ctx->Exec,
4161 (target, level, xoffset, yoffset, width,
4162 height, format, imageSize, data));
4163 }
4164 }
4165
4166
4167 static void GLAPIENTRY
4168 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
4169 GLint yoffset, GLint zoffset, GLsizei width,
4170 GLsizei height, GLsizei depth, GLenum format,
4171 GLsizei imageSize, const GLvoid * data)
4172 {
4173 Node *n;
4174 GLvoid *image;
4175
4176 GET_CURRENT_CONTEXT(ctx);
4177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4178
4179 /* make copy of image */
4180 image = _mesa_malloc(imageSize);
4181 if (!image) {
4182 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB");
4183 return;
4184 }
4185 MEMCPY(image, data, imageSize);
4186 n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
4187 if (n) {
4188 n[1].e = target;
4189 n[2].i = level;
4190 n[3].i = xoffset;
4191 n[4].i = yoffset;
4192 n[5].i = zoffset;
4193 n[6].i = (GLint) width;
4194 n[7].i = (GLint) height;
4195 n[8].i = (GLint) depth;
4196 n[9].e = format;
4197 n[10].i = imageSize;
4198 n[11].data = image;
4199 }
4200 else if (image) {
4201 _mesa_free(image);
4202 }
4203 if (ctx->ExecuteFlag) {
4204 CALL_CompressedTexSubImage3DARB(ctx->Exec,
4205 (target, level, xoffset, yoffset,
4206 zoffset, width, height, depth, format,
4207 imageSize, data));
4208 }
4209 }
4210
4211
4212 /* GL_ARB_multisample */
4213 static void GLAPIENTRY
4214 save_SampleCoverageARB(GLclampf value, GLboolean invert)
4215 {
4216 GET_CURRENT_CONTEXT(ctx);
4217 Node *n;
4218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4219 n = ALLOC_INSTRUCTION(ctx, OPCODE_SAMPLE_COVERAGE, 2);
4220 if (n) {
4221 n[1].f = value;
4222 n[2].b = invert;
4223 }
4224 if (ctx->ExecuteFlag) {
4225 CALL_SampleCoverageARB(ctx->Exec, (value, invert));
4226 }
4227 }
4228
4229
4230 /*
4231 * GL_NV_vertex_program
4232 */
4233 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4234 static void GLAPIENTRY
4235 save_BindProgramNV(GLenum target, GLuint id)
4236 {
4237 GET_CURRENT_CONTEXT(ctx);
4238 Node *n;
4239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4240 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_PROGRAM_NV, 2);
4241 if (n) {
4242 n[1].e = target;
4243 n[2].ui = id;
4244 }
4245 if (ctx->ExecuteFlag) {
4246 CALL_BindProgramNV(ctx->Exec, (target, id));
4247 }
4248 }
4249
4250 static void GLAPIENTRY
4251 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
4252 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4253 {
4254 GET_CURRENT_CONTEXT(ctx);
4255 Node *n;
4256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4257 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
4258 if (n) {
4259 n[1].e = target;
4260 n[2].ui = index;
4261 n[3].f = x;
4262 n[4].f = y;
4263 n[5].f = z;
4264 n[6].f = w;
4265 }
4266 if (ctx->ExecuteFlag) {
4267 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
4268 }
4269 }
4270
4271
4272 static void GLAPIENTRY
4273 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
4274 const GLfloat *params)
4275 {
4276 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
4277 params[2], params[3]);
4278 }
4279
4280
4281 static void GLAPIENTRY
4282 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
4283 const GLfloat * params)
4284 {
4285 GET_CURRENT_CONTEXT(ctx);
4286 Node *n;
4287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4288
4289 if (count > 0) {
4290 GLint i;
4291 const GLfloat * p = params;
4292
4293 for (i = 0 ; i < count ; i++) {
4294 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
4295 if (n) {
4296 n[1].e = target;
4297 n[2].ui = index;
4298 n[3].f = p[0];
4299 n[4].f = p[1];
4300 n[5].f = p[2];
4301 n[6].f = p[3];
4302 p += 4;
4303 }
4304 }
4305 }
4306
4307 if (ctx->ExecuteFlag) {
4308 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
4309 }
4310 }
4311
4312
4313 static void GLAPIENTRY
4314 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
4315 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4316 {
4317 save_ProgramEnvParameter4fARB(target, index,
4318 (GLfloat) x,
4319 (GLfloat) y, (GLfloat) z, (GLfloat) w);
4320 }
4321
4322
4323 static void GLAPIENTRY
4324 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
4325 const GLdouble *params)
4326 {
4327 save_ProgramEnvParameter4fARB(target, index,
4328 (GLfloat) params[0],
4329 (GLfloat) params[1],
4330 (GLfloat) params[2], (GLfloat) params[3]);
4331 }
4332
4333 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */
4334
4335 #if FEATURE_NV_vertex_program
4336 static void GLAPIENTRY
4337 save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
4338 {
4339 GET_CURRENT_CONTEXT(ctx);
4340 Node *n;
4341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4342 n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6);
4343 if (n) {
4344 n[1].e = target;
4345 n[2].ui = id;
4346 n[3].f = params[0];
4347 n[4].f = params[1];
4348 n[5].f = params[2];
4349 n[6].f = params[3];
4350 }
4351 if (ctx->ExecuteFlag) {
4352 CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
4353 }
4354 }
4355
4356
4357 static void GLAPIENTRY
4358 save_ProgramParameters4dvNV(GLenum target, GLuint index,
4359 GLuint num, const GLdouble *params)
4360 {
4361 GLuint i;
4362 for (i = 0; i < num; i++) {
4363 save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i);
4364 }
4365 }
4366
4367
4368 static void GLAPIENTRY
4369 save_ProgramParameters4fvNV(GLenum target, GLuint index,
4370 GLuint num, const GLfloat *params)
4371 {
4372 GLuint i;
4373 for (i = 0; i < num; i++) {
4374 save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i);
4375 }
4376 }
4377
4378
4379 static void GLAPIENTRY
4380 save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
4381 const GLubyte * program)
4382 {
4383 GET_CURRENT_CONTEXT(ctx);
4384 Node *n;
4385 GLubyte *programCopy;
4386
4387 programCopy = (GLubyte *) _mesa_malloc(len);
4388 if (!programCopy) {
4389 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
4390 return;
4391 }
4392 _mesa_memcpy(programCopy, program, len);
4393
4394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4395 n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
4396 if (n) {
4397 n[1].e = target;
4398 n[2].ui = id;
4399 n[3].i = len;
4400 n[4].data = programCopy;
4401 }
4402 if (ctx->ExecuteFlag) {
4403 CALL_LoadProgramNV(ctx->Exec, (target, id, len, program));
4404 }
4405 }
4406
4407
4408 static void GLAPIENTRY
4409 save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
4410 {
4411 GET_CURRENT_CONTEXT(ctx);
4412 Node *n;
4413 GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
4414 if (!idCopy) {
4415 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
4416 return;
4417 }
4418 _mesa_memcpy(idCopy, ids, num * sizeof(GLuint));
4419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4420 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2);
4421 if (n) {
4422 n[1].i = num;
4423 n[2].data = idCopy;
4424 }
4425 if (ctx->ExecuteFlag) {
4426 CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids));
4427 }
4428 }
4429
4430
4431 static void GLAPIENTRY
4432 save_TrackMatrixNV(GLenum target, GLuint address,
4433 GLenum matrix, GLenum transform)
4434 {
4435 GET_CURRENT_CONTEXT(ctx);
4436 Node *n;
4437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4438 n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 4);
4439 if (n) {
4440 n[1].e = target;
4441 n[2].ui = address;
4442 n[3].e = matrix;
4443 n[4].e = transform;
4444 }
4445 if (ctx->ExecuteFlag) {
4446 CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform));
4447 }
4448 }
4449 #endif /* FEATURE_NV_vertex_program */
4450
4451
4452 /*
4453 * GL_NV_fragment_program
4454 */
4455 #if FEATURE_NV_fragment_program
4456 static void GLAPIENTRY
4457 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
4458 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4459 {
4460 GET_CURRENT_CONTEXT(ctx);
4461 Node *n;
4462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4463 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
4464 if (n) {
4465 n[1].e = target;
4466 n[2].ui = index;
4467 n[3].f = x;
4468 n[4].f = y;
4469 n[5].f = z;
4470 n[6].f = w;
4471 }
4472 if (ctx->ExecuteFlag) {
4473 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
4474 }
4475 }
4476
4477
4478 static void GLAPIENTRY
4479 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
4480 const GLfloat *params)
4481 {
4482 GET_CURRENT_CONTEXT(ctx);
4483 Node *n;
4484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4485 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
4486 if (n) {
4487 n[1].e = target;
4488 n[2].ui = index;
4489 n[3].f = params[0];
4490 n[4].f = params[1];
4491 n[5].f = params[2];
4492 n[6].f = params[3];
4493 }
4494 if (ctx->ExecuteFlag) {
4495 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
4496 }
4497 }
4498
4499
4500 static void GLAPIENTRY
4501 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
4502 const GLfloat *params)
4503 {
4504 GET_CURRENT_CONTEXT(ctx);
4505 Node *n;
4506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4507
4508 if (count > 0) {
4509 GLint i;
4510 const GLfloat * p = params;
4511
4512 for (i = 0 ; i < count ; i++) {
4513 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
4514 if (n) {
4515 n[1].e = target;
4516 n[2].ui = index;
4517 n[3].f = p[0];
4518 n[4].f = p[1];
4519 n[5].f = p[2];
4520 n[6].f = p[3];
4521 p += 4;
4522 }
4523 }
4524 }
4525
4526 if (ctx->ExecuteFlag) {
4527 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
4528 }
4529 }
4530
4531
4532 static void GLAPIENTRY
4533 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
4534 GLdouble x, GLdouble y,
4535 GLdouble z, GLdouble w)
4536 {
4537 GET_CURRENT_CONTEXT(ctx);
4538 Node *n;
4539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4540 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
4541 if (n) {
4542 n[1].e = target;
4543 n[2].ui = index;
4544 n[3].f = (GLfloat) x;
4545 n[4].f = (GLfloat) y;
4546 n[5].f = (GLfloat) z;
4547 n[6].f = (GLfloat) w;
4548 }
4549 if (ctx->ExecuteFlag) {
4550 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
4551 }
4552 }
4553
4554
4555 static void GLAPIENTRY
4556 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
4557 const GLdouble *params)
4558 {
4559 GET_CURRENT_CONTEXT(ctx);
4560 Node *n;
4561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4562 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
4563 if (n) {
4564 n[1].e = target;
4565 n[2].ui = index;
4566 n[3].f = (GLfloat) params[0];
4567 n[4].f = (GLfloat) params[1];
4568 n[5].f = (GLfloat) params[2];
4569 n[6].f = (GLfloat) params[3];
4570 }
4571 if (ctx->ExecuteFlag) {
4572 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
4573 }
4574 }
4575
4576 static void GLAPIENTRY
4577 save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
4578 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4579 {
4580 GET_CURRENT_CONTEXT(ctx);
4581 Node *n;
4582 GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
4583 if (!nameCopy) {
4584 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
4585 return;
4586 }
4587 _mesa_memcpy(nameCopy, name, len);
4588
4589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4590 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
4591 if (n) {
4592 n[1].ui = id;
4593 n[2].i = len;
4594 n[3].data = nameCopy;
4595 n[4].f = x;
4596 n[5].f = y;
4597 n[6].f = z;
4598 n[7].f = w;
4599 }
4600 if (ctx->ExecuteFlag) {
4601 CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w));
4602 }
4603 }
4604
4605
4606 static void GLAPIENTRY
4607 save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name,
4608 const float v[])
4609 {
4610 save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]);
4611 }
4612
4613
4614 static void GLAPIENTRY
4615 save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name,
4616 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4617 {
4618 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y,
4619 (GLfloat) z, (GLfloat) w);
4620 }
4621
4622
4623 static void GLAPIENTRY
4624 save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name,
4625 const double v[])
4626 {
4627 save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0],
4628 (GLfloat) v[1], (GLfloat) v[2],
4629 (GLfloat) v[3]);
4630 }
4631
4632 #endif /* FEATURE_NV_fragment_program */
4633
4634
4635
4636 /* GL_EXT_stencil_two_side */
4637 static void GLAPIENTRY
4638 save_ActiveStencilFaceEXT(GLenum face)
4639 {
4640 GET_CURRENT_CONTEXT(ctx);
4641 Node *n;
4642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4643 n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
4644 if (n) {
4645 n[1].e = face;
4646 }
4647 if (ctx->ExecuteFlag) {
4648 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
4649 }
4650 }
4651
4652
4653 /* GL_EXT_depth_bounds_test */
4654 static void GLAPIENTRY
4655 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
4656 {
4657 GET_CURRENT_CONTEXT(ctx);
4658 Node *n;
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4660 n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
4661 if (n) {
4662 n[1].f = (GLfloat) zmin;
4663 n[2].f = (GLfloat) zmax;
4664 }
4665 if (ctx->ExecuteFlag) {
4666 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
4667 }
4668 }
4669
4670
4671
4672 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
4673
4674 static void GLAPIENTRY
4675 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
4676 const GLvoid * string)
4677 {
4678 GET_CURRENT_CONTEXT(ctx);
4679 Node *n;
4680 GLubyte *programCopy;
4681
4682 programCopy = (GLubyte *) _mesa_malloc(len);
4683 if (!programCopy) {
4684 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
4685 return;
4686 }
4687 _mesa_memcpy(programCopy, string, len);
4688
4689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4690 n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
4691 if (n) {
4692 n[1].e = target;
4693 n[2].e = format;
4694 n[3].i = len;
4695 n[4].data = programCopy;
4696 }
4697 if (ctx->ExecuteFlag) {
4698 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
4699 }
4700 }
4701
4702 #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
4703
4704
4705 #if FEATURE_ARB_occlusion_query
4706
4707 static void GLAPIENTRY
4708 save_BeginQueryARB(GLenum target, GLuint id)
4709 {
4710 GET_CURRENT_CONTEXT(ctx);
4711 Node *n;
4712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4713 n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
4714 if (n) {
4715 n[1].e = target;
4716 n[2].ui = id;
4717 }
4718 if (ctx->ExecuteFlag) {
4719 CALL_BeginQueryARB(ctx->Exec, (target, id));
4720 }
4721 }
4722
4723
4724 static void GLAPIENTRY
4725 save_EndQueryARB(GLenum target)
4726 {
4727 GET_CURRENT_CONTEXT(ctx);
4728 Node *n;
4729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4730 n = ALLOC_INSTRUCTION(ctx, OPCODE_END_QUERY_ARB, 1);
4731 if (n) {
4732 n[1].e = target;
4733 }
4734 if (ctx->ExecuteFlag) {
4735 CALL_EndQueryARB(ctx->Exec, (target));
4736 }
4737 }
4738
4739 #endif /* FEATURE_ARB_occlusion_query */
4740
4741
4742 static void GLAPIENTRY
4743 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
4744 {
4745 GET_CURRENT_CONTEXT(ctx);
4746 Node *n;
4747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4748 n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
4749 if (n) {
4750 GLint i;
4751 n[1].i = count;
4752 if (count > MAX_DRAW_BUFFERS)
4753 count = MAX_DRAW_BUFFERS;
4754 for (i = 0; i < count; i++) {
4755 n[2 + i].e = buffers[i];
4756 }
4757 }
4758 if (ctx->ExecuteFlag) {
4759 CALL_DrawBuffersARB(ctx->Exec, (count, buffers));
4760 }
4761 }
4762
4763 #if FEATURE_ATI_fragment_shader
4764 static void GLAPIENTRY
4765 save_BindFragmentShaderATI(GLuint id)
4766 {
4767 GET_CURRENT_CONTEXT(ctx);
4768 Node *n;
4769
4770 n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
4771 if (n) {
4772 n[1].ui = id;
4773 }
4774 if (ctx->ExecuteFlag) {
4775 CALL_BindFragmentShaderATI(ctx->Exec, (id));
4776 }
4777 }
4778
4779 static void GLAPIENTRY
4780 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
4781 {
4782 GET_CURRENT_CONTEXT(ctx);
4783 Node *n;
4784
4785 n = ALLOC_INSTRUCTION(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
4786 if (n) {
4787 n[1].ui = dst;
4788 n[2].f = value[0];
4789 n[3].f = value[1];
4790 n[4].f = value[2];
4791 n[5].f = value[3];
4792 }
4793 if (ctx->ExecuteFlag) {
4794 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
4795 }
4796 }
4797 #endif
4798
4799 static void
4800 save_Attr1fNV(GLenum attr, GLfloat x)
4801 {
4802 GET_CURRENT_CONTEXT(ctx);
4803 Node *n;
4804 SAVE_FLUSH_VERTICES(ctx);
4805 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_NV, 2);
4806 if (n) {
4807 n[1].e = attr;
4808 n[2].f = x;
4809 }
4810
4811 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
4812 ctx->ListState.ActiveAttribSize[attr] = 1;
4813 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
4814
4815 if (ctx->ExecuteFlag) {
4816 CALL_VertexAttrib1fNV(ctx->Exec, (attr, x));
4817 }
4818 }
4819
4820 static void
4821 save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y)
4822 {
4823 GET_CURRENT_CONTEXT(ctx);
4824 Node *n;
4825 SAVE_FLUSH_VERTICES(ctx);
4826 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_NV, 3);
4827 if (n) {
4828 n[1].e = attr;
4829 n[2].f = x;
4830 n[3].f = y;
4831 }
4832
4833 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
4834 ctx->ListState.ActiveAttribSize[attr] = 2;
4835 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
4836
4837 if (ctx->ExecuteFlag) {
4838 CALL_VertexAttrib2fNV(ctx->Exec, (attr, x, y));
4839 }
4840 }
4841
4842 static void
4843 save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
4844 {
4845 GET_CURRENT_CONTEXT(ctx);
4846 Node *n;
4847 SAVE_FLUSH_VERTICES(ctx);
4848 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_NV, 4);
4849 if (n) {
4850 n[1].e = attr;
4851 n[2].f = x;
4852 n[3].f = y;
4853 n[4].f = z;
4854 }
4855
4856 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
4857 ctx->ListState.ActiveAttribSize[attr] = 3;
4858 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
4859
4860 if (ctx->ExecuteFlag) {
4861 CALL_VertexAttrib3fNV(ctx->Exec, (attr, x, y, z));
4862 }
4863 }
4864
4865 static void
4866 save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4867 {
4868 GET_CURRENT_CONTEXT(ctx);
4869 Node *n;
4870 SAVE_FLUSH_VERTICES(ctx);
4871 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_NV, 5);
4872 if (n) {
4873 n[1].e = attr;
4874 n[2].f = x;
4875 n[3].f = y;
4876 n[4].f = z;
4877 n[5].f = w;
4878 }
4879
4880 ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS);
4881 ctx->ListState.ActiveAttribSize[attr] = 4;
4882 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
4883
4884 if (ctx->ExecuteFlag) {
4885 CALL_VertexAttrib4fNV(ctx->Exec, (attr, x, y, z, w));
4886 }
4887 }
4888
4889
4890 static void
4891 save_Attr1fARB(GLenum attr, GLfloat x)
4892 {
4893 GET_CURRENT_CONTEXT(ctx);
4894 Node *n;
4895 SAVE_FLUSH_VERTICES(ctx);
4896 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_ARB, 2);
4897 if (n) {
4898 n[1].e = attr;
4899 n[2].f = x;
4900 }
4901
4902 ASSERT(attr < MAX_VERTEX_ATTRIBS);
4903 ctx->ListState.ActiveAttribSize[attr] = 1;
4904 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
4905
4906 if (ctx->ExecuteFlag) {
4907 CALL_VertexAttrib1fARB(ctx->Exec, (attr, x));
4908 }
4909 }
4910
4911 static void
4912 save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y)
4913 {
4914 GET_CURRENT_CONTEXT(ctx);
4915 Node *n;
4916 SAVE_FLUSH_VERTICES(ctx);
4917 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_ARB, 3);
4918 if (n) {
4919 n[1].e = attr;
4920 n[2].f = x;
4921 n[3].f = y;
4922 }
4923
4924 ASSERT(attr < MAX_VERTEX_ATTRIBS);
4925 ctx->ListState.ActiveAttribSize[attr] = 2;
4926 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
4927
4928 if (ctx->ExecuteFlag) {
4929 CALL_VertexAttrib2fARB(ctx->Exec, (attr, x, y));
4930 }
4931 }
4932
4933 static void
4934 save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z)
4935 {
4936 GET_CURRENT_CONTEXT(ctx);
4937 Node *n;
4938 SAVE_FLUSH_VERTICES(ctx);
4939 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_ARB, 4);
4940 if (n) {
4941 n[1].e = attr;
4942 n[2].f = x;
4943 n[3].f = y;
4944 n[4].f = z;
4945 }
4946
4947 ASSERT(attr < MAX_VERTEX_ATTRIBS);
4948 ctx->ListState.ActiveAttribSize[attr] = 3;
4949 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
4950
4951 if (ctx->ExecuteFlag) {
4952 CALL_VertexAttrib3fARB(ctx->Exec, (attr, x, y, z));
4953 }
4954 }
4955
4956 static void
4957 save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4958 {
4959 GET_CURRENT_CONTEXT(ctx);
4960 Node *n;
4961 SAVE_FLUSH_VERTICES(ctx);
4962 n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_ARB, 5);
4963 if (n) {
4964 n[1].e = attr;
4965 n[2].f = x;
4966 n[3].f = y;
4967 n[4].f = z;
4968 n[5].f = w;
4969 }
4970
4971 ASSERT(attr < MAX_VERTEX_ATTRIBS);
4972 ctx->ListState.ActiveAttribSize[attr] = 4;
4973 ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w);
4974
4975 if (ctx->ExecuteFlag) {
4976 CALL_VertexAttrib4fARB(ctx->Exec, (attr, x, y, z, w));
4977 }
4978 }
4979
4980
4981 static void GLAPIENTRY
4982 save_EvalCoord1f(GLfloat x)
4983 {
4984 GET_CURRENT_CONTEXT(ctx);
4985 Node *n;
4986 SAVE_FLUSH_VERTICES(ctx);
4987 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C1, 1);
4988 if (n) {
4989 n[1].f = x;
4990 }
4991 if (ctx->ExecuteFlag) {
4992 CALL_EvalCoord1f(ctx->Exec, (x));
4993 }
4994 }
4995
4996 static void GLAPIENTRY
4997 save_EvalCoord1fv(const GLfloat * v)
4998 {
4999 save_EvalCoord1f(v[0]);
5000 }
5001
5002 static void GLAPIENTRY
5003 save_EvalCoord2f(GLfloat x, GLfloat y)
5004 {
5005 GET_CURRENT_CONTEXT(ctx);
5006 Node *n;
5007 SAVE_FLUSH_VERTICES(ctx);
5008 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C2, 2);
5009 if (n) {
5010 n[1].f = x;
5011 n[2].f = y;
5012 }
5013 if (ctx->ExecuteFlag) {
5014 CALL_EvalCoord2f(ctx->Exec, (x, y));
5015 }
5016 }
5017
5018 static void GLAPIENTRY
5019 save_EvalCoord2fv(const GLfloat * v)
5020 {
5021 save_EvalCoord2f(v[0], v[1]);
5022 }
5023
5024
5025 static void GLAPIENTRY
5026 save_EvalPoint1(GLint x)
5027 {
5028 GET_CURRENT_CONTEXT(ctx);
5029 Node *n;
5030 SAVE_FLUSH_VERTICES(ctx);
5031 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P1, 1);
5032 if (n) {
5033 n[1].i = x;
5034 }
5035 if (ctx->ExecuteFlag) {
5036 CALL_EvalPoint1(ctx->Exec, (x));
5037 }
5038 }
5039
5040 static void GLAPIENTRY
5041 save_EvalPoint2(GLint x, GLint y)
5042 {
5043 GET_CURRENT_CONTEXT(ctx);
5044 Node *n;
5045 SAVE_FLUSH_VERTICES(ctx);
5046 n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P2, 2);
5047 if (n) {
5048 n[1].i = x;
5049 n[2].i = y;
5050 }
5051 if (ctx->ExecuteFlag) {
5052 CALL_EvalPoint2(ctx->Exec, (x, y));
5053 }
5054 }
5055
5056 static void GLAPIENTRY
5057 save_Indexf(GLfloat x)
5058 {
5059 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x);
5060 }
5061
5062 static void GLAPIENTRY
5063 save_Indexfv(const GLfloat * v)
5064 {
5065 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]);
5066 }
5067
5068 static void GLAPIENTRY
5069 save_EdgeFlag(GLboolean x)
5070 {
5071 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0);
5072 }
5073
5074 static void GLAPIENTRY
5075 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
5076 {
5077 GET_CURRENT_CONTEXT(ctx);
5078 Node *n;
5079 int args, i;
5080
5081 SAVE_FLUSH_VERTICES(ctx);
5082
5083 switch (face) {
5084 case GL_BACK:
5085 case GL_FRONT:
5086 case GL_FRONT_AND_BACK:
5087 break;
5088 default:
5089 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(face)");
5090 return;
5091 }
5092
5093 switch (pname) {
5094 case GL_EMISSION:
5095 case GL_AMBIENT:
5096 case GL_DIFFUSE:
5097 case GL_SPECULAR:
5098 case GL_AMBIENT_AND_DIFFUSE:
5099 args = 4;
5100 break;
5101 case GL_SHININESS:
5102 args = 1;
5103 break;
5104 case GL_COLOR_INDEXES:
5105 args = 3;
5106 break;
5107 default:
5108 _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
5109 return;
5110 }
5111
5112 n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6);
5113 if (n) {
5114 n[1].e = face;
5115 n[2].e = pname;
5116 for (i = 0; i < args; i++)
5117 n[3 + i].f = param[i];
5118 }
5119
5120 {
5121 GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
5122 for (i = 0; i < MAT_ATTRIB_MAX; i++)
5123 if (bitmask & (1 << i)) {
5124 ctx->ListState.ActiveMaterialSize[i] = args;
5125 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
5126 }
5127 }
5128
5129 if (ctx->ExecuteFlag) {
5130 CALL_Materialfv(ctx->Exec, (face, pname, param));
5131 }
5132 }
5133
5134 static void GLAPIENTRY
5135 save_Begin(GLenum mode)
5136 {
5137 GET_CURRENT_CONTEXT(ctx);
5138 Node *n;
5139 GLboolean error = GL_FALSE;
5140
5141 if ( /*mode < GL_POINTS || */ mode > GL_POLYGON) {
5142 _mesa_compile_error(ctx, GL_INVALID_ENUM, "Begin (mode)");
5143 error = GL_TRUE;
5144 }
5145 else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
5146 /* Typically the first begin. This may raise an error on
5147 * playback, depending on whether CallList is issued from inside
5148 * a begin/end or not.
5149 */
5150 ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
5151 }
5152 else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
5153 ctx->Driver.CurrentSavePrimitive = mode;
5154 }
5155 else {
5156 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin");
5157 error = GL_TRUE;
5158 }
5159
5160 if (!error) {
5161 /* Give the driver an opportunity to hook in an optimized
5162 * display list compiler.
5163 */
5164 if (ctx->Driver.NotifySaveBegin(ctx, mode))
5165 return;
5166
5167 SAVE_FLUSH_VERTICES(ctx);
5168 n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN, 1);
5169 if (n) {
5170 n[1].e = mode;
5171 }
5172 }
5173
5174 if (ctx->ExecuteFlag) {
5175 CALL_Begin(ctx->Exec, (mode));
5176 }
5177 }
5178
5179 static void GLAPIENTRY
5180 save_End(void)
5181 {
5182 GET_CURRENT_CONTEXT(ctx);
5183 SAVE_FLUSH_VERTICES(ctx);
5184 (void) ALLOC_INSTRUCTION(ctx, OPCODE_END, 0);
5185 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
5186 if (ctx->ExecuteFlag) {
5187 CALL_End(ctx->Exec, ());
5188 }
5189 }
5190
5191 static void GLAPIENTRY
5192 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
5193 {
5194 GET_CURRENT_CONTEXT(ctx);
5195 Node *n;
5196 SAVE_FLUSH_VERTICES(ctx);
5197 n = ALLOC_INSTRUCTION(ctx, OPCODE_RECTF, 4);
5198 if (n) {
5199 n[1].f = a;
5200 n[2].f = b;
5201 n[3].f = c;
5202 n[4].f = d;
5203 }
5204 if (ctx->ExecuteFlag) {
5205 CALL_Rectf(ctx->Exec, (a, b, c, d));
5206 }
5207 }
5208
5209
5210 static void GLAPIENTRY
5211 save_Vertex2f(GLfloat x, GLfloat y)
5212 {
5213 save_Attr2fNV(VERT_ATTRIB_POS, x, y);
5214 }
5215
5216 static void GLAPIENTRY
5217 save_Vertex2fv(const GLfloat * v)
5218 {
5219 save_Attr2fNV(VERT_ATTRIB_POS, v[0], v[1]);
5220 }
5221
5222 static void GLAPIENTRY
5223 save_Vertex3f(GLfloat x, GLfloat y, GLfloat z)
5224 {
5225 save_Attr3fNV(VERT_ATTRIB_POS, x, y, z);
5226 }
5227
5228 static void GLAPIENTRY
5229 save_Vertex3fv(const GLfloat * v)
5230 {
5231 save_Attr3fNV(VERT_ATTRIB_POS, v[0], v[1], v[2]);
5232 }
5233
5234 static void GLAPIENTRY
5235 save_Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5236 {
5237 save_Attr4fNV(VERT_ATTRIB_POS, x, y, z, w);
5238 }
5239
5240 static void GLAPIENTRY
5241 save_Vertex4fv(const GLfloat * v)
5242 {
5243 save_Attr4fNV(VERT_ATTRIB_POS, v[0], v[1], v[2], v[3]);
5244 }
5245
5246 static void GLAPIENTRY
5247 save_TexCoord1f(GLfloat x)
5248 {
5249 save_Attr1fNV(VERT_ATTRIB_TEX0, x);
5250 }
5251
5252 static void GLAPIENTRY
5253 save_TexCoord1fv(const GLfloat * v)
5254 {
5255 save_Attr1fNV(VERT_ATTRIB_TEX0, v[0]);
5256 }
5257
5258 static void GLAPIENTRY
5259 save_TexCoord2f(GLfloat x, GLfloat y)
5260 {
5261 save_Attr2fNV(VERT_ATTRIB_TEX0, x, y);
5262 }
5263
5264 static void GLAPIENTRY
5265 save_TexCoord2fv(const GLfloat * v)
5266 {
5267 save_Attr2fNV(VERT_ATTRIB_TEX0, v[0], v[1]);
5268 }
5269
5270 static void GLAPIENTRY
5271 save_TexCoord3f(GLfloat x, GLfloat y, GLfloat z)
5272 {
5273 save_Attr3fNV(VERT_ATTRIB_TEX0, x, y, z);
5274 }
5275
5276 static void GLAPIENTRY
5277 save_TexCoord3fv(const GLfloat * v)
5278 {
5279 save_Attr3fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2]);
5280 }
5281
5282 static void GLAPIENTRY
5283 save_TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5284 {
5285 save_Attr4fNV(VERT_ATTRIB_TEX0, x, y, z, w);
5286 }
5287
5288 static void GLAPIENTRY
5289 save_TexCoord4fv(const GLfloat * v)
5290 {
5291 save_Attr4fNV(VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3]);
5292 }
5293
5294 static void GLAPIENTRY
5295 save_Normal3f(GLfloat x, GLfloat y, GLfloat z)
5296 {
5297 save_Attr3fNV(VERT_ATTRIB_NORMAL, x, y, z);
5298 }
5299
5300 static void GLAPIENTRY
5301 save_Normal3fv(const GLfloat * v)
5302 {
5303 save_Attr3fNV(VERT_ATTRIB_NORMAL, v[0], v[1], v[2]);
5304 }
5305
5306 static void GLAPIENTRY
5307 save_FogCoordfEXT(GLfloat x)
5308 {
5309 save_Attr1fNV(VERT_ATTRIB_FOG, x);
5310 }
5311
5312 static void GLAPIENTRY
5313 save_FogCoordfvEXT(const GLfloat * v)
5314 {
5315 save_Attr1fNV(VERT_ATTRIB_FOG, v[0]);
5316 }
5317
5318 static void GLAPIENTRY
5319 save_Color3f(GLfloat x, GLfloat y, GLfloat z)
5320 {
5321 save_Attr3fNV(VERT_ATTRIB_COLOR0, x, y, z);
5322 }
5323
5324 static void GLAPIENTRY
5325 save_Color3fv(const GLfloat * v)
5326 {
5327 save_Attr3fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2]);
5328 }
5329
5330 static void GLAPIENTRY
5331 save_Color4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5332 {
5333 save_Attr4fNV(VERT_ATTRIB_COLOR0, x, y, z, w);
5334 }
5335
5336 static void GLAPIENTRY
5337 save_Color4fv(const GLfloat * v)
5338 {
5339 save_Attr4fNV(VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3]);
5340 }
5341
5342 static void GLAPIENTRY
5343 save_SecondaryColor3fEXT(GLfloat x, GLfloat y, GLfloat z)
5344 {
5345 save_Attr3fNV(VERT_ATTRIB_COLOR1, x, y, z);
5346 }
5347
5348 static void GLAPIENTRY
5349 save_SecondaryColor3fvEXT(const GLfloat * v)
5350 {
5351 save_Attr3fNV(VERT_ATTRIB_COLOR1, v[0], v[1], v[2]);
5352 }
5353
5354
5355 /* Just call the respective ATTR for texcoord
5356 */
5357 static void GLAPIENTRY
5358 save_MultiTexCoord1f(GLenum target, GLfloat x)
5359 {
5360 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5361 save_Attr1fNV(attr, x);
5362 }
5363
5364 static void GLAPIENTRY
5365 save_MultiTexCoord1fv(GLenum target, const GLfloat * v)
5366 {
5367 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5368 save_Attr1fNV(attr, v[0]);
5369 }
5370
5371 static void GLAPIENTRY
5372 save_MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y)
5373 {
5374 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5375 save_Attr2fNV(attr, x, y);
5376 }
5377
5378 static void GLAPIENTRY
5379 save_MultiTexCoord2fv(GLenum target, const GLfloat * v)
5380 {
5381 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5382 save_Attr2fNV(attr, v[0], v[1]);
5383 }
5384
5385 static void GLAPIENTRY
5386 save_MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z)
5387 {
5388 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5389 save_Attr3fNV(attr, x, y, z);
5390 }
5391
5392 static void GLAPIENTRY
5393 save_MultiTexCoord3fv(GLenum target, const GLfloat * v)
5394 {
5395 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5396 save_Attr3fNV(attr, v[0], v[1], v[2]);
5397 }
5398
5399 static void GLAPIENTRY
5400 save_MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y,
5401 GLfloat z, GLfloat w)
5402 {
5403 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5404 save_Attr4fNV(attr, x, y, z, w);
5405 }
5406
5407 static void GLAPIENTRY
5408 save_MultiTexCoord4fv(GLenum target, const GLfloat * v)
5409 {
5410 GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
5411 save_Attr4fNV(attr, v[0], v[1], v[2], v[3]);
5412 }
5413
5414
5415 /**
5416 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5417 * index is found.
5418 */
5419 static void
5420 index_error(void)
5421 {
5422 GET_CURRENT_CONTEXT(ctx);
5423 _mesa_error(ctx, GL_INVALID_VALUE, "VertexAttribf(index)");
5424 }
5425
5426
5427 /* First level for NV_vertex_program:
5428 *
5429 * Check for errors at compile time?.
5430 */
5431 static void GLAPIENTRY
5432 save_VertexAttrib1fNV(GLuint index, GLfloat x)
5433 {
5434 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5435 save_Attr1fNV(index, x);
5436 else
5437 index_error();
5438 }
5439
5440 static void GLAPIENTRY
5441 save_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
5442 {
5443 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5444 save_Attr1fNV(index, v[0]);
5445 else
5446 index_error();
5447 }
5448
5449 static void GLAPIENTRY
5450 save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
5451 {
5452 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5453 save_Attr2fNV(index, x, y);
5454 else
5455 index_error();
5456 }
5457
5458 static void GLAPIENTRY
5459 save_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
5460 {
5461 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5462 save_Attr2fNV(index, v[0], v[1]);
5463 else
5464 index_error();
5465 }
5466
5467 static void GLAPIENTRY
5468 save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
5469 {
5470 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5471 save_Attr3fNV(index, x, y, z);
5472 else
5473 index_error();
5474 }
5475
5476 static void GLAPIENTRY
5477 save_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
5478 {
5479 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5480 save_Attr3fNV(index, v[0], v[1], v[2]);
5481 else
5482 index_error();
5483 }
5484
5485 static void GLAPIENTRY
5486 save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y,
5487 GLfloat z, GLfloat w)
5488 {
5489 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5490 save_Attr4fNV(index, x, y, z, w);
5491 else
5492 index_error();
5493 }
5494
5495 static void GLAPIENTRY
5496 save_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
5497 {
5498 if (index < MAX_VERTEX_PROGRAM_ATTRIBS)
5499 save_Attr4fNV(index, v[0], v[1], v[2], v[3]);
5500 else
5501 index_error();
5502 }
5503
5504
5505
5506
5507 static void GLAPIENTRY
5508 save_VertexAttrib1fARB(GLuint index, GLfloat x)
5509 {
5510 if (index < MAX_VERTEX_ATTRIBS)
5511 save_Attr1fARB(index, x);
5512 else
5513 index_error();
5514 }
5515
5516 static void GLAPIENTRY
5517 save_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
5518 {
5519 if (index < MAX_VERTEX_ATTRIBS)
5520 save_Attr1fARB(index, v[0]);
5521 else
5522 index_error();
5523 }
5524
5525 static void GLAPIENTRY
5526 save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
5527 {
5528 if (index < MAX_VERTEX_ATTRIBS)
5529 save_Attr2fARB(index, x, y);
5530 else
5531 index_error();
5532 }
5533
5534 static void GLAPIENTRY
5535 save_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
5536 {
5537 if (index < MAX_VERTEX_ATTRIBS)
5538 save_Attr2fARB(index, v[0], v[1]);
5539 else
5540 index_error();
5541 }
5542
5543 static void GLAPIENTRY
5544 save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
5545 {
5546 if (index < MAX_VERTEX_ATTRIBS)
5547 save_Attr3fARB(index, x, y, z);
5548 else
5549 index_error();
5550 }
5551
5552 static void GLAPIENTRY
5553 save_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
5554 {
5555 if (index < MAX_VERTEX_ATTRIBS)
5556 save_Attr3fARB(index, v[0], v[1], v[2]);
5557 else
5558 index_error();
5559 }
5560
5561 static void GLAPIENTRY
5562 save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z,
5563 GLfloat w)
5564 {
5565 if (index < MAX_VERTEX_ATTRIBS)
5566 save_Attr4fARB(index, x, y, z, w);
5567 else
5568 index_error();
5569 }
5570
5571 static void GLAPIENTRY
5572 save_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
5573 {
5574 if (index < MAX_VERTEX_ATTRIBS)
5575 save_Attr4fARB(index, v[0], v[1], v[2], v[3]);
5576 else
5577 index_error();
5578 }
5579
5580
5581 #if FEATURE_EXT_framebuffer_blit
5582 static void GLAPIENTRY
5583 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
5584 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
5585 GLbitfield mask, GLenum filter)
5586 {
5587 GET_CURRENT_CONTEXT(ctx);
5588 Node *n;
5589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5590 n = ALLOC_INSTRUCTION(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
5591 if (n) {
5592 n[1].i = srcX0;
5593 n[2].i = srcY0;
5594 n[3].i = srcX1;
5595 n[4].i = srcY1;
5596 n[5].i = dstX0;
5597 n[6].i = dstY0;
5598 n[7].i = dstX1;
5599 n[8].i = dstY1;
5600 n[9].i = mask;
5601 n[10].e = filter;
5602 }
5603 if (ctx->ExecuteFlag) {
5604 CALL_BlitFramebufferEXT(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
5605 dstX0, dstY0, dstX1, dstY1,
5606 mask, filter));
5607 }
5608 }
5609 #endif
5610
5611
5612 /**
5613 * Save an error-generating command into display list.
5614 *
5615 * KW: Will appear in the list before the vertex buffer containing the
5616 * command that provoked the error. I don't see this as a problem.
5617 */
5618 static void
5619 save_error(GLcontext *ctx, GLenum error, const char *s)
5620 {
5621 Node *n;
5622 n = ALLOC_INSTRUCTION(ctx, OPCODE_ERROR, 2);
5623 if (n) {
5624 n[1].e = error;
5625 n[2].data = (void *) s;
5626 }
5627 }
5628
5629
5630 /**
5631 * Compile an error into current display list.
5632 */
5633 void
5634 _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s)
5635 {
5636 if (ctx->CompileFlag)
5637 save_error(ctx, error, s);
5638 if (ctx->ExecuteFlag)
5639 _mesa_error(ctx, error, s);
5640 }
5641
5642
5643 /**
5644 * Test if ID names a display list.
5645 */
5646 static GLboolean
5647 islist(GLcontext *ctx, GLuint list)
5648 {
5649 if (list > 0 && lookup_list(ctx, list)) {
5650 return GL_TRUE;
5651 }
5652 else {
5653 return GL_FALSE;
5654 }
5655 }
5656
5657
5658
5659 /**********************************************************************/
5660 /* Display list execution */
5661 /**********************************************************************/
5662
5663
5664 /*
5665 * Execute a display list. Note that the ListBase offset must have already
5666 * been added before calling this function. I.e. the list argument is
5667 * the absolute list number, not relative to ListBase.
5668 * \param list - display list number
5669 */
5670 static void
5671 execute_list(GLcontext *ctx, GLuint list)
5672 {
5673 struct mesa_display_list *dlist;
5674 Node *n;
5675 GLboolean done;
5676
5677 if (list == 0 || !islist(ctx, list))
5678 return;
5679
5680 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
5681 /* raise an error? */
5682 return;
5683 }
5684
5685 dlist = lookup_list(ctx, list);
5686 if (!dlist)
5687 return;
5688
5689 ctx->ListState.CallDepth++;
5690
5691 if (ctx->Driver.BeginCallList)
5692 ctx->Driver.BeginCallList(ctx, dlist);
5693
5694 n = dlist->node;
5695
5696 done = GL_FALSE;
5697 while (!done) {
5698 OpCode opcode = n[0].opcode;
5699 int i = (int) n[0].opcode - (int) OPCODE_EXT_0;
5700
5701 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
5702 /* this is a driver-extended opcode */
5703 ctx->ListExt.Opcode[i].Execute(ctx, &n[1]);
5704 n += ctx->ListExt.Opcode[i].Size;
5705 }
5706 else {
5707 switch (opcode) {
5708 case OPCODE_ERROR:
5709 _mesa_error(ctx, n[1].e, (const char *) n[2].data);
5710 break;
5711 case OPCODE_ACCUM:
5712 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
5713 break;
5714 case OPCODE_ALPHA_FUNC:
5715 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
5716 break;
5717 case OPCODE_BIND_TEXTURE:
5718 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
5719 break;
5720 case OPCODE_BITMAP:
5721 {
5722 const struct gl_pixelstore_attrib save = ctx->Unpack;
5723 ctx->Unpack = ctx->DefaultPacking;
5724 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
5725 n[3].f, n[4].f, n[5].f, n[6].f,
5726 (const GLubyte *) n[7].data));
5727 ctx->Unpack = save; /* restore */
5728 }
5729 break;
5730 case OPCODE_BLEND_COLOR:
5731 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
5732 break;
5733 case OPCODE_BLEND_EQUATION:
5734 CALL_BlendEquation(ctx->Exec, (n[1].e));
5735 break;
5736 case OPCODE_BLEND_EQUATION_SEPARATE:
5737 CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e));
5738 break;
5739 case OPCODE_BLEND_FUNC_SEPARATE:
5740 CALL_BlendFuncSeparateEXT(ctx->Exec,
5741 (n[1].e, n[2].e, n[3].e, n[4].e));
5742 break;
5743 case OPCODE_CALL_LIST:
5744 /* Generated by glCallList(), don't add ListBase */
5745 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
5746 execute_list(ctx, n[1].ui);
5747 }
5748 break;
5749 case OPCODE_CALL_LIST_OFFSET:
5750 /* Generated by glCallLists() so we must add ListBase */
5751 if (n[2].b) {
5752 /* user specified a bad data type at compile time */
5753 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
5754 }
5755 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
5756 execute_list(ctx, ctx->List.ListBase + n[1].ui);
5757 }
5758 break;
5759 case OPCODE_CLEAR:
5760 CALL_Clear(ctx->Exec, (n[1].bf));
5761 break;
5762 case OPCODE_CLEAR_COLOR:
5763 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
5764 break;
5765 case OPCODE_CLEAR_ACCUM:
5766 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
5767 break;
5768 case OPCODE_CLEAR_DEPTH:
5769 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
5770 break;
5771 case OPCODE_CLEAR_INDEX:
5772 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
5773 break;
5774 case OPCODE_CLEAR_STENCIL:
5775 CALL_ClearStencil(ctx->Exec, (n[1].i));
5776 break;
5777 case OPCODE_CLIP_PLANE:
5778 {
5779 GLdouble eq[4];
5780 eq[0] = n[2].f;
5781 eq[1] = n[3].f;
5782 eq[2] = n[4].f;
5783 eq[3] = n[5].f;
5784 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
5785 }
5786 break;
5787 case OPCODE_COLOR_MASK:
5788 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
5789 break;
5790 case OPCODE_COLOR_MATERIAL:
5791 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
5792 break;
5793 case OPCODE_COLOR_TABLE:
5794 {
5795 const struct gl_pixelstore_attrib save = ctx->Unpack;
5796 ctx->Unpack = ctx->DefaultPacking;
5797 CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e,
5798 n[5].e, n[6].data));
5799 ctx->Unpack = save; /* restore */
5800 }
5801 break;
5802 case OPCODE_COLOR_TABLE_PARAMETER_FV:
5803 {
5804 GLfloat params[4];
5805 params[0] = n[3].f;
5806 params[1] = n[4].f;
5807 params[2] = n[5].f;
5808 params[3] = n[6].f;
5809 CALL_ColorTableParameterfv(ctx->Exec,
5810 (n[1].e, n[2].e, params));
5811 }
5812 break;
5813 case OPCODE_COLOR_TABLE_PARAMETER_IV:
5814 {
5815 GLint params[4];
5816 params[0] = n[3].i;
5817 params[1] = n[4].i;
5818 params[2] = n[5].i;
5819 params[3] = n[6].i;
5820 CALL_ColorTableParameteriv(ctx->Exec,
5821 (n[1].e, n[2].e, params));
5822 }
5823 break;
5824 case OPCODE_COLOR_SUB_TABLE:
5825 {
5826 const struct gl_pixelstore_attrib save = ctx->Unpack;
5827 ctx->Unpack = ctx->DefaultPacking;
5828 CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i,
5829 n[4].e, n[5].e, n[6].data));
5830 ctx->Unpack = save; /* restore */
5831 }
5832 break;
5833 case OPCODE_CONVOLUTION_FILTER_1D:
5834 {
5835 const struct gl_pixelstore_attrib save = ctx->Unpack;
5836 ctx->Unpack = ctx->DefaultPacking;
5837 CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
5838 n[4].e, n[5].e,
5839 n[6].data));
5840 ctx->Unpack = save; /* restore */
5841 }
5842 break;
5843 case OPCODE_CONVOLUTION_FILTER_2D:
5844 {
5845 const struct gl_pixelstore_attrib save = ctx->Unpack;
5846 ctx->Unpack = ctx->DefaultPacking;
5847 CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
5848 n[4].i, n[5].e, n[6].e,
5849 n[7].data));
5850 ctx->Unpack = save; /* restore */
5851 }
5852 break;
5853 case OPCODE_CONVOLUTION_PARAMETER_I:
5854 CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i));
5855 break;
5856 case OPCODE_CONVOLUTION_PARAMETER_IV:
5857 {
5858 GLint params[4];
5859 params[0] = n[3].i;
5860 params[1] = n[4].i;
5861 params[2] = n[5].i;
5862 params[3] = n[6].i;
5863 CALL_ConvolutionParameteriv(ctx->Exec,
5864 (n[1].e, n[2].e, params));
5865 }
5866 break;
5867 case OPCODE_CONVOLUTION_PARAMETER_F:
5868 CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f));
5869 break;
5870 case OPCODE_CONVOLUTION_PARAMETER_FV:
5871 {
5872 GLfloat params[4];
5873 params[0] = n[3].f;
5874 params[1] = n[4].f;
5875 params[2] = n[5].f;
5876 params[3] = n[6].f;
5877 CALL_ConvolutionParameterfv(ctx->Exec,
5878 (n[1].e, n[2].e, params));
5879 }
5880 break;
5881 case OPCODE_COPY_COLOR_SUB_TABLE:
5882 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
5883 n[3].i, n[4].i, n[5].i));
5884 break;
5885 case OPCODE_COPY_COLOR_TABLE:
5886 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
5887 n[3].i, n[4].i, n[5].i));
5888 break;
5889 case OPCODE_COPY_PIXELS:
5890 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
5891 (GLsizei) n[3].i, (GLsizei) n[4].i,
5892 n[5].e));
5893 break;
5894 case OPCODE_COPY_TEX_IMAGE1D:
5895 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
5896 n[5].i, n[6].i, n[7].i));
5897 break;
5898 case OPCODE_COPY_TEX_IMAGE2D:
5899 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
5900 n[5].i, n[6].i, n[7].i, n[8].i));
5901 break;
5902 case OPCODE_COPY_TEX_SUB_IMAGE1D:
5903 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
5904 n[4].i, n[5].i, n[6].i));
5905 break;
5906 case OPCODE_COPY_TEX_SUB_IMAGE2D:
5907 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
5908 n[4].i, n[5].i, n[6].i, n[7].i,
5909 n[8].i));
5910 break;
5911 case OPCODE_COPY_TEX_SUB_IMAGE3D:
5912 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
5913 n[4].i, n[5].i, n[6].i, n[7].i,
5914 n[8].i, n[9].i));
5915 break;
5916 case OPCODE_CULL_FACE:
5917 CALL_CullFace(ctx->Exec, (n[1].e));
5918 break;
5919 case OPCODE_DEPTH_FUNC:
5920 CALL_DepthFunc(ctx->Exec, (n[1].e));
5921 break;
5922 case OPCODE_DEPTH_MASK:
5923 CALL_DepthMask(ctx->Exec, (n[1].b));
5924 break;
5925 case OPCODE_DEPTH_RANGE:
5926 CALL_DepthRange(ctx->Exec,
5927 ((GLclampd) n[1].f, (GLclampd) n[2].f));
5928 break;
5929 case OPCODE_DISABLE:
5930 CALL_Disable(ctx->Exec, (n[1].e));
5931 break;
5932 case OPCODE_DRAW_BUFFER:
5933 CALL_DrawBuffer(ctx->Exec, (n[1].e));
5934 break;
5935 case OPCODE_DRAW_PIXELS:
5936 {
5937 const struct gl_pixelstore_attrib save = ctx->Unpack;
5938 ctx->Unpack = ctx->DefaultPacking;
5939 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
5940 n[5].data));
5941 ctx->Unpack = save; /* restore */
5942 }
5943 break;
5944 case OPCODE_ENABLE:
5945 CALL_Enable(ctx->Exec, (n[1].e));
5946 break;
5947 case OPCODE_EVALMESH1:
5948 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
5949 break;
5950 case OPCODE_EVALMESH2:
5951 CALL_EvalMesh2(ctx->Exec,
5952 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
5953 break;
5954 case OPCODE_FOG:
5955 {
5956 GLfloat p[4];
5957 p[0] = n[2].f;
5958 p[1] = n[3].f;
5959 p[2] = n[4].f;
5960 p[3] = n[5].f;
5961 CALL_Fogfv(ctx->Exec, (n[1].e, p));
5962 }
5963 break;
5964 case OPCODE_FRONT_FACE:
5965 CALL_FrontFace(ctx->Exec, (n[1].e));
5966 break;
5967 case OPCODE_FRUSTUM:
5968 CALL_Frustum(ctx->Exec,
5969 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
5970 break;
5971 case OPCODE_HINT:
5972 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
5973 break;
5974 case OPCODE_HISTOGRAM:
5975 CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b));
5976 break;
5977 case OPCODE_INDEX_MASK:
5978 CALL_IndexMask(ctx->Exec, (n[1].ui));
5979 break;
5980 case OPCODE_INIT_NAMES:
5981 CALL_InitNames(ctx->Exec, ());
5982 break;
5983 case OPCODE_LIGHT:
5984 {
5985 GLfloat p[4];
5986 p[0] = n[3].f;
5987 p[1] = n[4].f;
5988 p[2] = n[5].f;
5989 p[3] = n[6].f;
5990 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
5991 }
5992 break;
5993 case OPCODE_LIGHT_MODEL:
5994 {
5995 GLfloat p[4];
5996 p[0] = n[2].f;
5997 p[1] = n[3].f;
5998 p[2] = n[4].f;
5999 p[3] = n[5].f;
6000 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
6001 }
6002 break;
6003 case OPCODE_LINE_STIPPLE:
6004 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
6005 break;
6006 case OPCODE_LINE_WIDTH:
6007 CALL_LineWidth(ctx->Exec, (n[1].f));
6008 break;
6009 case OPCODE_LIST_BASE:
6010 CALL_ListBase(ctx->Exec, (n[1].ui));
6011 break;
6012 case OPCODE_LOAD_IDENTITY:
6013 CALL_LoadIdentity(ctx->Exec, ());
6014 break;
6015 case OPCODE_LOAD_MATRIX:
6016 if (sizeof(Node) == sizeof(GLfloat)) {
6017 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
6018 }
6019 else {
6020 GLfloat m[16];
6021 GLuint i;
6022 for (i = 0; i < 16; i++) {
6023 m[i] = n[1 + i].f;
6024 }
6025 CALL_LoadMatrixf(ctx->Exec, (m));
6026 }
6027 break;
6028 case OPCODE_LOAD_NAME:
6029 CALL_LoadName(ctx->Exec, (n[1].ui));
6030 break;
6031 case OPCODE_LOGIC_OP:
6032 CALL_LogicOp(ctx->Exec, (n[1].e));
6033 break;
6034 case OPCODE_MAP1:
6035 {
6036 GLenum target = n[1].e;
6037 GLint ustride = _mesa_evaluator_components(target);
6038 GLint uorder = n[5].i;
6039 GLfloat u1 = n[2].f;
6040 GLfloat u2 = n[3].f;
6041 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
6042 (GLfloat *) n[6].data));
6043 }
6044 break;
6045 case OPCODE_MAP2:
6046 {
6047 GLenum target = n[1].e;
6048 GLfloat u1 = n[2].f;
6049 GLfloat u2 = n[3].f;
6050 GLfloat v1 = n[4].f;
6051 GLfloat v2 = n[5].f;
6052 GLint ustride = n[6].i;
6053 GLint vstride = n[7].i;
6054 GLint uorder = n[8].i;
6055 GLint vorder = n[9].i;
6056 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
6057 v1, v2, vstride, vorder,
6058 (GLfloat *) n[10].data));
6059 }
6060 break;
6061 case OPCODE_MAPGRID1:
6062 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
6063 break;
6064 case OPCODE_MAPGRID2:
6065 CALL_MapGrid2f(ctx->Exec,
6066 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
6067 break;
6068 case OPCODE_MATRIX_MODE:
6069 CALL_MatrixMode(ctx->Exec, (n[1].e));
6070 break;
6071 case OPCODE_MIN_MAX:
6072 CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
6073 break;
6074 case OPCODE_MULT_MATRIX:
6075 if (sizeof(Node) == sizeof(GLfloat)) {
6076 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
6077 }
6078 else {
6079 GLfloat m[16];
6080 GLuint i;
6081 for (i = 0; i < 16; i++) {
6082 m[i] = n[1 + i].f;
6083 }
6084 CALL_MultMatrixf(ctx->Exec, (m));
6085 }
6086 break;
6087 case OPCODE_ORTHO:
6088 CALL_Ortho(ctx->Exec,
6089 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
6090 break;
6091 case OPCODE_PASSTHROUGH:
6092 CALL_PassThrough(ctx->Exec, (n[1].f));
6093 break;
6094 case OPCODE_PIXEL_MAP:
6095 CALL_PixelMapfv(ctx->Exec,
6096 (n[1].e, n[2].i, (GLfloat *) n[3].data));
6097 break;
6098 case OPCODE_PIXEL_TRANSFER:
6099 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
6100 break;
6101 case OPCODE_PIXEL_ZOOM:
6102 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
6103 break;
6104 case OPCODE_POINT_SIZE:
6105 CALL_PointSize(ctx->Exec, (n[1].f));
6106 break;
6107 case OPCODE_POINT_PARAMETERS:
6108 {
6109 GLfloat params[3];
6110 params[0] = n[2].f;
6111 params[1] = n[3].f;
6112 params[2] = n[4].f;
6113 CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params));
6114 }
6115 break;
6116 case OPCODE_POLYGON_MODE:
6117 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
6118 break;
6119 case OPCODE_POLYGON_STIPPLE:
6120 {
6121 const struct gl_pixelstore_attrib save = ctx->Unpack;
6122 ctx->Unpack = ctx->DefaultPacking;
6123 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
6124 ctx->Unpack = save; /* restore */
6125 }
6126 break;
6127 case OPCODE_POLYGON_OFFSET:
6128 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
6129 break;
6130 case OPCODE_POP_ATTRIB:
6131 CALL_PopAttrib(ctx->Exec, ());
6132 break;
6133 case OPCODE_POP_MATRIX:
6134 CALL_PopMatrix(ctx->Exec, ());
6135 break;
6136 case OPCODE_POP_NAME:
6137 CALL_PopName(ctx->Exec, ());
6138 break;
6139 case OPCODE_PRIORITIZE_TEXTURE:
6140 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
6141 break;
6142 case OPCODE_PUSH_ATTRIB:
6143 CALL_PushAttrib(ctx->Exec, (n[1].bf));
6144 break;
6145 case OPCODE_PUSH_MATRIX:
6146 CALL_PushMatrix(ctx->Exec, ());
6147 break;
6148 case OPCODE_PUSH_NAME:
6149 CALL_PushName(ctx->Exec, (n[1].ui));
6150 break;
6151 case OPCODE_RASTER_POS:
6152 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6153 break;
6154 case OPCODE_READ_BUFFER:
6155 CALL_ReadBuffer(ctx->Exec, (n[1].e));
6156 break;
6157 case OPCODE_RESET_HISTOGRAM:
6158 CALL_ResetHistogram(ctx->Exec, (n[1].e));
6159 break;
6160 case OPCODE_RESET_MIN_MAX:
6161 CALL_ResetMinmax(ctx->Exec, (n[1].e));
6162 break;
6163 case OPCODE_ROTATE:
6164 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6165 break;
6166 case OPCODE_SCALE:
6167 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
6168 break;
6169 case OPCODE_SCISSOR:
6170 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
6171 break;
6172 case OPCODE_SHADE_MODEL:
6173 CALL_ShadeModel(ctx->Exec, (n[1].e));
6174 break;
6175 case OPCODE_STENCIL_FUNC:
6176 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
6177 break;
6178 case OPCODE_STENCIL_MASK:
6179 CALL_StencilMask(ctx->Exec, (n[1].ui));
6180 break;
6181 case OPCODE_STENCIL_OP:
6182 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
6183 break;
6184 case OPCODE_STENCIL_FUNC_SEPARATE:
6185 CALL_StencilFuncSeparate(ctx->Exec,
6186 (n[1].e, n[2].e, n[3].i, n[4].ui));
6187 break;
6188 case OPCODE_STENCIL_MASK_SEPARATE:
6189 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
6190 break;
6191 case OPCODE_STENCIL_OP_SEPARATE:
6192 CALL_StencilOpSeparate(ctx->Exec,
6193 (n[1].e, n[2].e, n[3].e, n[4].e));
6194 break;
6195 case OPCODE_TEXENV:
6196 {
6197 GLfloat params[4];
6198 params[0] = n[3].f;
6199 params[1] = n[4].f;
6200 params[2] = n[5].f;
6201 params[3] = n[6].f;
6202 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
6203 }
6204 break;
6205 case OPCODE_TEXGEN:
6206 {
6207 GLfloat params[4];
6208 params[0] = n[3].f;
6209 params[1] = n[4].f;
6210 params[2] = n[5].f;
6211 params[3] = n[6].f;
6212 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
6213 }
6214 break;
6215 case OPCODE_TEXPARAMETER:
6216 {
6217 GLfloat params[4];
6218 params[0] = n[3].f;
6219 params[1] = n[4].f;
6220 params[2] = n[5].f;
6221 params[3] = n[6].f;
6222 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
6223 }
6224 break;
6225 case OPCODE_TEX_IMAGE1D:
6226 {
6227 const struct gl_pixelstore_attrib save = ctx->Unpack;
6228 ctx->Unpack = ctx->DefaultPacking;
6229 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
6230 n[2].i, /* level */
6231 n[3].i, /* components */
6232 n[4].i, /* width */
6233 n[5].e, /* border */
6234 n[6].e, /* format */
6235 n[7].e, /* type */
6236 n[8].data));
6237 ctx->Unpack = save; /* restore */
6238 }
6239 break;
6240 case OPCODE_TEX_IMAGE2D:
6241 {
6242 const struct gl_pixelstore_attrib save = ctx->Unpack;
6243 ctx->Unpack = ctx->DefaultPacking;
6244 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
6245 n[2].i, /* level */
6246 n[3].i, /* components */
6247 n[4].i, /* width */
6248 n[5].i, /* height */
6249 n[6].e, /* border */
6250 n[7].e, /* format */
6251 n[8].e, /* type */
6252 n[9].data));
6253 ctx->Unpack = save; /* restore */
6254 }
6255 break;
6256 case OPCODE_TEX_IMAGE3D:
6257 {
6258 const struct gl_pixelstore_attrib save = ctx->Unpack;
6259 ctx->Unpack = ctx->DefaultPacking;
6260 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
6261 n[2].i, /* level */
6262 n[3].i, /* components */
6263 n[4].i, /* width */
6264 n[5].i, /* height */
6265 n[6].i, /* depth */
6266 n[7].e, /* border */
6267 n[8].e, /* format */
6268 n[9].e, /* type */
6269 n[10].data));
6270 ctx->Unpack = save; /* restore */
6271 }
6272 break;
6273 case OPCODE_TEX_SUB_IMAGE1D:
6274 {
6275 const struct gl_pixelstore_attrib save = ctx->Unpack;
6276 ctx->Unpack = ctx->DefaultPacking;
6277 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6278 n[4].i, n[5].e,
6279 n[6].e, n[7].data));
6280 ctx->Unpack = save; /* restore */
6281 }
6282 break;
6283 case OPCODE_TEX_SUB_IMAGE2D:
6284 {
6285 const struct gl_pixelstore_attrib save = ctx->Unpack;
6286 ctx->Unpack = ctx->DefaultPacking;
6287 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6288 n[4].i, n[5].e,
6289 n[6].i, n[7].e, n[8].e,
6290 n[9].data));
6291 ctx->Unpack = save; /* restore */
6292 }
6293 break;
6294 case OPCODE_TEX_SUB_IMAGE3D:
6295 {
6296 const struct gl_pixelstore_attrib save = ctx->Unpack;
6297 ctx->Unpack = ctx->DefaultPacking;
6298 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6299 n[4].i, n[5].i, n[6].i, n[7].i,
6300 n[8].i, n[9].e, n[10].e,
6301 n[11].data));
6302 ctx->Unpack = save; /* restore */
6303 }
6304 break;
6305 case OPCODE_TRANSLATE:
6306 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
6307 break;
6308 case OPCODE_VIEWPORT:
6309 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
6310 (GLsizei) n[3].i, (GLsizei) n[4].i));
6311 break;
6312 case OPCODE_WINDOW_POS:
6313 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6314 break;
6315 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
6316 CALL_ActiveTextureARB(ctx->Exec, (n[1].e));
6317 break;
6318 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
6319 CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
6320 n[4].i, n[5].i, n[6].i,
6321 n[7].data));
6322 break;
6323 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
6324 CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
6325 n[4].i, n[5].i, n[6].i,
6326 n[7].i, n[8].data));
6327 break;
6328 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
6329 CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
6330 n[4].i, n[5].i, n[6].i,
6331 n[7].i, n[8].i,
6332 n[9].data));
6333 break;
6334 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
6335 CALL_CompressedTexSubImage1DARB(ctx->Exec,
6336 (n[1].e, n[2].i, n[3].i, n[4].i,
6337 n[5].e, n[6].i, n[7].data));
6338 break;
6339 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
6340 CALL_CompressedTexSubImage2DARB(ctx->Exec,
6341 (n[1].e, n[2].i, n[3].i, n[4].i,
6342 n[5].i, n[6].i, n[7].e, n[8].i,
6343 n[9].data));
6344 break;
6345 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
6346 CALL_CompressedTexSubImage3DARB(ctx->Exec,
6347 (n[1].e, n[2].i, n[3].i, n[4].i,
6348 n[5].i, n[6].i, n[7].i, n[8].i,
6349 n[9].e, n[10].i, n[11].data));
6350 break;
6351 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
6352 CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
6353 break;
6354 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
6355 CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f));
6356 break;
6357 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6358 case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
6359 CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui));
6360 break;
6361 #endif
6362 #if FEATURE_NV_vertex_program
6363 case OPCODE_EXECUTE_PROGRAM_NV:
6364 {
6365 GLfloat v[4];
6366 v[0] = n[3].f;
6367 v[1] = n[4].f;
6368 v[2] = n[5].f;
6369 v[3] = n[6].f;
6370 CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
6371 }
6372 break;
6373 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
6374 CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
6375 (GLuint *) n[2].data));
6376 break;
6377 case OPCODE_LOAD_PROGRAM_NV:
6378 CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
6379 (const GLubyte *) n[4].data));
6380 break;
6381 case OPCODE_TRACK_MATRIX_NV:
6382 CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
6383 break;
6384 #endif
6385
6386 #if FEATURE_NV_fragment_program
6387 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
6388 CALL_ProgramLocalParameter4fARB(ctx->Exec,
6389 (n[1].e, n[2].ui, n[3].f, n[4].f,
6390 n[5].f, n[6].f));
6391 break;
6392 case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
6393 CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
6394 (const GLubyte *) n[3].
6395 data, n[4].f, n[5].f,
6396 n[6].f, n[7].f));
6397 break;
6398 #endif
6399
6400 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
6401 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
6402 break;
6403 case OPCODE_DEPTH_BOUNDS_EXT:
6404 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
6405 break;
6406 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6407 case OPCODE_PROGRAM_STRING_ARB:
6408 CALL_ProgramStringARB(ctx->Exec,
6409 (n[1].e, n[2].e, n[3].i, n[4].data));
6410 break;
6411 #endif
6412 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
6413 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
6414 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
6415 n[4].f, n[5].f,
6416 n[6].f));
6417 break;
6418 #endif
6419 #if FEATURE_ARB_occlusion_query
6420 case OPCODE_BEGIN_QUERY_ARB:
6421 CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
6422 break;
6423 case OPCODE_END_QUERY_ARB:
6424 CALL_EndQueryARB(ctx->Exec, (n[1].e));
6425 break;
6426 #endif
6427 case OPCODE_DRAW_BUFFERS_ARB:
6428 {
6429 GLenum buffers[MAX_DRAW_BUFFERS];
6430 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
6431 for (i = 0; i < count; i++)
6432 buffers[i] = n[2 + i].e;
6433 CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
6434 }
6435 break;
6436 #if FEATURE_EXT_framebuffer_blit
6437 case OPCODE_BLIT_FRAMEBUFFER:
6438 CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
6439 n[5].i, n[6].i, n[7].i, n[8].i,
6440 n[9].i, n[10].e));
6441 break;
6442 #endif
6443 #if FEATURE_ATI_fragment_shader
6444 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
6445 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
6446 break;
6447 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
6448 {
6449 GLfloat values[4];
6450 GLuint i, dst = n[1].ui;
6451
6452 for (i = 0; i < 4; i++)
6453 values[i] = n[1 + i].f;
6454 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values));
6455 }
6456 break;
6457 #endif
6458 case OPCODE_ATTR_1F_NV:
6459 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
6460 break;
6461 case OPCODE_ATTR_2F_NV:
6462 /* Really shouldn't have to do this - the Node structure
6463 * is convenient, but it would be better to store the data
6464 * packed appropriately so that it can be sent directly
6465 * on. With x86_64 becoming common, this will start to
6466 * matter more.
6467 */
6468 if (sizeof(Node) == sizeof(GLfloat))
6469 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
6470 else
6471 CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f));
6472 break;
6473 case OPCODE_ATTR_3F_NV:
6474 if (sizeof(Node) == sizeof(GLfloat))
6475 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
6476 else
6477 CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
6478 n[4].f));
6479 break;
6480 case OPCODE_ATTR_4F_NV:
6481 if (sizeof(Node) == sizeof(GLfloat))
6482 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
6483 else
6484 CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
6485 n[4].f, n[5].f));
6486 break;
6487 case OPCODE_ATTR_1F_ARB:
6488 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
6489 break;
6490 case OPCODE_ATTR_2F_ARB:
6491 /* Really shouldn't have to do this - the Node structure
6492 * is convenient, but it would be better to store the data
6493 * packed appropriately so that it can be sent directly
6494 * on. With x86_64 becoming common, this will start to
6495 * matter more.
6496 */
6497 if (sizeof(Node) == sizeof(GLfloat))
6498 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
6499 else
6500 CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f));
6501 break;
6502 case OPCODE_ATTR_3F_ARB:
6503 if (sizeof(Node) == sizeof(GLfloat))
6504 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
6505 else
6506 CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
6507 n[4].f));
6508 break;
6509 case OPCODE_ATTR_4F_ARB:
6510 if (sizeof(Node) == sizeof(GLfloat))
6511 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
6512 else
6513 CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
6514 n[4].f, n[5].f));
6515 break;
6516 case OPCODE_MATERIAL:
6517 if (sizeof(Node) == sizeof(GLfloat))
6518 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
6519 else {
6520 GLfloat f[4];
6521 f[0] = n[3].f;
6522 f[1] = n[4].f;
6523 f[2] = n[5].f;
6524 f[3] = n[6].f;
6525 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
6526 }
6527 break;
6528 case OPCODE_BEGIN:
6529 CALL_Begin(ctx->Exec, (n[1].e));
6530 break;
6531 case OPCODE_END:
6532 CALL_End(ctx->Exec, ());
6533 break;
6534 case OPCODE_RECTF:
6535 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6536 break;
6537 case OPCODE_EVAL_C1:
6538 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
6539 break;
6540 case OPCODE_EVAL_C2:
6541 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
6542 break;
6543 case OPCODE_EVAL_P1:
6544 CALL_EvalPoint1(ctx->Exec, (n[1].i));
6545 break;
6546 case OPCODE_EVAL_P2:
6547 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
6548 break;
6549
6550 case OPCODE_CONTINUE:
6551 n = (Node *) n[1].next;
6552 break;
6553 case OPCODE_END_OF_LIST:
6554 done = GL_TRUE;
6555 break;
6556 default:
6557 {
6558 char msg[1000];
6559 _mesa_sprintf(msg, "Error in execute_list: opcode=%d",
6560 (int) opcode);
6561 _mesa_problem(ctx, msg);
6562 }
6563 done = GL_TRUE;
6564 }
6565
6566 /* increment n to point to next compiled command */
6567 if (opcode != OPCODE_CONTINUE) {
6568 n += InstSize[opcode];
6569 }
6570 }
6571 }
6572
6573 if (ctx->Driver.EndCallList)
6574 ctx->Driver.EndCallList(ctx);
6575
6576 ctx->ListState.CallDepth--;
6577 }
6578
6579
6580
6581 /**********************************************************************/
6582 /* GL functions */
6583 /**********************************************************************/
6584
6585 /**
6586 * Test if a display list number is valid.
6587 */
6588 GLboolean GLAPIENTRY
6589 _mesa_IsList(GLuint list)
6590 {
6591 GET_CURRENT_CONTEXT(ctx);
6592 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
6593 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
6594 return islist(ctx, list);
6595 }
6596
6597
6598 /**
6599 * Delete a sequence of consecutive display lists.
6600 */
6601 void GLAPIENTRY
6602 _mesa_DeleteLists(GLuint list, GLsizei range)
6603 {
6604 GET_CURRENT_CONTEXT(ctx);
6605 GLuint i;
6606 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
6607 ASSERT_OUTSIDE_BEGIN_END(ctx);
6608
6609 if (range < 0) {
6610 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
6611 return;
6612 }
6613 for (i = list; i < list + range; i++) {
6614 destroy_list(ctx, i);
6615 }
6616 }
6617
6618
6619 /**
6620 * Return a display list number, n, such that lists n through n+range-1
6621 * are free.
6622 */
6623 GLuint GLAPIENTRY
6624 _mesa_GenLists(GLsizei range)
6625 {
6626 GET_CURRENT_CONTEXT(ctx);
6627 GLuint base;
6628 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
6629 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
6630
6631 if (range < 0) {
6632 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
6633 return 0;
6634 }
6635 if (range == 0) {
6636 return 0;
6637 }
6638
6639 /*
6640 * Make this an atomic operation
6641 */
6642 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
6643
6644 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
6645 if (base) {
6646 /* reserve the list IDs by with empty/dummy lists */
6647 GLint i;
6648 for (i = 0; i < range; i++) {
6649 _mesa_HashInsert(ctx->Shared->DisplayList, base + i,
6650 make_list(base + i, 1));
6651 }
6652 }
6653
6654 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
6655
6656 return base;
6657 }
6658
6659
6660 /**
6661 * Begin a new display list.
6662 */
6663 void GLAPIENTRY
6664 _mesa_NewList(GLuint list, GLenum mode)
6665 {
6666 GET_CURRENT_CONTEXT(ctx);
6667 GLint i;
6668
6669 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
6670 ASSERT_OUTSIDE_BEGIN_END(ctx);
6671
6672 if (MESA_VERBOSE & VERBOSE_API)
6673 _mesa_debug(ctx, "glNewList %u %s\n", list,
6674 _mesa_lookup_enum_by_nr(mode));
6675
6676 if (list == 0) {
6677 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
6678 return;
6679 }
6680
6681 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
6682 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
6683 return;
6684 }
6685
6686 if (ctx->ListState.CurrentListPtr) {
6687 /* already compiling a display list */
6688 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
6689 return;
6690 }
6691
6692 ctx->CompileFlag = GL_TRUE;
6693 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
6694
6695 /* Allocate new display list */
6696 ctx->ListState.CurrentListNum = list;
6697 ctx->ListState.CurrentList = make_list(list, BLOCK_SIZE);
6698 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node;
6699 ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock;
6700 ctx->ListState.CurrentPos = 0;
6701
6702 /* Reset acumulated list state:
6703 */
6704 for (i = 0; i < VERT_ATTRIB_MAX; i++)
6705 ctx->ListState.ActiveAttribSize[i] = 0;
6706
6707 for (i = 0; i < MAT_ATTRIB_MAX; i++)
6708 ctx->ListState.ActiveMaterialSize[i] = 0;
6709
6710 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
6711 ctx->Driver.NewList(ctx, list, mode);
6712
6713 ctx->CurrentDispatch = ctx->Save;
6714 _glapi_set_dispatch(ctx->CurrentDispatch);
6715 }
6716
6717
6718 /**
6719 * End definition of current display list.
6720 */
6721 void GLAPIENTRY
6722 _mesa_EndList(void)
6723 {
6724 GET_CURRENT_CONTEXT(ctx);
6725 SAVE_FLUSH_VERTICES(ctx);
6726 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
6727
6728 if (MESA_VERBOSE & VERBOSE_API)
6729 _mesa_debug(ctx, "glEndList\n");
6730
6731 /* Check that a list is under construction */
6732 if (!ctx->ListState.CurrentListPtr) {
6733 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
6734 return;
6735 }
6736
6737 (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0);
6738
6739 /* Destroy old list, if any */
6740 destroy_list(ctx, ctx->ListState.CurrentListNum);
6741 /* Install the list */
6742 _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum,
6743 ctx->ListState.CurrentList);
6744
6745
6746 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
6747 mesa_print_display_list(ctx->ListState.CurrentListNum);
6748
6749 ctx->Driver.EndList(ctx);
6750
6751 ctx->ListState.CurrentList = NULL;
6752 ctx->ListState.CurrentListNum = 0;
6753 ctx->ListState.CurrentListPtr = NULL;
6754 ctx->ExecuteFlag = GL_TRUE;
6755 ctx->CompileFlag = GL_FALSE;
6756
6757 ctx->CurrentDispatch = ctx->Exec;
6758 _glapi_set_dispatch(ctx->CurrentDispatch);
6759 }
6760
6761
6762 void GLAPIENTRY
6763 _mesa_CallList(GLuint list)
6764 {
6765 GLboolean save_compile_flag;
6766 GET_CURRENT_CONTEXT(ctx);
6767 FLUSH_CURRENT(ctx, 0);
6768 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
6769 /* execute the display list, and restore the CompileFlag. */
6770
6771 if (MESA_VERBOSE & VERBOSE_API)
6772 _mesa_debug(ctx, "glCallList %d\n", list);
6773
6774 if (list == 0) {
6775 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
6776 return;
6777 }
6778
6779 /* mesa_print_display_list( list ); */
6780
6781 save_compile_flag = ctx->CompileFlag;
6782 if (save_compile_flag) {
6783 ctx->CompileFlag = GL_FALSE;
6784 }
6785
6786 execute_list(ctx, list);
6787 ctx->CompileFlag = save_compile_flag;
6788
6789 /* also restore API function pointers to point to "save" versions */
6790 if (save_compile_flag) {
6791 ctx->CurrentDispatch = ctx->Save;
6792 _glapi_set_dispatch(ctx->CurrentDispatch);
6793 }
6794 }
6795
6796
6797 /**
6798 * Execute glCallLists: call multiple display lists.
6799 */
6800 void GLAPIENTRY
6801 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
6802 {
6803 GET_CURRENT_CONTEXT(ctx);
6804 GLuint list;
6805 GLint i;
6806 GLboolean save_compile_flag;
6807
6808 if (MESA_VERBOSE & VERBOSE_API)
6809 _mesa_debug(ctx, "glCallLists %d\n", n);
6810
6811 switch (type) {
6812 case GL_BYTE:
6813 case GL_UNSIGNED_BYTE:
6814 case GL_SHORT:
6815 case GL_UNSIGNED_SHORT:
6816 case GL_INT:
6817 case GL_UNSIGNED_INT:
6818 case GL_FLOAT:
6819 case GL_2_BYTES:
6820 case GL_3_BYTES:
6821 case GL_4_BYTES:
6822 /* OK */
6823 break;
6824 default:
6825 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
6826 return;
6827 }
6828
6829 /* Save the CompileFlag status, turn it off, execute display list,
6830 * and restore the CompileFlag.
6831 */
6832 save_compile_flag = ctx->CompileFlag;
6833 ctx->CompileFlag = GL_FALSE;
6834
6835 for (i = 0; i < n; i++) {
6836 list = translate_id(i, type, lists);
6837 execute_list(ctx, ctx->List.ListBase + list);
6838 }
6839
6840 ctx->CompileFlag = save_compile_flag;
6841
6842 /* also restore API function pointers to point to "save" versions */
6843 if (save_compile_flag) {
6844 ctx->CurrentDispatch = ctx->Save;
6845 _glapi_set_dispatch(ctx->CurrentDispatch);
6846 }
6847 }
6848
6849
6850 /**
6851 * Set the offset added to list numbers in glCallLists.
6852 */
6853 void GLAPIENTRY
6854 _mesa_ListBase(GLuint base)
6855 {
6856 GET_CURRENT_CONTEXT(ctx);
6857 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
6858 ASSERT_OUTSIDE_BEGIN_END(ctx);
6859 ctx->List.ListBase = base;
6860 }
6861
6862
6863 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
6864 */
6865 static void GLAPIENTRY
6866 exec_Finish(void)
6867 {
6868 GET_CURRENT_CONTEXT(ctx);
6869 FLUSH_VERTICES(ctx, 0);
6870 CALL_Finish(ctx->Exec, ());
6871 }
6872
6873 static void GLAPIENTRY
6874 exec_Flush(void)
6875 {
6876 GET_CURRENT_CONTEXT(ctx);
6877 FLUSH_VERTICES(ctx, 0);
6878 CALL_Flush(ctx->Exec, ());
6879 }
6880
6881 static void GLAPIENTRY
6882 exec_GetBooleanv(GLenum pname, GLboolean *params)
6883 {
6884 GET_CURRENT_CONTEXT(ctx);
6885 FLUSH_VERTICES(ctx, 0);
6886 CALL_GetBooleanv(ctx->Exec, (pname, params));
6887 }
6888
6889 static void GLAPIENTRY
6890 exec_GetClipPlane(GLenum plane, GLdouble * equation)
6891 {
6892 GET_CURRENT_CONTEXT(ctx);
6893 FLUSH_VERTICES(ctx, 0);
6894 CALL_GetClipPlane(ctx->Exec, (plane, equation));
6895 }
6896
6897 static void GLAPIENTRY
6898 exec_GetDoublev(GLenum pname, GLdouble *params)
6899 {
6900 GET_CURRENT_CONTEXT(ctx);
6901 FLUSH_VERTICES(ctx, 0);
6902 CALL_GetDoublev(ctx->Exec, (pname, params));
6903 }
6904
6905 static GLenum GLAPIENTRY
6906 exec_GetError(void)
6907 {
6908 GET_CURRENT_CONTEXT(ctx);
6909 FLUSH_VERTICES(ctx, 0);
6910 return CALL_GetError(ctx->Exec, ());
6911 }
6912
6913 static void GLAPIENTRY
6914 exec_GetFloatv(GLenum pname, GLfloat *params)
6915 {
6916 GET_CURRENT_CONTEXT(ctx);
6917 FLUSH_VERTICES(ctx, 0);
6918 CALL_GetFloatv(ctx->Exec, (pname, params));
6919 }
6920
6921 static void GLAPIENTRY
6922 exec_GetIntegerv(GLenum pname, GLint *params)
6923 {
6924 GET_CURRENT_CONTEXT(ctx);
6925 FLUSH_VERTICES(ctx, 0);
6926 CALL_GetIntegerv(ctx->Exec, (pname, params));
6927 }
6928
6929 static void GLAPIENTRY
6930 exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
6931 {
6932 GET_CURRENT_CONTEXT(ctx);
6933 FLUSH_VERTICES(ctx, 0);
6934 CALL_GetLightfv(ctx->Exec, (light, pname, params));
6935 }
6936
6937 static void GLAPIENTRY
6938 exec_GetLightiv(GLenum light, GLenum pname, GLint *params)
6939 {
6940 GET_CURRENT_CONTEXT(ctx);
6941 FLUSH_VERTICES(ctx, 0);
6942 CALL_GetLightiv(ctx->Exec, (light, pname, params));
6943 }
6944
6945 static void GLAPIENTRY
6946 exec_GetMapdv(GLenum target, GLenum query, GLdouble * v)
6947 {
6948 GET_CURRENT_CONTEXT(ctx);
6949 FLUSH_VERTICES(ctx, 0);
6950 CALL_GetMapdv(ctx->Exec, (target, query, v));
6951 }
6952
6953 static void GLAPIENTRY
6954 exec_GetMapfv(GLenum target, GLenum query, GLfloat * v)
6955 {
6956 GET_CURRENT_CONTEXT(ctx);
6957 FLUSH_VERTICES(ctx, 0);
6958 CALL_GetMapfv(ctx->Exec, (target, query, v));
6959 }
6960
6961 static void GLAPIENTRY
6962 exec_GetMapiv(GLenum target, GLenum query, GLint * v)
6963 {
6964 GET_CURRENT_CONTEXT(ctx);
6965 FLUSH_VERTICES(ctx, 0);
6966 CALL_GetMapiv(ctx->Exec, (target, query, v));
6967 }
6968
6969 static void GLAPIENTRY
6970 exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
6971 {
6972 GET_CURRENT_CONTEXT(ctx);
6973 FLUSH_VERTICES(ctx, 0);
6974 CALL_GetMaterialfv(ctx->Exec, (face, pname, params));
6975 }
6976
6977 static void GLAPIENTRY
6978 exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
6979 {
6980 GET_CURRENT_CONTEXT(ctx);
6981 FLUSH_VERTICES(ctx, 0);
6982 CALL_GetMaterialiv(ctx->Exec, (face, pname, params));
6983 }
6984
6985 static void GLAPIENTRY
6986 exec_GetPixelMapfv(GLenum map, GLfloat *values)
6987 {
6988 GET_CURRENT_CONTEXT(ctx);
6989 FLUSH_VERTICES(ctx, 0);
6990 CALL_GetPixelMapfv(ctx->Exec, (map, values));
6991 }
6992
6993 static void GLAPIENTRY
6994 exec_GetPixelMapuiv(GLenum map, GLuint *values)
6995 {
6996 GET_CURRENT_CONTEXT(ctx);
6997 FLUSH_VERTICES(ctx, 0);
6998 CALL_GetPixelMapuiv(ctx->Exec, (map, values));
6999 }
7000
7001 static void GLAPIENTRY
7002 exec_GetPixelMapusv(GLenum map, GLushort *values)
7003 {
7004 GET_CURRENT_CONTEXT(ctx);
7005 FLUSH_VERTICES(ctx, 0);
7006 CALL_GetPixelMapusv(ctx->Exec, (map, values));
7007 }
7008
7009 static void GLAPIENTRY
7010 exec_GetPolygonStipple(GLubyte * dest)
7011 {
7012 GET_CURRENT_CONTEXT(ctx);
7013 FLUSH_VERTICES(ctx, 0);
7014 CALL_GetPolygonStipple(ctx->Exec, (dest));
7015 }
7016
7017 static const GLubyte *GLAPIENTRY
7018 exec_GetString(GLenum name)
7019 {
7020 GET_CURRENT_CONTEXT(ctx);
7021 FLUSH_VERTICES(ctx, 0);
7022 return CALL_GetString(ctx->Exec, (name));
7023 }
7024
7025 static void GLAPIENTRY
7026 exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
7027 {
7028 GET_CURRENT_CONTEXT(ctx);
7029 FLUSH_VERTICES(ctx, 0);
7030 CALL_GetTexEnvfv(ctx->Exec, (target, pname, params));
7031 }
7032
7033 static void GLAPIENTRY
7034 exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
7035 {
7036 GET_CURRENT_CONTEXT(ctx);
7037 FLUSH_VERTICES(ctx, 0);
7038 CALL_GetTexEnviv(ctx->Exec, (target, pname, params));
7039 }
7040
7041 static void GLAPIENTRY
7042 exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
7043 {
7044 GET_CURRENT_CONTEXT(ctx);
7045 FLUSH_VERTICES(ctx, 0);
7046 CALL_GetTexGendv(ctx->Exec, (coord, pname, params));
7047 }
7048
7049 static void GLAPIENTRY
7050 exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
7051 {
7052 GET_CURRENT_CONTEXT(ctx);
7053 FLUSH_VERTICES(ctx, 0);
7054 CALL_GetTexGenfv(ctx->Exec, (coord, pname, params));
7055 }
7056
7057 static void GLAPIENTRY
7058 exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
7059 {
7060 GET_CURRENT_CONTEXT(ctx);
7061 FLUSH_VERTICES(ctx, 0);
7062 CALL_GetTexGeniv(ctx->Exec, (coord, pname, params));
7063 }
7064
7065 static void GLAPIENTRY
7066 exec_GetTexImage(GLenum target, GLint level, GLenum format,
7067 GLenum type, GLvoid * pixels)
7068 {
7069 GET_CURRENT_CONTEXT(ctx);
7070 FLUSH_VERTICES(ctx, 0);
7071 CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels));
7072 }
7073
7074 static void GLAPIENTRY
7075 exec_GetTexLevelParameterfv(GLenum target, GLint level,
7076 GLenum pname, GLfloat *params)
7077 {
7078 GET_CURRENT_CONTEXT(ctx);
7079 FLUSH_VERTICES(ctx, 0);
7080 CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params));
7081 }
7082
7083 static void GLAPIENTRY
7084 exec_GetTexLevelParameteriv(GLenum target, GLint level,
7085 GLenum pname, GLint *params)
7086 {
7087 GET_CURRENT_CONTEXT(ctx);
7088 FLUSH_VERTICES(ctx, 0);
7089 CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params));
7090 }
7091
7092 static void GLAPIENTRY
7093 exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
7094 {
7095 GET_CURRENT_CONTEXT(ctx);
7096 FLUSH_VERTICES(ctx, 0);
7097 CALL_GetTexParameterfv(ctx->Exec, (target, pname, params));
7098 }
7099
7100 static void GLAPIENTRY
7101 exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
7102 {
7103 GET_CURRENT_CONTEXT(ctx);
7104 FLUSH_VERTICES(ctx, 0);
7105 CALL_GetTexParameteriv(ctx->Exec, (target, pname, params));
7106 }
7107
7108 static GLboolean GLAPIENTRY
7109 exec_IsEnabled(GLenum cap)
7110 {
7111 GET_CURRENT_CONTEXT(ctx);
7112 FLUSH_VERTICES(ctx, 0);
7113 return CALL_IsEnabled(ctx->Exec, (cap));
7114 }
7115
7116 static void GLAPIENTRY
7117 exec_PixelStoref(GLenum pname, GLfloat param)
7118 {
7119 GET_CURRENT_CONTEXT(ctx);
7120 FLUSH_VERTICES(ctx, 0);
7121 CALL_PixelStoref(ctx->Exec, (pname, param));
7122 }
7123
7124 static void GLAPIENTRY
7125 exec_PixelStorei(GLenum pname, GLint param)
7126 {
7127 GET_CURRENT_CONTEXT(ctx);
7128 FLUSH_VERTICES(ctx, 0);
7129 CALL_PixelStorei(ctx->Exec, (pname, param));
7130 }
7131
7132 static void GLAPIENTRY
7133 exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
7134 GLenum format, GLenum type, GLvoid * pixels)
7135 {
7136 GET_CURRENT_CONTEXT(ctx);
7137 FLUSH_VERTICES(ctx, 0);
7138 CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels));
7139 }
7140
7141 static GLint GLAPIENTRY
7142 exec_RenderMode(GLenum mode)
7143 {
7144 GET_CURRENT_CONTEXT(ctx);
7145 FLUSH_VERTICES(ctx, 0);
7146 return CALL_RenderMode(ctx->Exec, (mode));
7147 }
7148
7149 static void GLAPIENTRY
7150 exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
7151 {
7152 GET_CURRENT_CONTEXT(ctx);
7153 FLUSH_VERTICES(ctx, 0);
7154 CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer));
7155 }
7156
7157 static void GLAPIENTRY
7158 exec_SelectBuffer(GLsizei size, GLuint * buffer)
7159 {
7160 GET_CURRENT_CONTEXT(ctx);
7161 FLUSH_VERTICES(ctx, 0);
7162 CALL_SelectBuffer(ctx->Exec, (size, buffer));
7163 }
7164
7165 static GLboolean GLAPIENTRY
7166 exec_AreTexturesResident(GLsizei n, const GLuint * texName,
7167 GLboolean * residences)
7168 {
7169 GET_CURRENT_CONTEXT(ctx);
7170 FLUSH_VERTICES(ctx, 0);
7171 return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences));
7172 }
7173
7174 static void GLAPIENTRY
7175 exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
7176 {
7177 GET_CURRENT_CONTEXT(ctx);
7178 FLUSH_VERTICES(ctx, 0);
7179 CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr));
7180 }
7181
7182 static void GLAPIENTRY
7183 exec_DeleteTextures(GLsizei n, const GLuint * texName)
7184 {
7185 GET_CURRENT_CONTEXT(ctx);
7186 FLUSH_VERTICES(ctx, 0);
7187 CALL_DeleteTextures(ctx->Exec, (n, texName));
7188 }
7189
7190 static void GLAPIENTRY
7191 exec_DisableClientState(GLenum cap)
7192 {
7193 GET_CURRENT_CONTEXT(ctx);
7194 FLUSH_VERTICES(ctx, 0);
7195 CALL_DisableClientState(ctx->Exec, (cap));
7196 }
7197
7198 static void GLAPIENTRY
7199 exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr)
7200 {
7201 GET_CURRENT_CONTEXT(ctx);
7202 FLUSH_VERTICES(ctx, 0);
7203 CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr));
7204 }
7205
7206 static void GLAPIENTRY
7207 exec_EnableClientState(GLenum cap)
7208 {
7209 GET_CURRENT_CONTEXT(ctx);
7210 FLUSH_VERTICES(ctx, 0);
7211 CALL_EnableClientState(ctx->Exec, (cap));
7212 }
7213
7214 static void GLAPIENTRY
7215 exec_GenTextures(GLsizei n, GLuint * texName)
7216 {
7217 GET_CURRENT_CONTEXT(ctx);
7218 FLUSH_VERTICES(ctx, 0);
7219 CALL_GenTextures(ctx->Exec, (n, texName));
7220 }
7221
7222 static void GLAPIENTRY
7223 exec_GetPointerv(GLenum pname, GLvoid **params)
7224 {
7225 GET_CURRENT_CONTEXT(ctx);
7226 FLUSH_VERTICES(ctx, 0);
7227 CALL_GetPointerv(ctx->Exec, (pname, params));
7228 }
7229
7230 static void GLAPIENTRY
7231 exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
7232 {
7233 GET_CURRENT_CONTEXT(ctx);
7234 FLUSH_VERTICES(ctx, 0);
7235 CALL_IndexPointer(ctx->Exec, (type, stride, ptr));
7236 }
7237
7238 static void GLAPIENTRY
7239 exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer)
7240 {
7241 GET_CURRENT_CONTEXT(ctx);
7242 FLUSH_VERTICES(ctx, 0);
7243 CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer));
7244 }
7245
7246 static GLboolean GLAPIENTRY
7247 exec_IsTexture(GLuint texture)
7248 {
7249 GET_CURRENT_CONTEXT(ctx);
7250 FLUSH_VERTICES(ctx, 0);
7251 return CALL_IsTexture(ctx->Exec, (texture));
7252 }
7253
7254 static void GLAPIENTRY
7255 exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
7256 {
7257 GET_CURRENT_CONTEXT(ctx);
7258 FLUSH_VERTICES(ctx, 0);
7259 CALL_NormalPointer(ctx->Exec, (type, stride, ptr));
7260 }
7261
7262 static void GLAPIENTRY
7263 exec_PopClientAttrib(void)
7264 {
7265 GET_CURRENT_CONTEXT(ctx);
7266 FLUSH_VERTICES(ctx, 0);
7267 CALL_PopClientAttrib(ctx->Exec, ());
7268 }
7269
7270 static void GLAPIENTRY
7271 exec_PushClientAttrib(GLbitfield mask)
7272 {
7273 GET_CURRENT_CONTEXT(ctx);
7274 FLUSH_VERTICES(ctx, 0);
7275 CALL_PushClientAttrib(ctx->Exec, (mask));
7276 }
7277
7278 static void GLAPIENTRY
7279 exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
7280 const GLvoid *ptr)
7281 {
7282 GET_CURRENT_CONTEXT(ctx);
7283 FLUSH_VERTICES(ctx, 0);
7284 CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
7285 }
7286
7287 static void GLAPIENTRY
7288 exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
7289 {
7290 GET_CURRENT_CONTEXT(ctx);
7291 FLUSH_VERTICES(ctx, 0);
7292 CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img));
7293 }
7294
7295 static void GLAPIENTRY
7296 exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
7297 const GLvoid *ptr)
7298 {
7299 GET_CURRENT_CONTEXT(ctx);
7300 FLUSH_VERTICES(ctx, 0);
7301 CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr));
7302 }
7303
7304 static void GLAPIENTRY
7305 exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
7306 GLint x, GLint y, GLsizei width)
7307 {
7308 GET_CURRENT_CONTEXT(ctx);
7309 FLUSH_VERTICES(ctx, 0);
7310 CALL_CopyConvolutionFilter1D(ctx->Exec,
7311 (target, internalFormat, x, y, width));
7312 }
7313
7314 static void GLAPIENTRY
7315 exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
7316 GLint x, GLint y, GLsizei width, GLsizei height)
7317 {
7318 GET_CURRENT_CONTEXT(ctx);
7319 FLUSH_VERTICES(ctx, 0);
7320 CALL_CopyConvolutionFilter2D(ctx->Exec,
7321 (target, internalFormat, x, y, width,
7322 height));
7323 }
7324
7325 static void GLAPIENTRY
7326 exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data)
7327 {
7328 GET_CURRENT_CONTEXT(ctx);
7329 FLUSH_VERTICES(ctx, 0);
7330 CALL_GetColorTable(ctx->Exec, (target, format, type, data));
7331 }
7332
7333 static void GLAPIENTRY
7334 exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
7335 {
7336 GET_CURRENT_CONTEXT(ctx);
7337 FLUSH_VERTICES(ctx, 0);
7338 CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params));
7339 }
7340
7341 static void GLAPIENTRY
7342 exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
7343 {
7344 GET_CURRENT_CONTEXT(ctx);
7345 FLUSH_VERTICES(ctx, 0);
7346 CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params));
7347 }
7348
7349 static void GLAPIENTRY
7350 exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
7351 GLvoid * image)
7352 {
7353 GET_CURRENT_CONTEXT(ctx);
7354 FLUSH_VERTICES(ctx, 0);
7355 CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image));
7356 }
7357
7358 static void GLAPIENTRY
7359 exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
7360 {
7361 GET_CURRENT_CONTEXT(ctx);
7362 FLUSH_VERTICES(ctx, 0);
7363 CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params));
7364 }
7365
7366 static void GLAPIENTRY
7367 exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
7368 {
7369 GET_CURRENT_CONTEXT(ctx);
7370 FLUSH_VERTICES(ctx, 0);
7371 CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params));
7372 }
7373
7374 static void GLAPIENTRY
7375 exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
7376 GLenum type, GLvoid *values)
7377 {
7378 GET_CURRENT_CONTEXT(ctx);
7379 FLUSH_VERTICES(ctx, 0);
7380 CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values));
7381 }
7382
7383 static void GLAPIENTRY
7384 exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
7385 {
7386 GET_CURRENT_CONTEXT(ctx);
7387 FLUSH_VERTICES(ctx, 0);
7388 CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params));
7389 }
7390
7391 static void GLAPIENTRY
7392 exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
7393 {
7394 GET_CURRENT_CONTEXT(ctx);
7395 FLUSH_VERTICES(ctx, 0);
7396 CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params));
7397 }
7398
7399 static void GLAPIENTRY
7400 exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
7401 GLenum type, GLvoid *values)
7402 {
7403 GET_CURRENT_CONTEXT(ctx);
7404 FLUSH_VERTICES(ctx, 0);
7405 CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values));
7406 }
7407
7408 static void GLAPIENTRY
7409 exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
7410 {
7411 GET_CURRENT_CONTEXT(ctx);
7412 FLUSH_VERTICES(ctx, 0);
7413 CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params));
7414 }
7415
7416 static void GLAPIENTRY
7417 exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
7418 {
7419 GET_CURRENT_CONTEXT(ctx);
7420 FLUSH_VERTICES(ctx, 0);
7421 CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params));
7422 }
7423
7424 static void GLAPIENTRY
7425 exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
7426 GLvoid *row, GLvoid *column, GLvoid *span)
7427 {
7428 GET_CURRENT_CONTEXT(ctx);
7429 FLUSH_VERTICES(ctx, 0);
7430 CALL_GetSeparableFilter(ctx->Exec,
7431 (target, format, type, row, column, span));
7432 }
7433
7434 static void GLAPIENTRY
7435 exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
7436 GLsizei width, GLsizei height, GLenum format,
7437 GLenum type, const GLvoid *row, const GLvoid *column)
7438 {
7439 GET_CURRENT_CONTEXT(ctx);
7440 FLUSH_VERTICES(ctx, 0);
7441 CALL_SeparableFilter2D(ctx->Exec,
7442 (target, internalFormat, width, height, format,
7443 type, row, column));
7444 }
7445
7446 static void GLAPIENTRY
7447 exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
7448 GLsizei count, const GLvoid *ptr)
7449 {
7450 GET_CURRENT_CONTEXT(ctx);
7451 FLUSH_VERTICES(ctx, 0);
7452 CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
7453 }
7454
7455 static void GLAPIENTRY
7456 exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
7457 {
7458 GET_CURRENT_CONTEXT(ctx);
7459 FLUSH_VERTICES(ctx, 0);
7460 CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr));
7461 }
7462
7463 static void GLAPIENTRY
7464 exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
7465 const GLvoid *ptr)
7466 {
7467 GET_CURRENT_CONTEXT(ctx);
7468 FLUSH_VERTICES(ctx, 0);
7469 CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr));
7470 }
7471
7472 static void GLAPIENTRY
7473 exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
7474 const GLvoid *ptr)
7475 {
7476 GET_CURRENT_CONTEXT(ctx);
7477 FLUSH_VERTICES(ctx, 0);
7478 CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr));
7479 }
7480
7481 static void GLAPIENTRY
7482 exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
7483 GLsizei count, const GLvoid *ptr)
7484 {
7485 GET_CURRENT_CONTEXT(ctx);
7486 FLUSH_VERTICES(ctx, 0);
7487 CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
7488 }
7489
7490 static void GLAPIENTRY
7491 exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
7492 GLsizei count, const GLvoid *ptr)
7493 {
7494 GET_CURRENT_CONTEXT(ctx);
7495 FLUSH_VERTICES(ctx, 0);
7496 CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
7497 }
7498
7499 static void GLAPIENTRY
7500 exec_LockArraysEXT(GLint first, GLsizei count)
7501 {
7502 GET_CURRENT_CONTEXT(ctx);
7503 FLUSH_VERTICES(ctx, 0);
7504 CALL_LockArraysEXT(ctx->Exec, (first, count));
7505 }
7506
7507 static void GLAPIENTRY
7508 exec_UnlockArraysEXT(void)
7509 {
7510 GET_CURRENT_CONTEXT(ctx);
7511 FLUSH_VERTICES(ctx, 0);
7512 CALL_UnlockArraysEXT(ctx->Exec, ());
7513 }
7514
7515 static void GLAPIENTRY
7516 exec_ClientActiveTextureARB(GLenum target)
7517 {
7518 GET_CURRENT_CONTEXT(ctx);
7519 FLUSH_VERTICES(ctx, 0);
7520 CALL_ClientActiveTextureARB(ctx->Exec, (target));
7521 }
7522
7523 static void GLAPIENTRY
7524 exec_SecondaryColorPointerEXT(GLint size, GLenum type,
7525 GLsizei stride, const GLvoid *ptr)
7526 {
7527 GET_CURRENT_CONTEXT(ctx);
7528 FLUSH_VERTICES(ctx, 0);
7529 CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr));
7530 }
7531
7532 static void GLAPIENTRY
7533 exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
7534 {
7535 GET_CURRENT_CONTEXT(ctx);
7536 FLUSH_VERTICES(ctx, 0);
7537 CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr));
7538 }
7539
7540 /* GL_EXT_multi_draw_arrays */
7541 static void GLAPIENTRY
7542 exec_MultiDrawArraysEXT(GLenum mode, GLint * first,
7543 GLsizei * count, GLsizei primcount)
7544 {
7545 GET_CURRENT_CONTEXT(ctx);
7546 FLUSH_VERTICES(ctx, 0);
7547 CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount));
7548 }
7549
7550 /* GL_EXT_multi_draw_arrays */
7551 static void GLAPIENTRY
7552 exec_MultiDrawElementsEXT(GLenum mode, const GLsizei * count,
7553 GLenum type, const GLvoid ** indices,
7554 GLsizei primcount)
7555 {
7556 GET_CURRENT_CONTEXT(ctx);
7557 FLUSH_VERTICES(ctx, 0);
7558 CALL_MultiDrawElementsEXT(ctx->Exec,
7559 (mode, count, type, indices, primcount));
7560 }
7561
7562 /* GL_IBM_multimode_draw_arrays */
7563 static void GLAPIENTRY
7564 exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
7565 const GLsizei * count, GLsizei primcount,
7566 GLint modestride)
7567 {
7568 GET_CURRENT_CONTEXT(ctx);
7569 FLUSH_VERTICES(ctx, 0);
7570 CALL_MultiModeDrawArraysIBM(ctx->Exec,
7571 (mode, first, count, primcount, modestride));
7572 }
7573
7574 /* GL_IBM_multimode_draw_arrays */
7575 static void GLAPIENTRY
7576 exec_MultiModeDrawElementsIBM(const GLenum * mode,
7577 const GLsizei * count,
7578 GLenum type,
7579 const GLvoid * const *indices,
7580 GLsizei primcount, GLint modestride)
7581 {
7582 GET_CURRENT_CONTEXT(ctx);
7583 FLUSH_VERTICES(ctx, 0);
7584 CALL_MultiModeDrawElementsIBM(ctx->Exec,
7585 (mode, count, type, indices, primcount,
7586 modestride));
7587 }
7588
7589
7590
7591 /**
7592 * Setup the given dispatch table to point to Mesa's display list
7593 * building functions.
7594 *
7595 * This does not include any of the tnl functions - they are
7596 * initialized from _mesa_init_api_defaults and from the active vtxfmt
7597 * struct.
7598 */
7599 void
7600 _mesa_init_dlist_table(struct _glapi_table *table)
7601 {
7602 _mesa_loopback_init_api_table(table);
7603
7604 /* GL 1.0 */
7605 SET_Accum(table, save_Accum);
7606 SET_AlphaFunc(table, save_AlphaFunc);
7607 SET_Bitmap(table, save_Bitmap);
7608 SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */
7609 SET_CallList(table, _mesa_save_CallList);
7610 SET_CallLists(table, _mesa_save_CallLists);
7611 SET_Clear(table, save_Clear);
7612 SET_ClearAccum(table, save_ClearAccum);
7613 SET_ClearColor(table, save_ClearColor);
7614 SET_ClearDepth(table, save_ClearDepth);
7615 SET_ClearIndex(table, save_ClearIndex);
7616 SET_ClearStencil(table, save_ClearStencil);
7617 SET_ClipPlane(table, save_ClipPlane);
7618 SET_ColorMask(table, save_ColorMask);
7619 SET_ColorMaterial(table, save_ColorMaterial);
7620 SET_CopyPixels(table, save_CopyPixels);
7621 SET_CullFace(table, save_CullFace);
7622 SET_DeleteLists(table, _mesa_DeleteLists);
7623 SET_DepthFunc(table, save_DepthFunc);
7624 SET_DepthMask(table, save_DepthMask);
7625 SET_DepthRange(table, save_DepthRange);
7626 SET_Disable(table, save_Disable);
7627 SET_DrawBuffer(table, save_DrawBuffer);
7628 SET_DrawPixels(table, save_DrawPixels);
7629 SET_Enable(table, save_Enable);
7630 SET_EndList(table, _mesa_EndList);
7631 SET_EvalMesh1(table, _mesa_save_EvalMesh1);
7632 SET_EvalMesh2(table, _mesa_save_EvalMesh2);
7633 SET_Finish(table, exec_Finish);
7634 SET_Flush(table, exec_Flush);
7635 SET_Fogf(table, save_Fogf);
7636 SET_Fogfv(table, save_Fogfv);
7637 SET_Fogi(table, save_Fogi);
7638 SET_Fogiv(table, save_Fogiv);
7639 SET_FrontFace(table, save_FrontFace);
7640 SET_Frustum(table, save_Frustum);
7641 SET_GenLists(table, _mesa_GenLists);
7642 SET_GetBooleanv(table, exec_GetBooleanv);
7643 SET_GetClipPlane(table, exec_GetClipPlane);
7644 SET_GetDoublev(table, exec_GetDoublev);
7645 SET_GetError(table, exec_GetError);
7646 SET_GetFloatv(table, exec_GetFloatv);
7647 SET_GetIntegerv(table, exec_GetIntegerv);
7648 SET_GetLightfv(table, exec_GetLightfv);
7649 SET_GetLightiv(table, exec_GetLightiv);
7650 SET_GetMapdv(table, exec_GetMapdv);
7651 SET_GetMapfv(table, exec_GetMapfv);
7652 SET_GetMapiv(table, exec_GetMapiv);
7653 SET_GetMaterialfv(table, exec_GetMaterialfv);
7654 SET_GetMaterialiv(table, exec_GetMaterialiv);
7655 SET_GetPixelMapfv(table, exec_GetPixelMapfv);
7656 SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
7657 SET_GetPixelMapusv(table, exec_GetPixelMapusv);
7658 SET_GetPolygonStipple(table, exec_GetPolygonStipple);
7659 SET_GetString(table, exec_GetString);
7660 SET_GetTexEnvfv(table, exec_GetTexEnvfv);
7661 SET_GetTexEnviv(table, exec_GetTexEnviv);
7662 SET_GetTexGendv(table, exec_GetTexGendv);
7663 SET_GetTexGenfv(table, exec_GetTexGenfv);
7664 SET_GetTexGeniv(table, exec_GetTexGeniv);
7665 SET_GetTexImage(table, exec_GetTexImage);
7666 SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
7667 SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
7668 SET_GetTexParameterfv(table, exec_GetTexParameterfv);
7669 SET_GetTexParameteriv(table, exec_GetTexParameteriv);
7670 SET_Hint(table, save_Hint);
7671 SET_IndexMask(table, save_IndexMask);
7672 SET_InitNames(table, save_InitNames);
7673 SET_IsEnabled(table, exec_IsEnabled);
7674 SET_IsList(table, _mesa_IsList);
7675 SET_LightModelf(table, save_LightModelf);
7676 SET_LightModelfv(table, save_LightModelfv);
7677 SET_LightModeli(table, save_LightModeli);
7678 SET_LightModeliv(table, save_LightModeliv);
7679 SET_Lightf(table, save_Lightf);
7680 SET_Lightfv(table, save_Lightfv);
7681 SET_Lighti(table, save_Lighti);
7682 SET_Lightiv(table, save_Lightiv);
7683 SET_LineStipple(table, save_LineStipple);
7684 SET_LineWidth(table, save_LineWidth);
7685 SET_ListBase(table, save_ListBase);
7686 SET_LoadIdentity(table, save_LoadIdentity);
7687 SET_LoadMatrixd(table, save_LoadMatrixd);
7688 SET_LoadMatrixf(table, save_LoadMatrixf);
7689 SET_LoadName(table, save_LoadName);
7690 SET_LogicOp(table, save_LogicOp);
7691 SET_Map1d(table, save_Map1d);
7692 SET_Map1f(table, save_Map1f);
7693 SET_Map2d(table, save_Map2d);
7694 SET_Map2f(table, save_Map2f);
7695 SET_MapGrid1d(table, save_MapGrid1d);
7696 SET_MapGrid1f(table, save_MapGrid1f);
7697 SET_MapGrid2d(table, save_MapGrid2d);
7698 SET_MapGrid2f(table, save_MapGrid2f);
7699 SET_MatrixMode(table, save_MatrixMode);
7700 SET_MultMatrixd(table, save_MultMatrixd);
7701 SET_MultMatrixf(table, save_MultMatrixf);
7702 SET_NewList(table, save_NewList);
7703 SET_Ortho(table, save_Ortho);
7704 SET_PassThrough(table, save_PassThrough);
7705 SET_PixelMapfv(table, save_PixelMapfv);
7706 SET_PixelMapuiv(table, save_PixelMapuiv);
7707 SET_PixelMapusv(table, save_PixelMapusv);
7708 SET_PixelStoref(table, exec_PixelStoref);
7709 SET_PixelStorei(table, exec_PixelStorei);
7710 SET_PixelTransferf(table, save_PixelTransferf);
7711 SET_PixelTransferi(table, save_PixelTransferi);
7712 SET_PixelZoom(table, save_PixelZoom);
7713 SET_PointSize(table, save_PointSize);
7714 SET_PolygonMode(table, save_PolygonMode);
7715 SET_PolygonOffset(table, save_PolygonOffset);
7716 SET_PolygonStipple(table, save_PolygonStipple);
7717 SET_PopAttrib(table, save_PopAttrib);
7718 SET_PopMatrix(table, save_PopMatrix);
7719 SET_PopName(table, save_PopName);
7720 SET_PushAttrib(table, save_PushAttrib);
7721 SET_PushMatrix(table, save_PushMatrix);
7722 SET_PushName(table, save_PushName);
7723 SET_RasterPos2d(table, save_RasterPos2d);
7724 SET_RasterPos2dv(table, save_RasterPos2dv);
7725 SET_RasterPos2f(table, save_RasterPos2f);
7726 SET_RasterPos2fv(table, save_RasterPos2fv);
7727 SET_RasterPos2i(table, save_RasterPos2i);
7728 SET_RasterPos2iv(table, save_RasterPos2iv);
7729 SET_RasterPos2s(table, save_RasterPos2s);
7730 SET_RasterPos2sv(table, save_RasterPos2sv);
7731 SET_RasterPos3d(table, save_RasterPos3d);
7732 SET_RasterPos3dv(table, save_RasterPos3dv);
7733 SET_RasterPos3f(table, save_RasterPos3f);
7734 SET_RasterPos3fv(table, save_RasterPos3fv);
7735 SET_RasterPos3i(table, save_RasterPos3i);
7736 SET_RasterPos3iv(table, save_RasterPos3iv);
7737 SET_RasterPos3s(table, save_RasterPos3s);
7738 SET_RasterPos3sv(table, save_RasterPos3sv);
7739 SET_RasterPos4d(table, save_RasterPos4d);
7740 SET_RasterPos4dv(table, save_RasterPos4dv);
7741 SET_RasterPos4f(table, save_RasterPos4f);
7742 SET_RasterPos4fv(table, save_RasterPos4fv);
7743 SET_RasterPos4i(table, save_RasterPos4i);
7744 SET_RasterPos4iv(table, save_RasterPos4iv);
7745 SET_RasterPos4s(table, save_RasterPos4s);
7746 SET_RasterPos4sv(table, save_RasterPos4sv);
7747 SET_ReadBuffer(table, save_ReadBuffer);
7748 SET_ReadPixels(table, exec_ReadPixels);
7749 SET_RenderMode(table, exec_RenderMode);
7750 SET_Rotated(table, save_Rotated);
7751 SET_Rotatef(table, save_Rotatef);
7752 SET_Scaled(table, save_Scaled);
7753 SET_Scalef(table, save_Scalef);
7754 SET_Scissor(table, save_Scissor);
7755 SET_FeedbackBuffer(table, exec_FeedbackBuffer);
7756 SET_SelectBuffer(table, exec_SelectBuffer);
7757 SET_ShadeModel(table, save_ShadeModel);
7758 SET_StencilFunc(table, save_StencilFunc);
7759 SET_StencilMask(table, save_StencilMask);
7760 SET_StencilOp(table, save_StencilOp);
7761 SET_TexEnvf(table, save_TexEnvf);
7762 SET_TexEnvfv(table, save_TexEnvfv);
7763 SET_TexEnvi(table, save_TexEnvi);
7764 SET_TexEnviv(table, save_TexEnviv);
7765 SET_TexGend(table, save_TexGend);
7766 SET_TexGendv(table, save_TexGendv);
7767 SET_TexGenf(table, save_TexGenf);
7768 SET_TexGenfv(table, save_TexGenfv);
7769 SET_TexGeni(table, save_TexGeni);
7770 SET_TexGeniv(table, save_TexGeniv);
7771 SET_TexImage1D(table, save_TexImage1D);
7772 SET_TexImage2D(table, save_TexImage2D);
7773 SET_TexParameterf(table, save_TexParameterf);
7774 SET_TexParameterfv(table, save_TexParameterfv);
7775 SET_TexParameteri(table, save_TexParameteri);
7776 SET_TexParameteriv(table, save_TexParameteriv);
7777 SET_Translated(table, save_Translated);
7778 SET_Translatef(table, save_Translatef);
7779 SET_Viewport(table, save_Viewport);
7780
7781 /* GL 1.1 */
7782 SET_AreTexturesResident(table, exec_AreTexturesResident);
7783 SET_BindTexture(table, save_BindTexture);
7784 SET_ColorPointer(table, exec_ColorPointer);
7785 SET_CopyTexImage1D(table, save_CopyTexImage1D);
7786 SET_CopyTexImage2D(table, save_CopyTexImage2D);
7787 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
7788 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
7789 SET_DeleteTextures(table, exec_DeleteTextures);
7790 SET_DisableClientState(table, exec_DisableClientState);
7791 SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
7792 SET_EnableClientState(table, exec_EnableClientState);
7793 SET_GenTextures(table, exec_GenTextures);
7794 SET_GetPointerv(table, exec_GetPointerv);
7795 SET_IndexPointer(table, exec_IndexPointer);
7796 SET_InterleavedArrays(table, exec_InterleavedArrays);
7797 SET_IsTexture(table, exec_IsTexture);
7798 SET_NormalPointer(table, exec_NormalPointer);
7799 SET_PopClientAttrib(table, exec_PopClientAttrib);
7800 SET_PrioritizeTextures(table, save_PrioritizeTextures);
7801 SET_PushClientAttrib(table, exec_PushClientAttrib);
7802 SET_TexCoordPointer(table, exec_TexCoordPointer);
7803 SET_TexSubImage1D(table, save_TexSubImage1D);
7804 SET_TexSubImage2D(table, save_TexSubImage2D);
7805 SET_VertexPointer(table, exec_VertexPointer);
7806
7807 /* GL 1.2 */
7808 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
7809 SET_TexImage3D(table, save_TexImage3D);
7810 SET_TexSubImage3D(table, save_TexSubImage3D);
7811
7812 /* GL 2.0 */
7813 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
7814 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
7815 SET_StencilOpSeparate(table, save_StencilOpSeparate);
7816
7817 /* GL_ARB_imaging */
7818 /* Not all are supported */
7819 SET_BlendColor(table, save_BlendColor);
7820 SET_BlendEquation(table, save_BlendEquation);
7821 SET_ColorSubTable(table, save_ColorSubTable);
7822 SET_ColorTable(table, save_ColorTable);
7823 SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
7824 SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
7825 SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
7826 SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
7827 SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
7828 SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
7829 SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
7830 SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
7831 SET_CopyColorSubTable(table, save_CopyColorSubTable);
7832 SET_CopyColorTable(table, save_CopyColorTable);
7833 SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
7834 SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
7835 SET_GetColorTable(table, exec_GetColorTable);
7836 SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
7837 SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
7838 SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
7839 SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
7840 SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
7841 SET_GetHistogram(table, exec_GetHistogram);
7842 SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
7843 SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
7844 SET_GetMinmax(table, exec_GetMinmax);
7845 SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
7846 SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
7847 SET_GetSeparableFilter(table, exec_GetSeparableFilter);
7848 SET_Histogram(table, save_Histogram);
7849 SET_Minmax(table, save_Minmax);
7850 SET_ResetHistogram(table, save_ResetHistogram);
7851 SET_ResetMinmax(table, save_ResetMinmax);
7852 SET_SeparableFilter2D(table, exec_SeparableFilter2D);
7853
7854 /* 2. GL_EXT_blend_color */
7855 #if 0
7856 SET_BlendColorEXT(table, save_BlendColorEXT);
7857 #endif
7858
7859 /* 3. GL_EXT_polygon_offset */
7860 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
7861
7862 /* 6. GL_EXT_texture3d */
7863 #if 0
7864 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
7865 SET_TexImage3DEXT(table, save_TexImage3DEXT);
7866 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
7867 #endif
7868
7869 /* 14. GL_SGI_color_table */
7870 #if 0
7871 SET_ColorTableSGI(table, save_ColorTable);
7872 SET_ColorSubTableSGI(table, save_ColorSubTable);
7873 SET_GetColorTableSGI(table, exec_GetColorTable);
7874 SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv);
7875 SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv);
7876 #endif
7877
7878 /* 30. GL_EXT_vertex_array */
7879 SET_ColorPointerEXT(table, exec_ColorPointerEXT);
7880 SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
7881 SET_IndexPointerEXT(table, exec_IndexPointerEXT);
7882 SET_NormalPointerEXT(table, exec_NormalPointerEXT);
7883 SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
7884 SET_VertexPointerEXT(table, exec_VertexPointerEXT);
7885
7886 /* 37. GL_EXT_blend_minmax */
7887 #if 0
7888 SET_BlendEquationEXT(table, save_BlendEquationEXT);
7889 #endif
7890
7891 /* 54. GL_EXT_point_parameters */
7892 SET_PointParameterfEXT(table, save_PointParameterfEXT);
7893 SET_PointParameterfvEXT(table, save_PointParameterfvEXT);
7894
7895 /* 97. GL_EXT_compiled_vertex_array */
7896 SET_LockArraysEXT(table, exec_LockArraysEXT);
7897 SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
7898
7899 /* 145. GL_EXT_secondary_color */
7900 SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT);
7901
7902 /* 148. GL_EXT_multi_draw_arrays */
7903 SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT);
7904 SET_MultiDrawElementsEXT(table, exec_MultiDrawElementsEXT);
7905
7906 /* 149. GL_EXT_fog_coord */
7907 SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT);
7908
7909 /* 173. GL_EXT_blend_func_separate */
7910 SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT);
7911
7912 /* 196. GL_MESA_resize_buffers */
7913 SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
7914
7915 /* 197. GL_MESA_window_pos */
7916 SET_WindowPos2dMESA(table, save_WindowPos2dMESA);
7917 SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA);
7918 SET_WindowPos2fMESA(table, save_WindowPos2fMESA);
7919 SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA);
7920 SET_WindowPos2iMESA(table, save_WindowPos2iMESA);
7921 SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA);
7922 SET_WindowPos2sMESA(table, save_WindowPos2sMESA);
7923 SET_WindowPos2svMESA(table, save_WindowPos2svMESA);
7924 SET_WindowPos3dMESA(table, save_WindowPos3dMESA);
7925 SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA);
7926 SET_WindowPos3fMESA(table, save_WindowPos3fMESA);
7927 SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA);
7928 SET_WindowPos3iMESA(table, save_WindowPos3iMESA);
7929 SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA);
7930 SET_WindowPos3sMESA(table, save_WindowPos3sMESA);
7931 SET_WindowPos3svMESA(table, save_WindowPos3svMESA);
7932 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
7933 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
7934 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
7935 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
7936 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
7937 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
7938 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
7939 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
7940
7941 /* 200. GL_IBM_multimode_draw_arrays */
7942 SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
7943 SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
7944
7945 #if FEATURE_NV_vertex_program
7946 /* 233. GL_NV_vertex_program */
7947 /* The following commands DO NOT go into display lists:
7948 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
7949 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
7950 */
7951 SET_BindProgramNV(table, save_BindProgramNV);
7952 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
7953 SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
7954 SET_GenProgramsNV(table, _mesa_GenPrograms);
7955 SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
7956 SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
7957 SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
7958 SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
7959 SET_GetProgramivNV(table, _mesa_GetProgramivNV);
7960 SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
7961 SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
7962 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
7963 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
7964 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
7965 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
7966 SET_IsProgramNV(table, _mesa_IsProgramARB);
7967 SET_LoadProgramNV(table, save_LoadProgramNV);
7968 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
7969 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
7970 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
7971 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
7972 SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
7973 SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
7974 SET_TrackMatrixNV(table, save_TrackMatrixNV);
7975 SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
7976 #endif
7977
7978 /* 245. GL_ATI_fragment_shader */
7979 #if FEATURE_ATI_fragment_shader
7980 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
7981 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
7982 #endif
7983
7984 /* 282. GL_NV_fragment_program */
7985 #if FEATURE_NV_fragment_program
7986 SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
7987 SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
7988 SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
7989 SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
7990 SET_GetProgramNamedParameterfvNV(table,
7991 _mesa_GetProgramNamedParameterfvNV);
7992 SET_GetProgramNamedParameterdvNV(table,
7993 _mesa_GetProgramNamedParameterdvNV);
7994 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
7995 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
7996 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
7997 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
7998 SET_GetProgramLocalParameterdvARB(table,
7999 _mesa_GetProgramLocalParameterdvARB);
8000 SET_GetProgramLocalParameterfvARB(table,
8001 _mesa_GetProgramLocalParameterfvARB);
8002 #endif
8003
8004 /* 262. GL_NV_point_sprite */
8005 SET_PointParameteriNV(table, save_PointParameteriNV);
8006 SET_PointParameterivNV(table, save_PointParameterivNV);
8007
8008 /* 268. GL_EXT_stencil_two_side */
8009 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
8010
8011 /* 273. GL_APPLE_vertex_array_object */
8012 SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
8013 SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE);
8014 SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
8015 SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE);
8016
8017 /* ???. GL_EXT_depth_bounds_test */
8018 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
8019
8020 /* ARB 1. GL_ARB_multitexture */
8021 SET_ActiveTextureARB(table, save_ActiveTextureARB);
8022 SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB);
8023
8024 /* ARB 3. GL_ARB_transpose_matrix */
8025 SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB);
8026 SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB);
8027 SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB);
8028 SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB);
8029
8030 /* ARB 5. GL_ARB_multisample */
8031 SET_SampleCoverageARB(table, save_SampleCoverageARB);
8032
8033 /* ARB 12. GL_ARB_texture_compression */
8034 SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
8035 SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
8036 SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
8037 SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
8038 SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
8039 SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
8040 SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
8041
8042 /* ARB 14. GL_ARB_point_parameters */
8043 /* aliased with EXT_point_parameters functions */
8044
8045 /* ARB 25. GL_ARB_window_pos */
8046 /* aliased with MESA_window_pos functions */
8047
8048 /* ARB 26. GL_ARB_vertex_program */
8049 /* ARB 27. GL_ARB_fragment_program */
8050 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8051 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8052 SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB);
8053 SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB);
8054 SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB);
8055 SET_ProgramStringARB(table, save_ProgramStringARB);
8056 SET_BindProgramNV(table, save_BindProgramNV);
8057 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
8058 SET_GenProgramsNV(table, _mesa_GenPrograms);
8059 SET_IsProgramNV(table, _mesa_IsProgramARB);
8060 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
8061 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
8062 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
8063 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
8064 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
8065 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
8066 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
8067 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
8068 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
8069 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
8070 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
8071 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
8072 SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
8073 SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
8074 SET_GetProgramLocalParameterdvARB(table,
8075 _mesa_GetProgramLocalParameterdvARB);
8076 SET_GetProgramLocalParameterfvARB(table,
8077 _mesa_GetProgramLocalParameterfvARB);
8078 SET_GetProgramivARB(table, _mesa_GetProgramivARB);
8079 SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
8080 #endif
8081
8082 /* ARB 28. GL_ARB_vertex_buffer_object */
8083 #if FEATURE_ARB_vertex_buffer_object
8084 /* None of the extension's functions get compiled */
8085 SET_BindBufferARB(table, _mesa_BindBufferARB);
8086 SET_BufferDataARB(table, _mesa_BufferDataARB);
8087 SET_BufferSubDataARB(table, _mesa_BufferSubDataARB);
8088 SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB);
8089 SET_GenBuffersARB(table, _mesa_GenBuffersARB);
8090 SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB);
8091 SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB);
8092 SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB);
8093 SET_IsBufferARB(table, _mesa_IsBufferARB);
8094 SET_MapBufferARB(table, _mesa_MapBufferARB);
8095 SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
8096 #endif
8097
8098 #if FEATURE_ARB_occlusion_query
8099 SET_BeginQueryARB(table, save_BeginQueryARB);
8100 SET_EndQueryARB(table, save_EndQueryARB);
8101 SET_GenQueriesARB(table, _mesa_GenQueriesARB);
8102 SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB);
8103 SET_IsQueryARB(table, _mesa_IsQueryARB);
8104 SET_GetQueryivARB(table, _mesa_GetQueryivARB);
8105 SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB);
8106 SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB);
8107 #endif
8108 SET_DrawBuffersARB(table, save_DrawBuffersARB);
8109
8110 #if FEATURE_EXT_framebuffer_blit
8111 SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
8112 #endif
8113
8114 /* 299. GL_EXT_blend_equation_separate */
8115 SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
8116
8117 /* GL_EXT_gpu_program_parmaeters */
8118 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8119 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
8120 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
8121 #endif
8122 }
8123
8124
8125
8126 static const char *
8127 enum_string(GLenum k)
8128 {
8129 return _mesa_lookup_enum_by_nr(k);
8130 }
8131
8132
8133 /**
8134 * Print the commands in a display list. For debugging only.
8135 * TODO: many commands aren't handled yet.
8136 */
8137 static void GLAPIENTRY
8138 print_list(GLcontext *ctx, GLuint list)
8139 {
8140 struct mesa_display_list *dlist;
8141 Node *n;
8142 GLboolean done;
8143
8144 if (!islist(ctx, list)) {
8145 _mesa_printf("%u is not a display list ID\n", list);
8146 return;
8147 }
8148
8149 dlist = lookup_list(ctx, list);
8150 if (!dlist)
8151 return;
8152
8153 n = dlist->node;
8154
8155 _mesa_printf("START-LIST %u, address %p\n", list, (void *) n);
8156
8157 done = n ? GL_FALSE : GL_TRUE;
8158 while (!done) {
8159 OpCode opcode = n[0].opcode;
8160 GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
8161
8162 if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
8163 /* this is a driver-extended opcode */
8164 ctx->ListExt.Opcode[i].Print(ctx, &n[1]);
8165 n += ctx->ListExt.Opcode[i].Size;
8166 }
8167 else {
8168 switch (opcode) {
8169 case OPCODE_ACCUM:
8170 _mesa_printf("Accum %s %g\n", enum_string(n[1].e), n[2].f);
8171 break;
8172 case OPCODE_BITMAP:
8173 _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
8174 n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data);
8175 break;
8176 case OPCODE_CALL_LIST:
8177 _mesa_printf("CallList %d\n", (int) n[1].ui);
8178 break;
8179 case OPCODE_CALL_LIST_OFFSET:
8180 _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
8181 ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
8182 break;
8183 case OPCODE_COLOR_TABLE_PARAMETER_FV:
8184 _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n",
8185 enum_string(n[1].e), enum_string(n[2].e),
8186 n[3].f, n[4].f, n[5].f, n[6].f);
8187 break;
8188 case OPCODE_COLOR_TABLE_PARAMETER_IV:
8189 _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n",
8190 enum_string(n[1].e), enum_string(n[2].e),
8191 n[3].i, n[4].i, n[5].i, n[6].i);
8192 break;
8193 case OPCODE_DISABLE:
8194 _mesa_printf("Disable %s\n", enum_string(n[1].e));
8195 break;
8196 case OPCODE_ENABLE:
8197 _mesa_printf("Enable %s\n", enum_string(n[1].e));
8198 break;
8199 case OPCODE_FRUSTUM:
8200 _mesa_printf("Frustum %g %g %g %g %g %g\n",
8201 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
8202 break;
8203 case OPCODE_LINE_STIPPLE:
8204 _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us);
8205 break;
8206 case OPCODE_LOAD_IDENTITY:
8207 _mesa_printf("LoadIdentity\n");
8208 break;
8209 case OPCODE_LOAD_MATRIX:
8210 _mesa_printf("LoadMatrix\n");
8211 _mesa_printf(" %8f %8f %8f %8f\n",
8212 n[1].f, n[5].f, n[9].f, n[13].f);
8213 _mesa_printf(" %8f %8f %8f %8f\n",
8214 n[2].f, n[6].f, n[10].f, n[14].f);
8215 _mesa_printf(" %8f %8f %8f %8f\n",
8216 n[3].f, n[7].f, n[11].f, n[15].f);
8217 _mesa_printf(" %8f %8f %8f %8f\n",
8218 n[4].f, n[8].f, n[12].f, n[16].f);
8219 break;
8220 case OPCODE_MULT_MATRIX:
8221 _mesa_printf("MultMatrix (or Rotate)\n");
8222 _mesa_printf(" %8f %8f %8f %8f\n",
8223 n[1].f, n[5].f, n[9].f, n[13].f);
8224 _mesa_printf(" %8f %8f %8f %8f\n",
8225 n[2].f, n[6].f, n[10].f, n[14].f);
8226 _mesa_printf(" %8f %8f %8f %8f\n",
8227 n[3].f, n[7].f, n[11].f, n[15].f);
8228 _mesa_printf(" %8f %8f %8f %8f\n",
8229 n[4].f, n[8].f, n[12].f, n[16].f);
8230 break;
8231 case OPCODE_ORTHO:
8232 _mesa_printf("Ortho %g %g %g %g %g %g\n",
8233 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
8234 break;
8235 case OPCODE_POP_ATTRIB:
8236 _mesa_printf("PopAttrib\n");
8237 break;
8238 case OPCODE_POP_MATRIX:
8239 _mesa_printf("PopMatrix\n");
8240 break;
8241 case OPCODE_POP_NAME:
8242 _mesa_printf("PopName\n");
8243 break;
8244 case OPCODE_PUSH_ATTRIB:
8245 _mesa_printf("PushAttrib %x\n", n[1].bf);
8246 break;
8247 case OPCODE_PUSH_MATRIX:
8248 _mesa_printf("PushMatrix\n");
8249 break;
8250 case OPCODE_PUSH_NAME:
8251 _mesa_printf("PushName %d\n", (int) n[1].ui);
8252 break;
8253 case OPCODE_RASTER_POS:
8254 _mesa_printf("RasterPos %g %g %g %g\n",
8255 n[1].f, n[2].f, n[3].f, n[4].f);
8256 break;
8257 case OPCODE_ROTATE:
8258 _mesa_printf("Rotate %g %g %g %g\n",
8259 n[1].f, n[2].f, n[3].f, n[4].f);
8260 break;
8261 case OPCODE_SCALE:
8262 _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
8263 break;
8264 case OPCODE_TRANSLATE:
8265 _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
8266 break;
8267 case OPCODE_BIND_TEXTURE:
8268 _mesa_printf("BindTexture %s %d\n",
8269 _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
8270 break;
8271 case OPCODE_SHADE_MODEL:
8272 _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui));
8273 break;
8274 case OPCODE_MAP1:
8275 _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
8276 _mesa_lookup_enum_by_nr(n[1].ui),
8277 n[2].f, n[3].f, n[4].i, n[5].i);
8278 break;
8279 case OPCODE_MAP2:
8280 _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8281 _mesa_lookup_enum_by_nr(n[1].ui),
8282 n[2].f, n[3].f, n[4].f, n[5].f,
8283 n[6].i, n[7].i, n[8].i, n[9].i);
8284 break;
8285 case OPCODE_MAPGRID1:
8286 _mesa_printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
8287 break;
8288 case OPCODE_MAPGRID2:
8289 _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8290 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
8291 break;
8292 case OPCODE_EVALMESH1:
8293 _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i);
8294 break;
8295 case OPCODE_EVALMESH2:
8296 _mesa_printf("EvalMesh2 %d %d %d %d\n",
8297 n[1].i, n[2].i, n[3].i, n[4].i);
8298 break;
8299
8300 case OPCODE_ATTR_1F_NV:
8301 _mesa_printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
8302 break;
8303 case OPCODE_ATTR_2F_NV:
8304 _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
8305 n[1].i, n[2].f, n[3].f);
8306 break;
8307 case OPCODE_ATTR_3F_NV:
8308 _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
8309 n[1].i, n[2].f, n[3].f, n[4].f);
8310 break;
8311 case OPCODE_ATTR_4F_NV:
8312 _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8313 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
8314 break;
8315 case OPCODE_ATTR_1F_ARB:
8316 _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
8317 break;
8318 case OPCODE_ATTR_2F_ARB:
8319 _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
8320 n[1].i, n[2].f, n[3].f);
8321 break;
8322 case OPCODE_ATTR_3F_ARB:
8323 _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8324 n[1].i, n[2].f, n[3].f, n[4].f);
8325 break;
8326 case OPCODE_ATTR_4F_ARB:
8327 _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8328 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
8329 break;
8330
8331 case OPCODE_MATERIAL:
8332 _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
8333 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
8334 break;
8335 case OPCODE_BEGIN:
8336 _mesa_printf("BEGIN %x\n", n[1].i);
8337 break;
8338 case OPCODE_END:
8339 _mesa_printf("END\n");
8340 break;
8341 case OPCODE_RECTF:
8342 _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
8343 n[4].f);
8344 break;
8345 case OPCODE_EVAL_C1:
8346 _mesa_printf("EVAL_C1 %f\n", n[1].f);
8347 break;
8348 case OPCODE_EVAL_C2:
8349 _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
8350 break;
8351 case OPCODE_EVAL_P1:
8352 _mesa_printf("EVAL_P1 %d\n", n[1].i);
8353 break;
8354 case OPCODE_EVAL_P2:
8355 _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
8356 break;
8357
8358 /*
8359 * meta opcodes/commands
8360 */
8361 case OPCODE_ERROR:
8362 _mesa_printf("Error: %s %s\n",
8363 enum_string(n[1].e), (const char *) n[2].data);
8364 break;
8365 case OPCODE_CONTINUE:
8366 _mesa_printf("DISPLAY-LIST-CONTINUE\n");
8367 n = (Node *) n[1].next;
8368 break;
8369 case OPCODE_END_OF_LIST:
8370 _mesa_printf("END-LIST %u\n", list);
8371 done = GL_TRUE;
8372 break;
8373 default:
8374 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
8375 _mesa_printf
8376 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8377 opcode, (void *) n);
8378 return;
8379 }
8380 else {
8381 _mesa_printf("command %d, %u operands\n", opcode,
8382 InstSize[opcode]);
8383 }
8384 }
8385 /* increment n to point to next compiled command */
8386 if (opcode != OPCODE_CONTINUE) {
8387 n += InstSize[opcode];
8388 }
8389 }
8390 }
8391 }
8392
8393
8394
8395 /**
8396 * Clients may call this function to help debug display list problems.
8397 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
8398 * changed, or break in the future without notice.
8399 */
8400 void
8401 mesa_print_display_list(GLuint list)
8402 {
8403 GET_CURRENT_CONTEXT(ctx);
8404 print_list(ctx, list);
8405 }
8406
8407
8408 /**********************************************************************/
8409 /***** Initialization *****/
8410 /**********************************************************************/
8411
8412 void
8413 _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
8414 {
8415 vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
8416 vfmt->Begin = save_Begin;
8417 vfmt->CallList = _mesa_save_CallList;
8418 vfmt->CallLists = _mesa_save_CallLists;
8419 vfmt->Color3f = save_Color3f;
8420 vfmt->Color3fv = save_Color3fv;
8421 vfmt->Color4f = save_Color4f;
8422 vfmt->Color4fv = save_Color4fv;
8423 vfmt->EdgeFlag = save_EdgeFlag;
8424 vfmt->End = save_End;
8425 vfmt->EvalCoord1f = save_EvalCoord1f;
8426 vfmt->EvalCoord1fv = save_EvalCoord1fv;
8427 vfmt->EvalCoord2f = save_EvalCoord2f;
8428 vfmt->EvalCoord2fv = save_EvalCoord2fv;
8429 vfmt->EvalPoint1 = save_EvalPoint1;
8430 vfmt->EvalPoint2 = save_EvalPoint2;
8431 vfmt->FogCoordfEXT = save_FogCoordfEXT;
8432 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
8433 vfmt->Indexf = save_Indexf;
8434 vfmt->Indexfv = save_Indexfv;
8435 vfmt->Materialfv = save_Materialfv;
8436 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
8437 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
8438 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
8439 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
8440 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
8441 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
8442 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
8443 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
8444 vfmt->Normal3f = save_Normal3f;
8445 vfmt->Normal3fv = save_Normal3fv;
8446 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
8447 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
8448 vfmt->TexCoord1f = save_TexCoord1f;
8449 vfmt->TexCoord1fv = save_TexCoord1fv;
8450 vfmt->TexCoord2f = save_TexCoord2f;
8451 vfmt->TexCoord2fv = save_TexCoord2fv;
8452 vfmt->TexCoord3f = save_TexCoord3f;
8453 vfmt->TexCoord3fv = save_TexCoord3fv;
8454 vfmt->TexCoord4f = save_TexCoord4f;
8455 vfmt->TexCoord4fv = save_TexCoord4fv;
8456 vfmt->Vertex2f = save_Vertex2f;
8457 vfmt->Vertex2fv = save_Vertex2fv;
8458 vfmt->Vertex3f = save_Vertex3f;
8459 vfmt->Vertex3fv = save_Vertex3fv;
8460 vfmt->Vertex4f = save_Vertex4f;
8461 vfmt->Vertex4fv = save_Vertex4fv;
8462 vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
8463 vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
8464 vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
8465 vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
8466 vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
8467 vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
8468 vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
8469 vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
8470 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
8471 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
8472 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
8473 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
8474 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
8475 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
8476 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
8477 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
8478
8479 vfmt->EvalMesh1 = _mesa_save_EvalMesh1;
8480 vfmt->EvalMesh2 = _mesa_save_EvalMesh2;
8481 vfmt->Rectf = save_Rectf;
8482
8483 /* The driver is required to implement these as
8484 * 1) They can probably do a better job.
8485 * 2) A lot of new mechanisms would have to be added to this module
8486 * to support it. That code would probably never get used,
8487 * because of (1).
8488 */
8489 #if 0
8490 vfmt->DrawArrays = 0;
8491 vfmt->DrawElements = 0;
8492 vfmt->DrawRangeElements = 0;
8493 #endif
8494 }
8495
8496
8497 /**
8498 * Initialize display list state for given context.
8499 */
8500 void
8501 _mesa_init_display_list(GLcontext *ctx)
8502 {
8503 static GLboolean tableInitialized = GL_FALSE;
8504
8505 /* zero-out the instruction size table, just once */
8506 if (!tableInitialized) {
8507 _mesa_bzero(InstSize, sizeof(InstSize));
8508 tableInitialized = GL_TRUE;
8509 }
8510
8511 /* Display list */
8512 ctx->ListState.CallDepth = 0;
8513 ctx->ExecuteFlag = GL_TRUE;
8514 ctx->CompileFlag = GL_FALSE;
8515 ctx->ListState.CurrentListPtr = NULL;
8516 ctx->ListState.CurrentBlock = NULL;
8517 ctx->ListState.CurrentListNum = 0;
8518 ctx->ListState.CurrentPos = 0;
8519
8520 /* Display List group */
8521 ctx->List.ListBase = 0;
8522
8523 _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
8524 }