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