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