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