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