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