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