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