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