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