Merge remote branch 'origin/7.8'
[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 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6134 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6135 if (ctx->ExecuteFlag) {
6136 CALL_EndTransformFeedbackEXT(ctx->Exec, ());
6137 }
6138 }
6139
6140
6141 /* aka UseProgram() */
6142 static void GLAPIENTRY
6143 save_UseProgramObjectARB(GLhandleARB program)
6144 {
6145 GET_CURRENT_CONTEXT(ctx);
6146 Node *n;
6147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6148 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6149 if (n) {
6150 n[1].ui = program;
6151 }
6152 if (ctx->ExecuteFlag) {
6153 CALL_UseProgramObjectARB(ctx->Exec, (program));
6154 }
6155 }
6156
6157
6158 static void GLAPIENTRY
6159 save_Uniform1fARB(GLint location, GLfloat x)
6160 {
6161 GET_CURRENT_CONTEXT(ctx);
6162 Node *n;
6163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6164 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6165 if (n) {
6166 n[1].i = location;
6167 n[2].f = x;
6168 }
6169 if (ctx->ExecuteFlag) {
6170 CALL_Uniform1fARB(ctx->Exec, (location, x));
6171 }
6172 }
6173
6174
6175 static void GLAPIENTRY
6176 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6177 {
6178 GET_CURRENT_CONTEXT(ctx);
6179 Node *n;
6180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6181 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6182 if (n) {
6183 n[1].i = location;
6184 n[2].f = x;
6185 n[3].f = y;
6186 }
6187 if (ctx->ExecuteFlag) {
6188 CALL_Uniform2fARB(ctx->Exec, (location, x, y));
6189 }
6190 }
6191
6192
6193 static void GLAPIENTRY
6194 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6195 {
6196 GET_CURRENT_CONTEXT(ctx);
6197 Node *n;
6198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6199 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6200 if (n) {
6201 n[1].i = location;
6202 n[2].f = x;
6203 n[3].f = y;
6204 n[4].f = z;
6205 }
6206 if (ctx->ExecuteFlag) {
6207 CALL_Uniform3fARB(ctx->Exec, (location, x, y, z));
6208 }
6209 }
6210
6211
6212 static void GLAPIENTRY
6213 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6214 {
6215 GET_CURRENT_CONTEXT(ctx);
6216 Node *n;
6217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6218 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6219 if (n) {
6220 n[1].i = location;
6221 n[2].f = x;
6222 n[3].f = y;
6223 n[4].f = z;
6224 n[5].f = w;
6225 }
6226 if (ctx->ExecuteFlag) {
6227 CALL_Uniform4fARB(ctx->Exec, (location, x, y, z, w));
6228 }
6229 }
6230
6231
6232 /** Return copy of memory */
6233 static void *
6234 memdup(const void *src, GLsizei bytes)
6235 {
6236 void *b = bytes >= 0 ? malloc(bytes) : NULL;
6237 if (b)
6238 memcpy(b, src, bytes);
6239 return b;
6240 }
6241
6242
6243 static void GLAPIENTRY
6244 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6245 {
6246 GET_CURRENT_CONTEXT(ctx);
6247 Node *n;
6248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6249 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3);
6250 if (n) {
6251 n[1].i = location;
6252 n[2].i = count;
6253 n[3].data = memdup(v, count * 1 * sizeof(GLfloat));
6254 }
6255 if (ctx->ExecuteFlag) {
6256 CALL_Uniform1fvARB(ctx->Exec, (location, count, v));
6257 }
6258 }
6259
6260 static void GLAPIENTRY
6261 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6262 {
6263 GET_CURRENT_CONTEXT(ctx);
6264 Node *n;
6265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6266 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3);
6267 if (n) {
6268 n[1].i = location;
6269 n[2].i = count;
6270 n[3].data = memdup(v, count * 2 * sizeof(GLfloat));
6271 }
6272 if (ctx->ExecuteFlag) {
6273 CALL_Uniform2fvARB(ctx->Exec, (location, count, v));
6274 }
6275 }
6276
6277 static void GLAPIENTRY
6278 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6279 {
6280 GET_CURRENT_CONTEXT(ctx);
6281 Node *n;
6282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6283 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3);
6284 if (n) {
6285 n[1].i = location;
6286 n[2].i = count;
6287 n[3].data = memdup(v, count * 3 * sizeof(GLfloat));
6288 }
6289 if (ctx->ExecuteFlag) {
6290 CALL_Uniform3fvARB(ctx->Exec, (location, count, v));
6291 }
6292 }
6293
6294 static void GLAPIENTRY
6295 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6296 {
6297 GET_CURRENT_CONTEXT(ctx);
6298 Node *n;
6299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6300 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3);
6301 if (n) {
6302 n[1].i = location;
6303 n[2].i = count;
6304 n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
6305 }
6306 if (ctx->ExecuteFlag) {
6307 CALL_Uniform4fvARB(ctx->Exec, (location, count, v));
6308 }
6309 }
6310
6311
6312 static void GLAPIENTRY
6313 save_Uniform1iARB(GLint location, GLint x)
6314 {
6315 GET_CURRENT_CONTEXT(ctx);
6316 Node *n;
6317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6318 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6319 if (n) {
6320 n[1].i = location;
6321 n[2].i = x;
6322 }
6323 if (ctx->ExecuteFlag) {
6324 CALL_Uniform1iARB(ctx->Exec, (location, x));
6325 }
6326 }
6327
6328 static void GLAPIENTRY
6329 save_Uniform2iARB(GLint location, GLint x, GLint y)
6330 {
6331 GET_CURRENT_CONTEXT(ctx);
6332 Node *n;
6333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6334 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6335 if (n) {
6336 n[1].i = location;
6337 n[2].i = x;
6338 n[3].i = y;
6339 }
6340 if (ctx->ExecuteFlag) {
6341 CALL_Uniform2iARB(ctx->Exec, (location, x, y));
6342 }
6343 }
6344
6345 static void GLAPIENTRY
6346 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6347 {
6348 GET_CURRENT_CONTEXT(ctx);
6349 Node *n;
6350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6351 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6352 if (n) {
6353 n[1].i = location;
6354 n[2].i = x;
6355 n[3].i = y;
6356 n[4].i = z;
6357 }
6358 if (ctx->ExecuteFlag) {
6359 CALL_Uniform3iARB(ctx->Exec, (location, x, y, z));
6360 }
6361 }
6362
6363 static void GLAPIENTRY
6364 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6365 {
6366 GET_CURRENT_CONTEXT(ctx);
6367 Node *n;
6368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6369 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6370 if (n) {
6371 n[1].i = location;
6372 n[2].i = x;
6373 n[3].i = y;
6374 n[4].i = z;
6375 n[5].i = w;
6376 }
6377 if (ctx->ExecuteFlag) {
6378 CALL_Uniform4iARB(ctx->Exec, (location, x, y, z, w));
6379 }
6380 }
6381
6382
6383
6384 static void GLAPIENTRY
6385 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6386 {
6387 GET_CURRENT_CONTEXT(ctx);
6388 Node *n;
6389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6390 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3);
6391 if (n) {
6392 n[1].i = location;
6393 n[2].i = count;
6394 n[3].data = memdup(v, count * 1 * sizeof(GLint));
6395 }
6396 if (ctx->ExecuteFlag) {
6397 CALL_Uniform1ivARB(ctx->Exec, (location, count, v));
6398 }
6399 }
6400
6401 static void GLAPIENTRY
6402 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
6403 {
6404 GET_CURRENT_CONTEXT(ctx);
6405 Node *n;
6406 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6407 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3);
6408 if (n) {
6409 n[1].i = location;
6410 n[2].i = count;
6411 n[3].data = memdup(v, count * 2 * sizeof(GLint));
6412 }
6413 if (ctx->ExecuteFlag) {
6414 CALL_Uniform2ivARB(ctx->Exec, (location, count, v));
6415 }
6416 }
6417
6418 static void GLAPIENTRY
6419 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6420 {
6421 GET_CURRENT_CONTEXT(ctx);
6422 Node *n;
6423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6424 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3);
6425 if (n) {
6426 n[1].i = location;
6427 n[2].i = count;
6428 n[3].data = memdup(v, count * 3 * sizeof(GLint));
6429 }
6430 if (ctx->ExecuteFlag) {
6431 CALL_Uniform3ivARB(ctx->Exec, (location, count, v));
6432 }
6433 }
6434
6435 static void GLAPIENTRY
6436 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6437 {
6438 GET_CURRENT_CONTEXT(ctx);
6439 Node *n;
6440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6441 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3);
6442 if (n) {
6443 n[1].i = location;
6444 n[2].i = count;
6445 n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
6446 }
6447 if (ctx->ExecuteFlag) {
6448 CALL_Uniform4ivARB(ctx->Exec, (location, count, v));
6449 }
6450 }
6451
6452
6453 static void GLAPIENTRY
6454 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
6455 const GLfloat *m)
6456 {
6457 GET_CURRENT_CONTEXT(ctx);
6458 Node *n;
6459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6460 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4);
6461 if (n) {
6462 n[1].i = location;
6463 n[2].i = count;
6464 n[3].b = transpose;
6465 n[4].data = memdup(m, count * 2 * 2 * sizeof(GLfloat));
6466 }
6467 if (ctx->ExecuteFlag) {
6468 CALL_UniformMatrix2fvARB(ctx->Exec, (location, count, transpose, m));
6469 }
6470 }
6471
6472 static void GLAPIENTRY
6473 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
6474 const GLfloat *m)
6475 {
6476 GET_CURRENT_CONTEXT(ctx);
6477 Node *n;
6478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6479 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4);
6480 if (n) {
6481 n[1].i = location;
6482 n[2].i = count;
6483 n[3].b = transpose;
6484 n[4].data = memdup(m, count * 3 * 3 * sizeof(GLfloat));
6485 }
6486 if (ctx->ExecuteFlag) {
6487 CALL_UniformMatrix3fvARB(ctx->Exec, (location, count, transpose, m));
6488 }
6489 }
6490
6491 static void GLAPIENTRY
6492 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
6493 const GLfloat *m)
6494 {
6495 GET_CURRENT_CONTEXT(ctx);
6496 Node *n;
6497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6498 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4);
6499 if (n) {
6500 n[1].i = location;
6501 n[2].i = count;
6502 n[3].b = transpose;
6503 n[4].data = memdup(m, count * 4 * 4 * sizeof(GLfloat));
6504 }
6505 if (ctx->ExecuteFlag) {
6506 CALL_UniformMatrix4fvARB(ctx->Exec, (location, count, transpose, m));
6507 }
6508 }
6509
6510
6511 static void GLAPIENTRY
6512 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
6513 const GLfloat *m)
6514 {
6515 GET_CURRENT_CONTEXT(ctx);
6516 Node *n;
6517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6518 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4);
6519 if (n) {
6520 n[1].i = location;
6521 n[2].i = count;
6522 n[3].b = transpose;
6523 n[4].data = memdup(m, count * 2 * 3 * sizeof(GLfloat));
6524 }
6525 if (ctx->ExecuteFlag) {
6526 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
6527 }
6528 }
6529
6530 static void GLAPIENTRY
6531 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
6532 const GLfloat *m)
6533 {
6534 GET_CURRENT_CONTEXT(ctx);
6535 Node *n;
6536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6537 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4);
6538 if (n) {
6539 n[1].i = location;
6540 n[2].i = count;
6541 n[3].b = transpose;
6542 n[4].data = memdup(m, count * 3 * 2 * sizeof(GLfloat));
6543 }
6544 if (ctx->ExecuteFlag) {
6545 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
6546 }
6547 }
6548
6549
6550 static void GLAPIENTRY
6551 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
6552 const GLfloat *m)
6553 {
6554 GET_CURRENT_CONTEXT(ctx);
6555 Node *n;
6556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6557 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4);
6558 if (n) {
6559 n[1].i = location;
6560 n[2].i = count;
6561 n[3].b = transpose;
6562 n[4].data = memdup(m, count * 2 * 4 * sizeof(GLfloat));
6563 }
6564 if (ctx->ExecuteFlag) {
6565 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
6566 }
6567 }
6568
6569 static void GLAPIENTRY
6570 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
6571 const GLfloat *m)
6572 {
6573 GET_CURRENT_CONTEXT(ctx);
6574 Node *n;
6575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6576 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4);
6577 if (n) {
6578 n[1].i = location;
6579 n[2].i = count;
6580 n[3].b = transpose;
6581 n[4].data = memdup(m, count * 4 * 2 * sizeof(GLfloat));
6582 }
6583 if (ctx->ExecuteFlag) {
6584 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
6585 }
6586 }
6587
6588
6589 static void GLAPIENTRY
6590 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
6591 const GLfloat *m)
6592 {
6593 GET_CURRENT_CONTEXT(ctx);
6594 Node *n;
6595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6596 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4);
6597 if (n) {
6598 n[1].i = location;
6599 n[2].i = count;
6600 n[3].b = transpose;
6601 n[4].data = memdup(m, count * 3 * 4 * sizeof(GLfloat));
6602 }
6603 if (ctx->ExecuteFlag) {
6604 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
6605 }
6606 }
6607
6608 static void GLAPIENTRY
6609 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
6610 const GLfloat *m)
6611 {
6612 GET_CURRENT_CONTEXT(ctx);
6613 Node *n;
6614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6615 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4);
6616 if (n) {
6617 n[1].i = location;
6618 n[2].i = count;
6619 n[3].b = transpose;
6620 n[4].data = memdup(m, count * 4 * 3 * sizeof(GLfloat));
6621 }
6622 if (ctx->ExecuteFlag) {
6623 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
6624 }
6625 }
6626
6627
6628
6629 /**
6630 * Save an error-generating command into display list.
6631 *
6632 * KW: Will appear in the list before the vertex buffer containing the
6633 * command that provoked the error. I don't see this as a problem.
6634 */
6635 static void
6636 save_error(GLcontext *ctx, GLenum error, const char *s)
6637 {
6638 Node *n;
6639 n = alloc_instruction(ctx, OPCODE_ERROR, 2);
6640 if (n) {
6641 n[1].e = error;
6642 n[2].data = (void *) s;
6643 }
6644 }
6645
6646
6647 /**
6648 * Compile an error into current display list.
6649 */
6650 void
6651 _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s)
6652 {
6653 if (ctx->CompileFlag)
6654 save_error(ctx, error, s);
6655 if (ctx->ExecuteFlag)
6656 _mesa_error(ctx, error, s);
6657 }
6658
6659
6660 /**
6661 * Test if ID names a display list.
6662 */
6663 static GLboolean
6664 islist(GLcontext *ctx, GLuint list)
6665 {
6666 if (list > 0 && lookup_list(ctx, list)) {
6667 return GL_TRUE;
6668 }
6669 else {
6670 return GL_FALSE;
6671 }
6672 }
6673
6674
6675
6676 /**********************************************************************/
6677 /* Display list execution */
6678 /**********************************************************************/
6679
6680
6681 /*
6682 * Execute a display list. Note that the ListBase offset must have already
6683 * been added before calling this function. I.e. the list argument is
6684 * the absolute list number, not relative to ListBase.
6685 * \param list - display list number
6686 */
6687 static void
6688 execute_list(GLcontext *ctx, GLuint list)
6689 {
6690 struct gl_display_list *dlist;
6691 Node *n;
6692 GLboolean done;
6693
6694 if (list == 0 || !islist(ctx, list))
6695 return;
6696
6697 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
6698 /* raise an error? */
6699 return;
6700 }
6701
6702 dlist = lookup_list(ctx, list);
6703 if (!dlist)
6704 return;
6705
6706 ctx->ListState.CallDepth++;
6707
6708 if (ctx->Driver.BeginCallList)
6709 ctx->Driver.BeginCallList(ctx, dlist);
6710
6711 n = dlist->Head;
6712
6713 done = GL_FALSE;
6714 while (!done) {
6715 const OpCode opcode = n[0].opcode;
6716
6717 if (is_ext_opcode(opcode)) {
6718 n += ext_opcode_execute(ctx, n);
6719 }
6720 else {
6721 switch (opcode) {
6722 case OPCODE_ERROR:
6723 _mesa_error(ctx, n[1].e, (const char *) n[2].data);
6724 break;
6725 case OPCODE_ACCUM:
6726 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
6727 break;
6728 case OPCODE_ALPHA_FUNC:
6729 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
6730 break;
6731 case OPCODE_BIND_TEXTURE:
6732 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
6733 break;
6734 case OPCODE_BITMAP:
6735 {
6736 const struct gl_pixelstore_attrib save = ctx->Unpack;
6737 ctx->Unpack = ctx->DefaultPacking;
6738 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
6739 n[3].f, n[4].f, n[5].f, n[6].f,
6740 (const GLubyte *) n[7].data));
6741 ctx->Unpack = save; /* restore */
6742 }
6743 break;
6744 case OPCODE_BLEND_COLOR:
6745 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6746 break;
6747 case OPCODE_BLEND_EQUATION:
6748 CALL_BlendEquation(ctx->Exec, (n[1].e));
6749 break;
6750 case OPCODE_BLEND_EQUATION_SEPARATE:
6751 CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e));
6752 break;
6753 case OPCODE_BLEND_FUNC_SEPARATE:
6754 CALL_BlendFuncSeparateEXT(ctx->Exec,
6755 (n[1].e, n[2].e, n[3].e, n[4].e));
6756 break;
6757 case OPCODE_CALL_LIST:
6758 /* Generated by glCallList(), don't add ListBase */
6759 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
6760 execute_list(ctx, n[1].ui);
6761 }
6762 break;
6763 case OPCODE_CALL_LIST_OFFSET:
6764 /* Generated by glCallLists() so we must add ListBase */
6765 if (n[2].b) {
6766 /* user specified a bad data type at compile time */
6767 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
6768 }
6769 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
6770 GLuint list = (GLuint) (ctx->List.ListBase + n[1].i);
6771 execute_list(ctx, list);
6772 }
6773 break;
6774 case OPCODE_CLEAR:
6775 CALL_Clear(ctx->Exec, (n[1].bf));
6776 break;
6777 case OPCODE_CLEAR_BUFFER_IV:
6778 {
6779 GLint value[4];
6780 value[0] = n[3].i;
6781 value[1] = n[4].i;
6782 value[2] = n[5].i;
6783 value[3] = n[6].i;
6784 /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
6785 }
6786 break;
6787 case OPCODE_CLEAR_BUFFER_UIV:
6788 {
6789 GLuint value[4];
6790 value[0] = n[3].ui;
6791 value[1] = n[4].ui;
6792 value[2] = n[5].ui;
6793 value[3] = n[6].ui;
6794 /*CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));*/
6795 }
6796 break;
6797 case OPCODE_CLEAR_BUFFER_FV:
6798 {
6799 GLfloat value[4];
6800 value[0] = n[3].f;
6801 value[1] = n[4].f;
6802 value[2] = n[5].f;
6803 value[3] = n[6].f;
6804 /*CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));*/
6805 }
6806 break;
6807 case OPCODE_CLEAR_BUFFER_FI:
6808 /*CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));*/
6809 break;
6810 case OPCODE_CLEAR_COLOR:
6811 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6812 break;
6813 case OPCODE_CLEAR_ACCUM:
6814 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
6815 break;
6816 case OPCODE_CLEAR_DEPTH:
6817 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
6818 break;
6819 case OPCODE_CLEAR_INDEX:
6820 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
6821 break;
6822 case OPCODE_CLEAR_STENCIL:
6823 CALL_ClearStencil(ctx->Exec, (n[1].i));
6824 break;
6825 case OPCODE_CLIP_PLANE:
6826 {
6827 GLdouble eq[4];
6828 eq[0] = n[2].f;
6829 eq[1] = n[3].f;
6830 eq[2] = n[4].f;
6831 eq[3] = n[5].f;
6832 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
6833 }
6834 break;
6835 case OPCODE_COLOR_MASK:
6836 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
6837 break;
6838 case OPCODE_COLOR_MASK_INDEXED:
6839 CALL_ColorMaskIndexedEXT(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
6840 n[4].b, n[5].b));
6841 break;
6842 case OPCODE_COLOR_MATERIAL:
6843 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
6844 break;
6845 case OPCODE_COLOR_TABLE:
6846 {
6847 const struct gl_pixelstore_attrib save = ctx->Unpack;
6848 ctx->Unpack = ctx->DefaultPacking;
6849 CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e,
6850 n[5].e, n[6].data));
6851 ctx->Unpack = save; /* restore */
6852 }
6853 break;
6854 case OPCODE_COLOR_TABLE_PARAMETER_FV:
6855 {
6856 GLfloat params[4];
6857 params[0] = n[3].f;
6858 params[1] = n[4].f;
6859 params[2] = n[5].f;
6860 params[3] = n[6].f;
6861 CALL_ColorTableParameterfv(ctx->Exec,
6862 (n[1].e, n[2].e, params));
6863 }
6864 break;
6865 case OPCODE_COLOR_TABLE_PARAMETER_IV:
6866 {
6867 GLint params[4];
6868 params[0] = n[3].i;
6869 params[1] = n[4].i;
6870 params[2] = n[5].i;
6871 params[3] = n[6].i;
6872 CALL_ColorTableParameteriv(ctx->Exec,
6873 (n[1].e, n[2].e, params));
6874 }
6875 break;
6876 case OPCODE_COLOR_SUB_TABLE:
6877 {
6878 const struct gl_pixelstore_attrib save = ctx->Unpack;
6879 ctx->Unpack = ctx->DefaultPacking;
6880 CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6881 n[4].e, n[5].e, n[6].data));
6882 ctx->Unpack = save; /* restore */
6883 }
6884 break;
6885 case OPCODE_CONVOLUTION_FILTER_1D:
6886 {
6887 const struct gl_pixelstore_attrib save = ctx->Unpack;
6888 ctx->Unpack = ctx->DefaultPacking;
6889 CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6890 n[4].e, n[5].e,
6891 n[6].data));
6892 ctx->Unpack = save; /* restore */
6893 }
6894 break;
6895 case OPCODE_CONVOLUTION_FILTER_2D:
6896 {
6897 const struct gl_pixelstore_attrib save = ctx->Unpack;
6898 ctx->Unpack = ctx->DefaultPacking;
6899 CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6900 n[4].i, n[5].e, n[6].e,
6901 n[7].data));
6902 ctx->Unpack = save; /* restore */
6903 }
6904 break;
6905 case OPCODE_CONVOLUTION_PARAMETER_I:
6906 CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i));
6907 break;
6908 case OPCODE_CONVOLUTION_PARAMETER_IV:
6909 {
6910 GLint params[4];
6911 params[0] = n[3].i;
6912 params[1] = n[4].i;
6913 params[2] = n[5].i;
6914 params[3] = n[6].i;
6915 CALL_ConvolutionParameteriv(ctx->Exec,
6916 (n[1].e, n[2].e, params));
6917 }
6918 break;
6919 case OPCODE_CONVOLUTION_PARAMETER_F:
6920 CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f));
6921 break;
6922 case OPCODE_CONVOLUTION_PARAMETER_FV:
6923 {
6924 GLfloat params[4];
6925 params[0] = n[3].f;
6926 params[1] = n[4].f;
6927 params[2] = n[5].f;
6928 params[3] = n[6].f;
6929 CALL_ConvolutionParameterfv(ctx->Exec,
6930 (n[1].e, n[2].e, params));
6931 }
6932 break;
6933 case OPCODE_COPY_COLOR_SUB_TABLE:
6934 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
6935 n[3].i, n[4].i, n[5].i));
6936 break;
6937 case OPCODE_COPY_COLOR_TABLE:
6938 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
6939 n[3].i, n[4].i, n[5].i));
6940 break;
6941 case OPCODE_COPY_PIXELS:
6942 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
6943 (GLsizei) n[3].i, (GLsizei) n[4].i,
6944 n[5].e));
6945 break;
6946 case OPCODE_COPY_TEX_IMAGE1D:
6947 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
6948 n[5].i, n[6].i, n[7].i));
6949 break;
6950 case OPCODE_COPY_TEX_IMAGE2D:
6951 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
6952 n[5].i, n[6].i, n[7].i, n[8].i));
6953 break;
6954 case OPCODE_COPY_TEX_SUB_IMAGE1D:
6955 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6956 n[4].i, n[5].i, n[6].i));
6957 break;
6958 case OPCODE_COPY_TEX_SUB_IMAGE2D:
6959 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6960 n[4].i, n[5].i, n[6].i, n[7].i,
6961 n[8].i));
6962 break;
6963 case OPCODE_COPY_TEX_SUB_IMAGE3D:
6964 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
6965 n[4].i, n[5].i, n[6].i, n[7].i,
6966 n[8].i, n[9].i));
6967 break;
6968 case OPCODE_CULL_FACE:
6969 CALL_CullFace(ctx->Exec, (n[1].e));
6970 break;
6971 case OPCODE_DEPTH_FUNC:
6972 CALL_DepthFunc(ctx->Exec, (n[1].e));
6973 break;
6974 case OPCODE_DEPTH_MASK:
6975 CALL_DepthMask(ctx->Exec, (n[1].b));
6976 break;
6977 case OPCODE_DEPTH_RANGE:
6978 CALL_DepthRange(ctx->Exec,
6979 ((GLclampd) n[1].f, (GLclampd) n[2].f));
6980 break;
6981 case OPCODE_DISABLE:
6982 CALL_Disable(ctx->Exec, (n[1].e));
6983 break;
6984 case OPCODE_DISABLE_INDEXED:
6985 CALL_DisableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
6986 break;
6987 case OPCODE_DRAW_BUFFER:
6988 CALL_DrawBuffer(ctx->Exec, (n[1].e));
6989 break;
6990 case OPCODE_DRAW_PIXELS:
6991 {
6992 const struct gl_pixelstore_attrib save = ctx->Unpack;
6993 ctx->Unpack = ctx->DefaultPacking;
6994 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
6995 n[5].data));
6996 ctx->Unpack = save; /* restore */
6997 }
6998 break;
6999 case OPCODE_ENABLE:
7000 CALL_Enable(ctx->Exec, (n[1].e));
7001 break;
7002 case OPCODE_ENABLE_INDEXED:
7003 CALL_EnableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
7004 break;
7005 case OPCODE_EVALMESH1:
7006 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
7007 break;
7008 case OPCODE_EVALMESH2:
7009 CALL_EvalMesh2(ctx->Exec,
7010 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
7011 break;
7012 case OPCODE_FOG:
7013 {
7014 GLfloat p[4];
7015 p[0] = n[2].f;
7016 p[1] = n[3].f;
7017 p[2] = n[4].f;
7018 p[3] = n[5].f;
7019 CALL_Fogfv(ctx->Exec, (n[1].e, p));
7020 }
7021 break;
7022 case OPCODE_FRONT_FACE:
7023 CALL_FrontFace(ctx->Exec, (n[1].e));
7024 break;
7025 case OPCODE_FRUSTUM:
7026 CALL_Frustum(ctx->Exec,
7027 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
7028 break;
7029 case OPCODE_HINT:
7030 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
7031 break;
7032 case OPCODE_HISTOGRAM:
7033 CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b));
7034 break;
7035 case OPCODE_INDEX_MASK:
7036 CALL_IndexMask(ctx->Exec, (n[1].ui));
7037 break;
7038 case OPCODE_INIT_NAMES:
7039 CALL_InitNames(ctx->Exec, ());
7040 break;
7041 case OPCODE_LIGHT:
7042 {
7043 GLfloat p[4];
7044 p[0] = n[3].f;
7045 p[1] = n[4].f;
7046 p[2] = n[5].f;
7047 p[3] = n[6].f;
7048 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
7049 }
7050 break;
7051 case OPCODE_LIGHT_MODEL:
7052 {
7053 GLfloat p[4];
7054 p[0] = n[2].f;
7055 p[1] = n[3].f;
7056 p[2] = n[4].f;
7057 p[3] = n[5].f;
7058 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
7059 }
7060 break;
7061 case OPCODE_LINE_STIPPLE:
7062 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
7063 break;
7064 case OPCODE_LINE_WIDTH:
7065 CALL_LineWidth(ctx->Exec, (n[1].f));
7066 break;
7067 case OPCODE_LIST_BASE:
7068 CALL_ListBase(ctx->Exec, (n[1].ui));
7069 break;
7070 case OPCODE_LOAD_IDENTITY:
7071 CALL_LoadIdentity(ctx->Exec, ());
7072 break;
7073 case OPCODE_LOAD_MATRIX:
7074 if (sizeof(Node) == sizeof(GLfloat)) {
7075 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
7076 }
7077 else {
7078 GLfloat m[16];
7079 GLuint i;
7080 for (i = 0; i < 16; i++) {
7081 m[i] = n[1 + i].f;
7082 }
7083 CALL_LoadMatrixf(ctx->Exec, (m));
7084 }
7085 break;
7086 case OPCODE_LOAD_NAME:
7087 CALL_LoadName(ctx->Exec, (n[1].ui));
7088 break;
7089 case OPCODE_LOGIC_OP:
7090 CALL_LogicOp(ctx->Exec, (n[1].e));
7091 break;
7092 case OPCODE_MAP1:
7093 {
7094 GLenum target = n[1].e;
7095 GLint ustride = _mesa_evaluator_components(target);
7096 GLint uorder = n[5].i;
7097 GLfloat u1 = n[2].f;
7098 GLfloat u2 = n[3].f;
7099 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
7100 (GLfloat *) n[6].data));
7101 }
7102 break;
7103 case OPCODE_MAP2:
7104 {
7105 GLenum target = n[1].e;
7106 GLfloat u1 = n[2].f;
7107 GLfloat u2 = n[3].f;
7108 GLfloat v1 = n[4].f;
7109 GLfloat v2 = n[5].f;
7110 GLint ustride = n[6].i;
7111 GLint vstride = n[7].i;
7112 GLint uorder = n[8].i;
7113 GLint vorder = n[9].i;
7114 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
7115 v1, v2, vstride, vorder,
7116 (GLfloat *) n[10].data));
7117 }
7118 break;
7119 case OPCODE_MAPGRID1:
7120 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
7121 break;
7122 case OPCODE_MAPGRID2:
7123 CALL_MapGrid2f(ctx->Exec,
7124 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
7125 break;
7126 case OPCODE_MATRIX_MODE:
7127 CALL_MatrixMode(ctx->Exec, (n[1].e));
7128 break;
7129 case OPCODE_MIN_MAX:
7130 CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
7131 break;
7132 case OPCODE_MULT_MATRIX:
7133 if (sizeof(Node) == sizeof(GLfloat)) {
7134 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
7135 }
7136 else {
7137 GLfloat m[16];
7138 GLuint i;
7139 for (i = 0; i < 16; i++) {
7140 m[i] = n[1 + i].f;
7141 }
7142 CALL_MultMatrixf(ctx->Exec, (m));
7143 }
7144 break;
7145 case OPCODE_ORTHO:
7146 CALL_Ortho(ctx->Exec,
7147 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
7148 break;
7149 case OPCODE_PASSTHROUGH:
7150 CALL_PassThrough(ctx->Exec, (n[1].f));
7151 break;
7152 case OPCODE_PIXEL_MAP:
7153 CALL_PixelMapfv(ctx->Exec,
7154 (n[1].e, n[2].i, (GLfloat *) n[3].data));
7155 break;
7156 case OPCODE_PIXEL_TRANSFER:
7157 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
7158 break;
7159 case OPCODE_PIXEL_ZOOM:
7160 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
7161 break;
7162 case OPCODE_POINT_SIZE:
7163 CALL_PointSize(ctx->Exec, (n[1].f));
7164 break;
7165 case OPCODE_POINT_PARAMETERS:
7166 {
7167 GLfloat params[3];
7168 params[0] = n[2].f;
7169 params[1] = n[3].f;
7170 params[2] = n[4].f;
7171 CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params));
7172 }
7173 break;
7174 case OPCODE_POLYGON_MODE:
7175 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
7176 break;
7177 case OPCODE_POLYGON_STIPPLE:
7178 {
7179 const struct gl_pixelstore_attrib save = ctx->Unpack;
7180 ctx->Unpack = ctx->DefaultPacking;
7181 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
7182 ctx->Unpack = save; /* restore */
7183 }
7184 break;
7185 case OPCODE_POLYGON_OFFSET:
7186 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
7187 break;
7188 case OPCODE_POP_ATTRIB:
7189 CALL_PopAttrib(ctx->Exec, ());
7190 break;
7191 case OPCODE_POP_MATRIX:
7192 CALL_PopMatrix(ctx->Exec, ());
7193 break;
7194 case OPCODE_POP_NAME:
7195 CALL_PopName(ctx->Exec, ());
7196 break;
7197 case OPCODE_PRIORITIZE_TEXTURE:
7198 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
7199 break;
7200 case OPCODE_PUSH_ATTRIB:
7201 CALL_PushAttrib(ctx->Exec, (n[1].bf));
7202 break;
7203 case OPCODE_PUSH_MATRIX:
7204 CALL_PushMatrix(ctx->Exec, ());
7205 break;
7206 case OPCODE_PUSH_NAME:
7207 CALL_PushName(ctx->Exec, (n[1].ui));
7208 break;
7209 case OPCODE_RASTER_POS:
7210 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7211 break;
7212 case OPCODE_READ_BUFFER:
7213 CALL_ReadBuffer(ctx->Exec, (n[1].e));
7214 break;
7215 case OPCODE_RESET_HISTOGRAM:
7216 CALL_ResetHistogram(ctx->Exec, (n[1].e));
7217 break;
7218 case OPCODE_RESET_MIN_MAX:
7219 CALL_ResetMinmax(ctx->Exec, (n[1].e));
7220 break;
7221 case OPCODE_ROTATE:
7222 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7223 break;
7224 case OPCODE_SCALE:
7225 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
7226 break;
7227 case OPCODE_SCISSOR:
7228 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
7229 break;
7230 case OPCODE_SHADE_MODEL:
7231 CALL_ShadeModel(ctx->Exec, (n[1].e));
7232 break;
7233 case OPCODE_PROVOKING_VERTEX:
7234 CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e));
7235 break;
7236 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
7237 CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e));
7238 break;
7239 case OPCODE_END_TRANSFORM_FEEDBACK:
7240 CALL_EndTransformFeedbackEXT(ctx->Exec, ());
7241 break;
7242 case OPCODE_STENCIL_FUNC:
7243 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
7244 break;
7245 case OPCODE_STENCIL_MASK:
7246 CALL_StencilMask(ctx->Exec, (n[1].ui));
7247 break;
7248 case OPCODE_STENCIL_OP:
7249 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
7250 break;
7251 case OPCODE_STENCIL_FUNC_SEPARATE:
7252 CALL_StencilFuncSeparate(ctx->Exec,
7253 (n[1].e, n[2].e, n[3].i, n[4].ui));
7254 break;
7255 case OPCODE_STENCIL_MASK_SEPARATE:
7256 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
7257 break;
7258 case OPCODE_STENCIL_OP_SEPARATE:
7259 CALL_StencilOpSeparate(ctx->Exec,
7260 (n[1].e, n[2].e, n[3].e, n[4].e));
7261 break;
7262 case OPCODE_TEXENV:
7263 {
7264 GLfloat params[4];
7265 params[0] = n[3].f;
7266 params[1] = n[4].f;
7267 params[2] = n[5].f;
7268 params[3] = n[6].f;
7269 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
7270 }
7271 break;
7272 case OPCODE_TEXGEN:
7273 {
7274 GLfloat params[4];
7275 params[0] = n[3].f;
7276 params[1] = n[4].f;
7277 params[2] = n[5].f;
7278 params[3] = n[6].f;
7279 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
7280 }
7281 break;
7282 case OPCODE_TEXPARAMETER:
7283 {
7284 GLfloat params[4];
7285 params[0] = n[3].f;
7286 params[1] = n[4].f;
7287 params[2] = n[5].f;
7288 params[3] = n[6].f;
7289 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
7290 }
7291 break;
7292 case OPCODE_TEX_IMAGE1D:
7293 {
7294 const struct gl_pixelstore_attrib save = ctx->Unpack;
7295 ctx->Unpack = ctx->DefaultPacking;
7296 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
7297 n[2].i, /* level */
7298 n[3].i, /* components */
7299 n[4].i, /* width */
7300 n[5].e, /* border */
7301 n[6].e, /* format */
7302 n[7].e, /* type */
7303 n[8].data));
7304 ctx->Unpack = save; /* restore */
7305 }
7306 break;
7307 case OPCODE_TEX_IMAGE2D:
7308 {
7309 const struct gl_pixelstore_attrib save = ctx->Unpack;
7310 ctx->Unpack = ctx->DefaultPacking;
7311 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
7312 n[2].i, /* level */
7313 n[3].i, /* components */
7314 n[4].i, /* width */
7315 n[5].i, /* height */
7316 n[6].e, /* border */
7317 n[7].e, /* format */
7318 n[8].e, /* type */
7319 n[9].data));
7320 ctx->Unpack = save; /* restore */
7321 }
7322 break;
7323 case OPCODE_TEX_IMAGE3D:
7324 {
7325 const struct gl_pixelstore_attrib save = ctx->Unpack;
7326 ctx->Unpack = ctx->DefaultPacking;
7327 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
7328 n[2].i, /* level */
7329 n[3].i, /* components */
7330 n[4].i, /* width */
7331 n[5].i, /* height */
7332 n[6].i, /* depth */
7333 n[7].e, /* border */
7334 n[8].e, /* format */
7335 n[9].e, /* type */
7336 n[10].data));
7337 ctx->Unpack = save; /* restore */
7338 }
7339 break;
7340 case OPCODE_TEX_SUB_IMAGE1D:
7341 {
7342 const struct gl_pixelstore_attrib save = ctx->Unpack;
7343 ctx->Unpack = ctx->DefaultPacking;
7344 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7345 n[4].i, n[5].e,
7346 n[6].e, n[7].data));
7347 ctx->Unpack = save; /* restore */
7348 }
7349 break;
7350 case OPCODE_TEX_SUB_IMAGE2D:
7351 {
7352 const struct gl_pixelstore_attrib save = ctx->Unpack;
7353 ctx->Unpack = ctx->DefaultPacking;
7354 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7355 n[4].i, n[5].e,
7356 n[6].i, n[7].e, n[8].e,
7357 n[9].data));
7358 ctx->Unpack = save; /* restore */
7359 }
7360 break;
7361 case OPCODE_TEX_SUB_IMAGE3D:
7362 {
7363 const struct gl_pixelstore_attrib save = ctx->Unpack;
7364 ctx->Unpack = ctx->DefaultPacking;
7365 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7366 n[4].i, n[5].i, n[6].i, n[7].i,
7367 n[8].i, n[9].e, n[10].e,
7368 n[11].data));
7369 ctx->Unpack = save; /* restore */
7370 }
7371 break;
7372 case OPCODE_TRANSLATE:
7373 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
7374 break;
7375 case OPCODE_VIEWPORT:
7376 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
7377 (GLsizei) n[3].i, (GLsizei) n[4].i));
7378 break;
7379 case OPCODE_WINDOW_POS:
7380 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7381 break;
7382 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
7383 CALL_ActiveTextureARB(ctx->Exec, (n[1].e));
7384 break;
7385 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
7386 CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
7387 n[4].i, n[5].i, n[6].i,
7388 n[7].data));
7389 break;
7390 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
7391 CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
7392 n[4].i, n[5].i, n[6].i,
7393 n[7].i, n[8].data));
7394 break;
7395 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
7396 CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
7397 n[4].i, n[5].i, n[6].i,
7398 n[7].i, n[8].i,
7399 n[9].data));
7400 break;
7401 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
7402 CALL_CompressedTexSubImage1DARB(ctx->Exec,
7403 (n[1].e, n[2].i, n[3].i, n[4].i,
7404 n[5].e, n[6].i, n[7].data));
7405 break;
7406 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
7407 CALL_CompressedTexSubImage2DARB(ctx->Exec,
7408 (n[1].e, n[2].i, n[3].i, n[4].i,
7409 n[5].i, n[6].i, n[7].e, n[8].i,
7410 n[9].data));
7411 break;
7412 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
7413 CALL_CompressedTexSubImage3DARB(ctx->Exec,
7414 (n[1].e, n[2].i, n[3].i, n[4].i,
7415 n[5].i, n[6].i, n[7].i, n[8].i,
7416 n[9].e, n[10].i, n[11].data));
7417 break;
7418 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
7419 CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
7420 break;
7421 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
7422 CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f));
7423 break;
7424 #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
7425 case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
7426 CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui));
7427 break;
7428 #endif
7429 #if FEATURE_NV_vertex_program
7430 case OPCODE_EXECUTE_PROGRAM_NV:
7431 {
7432 GLfloat v[4];
7433 v[0] = n[3].f;
7434 v[1] = n[4].f;
7435 v[2] = n[5].f;
7436 v[3] = n[6].f;
7437 CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
7438 }
7439 break;
7440 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
7441 CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
7442 (GLuint *) n[2].data));
7443 break;
7444 case OPCODE_LOAD_PROGRAM_NV:
7445 CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
7446 (const GLubyte *) n[4].data));
7447 break;
7448 case OPCODE_TRACK_MATRIX_NV:
7449 CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
7450 break;
7451 #endif
7452
7453 #if FEATURE_NV_fragment_program
7454 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
7455 CALL_ProgramLocalParameter4fARB(ctx->Exec,
7456 (n[1].e, n[2].ui, n[3].f, n[4].f,
7457 n[5].f, n[6].f));
7458 break;
7459 case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
7460 CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
7461 (const GLubyte *) n[3].
7462 data, n[4].f, n[5].f,
7463 n[6].f, n[7].f));
7464 break;
7465 #endif
7466
7467 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
7468 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
7469 break;
7470 case OPCODE_DEPTH_BOUNDS_EXT:
7471 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
7472 break;
7473 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
7474 case OPCODE_PROGRAM_STRING_ARB:
7475 CALL_ProgramStringARB(ctx->Exec,
7476 (n[1].e, n[2].e, n[3].i, n[4].data));
7477 break;
7478 #endif
7479 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program
7480 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
7481 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
7482 n[4].f, n[5].f,
7483 n[6].f));
7484 break;
7485 #endif
7486 #if FEATURE_queryobj
7487 case OPCODE_BEGIN_QUERY_ARB:
7488 CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
7489 break;
7490 case OPCODE_END_QUERY_ARB:
7491 CALL_EndQueryARB(ctx->Exec, (n[1].e));
7492 break;
7493 #endif
7494 case OPCODE_DRAW_BUFFERS_ARB:
7495 {
7496 GLenum buffers[MAX_DRAW_BUFFERS];
7497 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
7498 for (i = 0; i < count; i++)
7499 buffers[i] = n[2 + i].e;
7500 CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
7501 }
7502 break;
7503 #if FEATURE_EXT_framebuffer_blit
7504 case OPCODE_BLIT_FRAMEBUFFER:
7505 CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
7506 n[5].i, n[6].i, n[7].i, n[8].i,
7507 n[9].i, n[10].e));
7508 break;
7509 #endif
7510
7511 case OPCODE_USE_PROGRAM:
7512 CALL_UseProgramObjectARB(ctx->Exec, (n[1].ui));
7513 break;
7514 case OPCODE_UNIFORM_1F:
7515 CALL_Uniform1fARB(ctx->Exec, (n[1].i, n[2].f));
7516 break;
7517 case OPCODE_UNIFORM_2F:
7518 CALL_Uniform2fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f));
7519 break;
7520 case OPCODE_UNIFORM_3F:
7521 CALL_Uniform3fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
7522 break;
7523 case OPCODE_UNIFORM_4F:
7524 CALL_Uniform4fARB(ctx->Exec,
7525 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
7526 break;
7527 case OPCODE_UNIFORM_1FV:
7528 CALL_Uniform1fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7529 break;
7530 case OPCODE_UNIFORM_2FV:
7531 CALL_Uniform2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7532 break;
7533 case OPCODE_UNIFORM_3FV:
7534 CALL_Uniform3fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7535 break;
7536 case OPCODE_UNIFORM_4FV:
7537 CALL_Uniform4fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7538 break;
7539 case OPCODE_UNIFORM_1I:
7540 CALL_Uniform1iARB(ctx->Exec, (n[1].i, n[2].i));
7541 break;
7542 case OPCODE_UNIFORM_2I:
7543 CALL_Uniform2iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));
7544 break;
7545 case OPCODE_UNIFORM_3I:
7546 CALL_Uniform3iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
7547 break;
7548 case OPCODE_UNIFORM_4I:
7549 CALL_Uniform4iARB(ctx->Exec,
7550 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7551 break;
7552 case OPCODE_UNIFORM_1IV:
7553 CALL_Uniform1ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7554 break;
7555 case OPCODE_UNIFORM_2IV:
7556 CALL_Uniform2ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7557 break;
7558 case OPCODE_UNIFORM_3IV:
7559 CALL_Uniform3ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7560 break;
7561 case OPCODE_UNIFORM_4IV:
7562 CALL_Uniform4ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
7563 break;
7564
7565 case OPCODE_UNIFORM_MATRIX22:
7566 CALL_UniformMatrix2fvARB(ctx->Exec,
7567 (n[1].i, n[2].i, n[3].b, n[4].data));
7568 break;
7569 case OPCODE_UNIFORM_MATRIX33:
7570 CALL_UniformMatrix3fvARB(ctx->Exec,
7571 (n[1].i, n[2].i, n[3].b, n[4].data));
7572 break;
7573 case OPCODE_UNIFORM_MATRIX44:
7574 CALL_UniformMatrix4fvARB(ctx->Exec,
7575 (n[1].i, n[2].i, n[3].b, n[4].data));
7576 break;
7577 case OPCODE_UNIFORM_MATRIX23:
7578 CALL_UniformMatrix2x3fv(ctx->Exec,
7579 (n[1].i, n[2].i, n[3].b, n[4].data));
7580 break;
7581 case OPCODE_UNIFORM_MATRIX32:
7582 CALL_UniformMatrix3x2fv(ctx->Exec,
7583 (n[1].i, n[2].i, n[3].b, n[4].data));
7584 break;
7585 case OPCODE_UNIFORM_MATRIX24:
7586 CALL_UniformMatrix2x4fv(ctx->Exec,
7587 (n[1].i, n[2].i, n[3].b, n[4].data));
7588 break;
7589 case OPCODE_UNIFORM_MATRIX42:
7590 CALL_UniformMatrix4x2fv(ctx->Exec,
7591 (n[1].i, n[2].i, n[3].b, n[4].data));
7592 break;
7593 case OPCODE_UNIFORM_MATRIX34:
7594 CALL_UniformMatrix3x4fv(ctx->Exec,
7595 (n[1].i, n[2].i, n[3].b, n[4].data));
7596 break;
7597 case OPCODE_UNIFORM_MATRIX43:
7598 CALL_UniformMatrix4x3fv(ctx->Exec,
7599 (n[1].i, n[2].i, n[3].b, n[4].data));
7600 break;
7601
7602 case OPCODE_TEX_BUMP_PARAMETER_ATI:
7603 {
7604 GLfloat values[4];
7605 GLuint i, pname = n[1].ui;
7606
7607 for (i = 0; i < 4; i++)
7608 values[i] = n[1 + i].f;
7609 CALL_TexBumpParameterfvATI(ctx->Exec, (pname, values));
7610 }
7611 break;
7612 #if FEATURE_ATI_fragment_shader
7613 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
7614 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
7615 break;
7616 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
7617 {
7618 GLfloat values[4];
7619 GLuint i, dst = n[1].ui;
7620
7621 for (i = 0; i < 4; i++)
7622 values[i] = n[1 + i].f;
7623 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values));
7624 }
7625 break;
7626 #endif
7627 case OPCODE_ATTR_1F_NV:
7628 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
7629 break;
7630 case OPCODE_ATTR_2F_NV:
7631 /* Really shouldn't have to do this - the Node structure
7632 * is convenient, but it would be better to store the data
7633 * packed appropriately so that it can be sent directly
7634 * on. With x86_64 becoming common, this will start to
7635 * matter more.
7636 */
7637 if (sizeof(Node) == sizeof(GLfloat))
7638 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
7639 else
7640 CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f));
7641 break;
7642 case OPCODE_ATTR_3F_NV:
7643 if (sizeof(Node) == sizeof(GLfloat))
7644 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
7645 else
7646 CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
7647 n[4].f));
7648 break;
7649 case OPCODE_ATTR_4F_NV:
7650 if (sizeof(Node) == sizeof(GLfloat))
7651 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
7652 else
7653 CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
7654 n[4].f, n[5].f));
7655 break;
7656 case OPCODE_ATTR_1F_ARB:
7657 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
7658 break;
7659 case OPCODE_ATTR_2F_ARB:
7660 /* Really shouldn't have to do this - the Node structure
7661 * is convenient, but it would be better to store the data
7662 * packed appropriately so that it can be sent directly
7663 * on. With x86_64 becoming common, this will start to
7664 * matter more.
7665 */
7666 if (sizeof(Node) == sizeof(GLfloat))
7667 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
7668 else
7669 CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f));
7670 break;
7671 case OPCODE_ATTR_3F_ARB:
7672 if (sizeof(Node) == sizeof(GLfloat))
7673 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
7674 else
7675 CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
7676 n[4].f));
7677 break;
7678 case OPCODE_ATTR_4F_ARB:
7679 if (sizeof(Node) == sizeof(GLfloat))
7680 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
7681 else
7682 CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
7683 n[4].f, n[5].f));
7684 break;
7685 case OPCODE_MATERIAL:
7686 if (sizeof(Node) == sizeof(GLfloat))
7687 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
7688 else {
7689 GLfloat f[4];
7690 f[0] = n[3].f;
7691 f[1] = n[4].f;
7692 f[2] = n[5].f;
7693 f[3] = n[6].f;
7694 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
7695 }
7696 break;
7697 case OPCODE_BEGIN:
7698 CALL_Begin(ctx->Exec, (n[1].e));
7699 break;
7700 case OPCODE_END:
7701 CALL_End(ctx->Exec, ());
7702 break;
7703 case OPCODE_RECTF:
7704 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7705 break;
7706 case OPCODE_EVAL_C1:
7707 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
7708 break;
7709 case OPCODE_EVAL_C2:
7710 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
7711 break;
7712 case OPCODE_EVAL_P1:
7713 CALL_EvalPoint1(ctx->Exec, (n[1].i));
7714 break;
7715 case OPCODE_EVAL_P2:
7716 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
7717 break;
7718
7719 case OPCODE_CONTINUE:
7720 n = (Node *) n[1].next;
7721 break;
7722 case OPCODE_END_OF_LIST:
7723 done = GL_TRUE;
7724 break;
7725 default:
7726 {
7727 char msg[1000];
7728 sprintf(msg, "Error in execute_list: opcode=%d",
7729 (int) opcode);
7730 _mesa_problem(ctx, msg);
7731 }
7732 done = GL_TRUE;
7733 }
7734
7735 /* increment n to point to next compiled command */
7736 if (opcode != OPCODE_CONTINUE) {
7737 n += InstSize[opcode];
7738 }
7739 }
7740 }
7741
7742 if (ctx->Driver.EndCallList)
7743 ctx->Driver.EndCallList(ctx);
7744
7745 ctx->ListState.CallDepth--;
7746 }
7747
7748
7749
7750 /**********************************************************************/
7751 /* GL functions */
7752 /**********************************************************************/
7753
7754 /**
7755 * Test if a display list number is valid.
7756 */
7757 static GLboolean GLAPIENTRY
7758 _mesa_IsList(GLuint list)
7759 {
7760 GET_CURRENT_CONTEXT(ctx);
7761 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
7762 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
7763 return islist(ctx, list);
7764 }
7765
7766
7767 /**
7768 * Delete a sequence of consecutive display lists.
7769 */
7770 static void GLAPIENTRY
7771 _mesa_DeleteLists(GLuint list, GLsizei range)
7772 {
7773 GET_CURRENT_CONTEXT(ctx);
7774 GLuint i;
7775 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
7776 ASSERT_OUTSIDE_BEGIN_END(ctx);
7777
7778 if (range < 0) {
7779 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
7780 return;
7781 }
7782 for (i = list; i < list + range; i++) {
7783 destroy_list(ctx, i);
7784 }
7785 }
7786
7787
7788 /**
7789 * Return a display list number, n, such that lists n through n+range-1
7790 * are free.
7791 */
7792 static GLuint GLAPIENTRY
7793 _mesa_GenLists(GLsizei range)
7794 {
7795 GET_CURRENT_CONTEXT(ctx);
7796 GLuint base;
7797 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
7798 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
7799
7800 if (range < 0) {
7801 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
7802 return 0;
7803 }
7804 if (range == 0) {
7805 return 0;
7806 }
7807
7808 /*
7809 * Make this an atomic operation
7810 */
7811 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
7812
7813 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
7814 if (base) {
7815 /* reserve the list IDs by with empty/dummy lists */
7816 GLint i;
7817 for (i = 0; i < range; i++) {
7818 _mesa_HashInsert(ctx->Shared->DisplayList, base + i,
7819 make_list(base + i, 1));
7820 }
7821 }
7822
7823 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
7824
7825 return base;
7826 }
7827
7828
7829 /**
7830 * Begin a new display list.
7831 */
7832 static void GLAPIENTRY
7833 _mesa_NewList(GLuint name, GLenum mode)
7834 {
7835 GET_CURRENT_CONTEXT(ctx);
7836
7837 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
7838 ASSERT_OUTSIDE_BEGIN_END(ctx);
7839
7840 if (MESA_VERBOSE & VERBOSE_API)
7841 _mesa_debug(ctx, "glNewList %u %s\n", name,
7842 _mesa_lookup_enum_by_nr(mode));
7843
7844 if (name == 0) {
7845 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
7846 return;
7847 }
7848
7849 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
7850 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
7851 return;
7852 }
7853
7854 if (ctx->ListState.CurrentList) {
7855 /* already compiling a display list */
7856 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
7857 return;
7858 }
7859
7860 ctx->CompileFlag = GL_TRUE;
7861 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
7862
7863 /* Reset acumulated list state:
7864 */
7865 invalidate_saved_current_state( ctx );
7866
7867 /* Allocate new display list */
7868 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
7869 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
7870 ctx->ListState.CurrentPos = 0;
7871
7872 ctx->Driver.NewList(ctx, name, mode);
7873
7874 ctx->CurrentDispatch = ctx->Save;
7875 _glapi_set_dispatch(ctx->CurrentDispatch);
7876 }
7877
7878
7879 /**
7880 * End definition of current display list.
7881 */
7882 static void GLAPIENTRY
7883 _mesa_EndList(void)
7884 {
7885 GET_CURRENT_CONTEXT(ctx);
7886 SAVE_FLUSH_VERTICES(ctx);
7887 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
7888
7889 if (MESA_VERBOSE & VERBOSE_API)
7890 _mesa_debug(ctx, "glEndList\n");
7891
7892 /* Check that a list is under construction */
7893 if (!ctx->ListState.CurrentList) {
7894 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
7895 return;
7896 }
7897
7898 /* Call before emitting END_OF_LIST, in case the driver wants to
7899 * emit opcodes itself.
7900 */
7901 ctx->Driver.EndList(ctx);
7902
7903 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
7904
7905 /* Destroy old list, if any */
7906 destroy_list(ctx, ctx->ListState.CurrentList->Name);
7907
7908 /* Install the new list */
7909 _mesa_HashInsert(ctx->Shared->DisplayList,
7910 ctx->ListState.CurrentList->Name,
7911 ctx->ListState.CurrentList);
7912
7913
7914 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
7915 mesa_print_display_list(ctx->ListState.CurrentList->Name);
7916
7917 ctx->ListState.CurrentList = NULL;
7918 ctx->ExecuteFlag = GL_TRUE;
7919 ctx->CompileFlag = GL_FALSE;
7920
7921 ctx->CurrentDispatch = ctx->Exec;
7922 _glapi_set_dispatch(ctx->CurrentDispatch);
7923 }
7924
7925
7926 void GLAPIENTRY
7927 _mesa_CallList(GLuint list)
7928 {
7929 GLboolean save_compile_flag;
7930 GET_CURRENT_CONTEXT(ctx);
7931 FLUSH_CURRENT(ctx, 0);
7932 /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */
7933 /* execute the display list, and restore the CompileFlag. */
7934
7935 if (MESA_VERBOSE & VERBOSE_API)
7936 _mesa_debug(ctx, "glCallList %d\n", list);
7937
7938 if (list == 0) {
7939 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
7940 return;
7941 }
7942
7943 /* mesa_print_display_list( list ); */
7944
7945 save_compile_flag = ctx->CompileFlag;
7946 if (save_compile_flag) {
7947 ctx->CompileFlag = GL_FALSE;
7948 }
7949
7950 execute_list(ctx, list);
7951 ctx->CompileFlag = save_compile_flag;
7952
7953 /* also restore API function pointers to point to "save" versions */
7954 if (save_compile_flag) {
7955 ctx->CurrentDispatch = ctx->Save;
7956 _glapi_set_dispatch(ctx->CurrentDispatch);
7957 }
7958 }
7959
7960
7961 /**
7962 * Execute glCallLists: call multiple display lists.
7963 */
7964 void GLAPIENTRY
7965 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
7966 {
7967 GET_CURRENT_CONTEXT(ctx);
7968 GLint i;
7969 GLboolean save_compile_flag;
7970
7971 if (MESA_VERBOSE & VERBOSE_API)
7972 _mesa_debug(ctx, "glCallLists %d\n", n);
7973
7974 switch (type) {
7975 case GL_BYTE:
7976 case GL_UNSIGNED_BYTE:
7977 case GL_SHORT:
7978 case GL_UNSIGNED_SHORT:
7979 case GL_INT:
7980 case GL_UNSIGNED_INT:
7981 case GL_FLOAT:
7982 case GL_2_BYTES:
7983 case GL_3_BYTES:
7984 case GL_4_BYTES:
7985 /* OK */
7986 break;
7987 default:
7988 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
7989 return;
7990 }
7991
7992 /* Save the CompileFlag status, turn it off, execute display list,
7993 * and restore the CompileFlag.
7994 */
7995 save_compile_flag = ctx->CompileFlag;
7996 ctx->CompileFlag = GL_FALSE;
7997
7998 for (i = 0; i < n; i++) {
7999 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
8000 execute_list(ctx, list);
8001 }
8002
8003 ctx->CompileFlag = save_compile_flag;
8004
8005 /* also restore API function pointers to point to "save" versions */
8006 if (save_compile_flag) {
8007 ctx->CurrentDispatch = ctx->Save;
8008 _glapi_set_dispatch(ctx->CurrentDispatch);
8009 }
8010 }
8011
8012
8013 /**
8014 * Set the offset added to list numbers in glCallLists.
8015 */
8016 static void GLAPIENTRY
8017 _mesa_ListBase(GLuint base)
8018 {
8019 GET_CURRENT_CONTEXT(ctx);
8020 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8021 ASSERT_OUTSIDE_BEGIN_END(ctx);
8022 ctx->List.ListBase = base;
8023 }
8024
8025
8026 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
8027 */
8028 static void GLAPIENTRY
8029 exec_Finish(void)
8030 {
8031 GET_CURRENT_CONTEXT(ctx);
8032 FLUSH_VERTICES(ctx, 0);
8033 CALL_Finish(ctx->Exec, ());
8034 }
8035
8036 static void GLAPIENTRY
8037 exec_Flush(void)
8038 {
8039 GET_CURRENT_CONTEXT(ctx);
8040 FLUSH_VERTICES(ctx, 0);
8041 CALL_Flush(ctx->Exec, ());
8042 }
8043
8044 static void GLAPIENTRY
8045 exec_GetBooleanv(GLenum pname, GLboolean *params)
8046 {
8047 GET_CURRENT_CONTEXT(ctx);
8048 FLUSH_VERTICES(ctx, 0);
8049 CALL_GetBooleanv(ctx->Exec, (pname, params));
8050 }
8051
8052 static void GLAPIENTRY
8053 exec_GetClipPlane(GLenum plane, GLdouble * equation)
8054 {
8055 GET_CURRENT_CONTEXT(ctx);
8056 FLUSH_VERTICES(ctx, 0);
8057 CALL_GetClipPlane(ctx->Exec, (plane, equation));
8058 }
8059
8060 static void GLAPIENTRY
8061 exec_GetDoublev(GLenum pname, GLdouble *params)
8062 {
8063 GET_CURRENT_CONTEXT(ctx);
8064 FLUSH_VERTICES(ctx, 0);
8065 CALL_GetDoublev(ctx->Exec, (pname, params));
8066 }
8067
8068 static GLenum GLAPIENTRY
8069 exec_GetError(void)
8070 {
8071 GET_CURRENT_CONTEXT(ctx);
8072 FLUSH_VERTICES(ctx, 0);
8073 return CALL_GetError(ctx->Exec, ());
8074 }
8075
8076 static void GLAPIENTRY
8077 exec_GetFloatv(GLenum pname, GLfloat *params)
8078 {
8079 GET_CURRENT_CONTEXT(ctx);
8080 FLUSH_VERTICES(ctx, 0);
8081 CALL_GetFloatv(ctx->Exec, (pname, params));
8082 }
8083
8084 static void GLAPIENTRY
8085 exec_GetIntegerv(GLenum pname, GLint *params)
8086 {
8087 GET_CURRENT_CONTEXT(ctx);
8088 FLUSH_VERTICES(ctx, 0);
8089 CALL_GetIntegerv(ctx->Exec, (pname, params));
8090 }
8091
8092 static void GLAPIENTRY
8093 exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
8094 {
8095 GET_CURRENT_CONTEXT(ctx);
8096 FLUSH_VERTICES(ctx, 0);
8097 CALL_GetLightfv(ctx->Exec, (light, pname, params));
8098 }
8099
8100 static void GLAPIENTRY
8101 exec_GetLightiv(GLenum light, GLenum pname, GLint *params)
8102 {
8103 GET_CURRENT_CONTEXT(ctx);
8104 FLUSH_VERTICES(ctx, 0);
8105 CALL_GetLightiv(ctx->Exec, (light, pname, params));
8106 }
8107
8108 static void GLAPIENTRY
8109 exec_GetMapdv(GLenum target, GLenum query, GLdouble * v)
8110 {
8111 GET_CURRENT_CONTEXT(ctx);
8112 FLUSH_VERTICES(ctx, 0);
8113 CALL_GetMapdv(ctx->Exec, (target, query, v));
8114 }
8115
8116 static void GLAPIENTRY
8117 exec_GetMapfv(GLenum target, GLenum query, GLfloat * v)
8118 {
8119 GET_CURRENT_CONTEXT(ctx);
8120 FLUSH_VERTICES(ctx, 0);
8121 CALL_GetMapfv(ctx->Exec, (target, query, v));
8122 }
8123
8124 static void GLAPIENTRY
8125 exec_GetMapiv(GLenum target, GLenum query, GLint * v)
8126 {
8127 GET_CURRENT_CONTEXT(ctx);
8128 FLUSH_VERTICES(ctx, 0);
8129 CALL_GetMapiv(ctx->Exec, (target, query, v));
8130 }
8131
8132 static void GLAPIENTRY
8133 exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
8134 {
8135 GET_CURRENT_CONTEXT(ctx);
8136 FLUSH_VERTICES(ctx, 0);
8137 CALL_GetMaterialfv(ctx->Exec, (face, pname, params));
8138 }
8139
8140 static void GLAPIENTRY
8141 exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
8142 {
8143 GET_CURRENT_CONTEXT(ctx);
8144 FLUSH_VERTICES(ctx, 0);
8145 CALL_GetMaterialiv(ctx->Exec, (face, pname, params));
8146 }
8147
8148 static void GLAPIENTRY
8149 exec_GetPixelMapfv(GLenum map, GLfloat *values)
8150 {
8151 GET_CURRENT_CONTEXT(ctx);
8152 FLUSH_VERTICES(ctx, 0);
8153 CALL_GetPixelMapfv(ctx->Exec, (map, values));
8154 }
8155
8156 static void GLAPIENTRY
8157 exec_GetPixelMapuiv(GLenum map, GLuint *values)
8158 {
8159 GET_CURRENT_CONTEXT(ctx);
8160 FLUSH_VERTICES(ctx, 0);
8161 CALL_GetPixelMapuiv(ctx->Exec, (map, values));
8162 }
8163
8164 static void GLAPIENTRY
8165 exec_GetPixelMapusv(GLenum map, GLushort *values)
8166 {
8167 GET_CURRENT_CONTEXT(ctx);
8168 FLUSH_VERTICES(ctx, 0);
8169 CALL_GetPixelMapusv(ctx->Exec, (map, values));
8170 }
8171
8172 static void GLAPIENTRY
8173 exec_GetPolygonStipple(GLubyte * dest)
8174 {
8175 GET_CURRENT_CONTEXT(ctx);
8176 FLUSH_VERTICES(ctx, 0);
8177 CALL_GetPolygonStipple(ctx->Exec, (dest));
8178 }
8179
8180 static const GLubyte *GLAPIENTRY
8181 exec_GetString(GLenum name)
8182 {
8183 GET_CURRENT_CONTEXT(ctx);
8184 FLUSH_VERTICES(ctx, 0);
8185 return CALL_GetString(ctx->Exec, (name));
8186 }
8187
8188 static void GLAPIENTRY
8189 exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
8190 {
8191 GET_CURRENT_CONTEXT(ctx);
8192 FLUSH_VERTICES(ctx, 0);
8193 CALL_GetTexEnvfv(ctx->Exec, (target, pname, params));
8194 }
8195
8196 static void GLAPIENTRY
8197 exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
8198 {
8199 GET_CURRENT_CONTEXT(ctx);
8200 FLUSH_VERTICES(ctx, 0);
8201 CALL_GetTexEnviv(ctx->Exec, (target, pname, params));
8202 }
8203
8204 static void GLAPIENTRY
8205 exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
8206 {
8207 GET_CURRENT_CONTEXT(ctx);
8208 FLUSH_VERTICES(ctx, 0);
8209 CALL_GetTexGendv(ctx->Exec, (coord, pname, params));
8210 }
8211
8212 static void GLAPIENTRY
8213 exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
8214 {
8215 GET_CURRENT_CONTEXT(ctx);
8216 FLUSH_VERTICES(ctx, 0);
8217 CALL_GetTexGenfv(ctx->Exec, (coord, pname, params));
8218 }
8219
8220 static void GLAPIENTRY
8221 exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
8222 {
8223 GET_CURRENT_CONTEXT(ctx);
8224 FLUSH_VERTICES(ctx, 0);
8225 CALL_GetTexGeniv(ctx->Exec, (coord, pname, params));
8226 }
8227
8228 static void GLAPIENTRY
8229 exec_GetTexImage(GLenum target, GLint level, GLenum format,
8230 GLenum type, GLvoid * pixels)
8231 {
8232 GET_CURRENT_CONTEXT(ctx);
8233 FLUSH_VERTICES(ctx, 0);
8234 CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels));
8235 }
8236
8237 static void GLAPIENTRY
8238 exec_GetTexLevelParameterfv(GLenum target, GLint level,
8239 GLenum pname, GLfloat *params)
8240 {
8241 GET_CURRENT_CONTEXT(ctx);
8242 FLUSH_VERTICES(ctx, 0);
8243 CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params));
8244 }
8245
8246 static void GLAPIENTRY
8247 exec_GetTexLevelParameteriv(GLenum target, GLint level,
8248 GLenum pname, GLint *params)
8249 {
8250 GET_CURRENT_CONTEXT(ctx);
8251 FLUSH_VERTICES(ctx, 0);
8252 CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params));
8253 }
8254
8255 static void GLAPIENTRY
8256 exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
8257 {
8258 GET_CURRENT_CONTEXT(ctx);
8259 FLUSH_VERTICES(ctx, 0);
8260 CALL_GetTexParameterfv(ctx->Exec, (target, pname, params));
8261 }
8262
8263 static void GLAPIENTRY
8264 exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
8265 {
8266 GET_CURRENT_CONTEXT(ctx);
8267 FLUSH_VERTICES(ctx, 0);
8268 CALL_GetTexParameteriv(ctx->Exec, (target, pname, params));
8269 }
8270
8271 static GLboolean GLAPIENTRY
8272 exec_IsEnabled(GLenum cap)
8273 {
8274 GET_CURRENT_CONTEXT(ctx);
8275 FLUSH_VERTICES(ctx, 0);
8276 return CALL_IsEnabled(ctx->Exec, (cap));
8277 }
8278
8279 static void GLAPIENTRY
8280 exec_PixelStoref(GLenum pname, GLfloat param)
8281 {
8282 GET_CURRENT_CONTEXT(ctx);
8283 FLUSH_VERTICES(ctx, 0);
8284 CALL_PixelStoref(ctx->Exec, (pname, param));
8285 }
8286
8287 static void GLAPIENTRY
8288 exec_PixelStorei(GLenum pname, GLint param)
8289 {
8290 GET_CURRENT_CONTEXT(ctx);
8291 FLUSH_VERTICES(ctx, 0);
8292 CALL_PixelStorei(ctx->Exec, (pname, param));
8293 }
8294
8295 static void GLAPIENTRY
8296 exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
8297 GLenum format, GLenum type, GLvoid * pixels)
8298 {
8299 GET_CURRENT_CONTEXT(ctx);
8300 FLUSH_VERTICES(ctx, 0);
8301 CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels));
8302 }
8303
8304 static GLint GLAPIENTRY
8305 exec_RenderMode(GLenum mode)
8306 {
8307 GET_CURRENT_CONTEXT(ctx);
8308 FLUSH_VERTICES(ctx, 0);
8309 return CALL_RenderMode(ctx->Exec, (mode));
8310 }
8311
8312 static void GLAPIENTRY
8313 exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
8314 {
8315 GET_CURRENT_CONTEXT(ctx);
8316 FLUSH_VERTICES(ctx, 0);
8317 CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer));
8318 }
8319
8320 static void GLAPIENTRY
8321 exec_SelectBuffer(GLsizei size, GLuint * buffer)
8322 {
8323 GET_CURRENT_CONTEXT(ctx);
8324 FLUSH_VERTICES(ctx, 0);
8325 CALL_SelectBuffer(ctx->Exec, (size, buffer));
8326 }
8327
8328 static GLboolean GLAPIENTRY
8329 exec_AreTexturesResident(GLsizei n, const GLuint * texName,
8330 GLboolean * residences)
8331 {
8332 GET_CURRENT_CONTEXT(ctx);
8333 FLUSH_VERTICES(ctx, 0);
8334 return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences));
8335 }
8336
8337 static void GLAPIENTRY
8338 exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
8339 {
8340 GET_CURRENT_CONTEXT(ctx);
8341 FLUSH_VERTICES(ctx, 0);
8342 CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr));
8343 }
8344
8345 static void GLAPIENTRY
8346 exec_DeleteTextures(GLsizei n, const GLuint * texName)
8347 {
8348 GET_CURRENT_CONTEXT(ctx);
8349 FLUSH_VERTICES(ctx, 0);
8350 CALL_DeleteTextures(ctx->Exec, (n, texName));
8351 }
8352
8353 static void GLAPIENTRY
8354 exec_DisableClientState(GLenum cap)
8355 {
8356 GET_CURRENT_CONTEXT(ctx);
8357 FLUSH_VERTICES(ctx, 0);
8358 CALL_DisableClientState(ctx->Exec, (cap));
8359 }
8360
8361 static void GLAPIENTRY
8362 exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr)
8363 {
8364 GET_CURRENT_CONTEXT(ctx);
8365 FLUSH_VERTICES(ctx, 0);
8366 CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr));
8367 }
8368
8369 static void GLAPIENTRY
8370 exec_EnableClientState(GLenum cap)
8371 {
8372 GET_CURRENT_CONTEXT(ctx);
8373 FLUSH_VERTICES(ctx, 0);
8374 CALL_EnableClientState(ctx->Exec, (cap));
8375 }
8376
8377 static void GLAPIENTRY
8378 exec_GenTextures(GLsizei n, GLuint * texName)
8379 {
8380 GET_CURRENT_CONTEXT(ctx);
8381 FLUSH_VERTICES(ctx, 0);
8382 CALL_GenTextures(ctx->Exec, (n, texName));
8383 }
8384
8385 static void GLAPIENTRY
8386 exec_GetPointerv(GLenum pname, GLvoid **params)
8387 {
8388 GET_CURRENT_CONTEXT(ctx);
8389 FLUSH_VERTICES(ctx, 0);
8390 CALL_GetPointerv(ctx->Exec, (pname, params));
8391 }
8392
8393 static void GLAPIENTRY
8394 exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
8395 {
8396 GET_CURRENT_CONTEXT(ctx);
8397 FLUSH_VERTICES(ctx, 0);
8398 CALL_IndexPointer(ctx->Exec, (type, stride, ptr));
8399 }
8400
8401 static void GLAPIENTRY
8402 exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer)
8403 {
8404 GET_CURRENT_CONTEXT(ctx);
8405 FLUSH_VERTICES(ctx, 0);
8406 CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer));
8407 }
8408
8409 static GLboolean GLAPIENTRY
8410 exec_IsTexture(GLuint texture)
8411 {
8412 GET_CURRENT_CONTEXT(ctx);
8413 FLUSH_VERTICES(ctx, 0);
8414 return CALL_IsTexture(ctx->Exec, (texture));
8415 }
8416
8417 static void GLAPIENTRY
8418 exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
8419 {
8420 GET_CURRENT_CONTEXT(ctx);
8421 FLUSH_VERTICES(ctx, 0);
8422 CALL_NormalPointer(ctx->Exec, (type, stride, ptr));
8423 }
8424
8425 static void GLAPIENTRY
8426 exec_PopClientAttrib(void)
8427 {
8428 GET_CURRENT_CONTEXT(ctx);
8429 FLUSH_VERTICES(ctx, 0);
8430 CALL_PopClientAttrib(ctx->Exec, ());
8431 }
8432
8433 static void GLAPIENTRY
8434 exec_PushClientAttrib(GLbitfield mask)
8435 {
8436 GET_CURRENT_CONTEXT(ctx);
8437 FLUSH_VERTICES(ctx, 0);
8438 CALL_PushClientAttrib(ctx->Exec, (mask));
8439 }
8440
8441 static void GLAPIENTRY
8442 exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
8443 const GLvoid *ptr)
8444 {
8445 GET_CURRENT_CONTEXT(ctx);
8446 FLUSH_VERTICES(ctx, 0);
8447 CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
8448 }
8449
8450 static void GLAPIENTRY
8451 exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
8452 {
8453 GET_CURRENT_CONTEXT(ctx);
8454 FLUSH_VERTICES(ctx, 0);
8455 CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img));
8456 }
8457
8458 static void GLAPIENTRY
8459 exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
8460 const GLvoid *ptr)
8461 {
8462 GET_CURRENT_CONTEXT(ctx);
8463 FLUSH_VERTICES(ctx, 0);
8464 CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr));
8465 }
8466
8467 static void GLAPIENTRY
8468 exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
8469 GLint x, GLint y, GLsizei width)
8470 {
8471 GET_CURRENT_CONTEXT(ctx);
8472 FLUSH_VERTICES(ctx, 0);
8473 CALL_CopyConvolutionFilter1D(ctx->Exec,
8474 (target, internalFormat, x, y, width));
8475 }
8476
8477 static void GLAPIENTRY
8478 exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
8479 GLint x, GLint y, GLsizei width, GLsizei height)
8480 {
8481 GET_CURRENT_CONTEXT(ctx);
8482 FLUSH_VERTICES(ctx, 0);
8483 CALL_CopyConvolutionFilter2D(ctx->Exec,
8484 (target, internalFormat, x, y, width,
8485 height));
8486 }
8487
8488 static void GLAPIENTRY
8489 exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data)
8490 {
8491 GET_CURRENT_CONTEXT(ctx);
8492 FLUSH_VERTICES(ctx, 0);
8493 CALL_GetColorTable(ctx->Exec, (target, format, type, data));
8494 }
8495
8496 static void GLAPIENTRY
8497 exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
8498 {
8499 GET_CURRENT_CONTEXT(ctx);
8500 FLUSH_VERTICES(ctx, 0);
8501 CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params));
8502 }
8503
8504 static void GLAPIENTRY
8505 exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
8506 {
8507 GET_CURRENT_CONTEXT(ctx);
8508 FLUSH_VERTICES(ctx, 0);
8509 CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params));
8510 }
8511
8512 static void GLAPIENTRY
8513 exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
8514 GLvoid * image)
8515 {
8516 GET_CURRENT_CONTEXT(ctx);
8517 FLUSH_VERTICES(ctx, 0);
8518 CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image));
8519 }
8520
8521 static void GLAPIENTRY
8522 exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
8523 {
8524 GET_CURRENT_CONTEXT(ctx);
8525 FLUSH_VERTICES(ctx, 0);
8526 CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params));
8527 }
8528
8529 static void GLAPIENTRY
8530 exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
8531 {
8532 GET_CURRENT_CONTEXT(ctx);
8533 FLUSH_VERTICES(ctx, 0);
8534 CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params));
8535 }
8536
8537 static void GLAPIENTRY
8538 exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
8539 GLenum type, GLvoid *values)
8540 {
8541 GET_CURRENT_CONTEXT(ctx);
8542 FLUSH_VERTICES(ctx, 0);
8543 CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values));
8544 }
8545
8546 static void GLAPIENTRY
8547 exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
8548 {
8549 GET_CURRENT_CONTEXT(ctx);
8550 FLUSH_VERTICES(ctx, 0);
8551 CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params));
8552 }
8553
8554 static void GLAPIENTRY
8555 exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
8556 {
8557 GET_CURRENT_CONTEXT(ctx);
8558 FLUSH_VERTICES(ctx, 0);
8559 CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params));
8560 }
8561
8562 static void GLAPIENTRY
8563 exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
8564 GLenum type, GLvoid *values)
8565 {
8566 GET_CURRENT_CONTEXT(ctx);
8567 FLUSH_VERTICES(ctx, 0);
8568 CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values));
8569 }
8570
8571 static void GLAPIENTRY
8572 exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
8573 {
8574 GET_CURRENT_CONTEXT(ctx);
8575 FLUSH_VERTICES(ctx, 0);
8576 CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params));
8577 }
8578
8579 static void GLAPIENTRY
8580 exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
8581 {
8582 GET_CURRENT_CONTEXT(ctx);
8583 FLUSH_VERTICES(ctx, 0);
8584 CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params));
8585 }
8586
8587 static void GLAPIENTRY
8588 exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
8589 GLvoid *row, GLvoid *column, GLvoid *span)
8590 {
8591 GET_CURRENT_CONTEXT(ctx);
8592 FLUSH_VERTICES(ctx, 0);
8593 CALL_GetSeparableFilter(ctx->Exec,
8594 (target, format, type, row, column, span));
8595 }
8596
8597 static void GLAPIENTRY
8598 exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
8599 GLsizei width, GLsizei height, GLenum format,
8600 GLenum type, const GLvoid *row, const GLvoid *column)
8601 {
8602 GET_CURRENT_CONTEXT(ctx);
8603 FLUSH_VERTICES(ctx, 0);
8604 CALL_SeparableFilter2D(ctx->Exec,
8605 (target, internalFormat, width, height, format,
8606 type, row, column));
8607 }
8608
8609 static void GLAPIENTRY
8610 exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
8611 GLsizei count, const GLvoid *ptr)
8612 {
8613 GET_CURRENT_CONTEXT(ctx);
8614 FLUSH_VERTICES(ctx, 0);
8615 CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
8616 }
8617
8618 static void GLAPIENTRY
8619 exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
8620 {
8621 GET_CURRENT_CONTEXT(ctx);
8622 FLUSH_VERTICES(ctx, 0);
8623 CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr));
8624 }
8625
8626 static void GLAPIENTRY
8627 exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
8628 const GLvoid *ptr)
8629 {
8630 GET_CURRENT_CONTEXT(ctx);
8631 FLUSH_VERTICES(ctx, 0);
8632 CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr));
8633 }
8634
8635 static void GLAPIENTRY
8636 exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
8637 const GLvoid *ptr)
8638 {
8639 GET_CURRENT_CONTEXT(ctx);
8640 FLUSH_VERTICES(ctx, 0);
8641 CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr));
8642 }
8643
8644 static void GLAPIENTRY
8645 exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
8646 GLsizei count, const GLvoid *ptr)
8647 {
8648 GET_CURRENT_CONTEXT(ctx);
8649 FLUSH_VERTICES(ctx, 0);
8650 CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
8651 }
8652
8653 static void GLAPIENTRY
8654 exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
8655 GLsizei count, const GLvoid *ptr)
8656 {
8657 GET_CURRENT_CONTEXT(ctx);
8658 FLUSH_VERTICES(ctx, 0);
8659 CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
8660 }
8661
8662 static void GLAPIENTRY
8663 exec_LockArraysEXT(GLint first, GLsizei count)
8664 {
8665 GET_CURRENT_CONTEXT(ctx);
8666 FLUSH_VERTICES(ctx, 0);
8667 CALL_LockArraysEXT(ctx->Exec, (first, count));
8668 }
8669
8670 static void GLAPIENTRY
8671 exec_UnlockArraysEXT(void)
8672 {
8673 GET_CURRENT_CONTEXT(ctx);
8674 FLUSH_VERTICES(ctx, 0);
8675 CALL_UnlockArraysEXT(ctx->Exec, ());
8676 }
8677
8678 static void GLAPIENTRY
8679 exec_ClientActiveTextureARB(GLenum target)
8680 {
8681 GET_CURRENT_CONTEXT(ctx);
8682 FLUSH_VERTICES(ctx, 0);
8683 CALL_ClientActiveTextureARB(ctx->Exec, (target));
8684 }
8685
8686 static void GLAPIENTRY
8687 exec_SecondaryColorPointerEXT(GLint size, GLenum type,
8688 GLsizei stride, const GLvoid *ptr)
8689 {
8690 GET_CURRENT_CONTEXT(ctx);
8691 FLUSH_VERTICES(ctx, 0);
8692 CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr));
8693 }
8694
8695 static void GLAPIENTRY
8696 exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
8697 {
8698 GET_CURRENT_CONTEXT(ctx);
8699 FLUSH_VERTICES(ctx, 0);
8700 CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr));
8701 }
8702
8703 /* GL_EXT_multi_draw_arrays */
8704 static void GLAPIENTRY
8705 exec_MultiDrawArraysEXT(GLenum mode, GLint * first,
8706 GLsizei * count, GLsizei primcount)
8707 {
8708 GET_CURRENT_CONTEXT(ctx);
8709 FLUSH_VERTICES(ctx, 0);
8710 CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount));
8711 }
8712
8713 /* GL_IBM_multimode_draw_arrays */
8714 static void GLAPIENTRY
8715 exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
8716 const GLsizei * count, GLsizei primcount,
8717 GLint modestride)
8718 {
8719 GET_CURRENT_CONTEXT(ctx);
8720 FLUSH_VERTICES(ctx, 0);
8721 CALL_MultiModeDrawArraysIBM(ctx->Exec,
8722 (mode, first, count, primcount, modestride));
8723 }
8724
8725 /* GL_IBM_multimode_draw_arrays */
8726 static void GLAPIENTRY
8727 exec_MultiModeDrawElementsIBM(const GLenum * mode,
8728 const GLsizei * count,
8729 GLenum type,
8730 const GLvoid * const *indices,
8731 GLsizei primcount, GLint modestride)
8732 {
8733 GET_CURRENT_CONTEXT(ctx);
8734 FLUSH_VERTICES(ctx, 0);
8735 CALL_MultiModeDrawElementsIBM(ctx->Exec,
8736 (mode, count, type, indices, primcount,
8737 modestride));
8738 }
8739
8740
8741
8742 /**
8743 * Setup the given dispatch table to point to Mesa's display list
8744 * building functions.
8745 *
8746 * This does not include any of the tnl functions - they are
8747 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8748 * struct.
8749 */
8750 void
8751 _mesa_init_save_table(struct _glapi_table *table)
8752 {
8753 _mesa_loopback_init_api_table(table);
8754
8755 /* GL 1.0 */
8756 SET_Accum(table, save_Accum);
8757 SET_AlphaFunc(table, save_AlphaFunc);
8758 SET_Bitmap(table, save_Bitmap);
8759 SET_BlendFunc(table, save_BlendFunc);
8760 SET_CallList(table, save_CallList);
8761 SET_CallLists(table, save_CallLists);
8762 SET_Clear(table, save_Clear);
8763 SET_ClearAccum(table, save_ClearAccum);
8764 SET_ClearColor(table, save_ClearColor);
8765 SET_ClearDepth(table, save_ClearDepth);
8766 SET_ClearIndex(table, save_ClearIndex);
8767 SET_ClearStencil(table, save_ClearStencil);
8768 SET_ClipPlane(table, save_ClipPlane);
8769 SET_ColorMask(table, save_ColorMask);
8770 SET_ColorMaskIndexedEXT(table, save_ColorMaskIndexed);
8771 SET_ColorMaterial(table, save_ColorMaterial);
8772 SET_CopyPixels(table, save_CopyPixels);
8773 SET_CullFace(table, save_CullFace);
8774 SET_DeleteLists(table, _mesa_DeleteLists);
8775 SET_DepthFunc(table, save_DepthFunc);
8776 SET_DepthMask(table, save_DepthMask);
8777 SET_DepthRange(table, save_DepthRange);
8778 SET_Disable(table, save_Disable);
8779 SET_DisableIndexedEXT(table, save_DisableIndexed);
8780 SET_DrawBuffer(table, save_DrawBuffer);
8781 SET_DrawPixels(table, save_DrawPixels);
8782 SET_Enable(table, save_Enable);
8783 SET_EnableIndexedEXT(table, save_EnableIndexed);
8784 SET_EndList(table, _mesa_EndList);
8785 SET_EvalMesh1(table, save_EvalMesh1);
8786 SET_EvalMesh2(table, save_EvalMesh2);
8787 SET_Finish(table, exec_Finish);
8788 SET_Flush(table, exec_Flush);
8789 SET_Fogf(table, save_Fogf);
8790 SET_Fogfv(table, save_Fogfv);
8791 SET_Fogi(table, save_Fogi);
8792 SET_Fogiv(table, save_Fogiv);
8793 SET_FrontFace(table, save_FrontFace);
8794 SET_Frustum(table, save_Frustum);
8795 SET_GenLists(table, _mesa_GenLists);
8796 SET_GetBooleanv(table, exec_GetBooleanv);
8797 SET_GetClipPlane(table, exec_GetClipPlane);
8798 SET_GetDoublev(table, exec_GetDoublev);
8799 SET_GetError(table, exec_GetError);
8800 SET_GetFloatv(table, exec_GetFloatv);
8801 SET_GetIntegerv(table, exec_GetIntegerv);
8802 SET_GetLightfv(table, exec_GetLightfv);
8803 SET_GetLightiv(table, exec_GetLightiv);
8804 SET_GetMapdv(table, exec_GetMapdv);
8805 SET_GetMapfv(table, exec_GetMapfv);
8806 SET_GetMapiv(table, exec_GetMapiv);
8807 SET_GetMaterialfv(table, exec_GetMaterialfv);
8808 SET_GetMaterialiv(table, exec_GetMaterialiv);
8809 SET_GetPixelMapfv(table, exec_GetPixelMapfv);
8810 SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
8811 SET_GetPixelMapusv(table, exec_GetPixelMapusv);
8812 SET_GetPolygonStipple(table, exec_GetPolygonStipple);
8813 SET_GetString(table, exec_GetString);
8814 SET_GetTexEnvfv(table, exec_GetTexEnvfv);
8815 SET_GetTexEnviv(table, exec_GetTexEnviv);
8816 SET_GetTexGendv(table, exec_GetTexGendv);
8817 SET_GetTexGenfv(table, exec_GetTexGenfv);
8818 SET_GetTexGeniv(table, exec_GetTexGeniv);
8819 SET_GetTexImage(table, exec_GetTexImage);
8820 SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
8821 SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
8822 SET_GetTexParameterfv(table, exec_GetTexParameterfv);
8823 SET_GetTexParameteriv(table, exec_GetTexParameteriv);
8824 SET_Hint(table, save_Hint);
8825 SET_IndexMask(table, save_IndexMask);
8826 SET_InitNames(table, save_InitNames);
8827 SET_IsEnabled(table, exec_IsEnabled);
8828 SET_IsList(table, _mesa_IsList);
8829 SET_LightModelf(table, save_LightModelf);
8830 SET_LightModelfv(table, save_LightModelfv);
8831 SET_LightModeli(table, save_LightModeli);
8832 SET_LightModeliv(table, save_LightModeliv);
8833 SET_Lightf(table, save_Lightf);
8834 SET_Lightfv(table, save_Lightfv);
8835 SET_Lighti(table, save_Lighti);
8836 SET_Lightiv(table, save_Lightiv);
8837 SET_LineStipple(table, save_LineStipple);
8838 SET_LineWidth(table, save_LineWidth);
8839 SET_ListBase(table, save_ListBase);
8840 SET_LoadIdentity(table, save_LoadIdentity);
8841 SET_LoadMatrixd(table, save_LoadMatrixd);
8842 SET_LoadMatrixf(table, save_LoadMatrixf);
8843 SET_LoadName(table, save_LoadName);
8844 SET_LogicOp(table, save_LogicOp);
8845 SET_Map1d(table, save_Map1d);
8846 SET_Map1f(table, save_Map1f);
8847 SET_Map2d(table, save_Map2d);
8848 SET_Map2f(table, save_Map2f);
8849 SET_MapGrid1d(table, save_MapGrid1d);
8850 SET_MapGrid1f(table, save_MapGrid1f);
8851 SET_MapGrid2d(table, save_MapGrid2d);
8852 SET_MapGrid2f(table, save_MapGrid2f);
8853 SET_MatrixMode(table, save_MatrixMode);
8854 SET_MultMatrixd(table, save_MultMatrixd);
8855 SET_MultMatrixf(table, save_MultMatrixf);
8856 SET_NewList(table, save_NewList);
8857 SET_Ortho(table, save_Ortho);
8858 SET_PassThrough(table, save_PassThrough);
8859 SET_PixelMapfv(table, save_PixelMapfv);
8860 SET_PixelMapuiv(table, save_PixelMapuiv);
8861 SET_PixelMapusv(table, save_PixelMapusv);
8862 SET_PixelStoref(table, exec_PixelStoref);
8863 SET_PixelStorei(table, exec_PixelStorei);
8864 SET_PixelTransferf(table, save_PixelTransferf);
8865 SET_PixelTransferi(table, save_PixelTransferi);
8866 SET_PixelZoom(table, save_PixelZoom);
8867 SET_PointSize(table, save_PointSize);
8868 SET_PolygonMode(table, save_PolygonMode);
8869 SET_PolygonOffset(table, save_PolygonOffset);
8870 SET_PolygonStipple(table, save_PolygonStipple);
8871 SET_PopAttrib(table, save_PopAttrib);
8872 SET_PopMatrix(table, save_PopMatrix);
8873 SET_PopName(table, save_PopName);
8874 SET_PushAttrib(table, save_PushAttrib);
8875 SET_PushMatrix(table, save_PushMatrix);
8876 SET_PushName(table, save_PushName);
8877 SET_RasterPos2d(table, save_RasterPos2d);
8878 SET_RasterPos2dv(table, save_RasterPos2dv);
8879 SET_RasterPos2f(table, save_RasterPos2f);
8880 SET_RasterPos2fv(table, save_RasterPos2fv);
8881 SET_RasterPos2i(table, save_RasterPos2i);
8882 SET_RasterPos2iv(table, save_RasterPos2iv);
8883 SET_RasterPos2s(table, save_RasterPos2s);
8884 SET_RasterPos2sv(table, save_RasterPos2sv);
8885 SET_RasterPos3d(table, save_RasterPos3d);
8886 SET_RasterPos3dv(table, save_RasterPos3dv);
8887 SET_RasterPos3f(table, save_RasterPos3f);
8888 SET_RasterPos3fv(table, save_RasterPos3fv);
8889 SET_RasterPos3i(table, save_RasterPos3i);
8890 SET_RasterPos3iv(table, save_RasterPos3iv);
8891 SET_RasterPos3s(table, save_RasterPos3s);
8892 SET_RasterPos3sv(table, save_RasterPos3sv);
8893 SET_RasterPos4d(table, save_RasterPos4d);
8894 SET_RasterPos4dv(table, save_RasterPos4dv);
8895 SET_RasterPos4f(table, save_RasterPos4f);
8896 SET_RasterPos4fv(table, save_RasterPos4fv);
8897 SET_RasterPos4i(table, save_RasterPos4i);
8898 SET_RasterPos4iv(table, save_RasterPos4iv);
8899 SET_RasterPos4s(table, save_RasterPos4s);
8900 SET_RasterPos4sv(table, save_RasterPos4sv);
8901 SET_ReadBuffer(table, save_ReadBuffer);
8902 SET_ReadPixels(table, exec_ReadPixels);
8903 SET_RenderMode(table, exec_RenderMode);
8904 SET_Rotated(table, save_Rotated);
8905 SET_Rotatef(table, save_Rotatef);
8906 SET_Scaled(table, save_Scaled);
8907 SET_Scalef(table, save_Scalef);
8908 SET_Scissor(table, save_Scissor);
8909 SET_FeedbackBuffer(table, exec_FeedbackBuffer);
8910 SET_SelectBuffer(table, exec_SelectBuffer);
8911 SET_ShadeModel(table, save_ShadeModel);
8912 SET_StencilFunc(table, save_StencilFunc);
8913 SET_StencilMask(table, save_StencilMask);
8914 SET_StencilOp(table, save_StencilOp);
8915 SET_TexEnvf(table, save_TexEnvf);
8916 SET_TexEnvfv(table, save_TexEnvfv);
8917 SET_TexEnvi(table, save_TexEnvi);
8918 SET_TexEnviv(table, save_TexEnviv);
8919 SET_TexGend(table, save_TexGend);
8920 SET_TexGendv(table, save_TexGendv);
8921 SET_TexGenf(table, save_TexGenf);
8922 SET_TexGenfv(table, save_TexGenfv);
8923 SET_TexGeni(table, save_TexGeni);
8924 SET_TexGeniv(table, save_TexGeniv);
8925 SET_TexImage1D(table, save_TexImage1D);
8926 SET_TexImage2D(table, save_TexImage2D);
8927 SET_TexParameterf(table, save_TexParameterf);
8928 SET_TexParameterfv(table, save_TexParameterfv);
8929 SET_TexParameteri(table, save_TexParameteri);
8930 SET_TexParameteriv(table, save_TexParameteriv);
8931 SET_Translated(table, save_Translated);
8932 SET_Translatef(table, save_Translatef);
8933 SET_Viewport(table, save_Viewport);
8934
8935 /* GL 1.1 */
8936 SET_AreTexturesResident(table, exec_AreTexturesResident);
8937 SET_BindTexture(table, save_BindTexture);
8938 SET_ColorPointer(table, exec_ColorPointer);
8939 SET_CopyTexImage1D(table, save_CopyTexImage1D);
8940 SET_CopyTexImage2D(table, save_CopyTexImage2D);
8941 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
8942 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
8943 SET_DeleteTextures(table, exec_DeleteTextures);
8944 SET_DisableClientState(table, exec_DisableClientState);
8945 SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
8946 SET_EnableClientState(table, exec_EnableClientState);
8947 SET_GenTextures(table, exec_GenTextures);
8948 SET_GetPointerv(table, exec_GetPointerv);
8949 SET_IndexPointer(table, exec_IndexPointer);
8950 SET_InterleavedArrays(table, exec_InterleavedArrays);
8951 SET_IsTexture(table, exec_IsTexture);
8952 SET_NormalPointer(table, exec_NormalPointer);
8953 SET_PopClientAttrib(table, exec_PopClientAttrib);
8954 SET_PrioritizeTextures(table, save_PrioritizeTextures);
8955 SET_PushClientAttrib(table, exec_PushClientAttrib);
8956 SET_TexCoordPointer(table, exec_TexCoordPointer);
8957 SET_TexSubImage1D(table, save_TexSubImage1D);
8958 SET_TexSubImage2D(table, save_TexSubImage2D);
8959 SET_VertexPointer(table, exec_VertexPointer);
8960
8961 /* GL 1.2 */
8962 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
8963 SET_TexImage3D(table, save_TexImage3D);
8964 SET_TexSubImage3D(table, save_TexSubImage3D);
8965
8966 /* GL 2.0 */
8967 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
8968 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
8969 SET_StencilOpSeparate(table, save_StencilOpSeparate);
8970
8971 /* ATI_separate_stencil */
8972 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
8973
8974 /* GL_ARB_imaging */
8975 /* Not all are supported */
8976 SET_BlendColor(table, save_BlendColor);
8977 SET_BlendEquation(table, save_BlendEquation);
8978 SET_ColorSubTable(table, save_ColorSubTable);
8979 SET_ColorTable(table, save_ColorTable);
8980 SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
8981 SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
8982 SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
8983 SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
8984 SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
8985 SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
8986 SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
8987 SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
8988 SET_CopyColorSubTable(table, save_CopyColorSubTable);
8989 SET_CopyColorTable(table, save_CopyColorTable);
8990 SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
8991 SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
8992 SET_GetColorTable(table, exec_GetColorTable);
8993 SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
8994 SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
8995 SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
8996 SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
8997 SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
8998 SET_GetHistogram(table, exec_GetHistogram);
8999 SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
9000 SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
9001 SET_GetMinmax(table, exec_GetMinmax);
9002 SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
9003 SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
9004 SET_GetSeparableFilter(table, exec_GetSeparableFilter);
9005 SET_Histogram(table, save_Histogram);
9006 SET_Minmax(table, save_Minmax);
9007 SET_ResetHistogram(table, save_ResetHistogram);
9008 SET_ResetMinmax(table, save_ResetMinmax);
9009 SET_SeparableFilter2D(table, exec_SeparableFilter2D);
9010
9011 /* 2. GL_EXT_blend_color */
9012 #if 0
9013 SET_BlendColorEXT(table, save_BlendColorEXT);
9014 #endif
9015
9016 /* 3. GL_EXT_polygon_offset */
9017 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
9018
9019 /* 6. GL_EXT_texture3d */
9020 #if 0
9021 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
9022 SET_TexImage3DEXT(table, save_TexImage3DEXT);
9023 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
9024 #endif
9025
9026 /* 14. GL_SGI_color_table */
9027 #if 0
9028 SET_ColorTableSGI(table, save_ColorTable);
9029 SET_ColorSubTableSGI(table, save_ColorSubTable);
9030 SET_GetColorTableSGI(table, exec_GetColorTable);
9031 SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv);
9032 SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv);
9033 #endif
9034
9035 /* 30. GL_EXT_vertex_array */
9036 SET_ColorPointerEXT(table, exec_ColorPointerEXT);
9037 SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
9038 SET_IndexPointerEXT(table, exec_IndexPointerEXT);
9039 SET_NormalPointerEXT(table, exec_NormalPointerEXT);
9040 SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
9041 SET_VertexPointerEXT(table, exec_VertexPointerEXT);
9042
9043 /* 37. GL_EXT_blend_minmax */
9044 #if 0
9045 SET_BlendEquationEXT(table, save_BlendEquationEXT);
9046 #endif
9047
9048 /* 54. GL_EXT_point_parameters */
9049 SET_PointParameterfEXT(table, save_PointParameterfEXT);
9050 SET_PointParameterfvEXT(table, save_PointParameterfvEXT);
9051
9052 /* 97. GL_EXT_compiled_vertex_array */
9053 SET_LockArraysEXT(table, exec_LockArraysEXT);
9054 SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
9055
9056 /* 145. GL_EXT_secondary_color */
9057 SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT);
9058
9059 /* 148. GL_EXT_multi_draw_arrays */
9060 SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT);
9061
9062 /* 149. GL_EXT_fog_coord */
9063 SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT);
9064
9065 /* 173. GL_EXT_blend_func_separate */
9066 SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT);
9067
9068 /* 196. GL_MESA_resize_buffers */
9069 SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
9070
9071 /* 197. GL_MESA_window_pos */
9072 SET_WindowPos2dMESA(table, save_WindowPos2dMESA);
9073 SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA);
9074 SET_WindowPos2fMESA(table, save_WindowPos2fMESA);
9075 SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA);
9076 SET_WindowPos2iMESA(table, save_WindowPos2iMESA);
9077 SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA);
9078 SET_WindowPos2sMESA(table, save_WindowPos2sMESA);
9079 SET_WindowPos2svMESA(table, save_WindowPos2svMESA);
9080 SET_WindowPos3dMESA(table, save_WindowPos3dMESA);
9081 SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA);
9082 SET_WindowPos3fMESA(table, save_WindowPos3fMESA);
9083 SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA);
9084 SET_WindowPos3iMESA(table, save_WindowPos3iMESA);
9085 SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA);
9086 SET_WindowPos3sMESA(table, save_WindowPos3sMESA);
9087 SET_WindowPos3svMESA(table, save_WindowPos3svMESA);
9088 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
9089 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
9090 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
9091 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
9092 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
9093 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
9094 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
9095 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
9096
9097 /* 200. GL_IBM_multimode_draw_arrays */
9098 SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
9099 SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
9100
9101 #if FEATURE_NV_vertex_program
9102 /* 233. GL_NV_vertex_program */
9103 /* The following commands DO NOT go into display lists:
9104 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9105 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9106 */
9107 SET_BindProgramNV(table, save_BindProgramNV);
9108 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
9109 SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
9110 SET_GenProgramsNV(table, _mesa_GenPrograms);
9111 SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
9112 SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
9113 SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
9114 SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
9115 SET_GetProgramivNV(table, _mesa_GetProgramivNV);
9116 SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
9117 SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
9118 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
9119 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
9120 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
9121 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
9122 SET_IsProgramNV(table, _mesa_IsProgramARB);
9123 SET_LoadProgramNV(table, save_LoadProgramNV);
9124 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
9125 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
9126 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
9127 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
9128 SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
9129 SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
9130 SET_TrackMatrixNV(table, save_TrackMatrixNV);
9131 SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
9132 #endif
9133
9134 /* 244. GL_ATI_envmap_bumpmap */
9135 SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
9136 SET_TexBumpParameterfvATI(table, save_TexBumpParameterfvATI);
9137
9138 /* 245. GL_ATI_fragment_shader */
9139 #if FEATURE_ATI_fragment_shader
9140 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
9141 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
9142 #endif
9143
9144 /* 282. GL_NV_fragment_program */
9145 #if FEATURE_NV_fragment_program
9146 SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
9147 SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
9148 SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
9149 SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
9150 SET_GetProgramNamedParameterfvNV(table,
9151 _mesa_GetProgramNamedParameterfvNV);
9152 SET_GetProgramNamedParameterdvNV(table,
9153 _mesa_GetProgramNamedParameterdvNV);
9154 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
9155 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
9156 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
9157 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
9158 SET_GetProgramLocalParameterdvARB(table,
9159 _mesa_GetProgramLocalParameterdvARB);
9160 SET_GetProgramLocalParameterfvARB(table,
9161 _mesa_GetProgramLocalParameterfvARB);
9162 #endif
9163
9164 /* 262. GL_NV_point_sprite */
9165 SET_PointParameteriNV(table, save_PointParameteriNV);
9166 SET_PointParameterivNV(table, save_PointParameterivNV);
9167
9168 /* 268. GL_EXT_stencil_two_side */
9169 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
9170
9171 /* 273. GL_APPLE_vertex_array_object */
9172 SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
9173 SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE);
9174 SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
9175 SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE);
9176
9177 /* ???. GL_EXT_depth_bounds_test */
9178 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
9179
9180 /* ARB 1. GL_ARB_multitexture */
9181 SET_ActiveTextureARB(table, save_ActiveTextureARB);
9182 SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB);
9183
9184 /* ARB 3. GL_ARB_transpose_matrix */
9185 SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB);
9186 SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB);
9187 SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB);
9188 SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB);
9189
9190 /* ARB 5. GL_ARB_multisample */
9191 SET_SampleCoverageARB(table, save_SampleCoverageARB);
9192
9193 /* ARB 12. GL_ARB_texture_compression */
9194 SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
9195 SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
9196 SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
9197 SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
9198 SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
9199 SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
9200 SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
9201
9202 /* ARB 14. GL_ARB_point_parameters */
9203 /* aliased with EXT_point_parameters functions */
9204
9205 /* ARB 25. GL_ARB_window_pos */
9206 /* aliased with MESA_window_pos functions */
9207
9208 /* ARB 26. GL_ARB_vertex_program */
9209 /* ARB 27. GL_ARB_fragment_program */
9210 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
9211 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9212 SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB);
9213 SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB);
9214 SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB);
9215 SET_ProgramStringARB(table, save_ProgramStringARB);
9216 SET_BindProgramNV(table, save_BindProgramNV);
9217 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
9218 SET_GenProgramsNV(table, _mesa_GenPrograms);
9219 SET_IsProgramNV(table, _mesa_IsProgramARB);
9220 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
9221 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
9222 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
9223 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
9224 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
9225 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
9226 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
9227 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
9228 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
9229 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
9230 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
9231 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
9232 SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
9233 SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
9234 SET_GetProgramLocalParameterdvARB(table,
9235 _mesa_GetProgramLocalParameterdvARB);
9236 SET_GetProgramLocalParameterfvARB(table,
9237 _mesa_GetProgramLocalParameterfvARB);
9238 SET_GetProgramivARB(table, _mesa_GetProgramivARB);
9239 SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
9240 #endif
9241
9242 /* ARB 28. GL_ARB_vertex_buffer_object */
9243 #if FEATURE_ARB_vertex_buffer_object
9244 /* None of the extension's functions get compiled */
9245 SET_BindBufferARB(table, _mesa_BindBufferARB);
9246 SET_BufferDataARB(table, _mesa_BufferDataARB);
9247 SET_BufferSubDataARB(table, _mesa_BufferSubDataARB);
9248 SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB);
9249 SET_GenBuffersARB(table, _mesa_GenBuffersARB);
9250 SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB);
9251 SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB);
9252 SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB);
9253 SET_IsBufferARB(table, _mesa_IsBufferARB);
9254 SET_MapBufferARB(table, _mesa_MapBufferARB);
9255 SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
9256 #endif
9257
9258 #if FEATURE_queryobj
9259 SET_BeginQueryARB(table, save_BeginQueryARB);
9260 SET_EndQueryARB(table, save_EndQueryARB);
9261 SET_GenQueriesARB(table, _mesa_GenQueriesARB);
9262 SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB);
9263 SET_IsQueryARB(table, _mesa_IsQueryARB);
9264 SET_GetQueryivARB(table, _mesa_GetQueryivARB);
9265 SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB);
9266 SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB);
9267 #endif
9268 SET_DrawBuffersARB(table, save_DrawBuffersARB);
9269
9270 #if FEATURE_EXT_framebuffer_blit
9271 SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
9272 #endif
9273
9274 /* GL_ARB_shader_objects */
9275 SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
9276 SET_Uniform1fARB(table, save_Uniform1fARB);
9277 SET_Uniform2fARB(table, save_Uniform2fARB);
9278 SET_Uniform3fARB(table, save_Uniform3fARB);
9279 SET_Uniform4fARB(table, save_Uniform4fARB);
9280 SET_Uniform1fvARB(table, save_Uniform1fvARB);
9281 SET_Uniform2fvARB(table, save_Uniform2fvARB);
9282 SET_Uniform3fvARB(table, save_Uniform3fvARB);
9283 SET_Uniform4fvARB(table, save_Uniform4fvARB);
9284 SET_Uniform1iARB(table, save_Uniform1iARB);
9285 SET_Uniform2iARB(table, save_Uniform2iARB);
9286 SET_Uniform3iARB(table, save_Uniform3iARB);
9287 SET_Uniform4iARB(table, save_Uniform4iARB);
9288 SET_Uniform1ivARB(table, save_Uniform1ivARB);
9289 SET_Uniform2ivARB(table, save_Uniform2ivARB);
9290 SET_Uniform3ivARB(table, save_Uniform3ivARB);
9291 SET_Uniform4ivARB(table, save_Uniform4ivARB);
9292 SET_UniformMatrix2fvARB(table, save_UniformMatrix2fvARB);
9293 SET_UniformMatrix3fvARB(table, save_UniformMatrix3fvARB);
9294 SET_UniformMatrix4fvARB(table, save_UniformMatrix4fvARB);
9295 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
9296 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
9297 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
9298 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
9299 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
9300 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
9301
9302 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
9303 SET_BindAttribLocationARB(table, exec_BindAttribLocationARB);
9304 SET_GetAttribLocationARB(table, exec_GetAttribLocationARB);
9305 /* XXX additional functions need to be implemented here! */
9306
9307 /* 299. GL_EXT_blend_equation_separate */
9308 SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
9309
9310 /* GL_EXT_gpu_program_parameters */
9311 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
9312 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
9313 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
9314 #endif
9315
9316 /* ARB 50. GL_ARB_map_buffer_range */
9317 #if FEATURE_ARB_map_buffer_range
9318 SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */
9319 SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */
9320 #endif
9321
9322 /* ARB 59. GL_ARB_copy_buffer */
9323 SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
9324
9325 /* 352. GL_EXT_transform_feedback */
9326 #if FEATURE_EXT_transform_feedback
9327 SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback);
9328 SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback);
9329 #endif
9330
9331 /* 364. GL_EXT_provoking_vertex */
9332 SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT);
9333
9334 /* 371. GL_APPLE_object_purgeable */
9335 #if FEATURE_APPLE_object_purgeable
9336 SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
9337 SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
9338 #endif
9339
9340 /* GL 3.0 */
9341 #if 0
9342 SET_ClearBufferiv(table, save_ClearBufferiv);
9343 SET_ClearBufferuiv(table, save_ClearBufferuiv);
9344 SET_ClearBufferfv(table, save_ClearBufferfv);
9345 SET_ClearBufferfi(table, save_ClearBufferfi);
9346 #else
9347 (void) save_ClearBufferiv;
9348 (void) save_ClearBufferuiv;
9349 (void) save_ClearBufferfv;
9350 (void) save_ClearBufferfi;
9351 #endif
9352 }
9353
9354
9355
9356 static const char *
9357 enum_string(GLenum k)
9358 {
9359 return _mesa_lookup_enum_by_nr(k);
9360 }
9361
9362
9363 /**
9364 * Print the commands in a display list. For debugging only.
9365 * TODO: many commands aren't handled yet.
9366 */
9367 static void GLAPIENTRY
9368 print_list(GLcontext *ctx, GLuint list)
9369 {
9370 struct gl_display_list *dlist;
9371 Node *n;
9372 GLboolean done;
9373
9374 if (!islist(ctx, list)) {
9375 printf("%u is not a display list ID\n", list);
9376 return;
9377 }
9378
9379 dlist = lookup_list(ctx, list);
9380 if (!dlist)
9381 return;
9382
9383 n = dlist->Head;
9384
9385 printf("START-LIST %u, address %p\n", list, (void *) n);
9386
9387 done = n ? GL_FALSE : GL_TRUE;
9388 while (!done) {
9389 const OpCode opcode = n[0].opcode;
9390
9391 if (is_ext_opcode(opcode)) {
9392 n += ext_opcode_print(ctx, n);
9393 }
9394 else {
9395 switch (opcode) {
9396 case OPCODE_ACCUM:
9397 printf("Accum %s %g\n", enum_string(n[1].e), n[2].f);
9398 break;
9399 case OPCODE_BITMAP:
9400 printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
9401 n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data);
9402 break;
9403 case OPCODE_CALL_LIST:
9404 printf("CallList %d\n", (int) n[1].ui);
9405 break;
9406 case OPCODE_CALL_LIST_OFFSET:
9407 printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
9408 ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
9409 break;
9410 case OPCODE_COLOR_TABLE_PARAMETER_FV:
9411 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9412 enum_string(n[1].e), enum_string(n[2].e),
9413 n[3].f, n[4].f, n[5].f, n[6].f);
9414 break;
9415 case OPCODE_COLOR_TABLE_PARAMETER_IV:
9416 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9417 enum_string(n[1].e), enum_string(n[2].e),
9418 n[3].i, n[4].i, n[5].i, n[6].i);
9419 break;
9420 case OPCODE_DISABLE:
9421 printf("Disable %s\n", enum_string(n[1].e));
9422 break;
9423 case OPCODE_ENABLE:
9424 printf("Enable %s\n", enum_string(n[1].e));
9425 break;
9426 case OPCODE_FRUSTUM:
9427 printf("Frustum %g %g %g %g %g %g\n",
9428 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
9429 break;
9430 case OPCODE_LINE_STIPPLE:
9431 printf("LineStipple %d %x\n", n[1].i, (int) n[2].us);
9432 break;
9433 case OPCODE_LOAD_IDENTITY:
9434 printf("LoadIdentity\n");
9435 break;
9436 case OPCODE_LOAD_MATRIX:
9437 printf("LoadMatrix\n");
9438 printf(" %8f %8f %8f %8f\n",
9439 n[1].f, n[5].f, n[9].f, n[13].f);
9440 printf(" %8f %8f %8f %8f\n",
9441 n[2].f, n[6].f, n[10].f, n[14].f);
9442 printf(" %8f %8f %8f %8f\n",
9443 n[3].f, n[7].f, n[11].f, n[15].f);
9444 printf(" %8f %8f %8f %8f\n",
9445 n[4].f, n[8].f, n[12].f, n[16].f);
9446 break;
9447 case OPCODE_MULT_MATRIX:
9448 printf("MultMatrix (or Rotate)\n");
9449 printf(" %8f %8f %8f %8f\n",
9450 n[1].f, n[5].f, n[9].f, n[13].f);
9451 printf(" %8f %8f %8f %8f\n",
9452 n[2].f, n[6].f, n[10].f, n[14].f);
9453 printf(" %8f %8f %8f %8f\n",
9454 n[3].f, n[7].f, n[11].f, n[15].f);
9455 printf(" %8f %8f %8f %8f\n",
9456 n[4].f, n[8].f, n[12].f, n[16].f);
9457 break;
9458 case OPCODE_ORTHO:
9459 printf("Ortho %g %g %g %g %g %g\n",
9460 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
9461 break;
9462 case OPCODE_POP_ATTRIB:
9463 printf("PopAttrib\n");
9464 break;
9465 case OPCODE_POP_MATRIX:
9466 printf("PopMatrix\n");
9467 break;
9468 case OPCODE_POP_NAME:
9469 printf("PopName\n");
9470 break;
9471 case OPCODE_PUSH_ATTRIB:
9472 printf("PushAttrib %x\n", n[1].bf);
9473 break;
9474 case OPCODE_PUSH_MATRIX:
9475 printf("PushMatrix\n");
9476 break;
9477 case OPCODE_PUSH_NAME:
9478 printf("PushName %d\n", (int) n[1].ui);
9479 break;
9480 case OPCODE_RASTER_POS:
9481 printf("RasterPos %g %g %g %g\n",
9482 n[1].f, n[2].f, n[3].f, n[4].f);
9483 break;
9484 case OPCODE_ROTATE:
9485 printf("Rotate %g %g %g %g\n",
9486 n[1].f, n[2].f, n[3].f, n[4].f);
9487 break;
9488 case OPCODE_SCALE:
9489 printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
9490 break;
9491 case OPCODE_TRANSLATE:
9492 printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
9493 break;
9494 case OPCODE_BIND_TEXTURE:
9495 printf("BindTexture %s %d\n",
9496 _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
9497 break;
9498 case OPCODE_SHADE_MODEL:
9499 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui));
9500 break;
9501 case OPCODE_MAP1:
9502 printf("Map1 %s %.3f %.3f %d %d\n",
9503 _mesa_lookup_enum_by_nr(n[1].ui),
9504 n[2].f, n[3].f, n[4].i, n[5].i);
9505 break;
9506 case OPCODE_MAP2:
9507 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9508 _mesa_lookup_enum_by_nr(n[1].ui),
9509 n[2].f, n[3].f, n[4].f, n[5].f,
9510 n[6].i, n[7].i, n[8].i, n[9].i);
9511 break;
9512 case OPCODE_MAPGRID1:
9513 printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
9514 break;
9515 case OPCODE_MAPGRID2:
9516 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9517 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
9518 break;
9519 case OPCODE_EVALMESH1:
9520 printf("EvalMesh1 %d %d\n", n[1].i, n[2].i);
9521 break;
9522 case OPCODE_EVALMESH2:
9523 printf("EvalMesh2 %d %d %d %d\n",
9524 n[1].i, n[2].i, n[3].i, n[4].i);
9525 break;
9526
9527 case OPCODE_ATTR_1F_NV:
9528 printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
9529 break;
9530 case OPCODE_ATTR_2F_NV:
9531 printf("ATTR_2F_NV attr %d: %f %f\n",
9532 n[1].i, n[2].f, n[3].f);
9533 break;
9534 case OPCODE_ATTR_3F_NV:
9535 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9536 n[1].i, n[2].f, n[3].f, n[4].f);
9537 break;
9538 case OPCODE_ATTR_4F_NV:
9539 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9540 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
9541 break;
9542 case OPCODE_ATTR_1F_ARB:
9543 printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
9544 break;
9545 case OPCODE_ATTR_2F_ARB:
9546 printf("ATTR_2F_ARB attr %d: %f %f\n",
9547 n[1].i, n[2].f, n[3].f);
9548 break;
9549 case OPCODE_ATTR_3F_ARB:
9550 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9551 n[1].i, n[2].f, n[3].f, n[4].f);
9552 break;
9553 case OPCODE_ATTR_4F_ARB:
9554 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9555 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
9556 break;
9557
9558 case OPCODE_MATERIAL:
9559 printf("MATERIAL %x %x: %f %f %f %f\n",
9560 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
9561 break;
9562 case OPCODE_BEGIN:
9563 printf("BEGIN %x\n", n[1].i);
9564 break;
9565 case OPCODE_END:
9566 printf("END\n");
9567 break;
9568 case OPCODE_RECTF:
9569 printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
9570 n[4].f);
9571 break;
9572 case OPCODE_EVAL_C1:
9573 printf("EVAL_C1 %f\n", n[1].f);
9574 break;
9575 case OPCODE_EVAL_C2:
9576 printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
9577 break;
9578 case OPCODE_EVAL_P1:
9579 printf("EVAL_P1 %d\n", n[1].i);
9580 break;
9581 case OPCODE_EVAL_P2:
9582 printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
9583 break;
9584
9585 case OPCODE_PROVOKING_VERTEX:
9586 printf("ProvokingVertex %s\n",
9587 _mesa_lookup_enum_by_nr(n[1].ui));
9588 break;
9589
9590 /*
9591 * meta opcodes/commands
9592 */
9593 case OPCODE_ERROR:
9594 printf("Error: %s %s\n",
9595 enum_string(n[1].e), (const char *) n[2].data);
9596 break;
9597 case OPCODE_CONTINUE:
9598 printf("DISPLAY-LIST-CONTINUE\n");
9599 n = (Node *) n[1].next;
9600 break;
9601 case OPCODE_END_OF_LIST:
9602 printf("END-LIST %u\n", list);
9603 done = GL_TRUE;
9604 break;
9605 default:
9606 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
9607 printf
9608 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9609 opcode, (void *) n);
9610 return;
9611 }
9612 else {
9613 printf("command %d, %u operands\n", opcode,
9614 InstSize[opcode]);
9615 }
9616 }
9617 /* increment n to point to next compiled command */
9618 if (opcode != OPCODE_CONTINUE) {
9619 n += InstSize[opcode];
9620 }
9621 }
9622 }
9623 }
9624
9625
9626
9627 /**
9628 * Clients may call this function to help debug display list problems.
9629 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9630 * changed, or break in the future without notice.
9631 */
9632 void
9633 mesa_print_display_list(GLuint list)
9634 {
9635 GET_CURRENT_CONTEXT(ctx);
9636 print_list(ctx, list);
9637 }
9638
9639
9640 /**********************************************************************/
9641 /***** Initialization *****/
9642 /**********************************************************************/
9643
9644 void
9645 _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
9646 {
9647 _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
9648
9649 vfmt->Begin = save_Begin;
9650
9651 _MESA_INIT_DLIST_VTXFMT(vfmt, save_);
9652
9653 vfmt->Color3f = save_Color3f;
9654 vfmt->Color3fv = save_Color3fv;
9655 vfmt->Color4f = save_Color4f;
9656 vfmt->Color4fv = save_Color4fv;
9657 vfmt->EdgeFlag = save_EdgeFlag;
9658 vfmt->End = save_End;
9659
9660 _MESA_INIT_EVAL_VTXFMT(vfmt, save_);
9661
9662 vfmt->FogCoordfEXT = save_FogCoordfEXT;
9663 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
9664 vfmt->Indexf = save_Indexf;
9665 vfmt->Indexfv = save_Indexfv;
9666 vfmt->Materialfv = save_Materialfv;
9667 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
9668 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
9669 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
9670 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
9671 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
9672 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
9673 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
9674 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
9675 vfmt->Normal3f = save_Normal3f;
9676 vfmt->Normal3fv = save_Normal3fv;
9677 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
9678 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
9679 vfmt->TexCoord1f = save_TexCoord1f;
9680 vfmt->TexCoord1fv = save_TexCoord1fv;
9681 vfmt->TexCoord2f = save_TexCoord2f;
9682 vfmt->TexCoord2fv = save_TexCoord2fv;
9683 vfmt->TexCoord3f = save_TexCoord3f;
9684 vfmt->TexCoord3fv = save_TexCoord3fv;
9685 vfmt->TexCoord4f = save_TexCoord4f;
9686 vfmt->TexCoord4fv = save_TexCoord4fv;
9687 vfmt->Vertex2f = save_Vertex2f;
9688 vfmt->Vertex2fv = save_Vertex2fv;
9689 vfmt->Vertex3f = save_Vertex3f;
9690 vfmt->Vertex3fv = save_Vertex3fv;
9691 vfmt->Vertex4f = save_Vertex4f;
9692 vfmt->Vertex4fv = save_Vertex4fv;
9693 vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
9694 vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
9695 vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
9696 vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
9697 vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
9698 vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
9699 vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
9700 vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
9701 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
9702 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
9703 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
9704 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
9705 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
9706 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
9707 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
9708 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
9709
9710 vfmt->Rectf = save_Rectf;
9711
9712 /* The driver is required to implement these as
9713 * 1) They can probably do a better job.
9714 * 2) A lot of new mechanisms would have to be added to this module
9715 * to support it. That code would probably never get used,
9716 * because of (1).
9717 */
9718 #if 0
9719 vfmt->DrawArrays = 0;
9720 vfmt->DrawElements = 0;
9721 vfmt->DrawRangeElements = 0;
9722 vfmt->MultiDrawElemementsEXT = 0;
9723 vfmt->DrawElementsBaseVertex = 0;
9724 vfmt->DrawRangeElementsBaseVertex = 0;
9725 vfmt->MultiDrawElemementsBaseVertex = 0;
9726 #endif
9727 }
9728
9729
9730 void
9731 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
9732 const GLvertexformat *vfmt)
9733 {
9734 SET_CallList(disp, vfmt->CallList);
9735 SET_CallLists(disp, vfmt->CallLists);
9736 }
9737
9738
9739 void _mesa_init_dlist_dispatch(struct _glapi_table *disp)
9740 {
9741 SET_CallList(disp, _mesa_CallList);
9742 SET_CallLists(disp, _mesa_CallLists);
9743
9744 SET_DeleteLists(disp, _mesa_DeleteLists);
9745 SET_EndList(disp, _mesa_EndList);
9746 SET_GenLists(disp, _mesa_GenLists);
9747 SET_IsList(disp, _mesa_IsList);
9748 SET_ListBase(disp, _mesa_ListBase);
9749 SET_NewList(disp, _mesa_NewList);
9750 }
9751
9752
9753 #endif /* FEATURE_dlist */
9754
9755
9756 /**
9757 * Initialize display list state for given context.
9758 */
9759 void
9760 _mesa_init_display_list(GLcontext *ctx)
9761 {
9762 static GLboolean tableInitialized = GL_FALSE;
9763
9764 /* zero-out the instruction size table, just once */
9765 if (!tableInitialized) {
9766 memset(InstSize, 0, sizeof(InstSize));
9767 tableInitialized = GL_TRUE;
9768 }
9769
9770 /* extension info */
9771 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
9772
9773 /* Display list */
9774 ctx->ListState.CallDepth = 0;
9775 ctx->ExecuteFlag = GL_TRUE;
9776 ctx->CompileFlag = GL_FALSE;
9777 ctx->ListState.CurrentBlock = NULL;
9778 ctx->ListState.CurrentPos = 0;
9779
9780 /* Display List group */
9781 ctx->List.ListBase = 0;
9782
9783 #if FEATURE_dlist
9784 _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
9785 #endif
9786 }
9787
9788
9789 void
9790 _mesa_free_display_list_data(GLcontext *ctx)
9791 {
9792 free(ctx->ListExt);
9793 ctx->ListExt = NULL;
9794 }