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