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