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