6ee1834cdd9bd90760ad62fb3fc14689515d54d6
[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 #if FEATURE_EXT_framebuffer_blit
6327 static void GLAPIENTRY
6328 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6329 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6330 GLbitfield mask, GLenum filter)
6331 {
6332 GET_CURRENT_CONTEXT(ctx);
6333 Node *n;
6334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6335 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6336 if (n) {
6337 n[1].i = srcX0;
6338 n[2].i = srcY0;
6339 n[3].i = srcX1;
6340 n[4].i = srcY1;
6341 n[5].i = dstX0;
6342 n[6].i = dstY0;
6343 n[7].i = dstX1;
6344 n[8].i = dstY1;
6345 n[9].i = mask;
6346 n[10].e = filter;
6347 }
6348 if (ctx->ExecuteFlag) {
6349 CALL_BlitFramebufferEXT(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6350 dstX0, dstY0, dstX1, dstY1,
6351 mask, filter));
6352 }
6353 }
6354 #endif
6355
6356
6357 /** GL_EXT_provoking_vertex */
6358 static void GLAPIENTRY
6359 save_ProvokingVertexEXT(GLenum mode)
6360 {
6361 GET_CURRENT_CONTEXT(ctx);
6362 Node *n;
6363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6364 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6365 if (n) {
6366 n[1].e = mode;
6367 }
6368 if (ctx->ExecuteFlag) {
6369 /*CALL_ProvokingVertexEXT(ctx->Exec, (mode));*/
6370 _mesa_ProvokingVertexEXT(mode);
6371 }
6372 }
6373
6374
6375 /** GL_EXT_transform_feedback */
6376 static void GLAPIENTRY
6377 save_BeginTransformFeedback(GLenum mode)
6378 {
6379 GET_CURRENT_CONTEXT(ctx);
6380 Node *n;
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6382 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6383 if (n) {
6384 n[1].e = mode;
6385 }
6386 if (ctx->ExecuteFlag) {
6387 CALL_BeginTransformFeedbackEXT(ctx->Exec, (mode));
6388 }
6389 }
6390
6391
6392 /** GL_EXT_transform_feedback */
6393 static void GLAPIENTRY
6394 save_EndTransformFeedback(void)
6395 {
6396 GET_CURRENT_CONTEXT(ctx);
6397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6398 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6399 if (ctx->ExecuteFlag) {
6400 CALL_EndTransformFeedbackEXT(ctx->Exec, ());
6401 }
6402 }
6403
6404 static void GLAPIENTRY
6405 save_BindTransformFeedback(GLenum target, GLuint name)
6406 {
6407 GET_CURRENT_CONTEXT(ctx);
6408 Node *n;
6409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6410 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6411 if (n) {
6412 n[1].e = target;
6413 n[2].ui = name;
6414 }
6415 if (ctx->ExecuteFlag) {
6416 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6417 }
6418 }
6419
6420 static void GLAPIENTRY
6421 save_PauseTransformFeedback(void)
6422 {
6423 GET_CURRENT_CONTEXT(ctx);
6424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6425 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6426 if (ctx->ExecuteFlag) {
6427 CALL_PauseTransformFeedback(ctx->Exec, ());
6428 }
6429 }
6430
6431 static void GLAPIENTRY
6432 save_ResumeTransformFeedback(void)
6433 {
6434 GET_CURRENT_CONTEXT(ctx);
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6436 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6437 if (ctx->ExecuteFlag) {
6438 CALL_ResumeTransformFeedback(ctx->Exec, ());
6439 }
6440 }
6441
6442 static void GLAPIENTRY
6443 save_DrawTransformFeedback(GLenum mode, GLuint name)
6444 {
6445 GET_CURRENT_CONTEXT(ctx);
6446 Node *n;
6447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6448 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6449 if (n) {
6450 n[1].e = mode;
6451 n[2].ui = name;
6452 }
6453 if (ctx->ExecuteFlag) {
6454 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6455 }
6456 }
6457
6458 static void GLAPIENTRY
6459 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6460 {
6461 GET_CURRENT_CONTEXT(ctx);
6462 Node *n;
6463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6464 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6465 if (n) {
6466 n[1].e = mode;
6467 n[2].ui = name;
6468 n[3].ui = stream;
6469 }
6470 if (ctx->ExecuteFlag) {
6471 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6472 }
6473 }
6474
6475 static void GLAPIENTRY
6476 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6477 GLsizei primcount)
6478 {
6479 GET_CURRENT_CONTEXT(ctx);
6480 Node *n;
6481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6482 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6483 if (n) {
6484 n[1].e = mode;
6485 n[2].ui = name;
6486 n[3].si = primcount;
6487 }
6488 if (ctx->ExecuteFlag) {
6489 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6490 }
6491 }
6492
6493 static void GLAPIENTRY
6494 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6495 GLuint stream, GLsizei primcount)
6496 {
6497 GET_CURRENT_CONTEXT(ctx);
6498 Node *n;
6499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6500 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6501 if (n) {
6502 n[1].e = mode;
6503 n[2].ui = name;
6504 n[3].ui = stream;
6505 n[4].si = primcount;
6506 }
6507 if (ctx->ExecuteFlag) {
6508 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6509 primcount));
6510 }
6511 }
6512
6513 /* aka UseProgram() */
6514 static void GLAPIENTRY
6515 save_UseProgramObjectARB(GLhandleARB program)
6516 {
6517 GET_CURRENT_CONTEXT(ctx);
6518 Node *n;
6519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6520 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6521 if (n) {
6522 n[1].ui = program;
6523 }
6524 if (ctx->ExecuteFlag) {
6525 CALL_UseProgramObjectARB(ctx->Exec, (program));
6526 }
6527 }
6528
6529
6530 static void GLAPIENTRY
6531 save_Uniform1fARB(GLint location, GLfloat x)
6532 {
6533 GET_CURRENT_CONTEXT(ctx);
6534 Node *n;
6535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6536 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6537 if (n) {
6538 n[1].i = location;
6539 n[2].f = x;
6540 }
6541 if (ctx->ExecuteFlag) {
6542 CALL_Uniform1fARB(ctx->Exec, (location, x));
6543 }
6544 }
6545
6546
6547 static void GLAPIENTRY
6548 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6549 {
6550 GET_CURRENT_CONTEXT(ctx);
6551 Node *n;
6552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6553 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6554 if (n) {
6555 n[1].i = location;
6556 n[2].f = x;
6557 n[3].f = y;
6558 }
6559 if (ctx->ExecuteFlag) {
6560 CALL_Uniform2fARB(ctx->Exec, (location, x, y));
6561 }
6562 }
6563
6564
6565 static void GLAPIENTRY
6566 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6567 {
6568 GET_CURRENT_CONTEXT(ctx);
6569 Node *n;
6570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6571 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6572 if (n) {
6573 n[1].i = location;
6574 n[2].f = x;
6575 n[3].f = y;
6576 n[4].f = z;
6577 }
6578 if (ctx->ExecuteFlag) {
6579 CALL_Uniform3fARB(ctx->Exec, (location, x, y, z));
6580 }
6581 }
6582
6583
6584 static void GLAPIENTRY
6585 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6586 {
6587 GET_CURRENT_CONTEXT(ctx);
6588 Node *n;
6589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6590 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6591 if (n) {
6592 n[1].i = location;
6593 n[2].f = x;
6594 n[3].f = y;
6595 n[4].f = z;
6596 n[5].f = w;
6597 }
6598 if (ctx->ExecuteFlag) {
6599 CALL_Uniform4fARB(ctx->Exec, (location, x, y, z, w));
6600 }
6601 }
6602
6603
6604 /** Return copy of memory */
6605 static void *
6606 memdup(const void *src, GLsizei bytes)
6607 {
6608 void *b = bytes >= 0 ? malloc(bytes) : NULL;
6609 if (b)
6610 memcpy(b, src, bytes);
6611 return b;
6612 }
6613
6614
6615 static void GLAPIENTRY
6616 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6617 {
6618 GET_CURRENT_CONTEXT(ctx);
6619 Node *n;
6620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6621 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3);
6622 if (n) {
6623 n[1].i = location;
6624 n[2].i = count;
6625 n[3].data = memdup(v, count * 1 * sizeof(GLfloat));
6626 }
6627 if (ctx->ExecuteFlag) {
6628 CALL_Uniform1fvARB(ctx->Exec, (location, count, v));
6629 }
6630 }
6631
6632 static void GLAPIENTRY
6633 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6634 {
6635 GET_CURRENT_CONTEXT(ctx);
6636 Node *n;
6637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6638 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3);
6639 if (n) {
6640 n[1].i = location;
6641 n[2].i = count;
6642 n[3].data = memdup(v, count * 2 * sizeof(GLfloat));
6643 }
6644 if (ctx->ExecuteFlag) {
6645 CALL_Uniform2fvARB(ctx->Exec, (location, count, v));
6646 }
6647 }
6648
6649 static void GLAPIENTRY
6650 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6651 {
6652 GET_CURRENT_CONTEXT(ctx);
6653 Node *n;
6654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6655 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3);
6656 if (n) {
6657 n[1].i = location;
6658 n[2].i = count;
6659 n[3].data = memdup(v, count * 3 * sizeof(GLfloat));
6660 }
6661 if (ctx->ExecuteFlag) {
6662 CALL_Uniform3fvARB(ctx->Exec, (location, count, v));
6663 }
6664 }
6665
6666 static void GLAPIENTRY
6667 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6668 {
6669 GET_CURRENT_CONTEXT(ctx);
6670 Node *n;
6671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6672 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3);
6673 if (n) {
6674 n[1].i = location;
6675 n[2].i = count;
6676 n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
6677 }
6678 if (ctx->ExecuteFlag) {
6679 CALL_Uniform4fvARB(ctx->Exec, (location, count, v));
6680 }
6681 }
6682
6683
6684 static void GLAPIENTRY
6685 save_Uniform1iARB(GLint location, GLint x)
6686 {
6687 GET_CURRENT_CONTEXT(ctx);
6688 Node *n;
6689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6690 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6691 if (n) {
6692 n[1].i = location;
6693 n[2].i = x;
6694 }
6695 if (ctx->ExecuteFlag) {
6696 CALL_Uniform1iARB(ctx->Exec, (location, x));
6697 }
6698 }
6699
6700 static void GLAPIENTRY
6701 save_Uniform2iARB(GLint location, GLint x, GLint y)
6702 {
6703 GET_CURRENT_CONTEXT(ctx);
6704 Node *n;
6705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6706 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6707 if (n) {
6708 n[1].i = location;
6709 n[2].i = x;
6710 n[3].i = y;
6711 }
6712 if (ctx->ExecuteFlag) {
6713 CALL_Uniform2iARB(ctx->Exec, (location, x, y));
6714 }
6715 }
6716
6717 static void GLAPIENTRY
6718 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6719 {
6720 GET_CURRENT_CONTEXT(ctx);
6721 Node *n;
6722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6723 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6724 if (n) {
6725 n[1].i = location;
6726 n[2].i = x;
6727 n[3].i = y;
6728 n[4].i = z;
6729 }
6730 if (ctx->ExecuteFlag) {
6731 CALL_Uniform3iARB(ctx->Exec, (location, x, y, z));
6732 }
6733 }
6734
6735 static void GLAPIENTRY
6736 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6737 {
6738 GET_CURRENT_CONTEXT(ctx);
6739 Node *n;
6740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6741 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6742 if (n) {
6743 n[1].i = location;
6744 n[2].i = x;
6745 n[3].i = y;
6746 n[4].i = z;
6747 n[5].i = w;
6748 }
6749 if (ctx->ExecuteFlag) {
6750 CALL_Uniform4iARB(ctx->Exec, (location, x, y, z, w));
6751 }
6752 }
6753
6754
6755
6756 static void GLAPIENTRY
6757 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6758 {
6759 GET_CURRENT_CONTEXT(ctx);
6760 Node *n;
6761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6762 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3);
6763 if (n) {
6764 n[1].i = location;
6765 n[2].i = count;
6766 n[3].data = memdup(v, count * 1 * sizeof(GLint));
6767 }
6768 if (ctx->ExecuteFlag) {
6769 CALL_Uniform1ivARB(ctx->Exec, (location, count, v));
6770 }
6771 }
6772
6773 static void GLAPIENTRY
6774 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
6775 {
6776 GET_CURRENT_CONTEXT(ctx);
6777 Node *n;
6778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6779 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3);
6780 if (n) {
6781 n[1].i = location;
6782 n[2].i = count;
6783 n[3].data = memdup(v, count * 2 * sizeof(GLint));
6784 }
6785 if (ctx->ExecuteFlag) {
6786 CALL_Uniform2ivARB(ctx->Exec, (location, count, v));
6787 }
6788 }
6789
6790 static void GLAPIENTRY
6791 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6792 {
6793 GET_CURRENT_CONTEXT(ctx);
6794 Node *n;
6795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6796 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3);
6797 if (n) {
6798 n[1].i = location;
6799 n[2].i = count;
6800 n[3].data = memdup(v, count * 3 * sizeof(GLint));
6801 }
6802 if (ctx->ExecuteFlag) {
6803 CALL_Uniform3ivARB(ctx->Exec, (location, count, v));
6804 }
6805 }
6806
6807 static void GLAPIENTRY
6808 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6809 {
6810 GET_CURRENT_CONTEXT(ctx);
6811 Node *n;
6812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6813 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3);
6814 if (n) {
6815 n[1].i = location;
6816 n[2].i = count;
6817 n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
6818 }
6819 if (ctx->ExecuteFlag) {
6820 CALL_Uniform4ivARB(ctx->Exec, (location, count, v));
6821 }
6822 }
6823
6824
6825
6826 static void GLAPIENTRY
6827 save_Uniform1ui(GLint location, GLuint x)
6828 {
6829 GET_CURRENT_CONTEXT(ctx);
6830 Node *n;
6831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6832 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6833 if (n) {
6834 n[1].i = location;
6835 n[2].i = x;
6836 }
6837 if (ctx->ExecuteFlag) {
6838 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6839 }
6840 }
6841
6842 static void GLAPIENTRY
6843 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6844 {
6845 GET_CURRENT_CONTEXT(ctx);
6846 Node *n;
6847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6848 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6849 if (n) {
6850 n[1].i = location;
6851 n[2].i = x;
6852 n[3].i = y;
6853 }
6854 if (ctx->ExecuteFlag) {
6855 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6856 }
6857 }
6858
6859 static void GLAPIENTRY
6860 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6861 {
6862 GET_CURRENT_CONTEXT(ctx);
6863 Node *n;
6864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6865 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6866 if (n) {
6867 n[1].i = location;
6868 n[2].i = x;
6869 n[3].i = y;
6870 n[4].i = z;
6871 }
6872 if (ctx->ExecuteFlag) {
6873 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6874 }
6875 }
6876
6877 static void GLAPIENTRY
6878 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6879 {
6880 GET_CURRENT_CONTEXT(ctx);
6881 Node *n;
6882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6883 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
6884 if (n) {
6885 n[1].i = location;
6886 n[2].i = x;
6887 n[3].i = y;
6888 n[4].i = z;
6889 n[5].i = w;
6890 }
6891 if (ctx->ExecuteFlag) {
6892 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6893 }
6894 }
6895
6896
6897
6898 static void GLAPIENTRY
6899 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
6900 {
6901 GET_CURRENT_CONTEXT(ctx);
6902 Node *n;
6903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6904 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 3);
6905 if (n) {
6906 n[1].i = location;
6907 n[2].i = count;
6908 n[3].data = memdup(v, count * 1 * sizeof(*v));
6909 }
6910 if (ctx->ExecuteFlag) {
6911 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6912 }
6913 }
6914
6915 static void GLAPIENTRY
6916 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
6917 {
6918 GET_CURRENT_CONTEXT(ctx);
6919 Node *n;
6920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6921 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 3);
6922 if (n) {
6923 n[1].i = location;
6924 n[2].i = count;
6925 n[3].data = memdup(v, count * 2 * sizeof(*v));
6926 }
6927 if (ctx->ExecuteFlag) {
6928 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6929 }
6930 }
6931
6932 static void GLAPIENTRY
6933 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
6934 {
6935 GET_CURRENT_CONTEXT(ctx);
6936 Node *n;
6937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6938 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 3);
6939 if (n) {
6940 n[1].i = location;
6941 n[2].i = count;
6942 n[3].data = memdup(v, count * 3 * sizeof(*v));
6943 }
6944 if (ctx->ExecuteFlag) {
6945 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6946 }
6947 }
6948
6949 static void GLAPIENTRY
6950 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
6951 {
6952 GET_CURRENT_CONTEXT(ctx);
6953 Node *n;
6954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6955 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 3);
6956 if (n) {
6957 n[1].i = location;
6958 n[2].i = count;
6959 n[3].data = memdup(v, count * 4 * sizeof(*v));
6960 }
6961 if (ctx->ExecuteFlag) {
6962 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6963 }
6964 }
6965
6966
6967
6968 static void GLAPIENTRY
6969 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
6970 const GLfloat *m)
6971 {
6972 GET_CURRENT_CONTEXT(ctx);
6973 Node *n;
6974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6975 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4);
6976 if (n) {
6977 n[1].i = location;
6978 n[2].i = count;
6979 n[3].b = transpose;
6980 n[4].data = memdup(m, count * 2 * 2 * sizeof(GLfloat));
6981 }
6982 if (ctx->ExecuteFlag) {
6983 CALL_UniformMatrix2fvARB(ctx->Exec, (location, count, transpose, m));
6984 }
6985 }
6986
6987 static void GLAPIENTRY
6988 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
6989 const GLfloat *m)
6990 {
6991 GET_CURRENT_CONTEXT(ctx);
6992 Node *n;
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6994 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4);
6995 if (n) {
6996 n[1].i = location;
6997 n[2].i = count;
6998 n[3].b = transpose;
6999 n[4].data = memdup(m, count * 3 * 3 * sizeof(GLfloat));
7000 }
7001 if (ctx->ExecuteFlag) {
7002 CALL_UniformMatrix3fvARB(ctx->Exec, (location, count, transpose, m));
7003 }
7004 }
7005
7006 static void GLAPIENTRY
7007 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7008 const GLfloat *m)
7009 {
7010 GET_CURRENT_CONTEXT(ctx);
7011 Node *n;
7012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7013 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4);
7014 if (n) {
7015 n[1].i = location;
7016 n[2].i = count;
7017 n[3].b = transpose;
7018 n[4].data = memdup(m, count * 4 * 4 * sizeof(GLfloat));
7019 }
7020 if (ctx->ExecuteFlag) {
7021 CALL_UniformMatrix4fvARB(ctx->Exec, (location, count, transpose, m));
7022 }
7023 }
7024
7025
7026 static void GLAPIENTRY
7027 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7028 const GLfloat *m)
7029 {
7030 GET_CURRENT_CONTEXT(ctx);
7031 Node *n;
7032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7033 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4);
7034 if (n) {
7035 n[1].i = location;
7036 n[2].i = count;
7037 n[3].b = transpose;
7038 n[4].data = memdup(m, count * 2 * 3 * sizeof(GLfloat));
7039 }
7040 if (ctx->ExecuteFlag) {
7041 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7042 }
7043 }
7044
7045 static void GLAPIENTRY
7046 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7047 const GLfloat *m)
7048 {
7049 GET_CURRENT_CONTEXT(ctx);
7050 Node *n;
7051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7052 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4);
7053 if (n) {
7054 n[1].i = location;
7055 n[2].i = count;
7056 n[3].b = transpose;
7057 n[4].data = memdup(m, count * 3 * 2 * sizeof(GLfloat));
7058 }
7059 if (ctx->ExecuteFlag) {
7060 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7061 }
7062 }
7063
7064
7065 static void GLAPIENTRY
7066 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7067 const GLfloat *m)
7068 {
7069 GET_CURRENT_CONTEXT(ctx);
7070 Node *n;
7071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7072 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4);
7073 if (n) {
7074 n[1].i = location;
7075 n[2].i = count;
7076 n[3].b = transpose;
7077 n[4].data = memdup(m, count * 2 * 4 * sizeof(GLfloat));
7078 }
7079 if (ctx->ExecuteFlag) {
7080 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7081 }
7082 }
7083
7084 static void GLAPIENTRY
7085 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7086 const GLfloat *m)
7087 {
7088 GET_CURRENT_CONTEXT(ctx);
7089 Node *n;
7090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7091 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4);
7092 if (n) {
7093 n[1].i = location;
7094 n[2].i = count;
7095 n[3].b = transpose;
7096 n[4].data = memdup(m, count * 4 * 2 * sizeof(GLfloat));
7097 }
7098 if (ctx->ExecuteFlag) {
7099 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7100 }
7101 }
7102
7103
7104 static void GLAPIENTRY
7105 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7106 const GLfloat *m)
7107 {
7108 GET_CURRENT_CONTEXT(ctx);
7109 Node *n;
7110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7111 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4);
7112 if (n) {
7113 n[1].i = location;
7114 n[2].i = count;
7115 n[3].b = transpose;
7116 n[4].data = memdup(m, count * 3 * 4 * sizeof(GLfloat));
7117 }
7118 if (ctx->ExecuteFlag) {
7119 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7120 }
7121 }
7122
7123 static void GLAPIENTRY
7124 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7125 const GLfloat *m)
7126 {
7127 GET_CURRENT_CONTEXT(ctx);
7128 Node *n;
7129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7130 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4);
7131 if (n) {
7132 n[1].i = location;
7133 n[2].i = count;
7134 n[3].b = transpose;
7135 n[4].data = memdup(m, count * 4 * 3 * sizeof(GLfloat));
7136 }
7137 if (ctx->ExecuteFlag) {
7138 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7139 }
7140 }
7141
7142 static void GLAPIENTRY
7143 save_ClampColorARB(GLenum target, GLenum clamp)
7144 {
7145 GET_CURRENT_CONTEXT(ctx);
7146 Node *n;
7147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7148 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
7149 if (n) {
7150 n[1].e = target;
7151 n[2].e = clamp;
7152 }
7153 if (ctx->ExecuteFlag) {
7154 CALL_ClampColorARB(ctx->Exec, (target, clamp));
7155 }
7156 }
7157
7158 static void GLAPIENTRY
7159 save_UseShaderProgramEXT(GLenum type, GLuint program)
7160 {
7161 GET_CURRENT_CONTEXT(ctx);
7162 Node *n;
7163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7164 n = alloc_instruction(ctx, OPCODE_USE_SHADER_PROGRAM_EXT, 2);
7165 if (n) {
7166 n[1].ui = type;
7167 n[2].ui = program;
7168 }
7169 if (ctx->ExecuteFlag) {
7170 CALL_UseShaderProgramEXT(ctx->Exec, (type, program));
7171 }
7172 }
7173
7174 static void GLAPIENTRY
7175 save_ActiveProgramEXT(GLuint program)
7176 {
7177 GET_CURRENT_CONTEXT(ctx);
7178 Node *n;
7179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7180 n = alloc_instruction(ctx, OPCODE_ACTIVE_PROGRAM_EXT, 1);
7181 if (n) {
7182 n[1].ui = program;
7183 }
7184 if (ctx->ExecuteFlag) {
7185 CALL_ActiveProgramEXT(ctx->Exec, (program));
7186 }
7187 }
7188
7189 /** GL_EXT_texture_integer */
7190 static void GLAPIENTRY
7191 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
7192 {
7193 GET_CURRENT_CONTEXT(ctx);
7194 Node *n;
7195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7196 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
7197 if (n) {
7198 n[1].i = red;
7199 n[2].i = green;
7200 n[3].i = blue;
7201 n[4].i = alpha;
7202 }
7203 if (ctx->ExecuteFlag) {
7204 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
7205 }
7206 }
7207
7208 /** GL_EXT_texture_integer */
7209 static void GLAPIENTRY
7210 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
7211 {
7212 GET_CURRENT_CONTEXT(ctx);
7213 Node *n;
7214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7215 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
7216 if (n) {
7217 n[1].ui = red;
7218 n[2].ui = green;
7219 n[3].ui = blue;
7220 n[4].ui = alpha;
7221 }
7222 if (ctx->ExecuteFlag) {
7223 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
7224 }
7225 }
7226
7227 /** GL_EXT_texture_integer */
7228 static void GLAPIENTRY
7229 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
7230 {
7231 GET_CURRENT_CONTEXT(ctx);
7232 Node *n;
7233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7234 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
7235 if (n) {
7236 n[1].e = target;
7237 n[2].e = pname;
7238 n[3].i = params[0];
7239 n[4].i = params[1];
7240 n[5].i = params[2];
7241 n[6].i = params[3];
7242 }
7243 if (ctx->ExecuteFlag) {
7244 CALL_TexParameterIivEXT(ctx->Exec, (target, pname, params));
7245 }
7246 }
7247
7248 /** GL_EXT_texture_integer */
7249 static void GLAPIENTRY
7250 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
7251 {
7252 GET_CURRENT_CONTEXT(ctx);
7253 Node *n;
7254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7255 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
7256 if (n) {
7257 n[1].e = target;
7258 n[2].e = pname;
7259 n[3].ui = params[0];
7260 n[4].ui = params[1];
7261 n[5].ui = params[2];
7262 n[6].ui = params[3];
7263 }
7264 if (ctx->ExecuteFlag) {
7265 CALL_TexParameterIuivEXT(ctx->Exec, (target, pname, params));
7266 }
7267 }
7268
7269 /** GL_EXT_texture_integer */
7270 static void GLAPIENTRY
7271 exec_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
7272 {
7273 GET_CURRENT_CONTEXT(ctx);
7274 FLUSH_VERTICES(ctx, 0);
7275 CALL_GetTexParameterIivEXT(ctx->Exec, (target, pname, params));
7276 }
7277
7278 /** GL_EXT_texture_integer */
7279 static void GLAPIENTRY
7280 exec_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
7281 {
7282 GET_CURRENT_CONTEXT(ctx);
7283 FLUSH_VERTICES(ctx, 0);
7284 CALL_GetTexParameterIuivEXT(ctx->Exec, (target, pname, params));
7285 }
7286
7287
7288 /* GL_ARB_instanced_arrays */
7289 static void GLAPIENTRY
7290 save_VertexAttribDivisor(GLuint index, GLuint divisor)
7291 {
7292 GET_CURRENT_CONTEXT(ctx);
7293 Node *n;
7294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7295 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
7296 if (n) {
7297 n[1].ui = index;
7298 n[2].ui = divisor;
7299 }
7300 if (ctx->ExecuteFlag) {
7301 CALL_VertexAttribDivisorARB(ctx->Exec, (index, divisor));
7302 }
7303 }
7304
7305
7306 /* GL_NV_texture_barrier */
7307 static void GLAPIENTRY
7308 save_TextureBarrierNV(void)
7309 {
7310 GET_CURRENT_CONTEXT(ctx);
7311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7312 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
7313 if (ctx->ExecuteFlag) {
7314 CALL_TextureBarrierNV(ctx->Exec, ());
7315 }
7316 }
7317
7318
7319 /* GL_ARB_sampler_objects */
7320 static void GLAPIENTRY
7321 save_BindSampler(GLuint unit, GLuint sampler)
7322 {
7323 Node *n;
7324 GET_CURRENT_CONTEXT(ctx);
7325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7326 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
7327 if (n) {
7328 n[1].ui = unit;
7329 n[2].ui = sampler;
7330 }
7331 if (ctx->ExecuteFlag) {
7332 CALL_BindSampler(ctx->Exec, (unit, sampler));
7333 }
7334 }
7335
7336 static void GLAPIENTRY
7337 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
7338 {
7339 Node *n;
7340 GET_CURRENT_CONTEXT(ctx);
7341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7342 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
7343 if (n) {
7344 n[1].ui = sampler;
7345 n[2].e = pname;
7346 n[3].i = params[0];
7347 if (pname == GL_TEXTURE_BORDER_COLOR) {
7348 n[4].i = params[1];
7349 n[5].i = params[2];
7350 n[6].i = params[3];
7351 }
7352 else {
7353 n[4].i = n[5].i = n[6].i = 0;
7354 }
7355 }
7356 if (ctx->ExecuteFlag) {
7357 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
7358 }
7359 }
7360
7361 static void GLAPIENTRY
7362 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
7363 {
7364 save_SamplerParameteriv(sampler, pname, &param);
7365 }
7366
7367 static void GLAPIENTRY
7368 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
7369 {
7370 Node *n;
7371 GET_CURRENT_CONTEXT(ctx);
7372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7373 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
7374 if (n) {
7375 n[1].ui = sampler;
7376 n[2].e = pname;
7377 n[3].f = params[0];
7378 if (pname == GL_TEXTURE_BORDER_COLOR) {
7379 n[4].f = params[1];
7380 n[5].f = params[2];
7381 n[6].f = params[3];
7382 }
7383 else {
7384 n[4].f = n[5].f = n[6].f = 0.0F;
7385 }
7386 }
7387 if (ctx->ExecuteFlag) {
7388 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
7389 }
7390 }
7391
7392 static void GLAPIENTRY
7393 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
7394 {
7395 save_SamplerParameterfv(sampler, pname, &param);
7396 }
7397
7398 static void GLAPIENTRY
7399 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
7400 {
7401 Node *n;
7402 GET_CURRENT_CONTEXT(ctx);
7403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7404 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
7405 if (n) {
7406 n[1].ui = sampler;
7407 n[2].e = pname;
7408 n[3].i = params[0];
7409 if (pname == GL_TEXTURE_BORDER_COLOR) {
7410 n[4].i = params[1];
7411 n[5].i = params[2];
7412 n[6].i = params[3];
7413 }
7414 else {
7415 n[4].i = n[5].i = n[6].i = 0;
7416 }
7417 }
7418 if (ctx->ExecuteFlag) {
7419 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
7420 }
7421 }
7422
7423 static void GLAPIENTRY
7424 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
7425 {
7426 Node *n;
7427 GET_CURRENT_CONTEXT(ctx);
7428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7429 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
7430 if (n) {
7431 n[1].ui = sampler;
7432 n[2].e = pname;
7433 n[3].ui = params[0];
7434 if (pname == GL_TEXTURE_BORDER_COLOR) {
7435 n[4].ui = params[1];
7436 n[5].ui = params[2];
7437 n[6].ui = params[3];
7438 }
7439 else {
7440 n[4].ui = n[5].ui = n[6].ui = 0;
7441 }
7442 }
7443 if (ctx->ExecuteFlag) {
7444 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
7445 }
7446 }
7447
7448 /* GL_ARB_geometry_shader4 */
7449 static void GLAPIENTRY
7450 save_ProgramParameteri(GLuint program, GLenum pname, GLint value)
7451 {
7452 Node *n;
7453 GET_CURRENT_CONTEXT(ctx);
7454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7455 n = alloc_instruction(ctx, OPCODE_PROGRAM_PARAMETERI, 3);
7456 if (n) {
7457 n[1].ui = program;
7458 n[2].e = pname;
7459 n[3].i = value;
7460 }
7461 if (ctx->ExecuteFlag) {
7462 CALL_ProgramParameteriARB(ctx->Exec, (program, pname, value));
7463 }
7464 }
7465
7466 static void GLAPIENTRY
7467 save_FramebufferTexture(GLenum target, GLenum attachment,
7468 GLuint texture, GLint level)
7469 {
7470 Node *n;
7471 GET_CURRENT_CONTEXT(ctx);
7472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7473 n = alloc_instruction(ctx, OPCODE_FRAMEBUFFER_TEXTURE, 4);
7474 if (n) {
7475 n[1].e = target;
7476 n[2].e = attachment;
7477 n[3].ui = texture;
7478 n[4].i = level;
7479 }
7480 if (ctx->ExecuteFlag) {
7481 CALL_FramebufferTextureARB(ctx->Exec, (target, attachment, texture, level));
7482 }
7483 }
7484
7485 static void GLAPIENTRY
7486 save_FramebufferTextureFace(GLenum target, GLenum attachment,
7487 GLuint texture, GLint level, GLenum face)
7488 {
7489 Node *n;
7490 GET_CURRENT_CONTEXT(ctx);
7491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7492 n = alloc_instruction(ctx, OPCODE_FRAMEBUFFER_TEXTURE_FACE, 5);
7493 if (n) {
7494 n[1].e = target;
7495 n[2].e = attachment;
7496 n[3].ui = texture;
7497 n[4].i = level;
7498 n[5].e = face;
7499 }
7500 if (ctx->ExecuteFlag) {
7501 CALL_FramebufferTextureFaceARB(ctx->Exec, (target, attachment, texture,
7502 level, face));
7503 }
7504 }
7505
7506
7507
7508 static void GLAPIENTRY
7509 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
7510 {
7511 Node *n;
7512 GET_CURRENT_CONTEXT(ctx);
7513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7514 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
7515 if (n) {
7516 union uint64_pair p;
7517 p.uint64 = timeout;
7518 n[1].data = sync;
7519 n[2].e = flags;
7520 n[3].ui = p.uint32[0];
7521 n[4].ui = p.uint32[1];
7522 }
7523 if (ctx->ExecuteFlag) {
7524 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
7525 }
7526 }
7527
7528
7529 /** GL_NV_conditional_render */
7530 static void GLAPIENTRY
7531 save_BeginConditionalRender(GLuint queryId, GLenum mode)
7532 {
7533 GET_CURRENT_CONTEXT(ctx);
7534 Node *n;
7535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7536 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
7537 if (n) {
7538 n[1].i = queryId;
7539 n[2].e = mode;
7540 }
7541 if (ctx->ExecuteFlag) {
7542 CALL_BeginConditionalRenderNV(ctx->Exec, (queryId, mode));
7543 }
7544 }
7545
7546 static void GLAPIENTRY
7547 save_EndConditionalRender(void)
7548 {
7549 GET_CURRENT_CONTEXT(ctx);
7550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7551 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
7552 if (ctx->ExecuteFlag) {
7553 CALL_EndConditionalRenderNV(ctx->Exec, ());
7554 }
7555 }
7556
7557 static void GLAPIENTRY
7558 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
7559 {
7560 GET_CURRENT_CONTEXT(ctx);
7561 Node *n;
7562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7563 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
7564 if (n) {
7565 n[1].ui = prog;
7566 n[2].ui = index;
7567 n[3].ui = binding;
7568 }
7569 if (ctx->ExecuteFlag) {
7570 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
7571 }
7572 }
7573
7574
7575 /**
7576 * Save an error-generating command into display list.
7577 *
7578 * KW: Will appear in the list before the vertex buffer containing the
7579 * command that provoked the error. I don't see this as a problem.
7580 */
7581 static void
7582 save_error(struct gl_context *ctx, GLenum error, const char *s)
7583 {
7584 Node *n;
7585 n = alloc_instruction(ctx, OPCODE_ERROR, 2);
7586 if (n) {
7587 n[1].e = error;
7588 n[2].data = (void *) s;
7589 }
7590 }
7591
7592
7593 /**
7594 * Compile an error into current display list.
7595 */
7596 void
7597 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
7598 {
7599 if (ctx->CompileFlag)
7600 save_error(ctx, error, s);
7601 if (ctx->ExecuteFlag)
7602 _mesa_error(ctx, error, "%s", s);
7603 }
7604
7605
7606 /**
7607 * Test if ID names a display list.
7608 */
7609 static GLboolean
7610 islist(struct gl_context *ctx, GLuint list)
7611 {
7612 if (list > 0 && lookup_list(ctx, list)) {
7613 return GL_TRUE;
7614 }
7615 else {
7616 return GL_FALSE;
7617 }
7618 }
7619
7620
7621
7622 /**********************************************************************/
7623 /* Display list execution */
7624 /**********************************************************************/
7625
7626
7627 /*
7628 * Execute a display list. Note that the ListBase offset must have already
7629 * been added before calling this function. I.e. the list argument is
7630 * the absolute list number, not relative to ListBase.
7631 * \param list - display list number
7632 */
7633 static void
7634 execute_list(struct gl_context *ctx, GLuint list)
7635 {
7636 struct gl_display_list *dlist;
7637 Node *n;
7638 GLboolean done;
7639
7640 if (list == 0 || !islist(ctx, list))
7641 return;
7642
7643 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
7644 /* raise an error? */
7645 return;
7646 }
7647
7648 dlist = lookup_list(ctx, list);
7649 if (!dlist)
7650 return;
7651
7652 ctx->ListState.CallDepth++;
7653
7654 if (ctx->Driver.BeginCallList)
7655 ctx->Driver.BeginCallList(ctx, dlist);
7656
7657 n = dlist->Head;
7658
7659 done = GL_FALSE;
7660 while (!done) {
7661 const OpCode opcode = n[0].opcode;
7662
7663 if (is_ext_opcode(opcode)) {
7664 n += ext_opcode_execute(ctx, n);
7665 }
7666 else {
7667 switch (opcode) {
7668 case OPCODE_ERROR:
7669 _mesa_error(ctx, n[1].e, "%s", (const char *) n[2].data);
7670 break;
7671 case OPCODE_ACCUM:
7672 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
7673 break;
7674 case OPCODE_ALPHA_FUNC:
7675 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
7676 break;
7677 case OPCODE_BIND_TEXTURE:
7678 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
7679 break;
7680 case OPCODE_BITMAP:
7681 {
7682 const struct gl_pixelstore_attrib save = ctx->Unpack;
7683 ctx->Unpack = ctx->DefaultPacking;
7684 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
7685 n[3].f, n[4].f, n[5].f, n[6].f,
7686 (const GLubyte *) n[7].data));
7687 ctx->Unpack = save; /* restore */
7688 }
7689 break;
7690 case OPCODE_BLEND_COLOR:
7691 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7692 break;
7693 case OPCODE_BLEND_EQUATION:
7694 CALL_BlendEquation(ctx->Exec, (n[1].e));
7695 break;
7696 case OPCODE_BLEND_EQUATION_SEPARATE:
7697 CALL_BlendEquationSeparateEXT(ctx->Exec, (n[1].e, n[2].e));
7698 break;
7699 case OPCODE_BLEND_FUNC_SEPARATE:
7700 CALL_BlendFuncSeparateEXT(ctx->Exec,
7701 (n[1].e, n[2].e, n[3].e, n[4].e));
7702 break;
7703
7704 case OPCODE_BLEND_FUNC_I:
7705 /* GL_ARB_draw_buffers_blend */
7706 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
7707 break;
7708 case OPCODE_BLEND_FUNC_SEPARATE_I:
7709 /* GL_ARB_draw_buffers_blend */
7710 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
7711 n[4].e, n[5].e));
7712 break;
7713 case OPCODE_BLEND_EQUATION_I:
7714 /* GL_ARB_draw_buffers_blend */
7715 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
7716 break;
7717 case OPCODE_BLEND_EQUATION_SEPARATE_I:
7718 /* GL_ARB_draw_buffers_blend */
7719 CALL_BlendEquationSeparateiARB(ctx->Exec,
7720 (n[1].ui, n[2].e, n[3].e));
7721 break;
7722
7723 case OPCODE_CALL_LIST:
7724 /* Generated by glCallList(), don't add ListBase */
7725 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
7726 execute_list(ctx, n[1].ui);
7727 }
7728 break;
7729 case OPCODE_CALL_LIST_OFFSET:
7730 /* Generated by glCallLists() so we must add ListBase */
7731 if (n[2].b) {
7732 /* user specified a bad data type at compile time */
7733 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
7734 }
7735 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
7736 GLuint list = (GLuint) (ctx->List.ListBase + n[1].i);
7737 execute_list(ctx, list);
7738 }
7739 break;
7740 case OPCODE_CLEAR:
7741 CALL_Clear(ctx->Exec, (n[1].bf));
7742 break;
7743 case OPCODE_CLEAR_BUFFER_IV:
7744 {
7745 GLint value[4];
7746 value[0] = n[3].i;
7747 value[1] = n[4].i;
7748 value[2] = n[5].i;
7749 value[3] = n[6].i;
7750 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
7751 }
7752 break;
7753 case OPCODE_CLEAR_BUFFER_UIV:
7754 {
7755 GLuint value[4];
7756 value[0] = n[3].ui;
7757 value[1] = n[4].ui;
7758 value[2] = n[5].ui;
7759 value[3] = n[6].ui;
7760 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
7761 }
7762 break;
7763 case OPCODE_CLEAR_BUFFER_FV:
7764 {
7765 GLfloat value[4];
7766 value[0] = n[3].f;
7767 value[1] = n[4].f;
7768 value[2] = n[5].f;
7769 value[3] = n[6].f;
7770 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
7771 }
7772 break;
7773 case OPCODE_CLEAR_BUFFER_FI:
7774 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
7775 break;
7776 case OPCODE_CLEAR_COLOR:
7777 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7778 break;
7779 case OPCODE_CLEAR_ACCUM:
7780 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7781 break;
7782 case OPCODE_CLEAR_DEPTH:
7783 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
7784 break;
7785 case OPCODE_CLEAR_INDEX:
7786 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
7787 break;
7788 case OPCODE_CLEAR_STENCIL:
7789 CALL_ClearStencil(ctx->Exec, (n[1].i));
7790 break;
7791 case OPCODE_CLIP_PLANE:
7792 {
7793 GLdouble eq[4];
7794 eq[0] = n[2].f;
7795 eq[1] = n[3].f;
7796 eq[2] = n[4].f;
7797 eq[3] = n[5].f;
7798 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
7799 }
7800 break;
7801 case OPCODE_COLOR_MASK:
7802 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
7803 break;
7804 case OPCODE_COLOR_MASK_INDEXED:
7805 CALL_ColorMaskIndexedEXT(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
7806 n[4].b, n[5].b));
7807 break;
7808 case OPCODE_COLOR_MATERIAL:
7809 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
7810 break;
7811 case OPCODE_COLOR_TABLE:
7812 {
7813 const struct gl_pixelstore_attrib save = ctx->Unpack;
7814 ctx->Unpack = ctx->DefaultPacking;
7815 CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e,
7816 n[5].e, n[6].data));
7817 ctx->Unpack = save; /* restore */
7818 }
7819 break;
7820 case OPCODE_COLOR_TABLE_PARAMETER_FV:
7821 {
7822 GLfloat params[4];
7823 params[0] = n[3].f;
7824 params[1] = n[4].f;
7825 params[2] = n[5].f;
7826 params[3] = n[6].f;
7827 CALL_ColorTableParameterfv(ctx->Exec,
7828 (n[1].e, n[2].e, params));
7829 }
7830 break;
7831 case OPCODE_COLOR_TABLE_PARAMETER_IV:
7832 {
7833 GLint params[4];
7834 params[0] = n[3].i;
7835 params[1] = n[4].i;
7836 params[2] = n[5].i;
7837 params[3] = n[6].i;
7838 CALL_ColorTableParameteriv(ctx->Exec,
7839 (n[1].e, n[2].e, params));
7840 }
7841 break;
7842 case OPCODE_COLOR_SUB_TABLE:
7843 {
7844 const struct gl_pixelstore_attrib save = ctx->Unpack;
7845 ctx->Unpack = ctx->DefaultPacking;
7846 CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7847 n[4].e, n[5].e, n[6].data));
7848 ctx->Unpack = save; /* restore */
7849 }
7850 break;
7851 case OPCODE_CONVOLUTION_FILTER_1D:
7852 {
7853 const struct gl_pixelstore_attrib save = ctx->Unpack;
7854 ctx->Unpack = ctx->DefaultPacking;
7855 CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7856 n[4].e, n[5].e,
7857 n[6].data));
7858 ctx->Unpack = save; /* restore */
7859 }
7860 break;
7861 case OPCODE_CONVOLUTION_FILTER_2D:
7862 {
7863 const struct gl_pixelstore_attrib save = ctx->Unpack;
7864 ctx->Unpack = ctx->DefaultPacking;
7865 CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7866 n[4].i, n[5].e, n[6].e,
7867 n[7].data));
7868 ctx->Unpack = save; /* restore */
7869 }
7870 break;
7871 case OPCODE_CONVOLUTION_PARAMETER_I:
7872 CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i));
7873 break;
7874 case OPCODE_CONVOLUTION_PARAMETER_IV:
7875 {
7876 GLint params[4];
7877 params[0] = n[3].i;
7878 params[1] = n[4].i;
7879 params[2] = n[5].i;
7880 params[3] = n[6].i;
7881 CALL_ConvolutionParameteriv(ctx->Exec,
7882 (n[1].e, n[2].e, params));
7883 }
7884 break;
7885 case OPCODE_CONVOLUTION_PARAMETER_F:
7886 CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f));
7887 break;
7888 case OPCODE_CONVOLUTION_PARAMETER_FV:
7889 {
7890 GLfloat params[4];
7891 params[0] = n[3].f;
7892 params[1] = n[4].f;
7893 params[2] = n[5].f;
7894 params[3] = n[6].f;
7895 CALL_ConvolutionParameterfv(ctx->Exec,
7896 (n[1].e, n[2].e, params));
7897 }
7898 break;
7899 case OPCODE_COPY_COLOR_SUB_TABLE:
7900 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
7901 n[3].i, n[4].i, n[5].i));
7902 break;
7903 case OPCODE_COPY_COLOR_TABLE:
7904 CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
7905 n[3].i, n[4].i, n[5].i));
7906 break;
7907 case OPCODE_COPY_PIXELS:
7908 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
7909 (GLsizei) n[3].i, (GLsizei) n[4].i,
7910 n[5].e));
7911 break;
7912 case OPCODE_COPY_TEX_IMAGE1D:
7913 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
7914 n[5].i, n[6].i, n[7].i));
7915 break;
7916 case OPCODE_COPY_TEX_IMAGE2D:
7917 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
7918 n[5].i, n[6].i, n[7].i, n[8].i));
7919 break;
7920 case OPCODE_COPY_TEX_SUB_IMAGE1D:
7921 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7922 n[4].i, n[5].i, n[6].i));
7923 break;
7924 case OPCODE_COPY_TEX_SUB_IMAGE2D:
7925 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7926 n[4].i, n[5].i, n[6].i, n[7].i,
7927 n[8].i));
7928 break;
7929 case OPCODE_COPY_TEX_SUB_IMAGE3D:
7930 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7931 n[4].i, n[5].i, n[6].i, n[7].i,
7932 n[8].i, n[9].i));
7933 break;
7934 case OPCODE_CULL_FACE:
7935 CALL_CullFace(ctx->Exec, (n[1].e));
7936 break;
7937 case OPCODE_DEPTH_FUNC:
7938 CALL_DepthFunc(ctx->Exec, (n[1].e));
7939 break;
7940 case OPCODE_DEPTH_MASK:
7941 CALL_DepthMask(ctx->Exec, (n[1].b));
7942 break;
7943 case OPCODE_DEPTH_RANGE:
7944 CALL_DepthRange(ctx->Exec,
7945 ((GLclampd) n[1].f, (GLclampd) n[2].f));
7946 break;
7947 case OPCODE_DISABLE:
7948 CALL_Disable(ctx->Exec, (n[1].e));
7949 break;
7950 case OPCODE_DISABLE_INDEXED:
7951 CALL_DisableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
7952 break;
7953 case OPCODE_DRAW_BUFFER:
7954 CALL_DrawBuffer(ctx->Exec, (n[1].e));
7955 break;
7956 case OPCODE_DRAW_PIXELS:
7957 {
7958 const struct gl_pixelstore_attrib save = ctx->Unpack;
7959 ctx->Unpack = ctx->DefaultPacking;
7960 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
7961 n[5].data));
7962 ctx->Unpack = save; /* restore */
7963 }
7964 break;
7965 case OPCODE_ENABLE:
7966 CALL_Enable(ctx->Exec, (n[1].e));
7967 break;
7968 case OPCODE_ENABLE_INDEXED:
7969 CALL_EnableIndexedEXT(ctx->Exec, (n[1].ui, n[2].e));
7970 break;
7971 case OPCODE_EVALMESH1:
7972 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
7973 break;
7974 case OPCODE_EVALMESH2:
7975 CALL_EvalMesh2(ctx->Exec,
7976 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
7977 break;
7978 case OPCODE_FOG:
7979 {
7980 GLfloat p[4];
7981 p[0] = n[2].f;
7982 p[1] = n[3].f;
7983 p[2] = n[4].f;
7984 p[3] = n[5].f;
7985 CALL_Fogfv(ctx->Exec, (n[1].e, p));
7986 }
7987 break;
7988 case OPCODE_FRONT_FACE:
7989 CALL_FrontFace(ctx->Exec, (n[1].e));
7990 break;
7991 case OPCODE_FRUSTUM:
7992 CALL_Frustum(ctx->Exec,
7993 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
7994 break;
7995 case OPCODE_HINT:
7996 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
7997 break;
7998 case OPCODE_HISTOGRAM:
7999 CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b));
8000 break;
8001 case OPCODE_INDEX_MASK:
8002 CALL_IndexMask(ctx->Exec, (n[1].ui));
8003 break;
8004 case OPCODE_INIT_NAMES:
8005 CALL_InitNames(ctx->Exec, ());
8006 break;
8007 case OPCODE_LIGHT:
8008 {
8009 GLfloat p[4];
8010 p[0] = n[3].f;
8011 p[1] = n[4].f;
8012 p[2] = n[5].f;
8013 p[3] = n[6].f;
8014 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
8015 }
8016 break;
8017 case OPCODE_LIGHT_MODEL:
8018 {
8019 GLfloat p[4];
8020 p[0] = n[2].f;
8021 p[1] = n[3].f;
8022 p[2] = n[4].f;
8023 p[3] = n[5].f;
8024 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
8025 }
8026 break;
8027 case OPCODE_LINE_STIPPLE:
8028 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
8029 break;
8030 case OPCODE_LINE_WIDTH:
8031 CALL_LineWidth(ctx->Exec, (n[1].f));
8032 break;
8033 case OPCODE_LIST_BASE:
8034 CALL_ListBase(ctx->Exec, (n[1].ui));
8035 break;
8036 case OPCODE_LOAD_IDENTITY:
8037 CALL_LoadIdentity(ctx->Exec, ());
8038 break;
8039 case OPCODE_LOAD_MATRIX:
8040 if (sizeof(Node) == sizeof(GLfloat)) {
8041 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
8042 }
8043 else {
8044 GLfloat m[16];
8045 GLuint i;
8046 for (i = 0; i < 16; i++) {
8047 m[i] = n[1 + i].f;
8048 }
8049 CALL_LoadMatrixf(ctx->Exec, (m));
8050 }
8051 break;
8052 case OPCODE_LOAD_NAME:
8053 CALL_LoadName(ctx->Exec, (n[1].ui));
8054 break;
8055 case OPCODE_LOGIC_OP:
8056 CALL_LogicOp(ctx->Exec, (n[1].e));
8057 break;
8058 case OPCODE_MAP1:
8059 {
8060 GLenum target = n[1].e;
8061 GLint ustride = _mesa_evaluator_components(target);
8062 GLint uorder = n[5].i;
8063 GLfloat u1 = n[2].f;
8064 GLfloat u2 = n[3].f;
8065 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
8066 (GLfloat *) n[6].data));
8067 }
8068 break;
8069 case OPCODE_MAP2:
8070 {
8071 GLenum target = n[1].e;
8072 GLfloat u1 = n[2].f;
8073 GLfloat u2 = n[3].f;
8074 GLfloat v1 = n[4].f;
8075 GLfloat v2 = n[5].f;
8076 GLint ustride = n[6].i;
8077 GLint vstride = n[7].i;
8078 GLint uorder = n[8].i;
8079 GLint vorder = n[9].i;
8080 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
8081 v1, v2, vstride, vorder,
8082 (GLfloat *) n[10].data));
8083 }
8084 break;
8085 case OPCODE_MAPGRID1:
8086 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
8087 break;
8088 case OPCODE_MAPGRID2:
8089 CALL_MapGrid2f(ctx->Exec,
8090 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
8091 break;
8092 case OPCODE_MATRIX_MODE:
8093 CALL_MatrixMode(ctx->Exec, (n[1].e));
8094 break;
8095 case OPCODE_MIN_MAX:
8096 CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
8097 break;
8098 case OPCODE_MULT_MATRIX:
8099 if (sizeof(Node) == sizeof(GLfloat)) {
8100 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
8101 }
8102 else {
8103 GLfloat m[16];
8104 GLuint i;
8105 for (i = 0; i < 16; i++) {
8106 m[i] = n[1 + i].f;
8107 }
8108 CALL_MultMatrixf(ctx->Exec, (m));
8109 }
8110 break;
8111 case OPCODE_ORTHO:
8112 CALL_Ortho(ctx->Exec,
8113 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
8114 break;
8115 case OPCODE_PASSTHROUGH:
8116 CALL_PassThrough(ctx->Exec, (n[1].f));
8117 break;
8118 case OPCODE_PIXEL_MAP:
8119 CALL_PixelMapfv(ctx->Exec,
8120 (n[1].e, n[2].i, (GLfloat *) n[3].data));
8121 break;
8122 case OPCODE_PIXEL_TRANSFER:
8123 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
8124 break;
8125 case OPCODE_PIXEL_ZOOM:
8126 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
8127 break;
8128 case OPCODE_POINT_SIZE:
8129 CALL_PointSize(ctx->Exec, (n[1].f));
8130 break;
8131 case OPCODE_POINT_PARAMETERS:
8132 {
8133 GLfloat params[3];
8134 params[0] = n[2].f;
8135 params[1] = n[3].f;
8136 params[2] = n[4].f;
8137 CALL_PointParameterfvEXT(ctx->Exec, (n[1].e, params));
8138 }
8139 break;
8140 case OPCODE_POLYGON_MODE:
8141 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
8142 break;
8143 case OPCODE_POLYGON_STIPPLE:
8144 {
8145 const struct gl_pixelstore_attrib save = ctx->Unpack;
8146 ctx->Unpack = ctx->DefaultPacking;
8147 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
8148 ctx->Unpack = save; /* restore */
8149 }
8150 break;
8151 case OPCODE_POLYGON_OFFSET:
8152 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
8153 break;
8154 case OPCODE_POP_ATTRIB:
8155 CALL_PopAttrib(ctx->Exec, ());
8156 break;
8157 case OPCODE_POP_MATRIX:
8158 CALL_PopMatrix(ctx->Exec, ());
8159 break;
8160 case OPCODE_POP_NAME:
8161 CALL_PopName(ctx->Exec, ());
8162 break;
8163 case OPCODE_PRIORITIZE_TEXTURE:
8164 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
8165 break;
8166 case OPCODE_PUSH_ATTRIB:
8167 CALL_PushAttrib(ctx->Exec, (n[1].bf));
8168 break;
8169 case OPCODE_PUSH_MATRIX:
8170 CALL_PushMatrix(ctx->Exec, ());
8171 break;
8172 case OPCODE_PUSH_NAME:
8173 CALL_PushName(ctx->Exec, (n[1].ui));
8174 break;
8175 case OPCODE_RASTER_POS:
8176 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8177 break;
8178 case OPCODE_READ_BUFFER:
8179 CALL_ReadBuffer(ctx->Exec, (n[1].e));
8180 break;
8181 case OPCODE_RESET_HISTOGRAM:
8182 CALL_ResetHistogram(ctx->Exec, (n[1].e));
8183 break;
8184 case OPCODE_RESET_MIN_MAX:
8185 CALL_ResetMinmax(ctx->Exec, (n[1].e));
8186 break;
8187 case OPCODE_ROTATE:
8188 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8189 break;
8190 case OPCODE_SCALE:
8191 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8192 break;
8193 case OPCODE_SCISSOR:
8194 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8195 break;
8196 case OPCODE_SHADE_MODEL:
8197 CALL_ShadeModel(ctx->Exec, (n[1].e));
8198 break;
8199 case OPCODE_PROVOKING_VERTEX:
8200 CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e));
8201 break;
8202 case OPCODE_STENCIL_FUNC:
8203 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
8204 break;
8205 case OPCODE_STENCIL_MASK:
8206 CALL_StencilMask(ctx->Exec, (n[1].ui));
8207 break;
8208 case OPCODE_STENCIL_OP:
8209 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
8210 break;
8211 case OPCODE_STENCIL_FUNC_SEPARATE:
8212 CALL_StencilFuncSeparate(ctx->Exec,
8213 (n[1].e, n[2].e, n[3].i, n[4].ui));
8214 break;
8215 case OPCODE_STENCIL_MASK_SEPARATE:
8216 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
8217 break;
8218 case OPCODE_STENCIL_OP_SEPARATE:
8219 CALL_StencilOpSeparate(ctx->Exec,
8220 (n[1].e, n[2].e, n[3].e, n[4].e));
8221 break;
8222 case OPCODE_TEXENV:
8223 {
8224 GLfloat params[4];
8225 params[0] = n[3].f;
8226 params[1] = n[4].f;
8227 params[2] = n[5].f;
8228 params[3] = n[6].f;
8229 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
8230 }
8231 break;
8232 case OPCODE_TEXGEN:
8233 {
8234 GLfloat params[4];
8235 params[0] = n[3].f;
8236 params[1] = n[4].f;
8237 params[2] = n[5].f;
8238 params[3] = n[6].f;
8239 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
8240 }
8241 break;
8242 case OPCODE_TEXPARAMETER:
8243 {
8244 GLfloat params[4];
8245 params[0] = n[3].f;
8246 params[1] = n[4].f;
8247 params[2] = n[5].f;
8248 params[3] = n[6].f;
8249 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
8250 }
8251 break;
8252 case OPCODE_TEX_IMAGE1D:
8253 {
8254 const struct gl_pixelstore_attrib save = ctx->Unpack;
8255 ctx->Unpack = ctx->DefaultPacking;
8256 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
8257 n[2].i, /* level */
8258 n[3].i, /* components */
8259 n[4].i, /* width */
8260 n[5].e, /* border */
8261 n[6].e, /* format */
8262 n[7].e, /* type */
8263 n[8].data));
8264 ctx->Unpack = save; /* restore */
8265 }
8266 break;
8267 case OPCODE_TEX_IMAGE2D:
8268 {
8269 const struct gl_pixelstore_attrib save = ctx->Unpack;
8270 ctx->Unpack = ctx->DefaultPacking;
8271 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
8272 n[2].i, /* level */
8273 n[3].i, /* components */
8274 n[4].i, /* width */
8275 n[5].i, /* height */
8276 n[6].e, /* border */
8277 n[7].e, /* format */
8278 n[8].e, /* type */
8279 n[9].data));
8280 ctx->Unpack = save; /* restore */
8281 }
8282 break;
8283 case OPCODE_TEX_IMAGE3D:
8284 {
8285 const struct gl_pixelstore_attrib save = ctx->Unpack;
8286 ctx->Unpack = ctx->DefaultPacking;
8287 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
8288 n[2].i, /* level */
8289 n[3].i, /* components */
8290 n[4].i, /* width */
8291 n[5].i, /* height */
8292 n[6].i, /* depth */
8293 n[7].e, /* border */
8294 n[8].e, /* format */
8295 n[9].e, /* type */
8296 n[10].data));
8297 ctx->Unpack = save; /* restore */
8298 }
8299 break;
8300 case OPCODE_TEX_SUB_IMAGE1D:
8301 {
8302 const struct gl_pixelstore_attrib save = ctx->Unpack;
8303 ctx->Unpack = ctx->DefaultPacking;
8304 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8305 n[4].i, n[5].e,
8306 n[6].e, n[7].data));
8307 ctx->Unpack = save; /* restore */
8308 }
8309 break;
8310 case OPCODE_TEX_SUB_IMAGE2D:
8311 {
8312 const struct gl_pixelstore_attrib save = ctx->Unpack;
8313 ctx->Unpack = ctx->DefaultPacking;
8314 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8315 n[4].i, n[5].e,
8316 n[6].i, n[7].e, n[8].e,
8317 n[9].data));
8318 ctx->Unpack = save; /* restore */
8319 }
8320 break;
8321 case OPCODE_TEX_SUB_IMAGE3D:
8322 {
8323 const struct gl_pixelstore_attrib save = ctx->Unpack;
8324 ctx->Unpack = ctx->DefaultPacking;
8325 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8326 n[4].i, n[5].i, n[6].i, n[7].i,
8327 n[8].i, n[9].e, n[10].e,
8328 n[11].data));
8329 ctx->Unpack = save; /* restore */
8330 }
8331 break;
8332 case OPCODE_TRANSLATE:
8333 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8334 break;
8335 case OPCODE_VIEWPORT:
8336 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
8337 (GLsizei) n[3].i, (GLsizei) n[4].i));
8338 break;
8339 case OPCODE_WINDOW_POS:
8340 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8341 break;
8342 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
8343 CALL_ActiveTextureARB(ctx->Exec, (n[1].e));
8344 break;
8345 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
8346 CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8347 n[4].i, n[5].i, n[6].i,
8348 n[7].data));
8349 break;
8350 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
8351 CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8352 n[4].i, n[5].i, n[6].i,
8353 n[7].i, n[8].data));
8354 break;
8355 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
8356 CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8357 n[4].i, n[5].i, n[6].i,
8358 n[7].i, n[8].i,
8359 n[9].data));
8360 break;
8361 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
8362 CALL_CompressedTexSubImage1DARB(ctx->Exec,
8363 (n[1].e, n[2].i, n[3].i, n[4].i,
8364 n[5].e, n[6].i, n[7].data));
8365 break;
8366 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
8367 CALL_CompressedTexSubImage2DARB(ctx->Exec,
8368 (n[1].e, n[2].i, n[3].i, n[4].i,
8369 n[5].i, n[6].i, n[7].e, n[8].i,
8370 n[9].data));
8371 break;
8372 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
8373 CALL_CompressedTexSubImage3DARB(ctx->Exec,
8374 (n[1].e, n[2].i, n[3].i, n[4].i,
8375 n[5].i, n[6].i, n[7].i, n[8].i,
8376 n[9].e, n[10].i, n[11].data));
8377 break;
8378 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
8379 CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
8380 break;
8381 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
8382 CALL_WindowPos3fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8383 break;
8384 case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
8385 CALL_BindProgramNV(ctx->Exec, (n[1].e, n[2].ui));
8386 break;
8387 case OPCODE_EXECUTE_PROGRAM_NV:
8388 {
8389 GLfloat v[4];
8390 v[0] = n[3].f;
8391 v[1] = n[4].f;
8392 v[2] = n[5].f;
8393 v[3] = n[6].f;
8394 CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
8395 }
8396 break;
8397 case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
8398 CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
8399 (GLuint *) n[2].data));
8400 break;
8401 case OPCODE_LOAD_PROGRAM_NV:
8402 CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
8403 (const GLubyte *) n[4].data));
8404 break;
8405 case OPCODE_TRACK_MATRIX_NV:
8406 CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
8407 break;
8408 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
8409 CALL_ProgramLocalParameter4fARB(ctx->Exec,
8410 (n[1].e, n[2].ui, n[3].f, n[4].f,
8411 n[5].f, n[6].f));
8412 break;
8413 case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
8414 CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
8415 (const GLubyte *) n[3].
8416 data, n[4].f, n[5].f,
8417 n[6].f, n[7].f));
8418 break;
8419 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
8420 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
8421 break;
8422 case OPCODE_DEPTH_BOUNDS_EXT:
8423 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
8424 break;
8425 case OPCODE_PROGRAM_STRING_ARB:
8426 CALL_ProgramStringARB(ctx->Exec,
8427 (n[1].e, n[2].e, n[3].i, n[4].data));
8428 break;
8429 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
8430 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
8431 n[4].f, n[5].f,
8432 n[6].f));
8433 break;
8434 case OPCODE_BEGIN_QUERY_ARB:
8435 CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
8436 break;
8437 case OPCODE_END_QUERY_ARB:
8438 CALL_EndQueryARB(ctx->Exec, (n[1].e));
8439 break;
8440 case OPCODE_QUERY_COUNTER:
8441 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
8442 break;
8443 case OPCODE_BEGIN_QUERY_INDEXED:
8444 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
8445 break;
8446 case OPCODE_END_QUERY_INDEXED:
8447 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
8448 break;
8449 case OPCODE_DRAW_BUFFERS_ARB:
8450 {
8451 GLenum buffers[MAX_DRAW_BUFFERS];
8452 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
8453 for (i = 0; i < count; i++)
8454 buffers[i] = n[2 + i].e;
8455 CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
8456 }
8457 break;
8458 #if FEATURE_EXT_framebuffer_blit
8459 case OPCODE_BLIT_FRAMEBUFFER:
8460 CALL_BlitFramebufferEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
8461 n[5].i, n[6].i, n[7].i, n[8].i,
8462 n[9].i, n[10].e));
8463 break;
8464 #endif
8465
8466 case OPCODE_USE_PROGRAM:
8467 CALL_UseProgramObjectARB(ctx->Exec, (n[1].ui));
8468 break;
8469 case OPCODE_USE_SHADER_PROGRAM_EXT:
8470 CALL_UseShaderProgramEXT(ctx->Exec, (n[1].ui, n[2].ui));
8471 break;
8472 case OPCODE_ACTIVE_PROGRAM_EXT:
8473 CALL_ActiveProgramEXT(ctx->Exec, (n[1].ui));
8474 break;
8475 case OPCODE_UNIFORM_1F:
8476 CALL_Uniform1fARB(ctx->Exec, (n[1].i, n[2].f));
8477 break;
8478 case OPCODE_UNIFORM_2F:
8479 CALL_Uniform2fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f));
8480 break;
8481 case OPCODE_UNIFORM_3F:
8482 CALL_Uniform3fARB(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
8483 break;
8484 case OPCODE_UNIFORM_4F:
8485 CALL_Uniform4fARB(ctx->Exec,
8486 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
8487 break;
8488 case OPCODE_UNIFORM_1FV:
8489 CALL_Uniform1fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8490 break;
8491 case OPCODE_UNIFORM_2FV:
8492 CALL_Uniform2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8493 break;
8494 case OPCODE_UNIFORM_3FV:
8495 CALL_Uniform3fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8496 break;
8497 case OPCODE_UNIFORM_4FV:
8498 CALL_Uniform4fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8499 break;
8500 case OPCODE_UNIFORM_1I:
8501 CALL_Uniform1iARB(ctx->Exec, (n[1].i, n[2].i));
8502 break;
8503 case OPCODE_UNIFORM_2I:
8504 CALL_Uniform2iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));
8505 break;
8506 case OPCODE_UNIFORM_3I:
8507 CALL_Uniform3iARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8508 break;
8509 case OPCODE_UNIFORM_4I:
8510 CALL_Uniform4iARB(ctx->Exec,
8511 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8512 break;
8513 case OPCODE_UNIFORM_1IV:
8514 CALL_Uniform1ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8515 break;
8516 case OPCODE_UNIFORM_2IV:
8517 CALL_Uniform2ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8518 break;
8519 case OPCODE_UNIFORM_3IV:
8520 CALL_Uniform3ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8521 break;
8522 case OPCODE_UNIFORM_4IV:
8523 CALL_Uniform4ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));
8524 break;
8525 case OPCODE_UNIFORM_1UI:
8526 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8527 break;
8528 case OPCODE_UNIFORM_2UI:
8529 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8530 break;
8531 case OPCODE_UNIFORM_3UI:
8532 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8533 break;
8534 case OPCODE_UNIFORM_4UI:
8535 /*CALL_Uniform4uiARB(ctx->Exec,
8536 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8537 */
8538 break;
8539 case OPCODE_UNIFORM_1UIV:
8540 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8541 break;
8542 case OPCODE_UNIFORM_2UIV:
8543 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8544 break;
8545 case OPCODE_UNIFORM_3UIV:
8546 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8547 break;
8548 case OPCODE_UNIFORM_4UIV:
8549 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8550 break;
8551 case OPCODE_UNIFORM_MATRIX22:
8552 CALL_UniformMatrix2fvARB(ctx->Exec,
8553 (n[1].i, n[2].i, n[3].b, n[4].data));
8554 break;
8555 case OPCODE_UNIFORM_MATRIX33:
8556 CALL_UniformMatrix3fvARB(ctx->Exec,
8557 (n[1].i, n[2].i, n[3].b, n[4].data));
8558 break;
8559 case OPCODE_UNIFORM_MATRIX44:
8560 CALL_UniformMatrix4fvARB(ctx->Exec,
8561 (n[1].i, n[2].i, n[3].b, n[4].data));
8562 break;
8563 case OPCODE_UNIFORM_MATRIX23:
8564 CALL_UniformMatrix2x3fv(ctx->Exec,
8565 (n[1].i, n[2].i, n[3].b, n[4].data));
8566 break;
8567 case OPCODE_UNIFORM_MATRIX32:
8568 CALL_UniformMatrix3x2fv(ctx->Exec,
8569 (n[1].i, n[2].i, n[3].b, n[4].data));
8570 break;
8571 case OPCODE_UNIFORM_MATRIX24:
8572 CALL_UniformMatrix2x4fv(ctx->Exec,
8573 (n[1].i, n[2].i, n[3].b, n[4].data));
8574 break;
8575 case OPCODE_UNIFORM_MATRIX42:
8576 CALL_UniformMatrix4x2fv(ctx->Exec,
8577 (n[1].i, n[2].i, n[3].b, n[4].data));
8578 break;
8579 case OPCODE_UNIFORM_MATRIX34:
8580 CALL_UniformMatrix3x4fv(ctx->Exec,
8581 (n[1].i, n[2].i, n[3].b, n[4].data));
8582 break;
8583 case OPCODE_UNIFORM_MATRIX43:
8584 CALL_UniformMatrix4x3fv(ctx->Exec,
8585 (n[1].i, n[2].i, n[3].b, n[4].data));
8586 break;
8587
8588 case OPCODE_CLAMP_COLOR:
8589 CALL_ClampColorARB(ctx->Exec, (n[1].e, n[2].e));
8590 break;
8591
8592 case OPCODE_TEX_BUMP_PARAMETER_ATI:
8593 {
8594 GLfloat values[4];
8595 GLuint i, pname = n[1].ui;
8596
8597 for (i = 0; i < 4; i++)
8598 values[i] = n[1 + i].f;
8599 CALL_TexBumpParameterfvATI(ctx->Exec, (pname, values));
8600 }
8601 break;
8602 #if FEATURE_ATI_fragment_shader
8603 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
8604 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
8605 break;
8606 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
8607 {
8608 GLfloat values[4];
8609 GLuint i, dst = n[1].ui;
8610
8611 for (i = 0; i < 4; i++)
8612 values[i] = n[1 + i].f;
8613 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values));
8614 }
8615 break;
8616 #endif
8617 case OPCODE_ATTR_1F_NV:
8618 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
8619 break;
8620 case OPCODE_ATTR_2F_NV:
8621 /* Really shouldn't have to do this - the Node structure
8622 * is convenient, but it would be better to store the data
8623 * packed appropriately so that it can be sent directly
8624 * on. With x86_64 becoming common, this will start to
8625 * matter more.
8626 */
8627 if (sizeof(Node) == sizeof(GLfloat))
8628 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
8629 else
8630 CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f));
8631 break;
8632 case OPCODE_ATTR_3F_NV:
8633 if (sizeof(Node) == sizeof(GLfloat))
8634 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
8635 else
8636 CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8637 n[4].f));
8638 break;
8639 case OPCODE_ATTR_4F_NV:
8640 if (sizeof(Node) == sizeof(GLfloat))
8641 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
8642 else
8643 CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8644 n[4].f, n[5].f));
8645 break;
8646 case OPCODE_ATTR_1F_ARB:
8647 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
8648 break;
8649 case OPCODE_ATTR_2F_ARB:
8650 /* Really shouldn't have to do this - the Node structure
8651 * is convenient, but it would be better to store the data
8652 * packed appropriately so that it can be sent directly
8653 * on. With x86_64 becoming common, this will start to
8654 * matter more.
8655 */
8656 if (sizeof(Node) == sizeof(GLfloat))
8657 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
8658 else
8659 CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f));
8660 break;
8661 case OPCODE_ATTR_3F_ARB:
8662 if (sizeof(Node) == sizeof(GLfloat))
8663 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
8664 else
8665 CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8666 n[4].f));
8667 break;
8668 case OPCODE_ATTR_4F_ARB:
8669 if (sizeof(Node) == sizeof(GLfloat))
8670 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
8671 else
8672 CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
8673 n[4].f, n[5].f));
8674 break;
8675 case OPCODE_MATERIAL:
8676 if (sizeof(Node) == sizeof(GLfloat))
8677 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
8678 else {
8679 GLfloat f[4];
8680 f[0] = n[3].f;
8681 f[1] = n[4].f;
8682 f[2] = n[5].f;
8683 f[3] = n[6].f;
8684 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
8685 }
8686 break;
8687 case OPCODE_BEGIN:
8688 CALL_Begin(ctx->Exec, (n[1].e));
8689 break;
8690 case OPCODE_END:
8691 CALL_End(ctx->Exec, ());
8692 break;
8693 case OPCODE_RECTF:
8694 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8695 break;
8696 case OPCODE_EVAL_C1:
8697 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
8698 break;
8699 case OPCODE_EVAL_C2:
8700 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
8701 break;
8702 case OPCODE_EVAL_P1:
8703 CALL_EvalPoint1(ctx->Exec, (n[1].i));
8704 break;
8705 case OPCODE_EVAL_P2:
8706 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
8707 break;
8708
8709 /* GL_EXT_texture_integer */
8710 case OPCODE_CLEARCOLOR_I:
8711 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8712 break;
8713 case OPCODE_CLEARCOLOR_UI:
8714 CALL_ClearColorIuiEXT(ctx->Exec,
8715 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
8716 break;
8717 case OPCODE_TEXPARAMETER_I:
8718 {
8719 GLint params[4];
8720 params[0] = n[3].i;
8721 params[1] = n[4].i;
8722 params[2] = n[5].i;
8723 params[3] = n[6].i;
8724 CALL_TexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, params));
8725 }
8726 break;
8727 case OPCODE_TEXPARAMETER_UI:
8728 {
8729 GLuint params[4];
8730 params[0] = n[3].ui;
8731 params[1] = n[4].ui;
8732 params[2] = n[5].ui;
8733 params[3] = n[6].ui;
8734 CALL_TexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, params));
8735 }
8736 break;
8737
8738 case OPCODE_VERTEX_ATTRIB_DIVISOR:
8739 /* GL_ARB_instanced_arrays */
8740 CALL_VertexAttribDivisorARB(ctx->Exec, (n[1].ui, n[2].ui));
8741 break;
8742
8743 case OPCODE_TEXTURE_BARRIER_NV:
8744 CALL_TextureBarrierNV(ctx->Exec, ());
8745 break;
8746
8747 /* GL_EXT/ARB_transform_feedback */
8748 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
8749 CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e));
8750 break;
8751 case OPCODE_END_TRANSFORM_FEEDBACK:
8752 CALL_EndTransformFeedbackEXT(ctx->Exec, ());
8753 break;
8754 case OPCODE_BIND_TRANSFORM_FEEDBACK:
8755 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
8756 break;
8757 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
8758 CALL_PauseTransformFeedback(ctx->Exec, ());
8759 break;
8760 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
8761 CALL_ResumeTransformFeedback(ctx->Exec, ());
8762 break;
8763 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
8764 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
8765 break;
8766 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
8767 CALL_DrawTransformFeedbackStream(ctx->Exec,
8768 (n[1].e, n[2].ui, n[3].ui));
8769 break;
8770 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
8771 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
8772 (n[1].e, n[2].ui, n[3].si));
8773 break;
8774 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
8775 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
8776 (n[1].e, n[2].ui, n[3].ui, n[4].si));
8777 break;
8778
8779
8780 case OPCODE_BIND_SAMPLER:
8781 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
8782 break;
8783 case OPCODE_SAMPLER_PARAMETERIV:
8784 {
8785 GLint params[4];
8786 params[0] = n[3].i;
8787 params[1] = n[4].i;
8788 params[2] = n[5].i;
8789 params[3] = n[6].i;
8790 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
8791 }
8792 break;
8793 case OPCODE_SAMPLER_PARAMETERFV:
8794 {
8795 GLfloat params[4];
8796 params[0] = n[3].f;
8797 params[1] = n[4].f;
8798 params[2] = n[5].f;
8799 params[3] = n[6].f;
8800 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
8801 }
8802 break;
8803 case OPCODE_SAMPLER_PARAMETERIIV:
8804 {
8805 GLint params[4];
8806 params[0] = n[3].i;
8807 params[1] = n[4].i;
8808 params[2] = n[5].i;
8809 params[3] = n[6].i;
8810 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
8811 }
8812 break;
8813 case OPCODE_SAMPLER_PARAMETERUIV:
8814 {
8815 GLuint params[4];
8816 params[0] = n[3].ui;
8817 params[1] = n[4].ui;
8818 params[2] = n[5].ui;
8819 params[3] = n[6].ui;
8820 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
8821 }
8822 break;
8823
8824 /* GL_ARB_geometry_shader4 */
8825 case OPCODE_PROGRAM_PARAMETERI:
8826 CALL_ProgramParameteriARB(ctx->Exec, (n[1].ui, n[2].e, n[3].i));
8827 break;
8828 case OPCODE_FRAMEBUFFER_TEXTURE:
8829 CALL_FramebufferTextureARB(ctx->Exec, (n[1].e, n[2].e,
8830 n[3].ui, n[4].i));
8831 break;
8832 case OPCODE_FRAMEBUFFER_TEXTURE_FACE:
8833 CALL_FramebufferTextureFaceARB(ctx->Exec, (n[1].e, n[2].e,
8834 n[3].ui, n[4].i, n[5].e));
8835 break;
8836
8837 /* GL_ARB_sync */
8838 case OPCODE_WAIT_SYNC:
8839 {
8840 union uint64_pair p;
8841 p.uint32[0] = n[3].ui;
8842 p.uint32[1] = n[4].ui;
8843 CALL_WaitSync(ctx->Exec, (n[1].data, n[2].bf, p.uint64));
8844 }
8845 break;
8846
8847 /* GL_NV_conditional_render */
8848 case OPCODE_BEGIN_CONDITIONAL_RENDER:
8849 CALL_BeginConditionalRenderNV(ctx->Exec, (n[1].i, n[2].e));
8850 break;
8851 case OPCODE_END_CONDITIONAL_RENDER:
8852 CALL_EndConditionalRenderNV(ctx->Exec, ());
8853 break;
8854
8855 case OPCODE_UNIFORM_BLOCK_BINDING:
8856 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
8857 break;
8858
8859 case OPCODE_CONTINUE:
8860 n = (Node *) n[1].next;
8861 break;
8862 case OPCODE_END_OF_LIST:
8863 done = GL_TRUE;
8864 break;
8865 default:
8866 {
8867 char msg[1000];
8868 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
8869 (int) opcode);
8870 _mesa_problem(ctx, "%s", msg);
8871 }
8872 done = GL_TRUE;
8873 }
8874
8875 /* increment n to point to next compiled command */
8876 if (opcode != OPCODE_CONTINUE) {
8877 n += InstSize[opcode];
8878 }
8879 }
8880 }
8881
8882 if (ctx->Driver.EndCallList)
8883 ctx->Driver.EndCallList(ctx);
8884
8885 ctx->ListState.CallDepth--;
8886 }
8887
8888
8889
8890 /**********************************************************************/
8891 /* GL functions */
8892 /**********************************************************************/
8893
8894 /**
8895 * Test if a display list number is valid.
8896 */
8897 static GLboolean GLAPIENTRY
8898 _mesa_IsList(GLuint list)
8899 {
8900 GET_CURRENT_CONTEXT(ctx);
8901 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8902 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
8903 return islist(ctx, list);
8904 }
8905
8906
8907 /**
8908 * Delete a sequence of consecutive display lists.
8909 */
8910 static void GLAPIENTRY
8911 _mesa_DeleteLists(GLuint list, GLsizei range)
8912 {
8913 GET_CURRENT_CONTEXT(ctx);
8914 GLuint i;
8915 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8916 ASSERT_OUTSIDE_BEGIN_END(ctx);
8917
8918 if (range < 0) {
8919 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
8920 return;
8921 }
8922 for (i = list; i < list + range; i++) {
8923 destroy_list(ctx, i);
8924 }
8925 }
8926
8927
8928 /**
8929 * Return a display list number, n, such that lists n through n+range-1
8930 * are free.
8931 */
8932 static GLuint GLAPIENTRY
8933 _mesa_GenLists(GLsizei range)
8934 {
8935 GET_CURRENT_CONTEXT(ctx);
8936 GLuint base;
8937 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8938 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
8939
8940 if (range < 0) {
8941 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
8942 return 0;
8943 }
8944 if (range == 0) {
8945 return 0;
8946 }
8947
8948 /*
8949 * Make this an atomic operation
8950 */
8951 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
8952
8953 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
8954 if (base) {
8955 /* reserve the list IDs by with empty/dummy lists */
8956 GLint i;
8957 for (i = 0; i < range; i++) {
8958 _mesa_HashInsert(ctx->Shared->DisplayList, base + i,
8959 make_list(base + i, 1));
8960 }
8961 }
8962
8963 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
8964
8965 return base;
8966 }
8967
8968
8969 /**
8970 * Begin a new display list.
8971 */
8972 static void GLAPIENTRY
8973 _mesa_NewList(GLuint name, GLenum mode)
8974 {
8975 GET_CURRENT_CONTEXT(ctx);
8976
8977 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
8978 ASSERT_OUTSIDE_BEGIN_END(ctx);
8979
8980 if (MESA_VERBOSE & VERBOSE_API)
8981 _mesa_debug(ctx, "glNewList %u %s\n", name,
8982 _mesa_lookup_enum_by_nr(mode));
8983
8984 if (name == 0) {
8985 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
8986 return;
8987 }
8988
8989 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
8990 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
8991 return;
8992 }
8993
8994 if (ctx->ListState.CurrentList) {
8995 /* already compiling a display list */
8996 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
8997 return;
8998 }
8999
9000 ctx->CompileFlag = GL_TRUE;
9001 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
9002
9003 /* Reset acumulated list state:
9004 */
9005 invalidate_saved_current_state( ctx );
9006
9007 /* Allocate new display list */
9008 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
9009 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
9010 ctx->ListState.CurrentPos = 0;
9011
9012 ctx->Driver.NewList(ctx, name, mode);
9013
9014 ctx->CurrentDispatch = ctx->Save;
9015 _glapi_set_dispatch(ctx->CurrentDispatch);
9016 }
9017
9018
9019 /**
9020 * End definition of current display list.
9021 */
9022 static void GLAPIENTRY
9023 _mesa_EndList(void)
9024 {
9025 GET_CURRENT_CONTEXT(ctx);
9026 SAVE_FLUSH_VERTICES(ctx);
9027 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
9028
9029 if (MESA_VERBOSE & VERBOSE_API)
9030 _mesa_debug(ctx, "glEndList\n");
9031
9032 /* Check that a list is under construction */
9033 if (!ctx->ListState.CurrentList) {
9034 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
9035 return;
9036 }
9037
9038 /* Call before emitting END_OF_LIST, in case the driver wants to
9039 * emit opcodes itself.
9040 */
9041 ctx->Driver.EndList(ctx);
9042
9043 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
9044
9045 /* Destroy old list, if any */
9046 destroy_list(ctx, ctx->ListState.CurrentList->Name);
9047
9048 /* Install the new list */
9049 _mesa_HashInsert(ctx->Shared->DisplayList,
9050 ctx->ListState.CurrentList->Name,
9051 ctx->ListState.CurrentList);
9052
9053
9054 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
9055 mesa_print_display_list(ctx->ListState.CurrentList->Name);
9056
9057 ctx->ListState.CurrentList = NULL;
9058 ctx->ExecuteFlag = GL_TRUE;
9059 ctx->CompileFlag = GL_FALSE;
9060
9061 ctx->CurrentDispatch = ctx->Exec;
9062 _glapi_set_dispatch(ctx->CurrentDispatch);
9063 }
9064
9065
9066 void GLAPIENTRY
9067 _mesa_CallList(GLuint list)
9068 {
9069 GLboolean save_compile_flag;
9070 GET_CURRENT_CONTEXT(ctx);
9071 FLUSH_CURRENT(ctx, 0);
9072
9073 if (MESA_VERBOSE & VERBOSE_API)
9074 _mesa_debug(ctx, "glCallList %d\n", list);
9075
9076 if (list == 0) {
9077 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
9078 return;
9079 }
9080
9081 if (0)
9082 mesa_print_display_list( list );
9083
9084 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9085 * execute the display list, and restore the CompileFlag.
9086 */
9087 save_compile_flag = ctx->CompileFlag;
9088 if (save_compile_flag) {
9089 ctx->CompileFlag = GL_FALSE;
9090 }
9091
9092 execute_list(ctx, list);
9093 ctx->CompileFlag = save_compile_flag;
9094
9095 /* also restore API function pointers to point to "save" versions */
9096 if (save_compile_flag) {
9097 ctx->CurrentDispatch = ctx->Save;
9098 _glapi_set_dispatch(ctx->CurrentDispatch);
9099 }
9100 }
9101
9102
9103 /**
9104 * Execute glCallLists: call multiple display lists.
9105 */
9106 void GLAPIENTRY
9107 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
9108 {
9109 GET_CURRENT_CONTEXT(ctx);
9110 GLint i;
9111 GLboolean save_compile_flag;
9112
9113 if (MESA_VERBOSE & VERBOSE_API)
9114 _mesa_debug(ctx, "glCallLists %d\n", n);
9115
9116 switch (type) {
9117 case GL_BYTE:
9118 case GL_UNSIGNED_BYTE:
9119 case GL_SHORT:
9120 case GL_UNSIGNED_SHORT:
9121 case GL_INT:
9122 case GL_UNSIGNED_INT:
9123 case GL_FLOAT:
9124 case GL_2_BYTES:
9125 case GL_3_BYTES:
9126 case GL_4_BYTES:
9127 /* OK */
9128 break;
9129 default:
9130 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
9131 return;
9132 }
9133
9134 /* Save the CompileFlag status, turn it off, execute display list,
9135 * and restore the CompileFlag.
9136 */
9137 save_compile_flag = ctx->CompileFlag;
9138 ctx->CompileFlag = GL_FALSE;
9139
9140 for (i = 0; i < n; i++) {
9141 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
9142 execute_list(ctx, list);
9143 }
9144
9145 ctx->CompileFlag = save_compile_flag;
9146
9147 /* also restore API function pointers to point to "save" versions */
9148 if (save_compile_flag) {
9149 ctx->CurrentDispatch = ctx->Save;
9150 _glapi_set_dispatch(ctx->CurrentDispatch);
9151 }
9152 }
9153
9154
9155 /**
9156 * Set the offset added to list numbers in glCallLists.
9157 */
9158 static void GLAPIENTRY
9159 _mesa_ListBase(GLuint base)
9160 {
9161 GET_CURRENT_CONTEXT(ctx);
9162 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
9163 ASSERT_OUTSIDE_BEGIN_END(ctx);
9164 ctx->List.ListBase = base;
9165 }
9166
9167
9168 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
9169 */
9170 static void GLAPIENTRY
9171 exec_Finish(void)
9172 {
9173 GET_CURRENT_CONTEXT(ctx);
9174 FLUSH_VERTICES(ctx, 0);
9175 CALL_Finish(ctx->Exec, ());
9176 }
9177
9178 static void GLAPIENTRY
9179 exec_Flush(void)
9180 {
9181 GET_CURRENT_CONTEXT(ctx);
9182 FLUSH_VERTICES(ctx, 0);
9183 CALL_Flush(ctx->Exec, ());
9184 }
9185
9186 static void GLAPIENTRY
9187 exec_GetBooleanv(GLenum pname, GLboolean *params)
9188 {
9189 GET_CURRENT_CONTEXT(ctx);
9190 FLUSH_VERTICES(ctx, 0);
9191 CALL_GetBooleanv(ctx->Exec, (pname, params));
9192 }
9193
9194 static void GLAPIENTRY
9195 exec_GetClipPlane(GLenum plane, GLdouble * equation)
9196 {
9197 GET_CURRENT_CONTEXT(ctx);
9198 FLUSH_VERTICES(ctx, 0);
9199 CALL_GetClipPlane(ctx->Exec, (plane, equation));
9200 }
9201
9202 static void GLAPIENTRY
9203 exec_GetDoublev(GLenum pname, GLdouble *params)
9204 {
9205 GET_CURRENT_CONTEXT(ctx);
9206 FLUSH_VERTICES(ctx, 0);
9207 CALL_GetDoublev(ctx->Exec, (pname, params));
9208 }
9209
9210 static GLenum GLAPIENTRY
9211 exec_GetError(void)
9212 {
9213 GET_CURRENT_CONTEXT(ctx);
9214 FLUSH_VERTICES(ctx, 0);
9215 return CALL_GetError(ctx->Exec, ());
9216 }
9217
9218 static void GLAPIENTRY
9219 exec_GetFloatv(GLenum pname, GLfloat *params)
9220 {
9221 GET_CURRENT_CONTEXT(ctx);
9222 FLUSH_VERTICES(ctx, 0);
9223 CALL_GetFloatv(ctx->Exec, (pname, params));
9224 }
9225
9226 static void GLAPIENTRY
9227 exec_GetIntegerv(GLenum pname, GLint *params)
9228 {
9229 GET_CURRENT_CONTEXT(ctx);
9230 FLUSH_VERTICES(ctx, 0);
9231 CALL_GetIntegerv(ctx->Exec, (pname, params));
9232 }
9233
9234 static void GLAPIENTRY
9235 exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params)
9236 {
9237 GET_CURRENT_CONTEXT(ctx);
9238 FLUSH_VERTICES(ctx, 0);
9239 CALL_GetLightfv(ctx->Exec, (light, pname, params));
9240 }
9241
9242 static void GLAPIENTRY
9243 exec_GetLightiv(GLenum light, GLenum pname, GLint *params)
9244 {
9245 GET_CURRENT_CONTEXT(ctx);
9246 FLUSH_VERTICES(ctx, 0);
9247 CALL_GetLightiv(ctx->Exec, (light, pname, params));
9248 }
9249
9250 static void GLAPIENTRY
9251 exec_GetMapdv(GLenum target, GLenum query, GLdouble * v)
9252 {
9253 GET_CURRENT_CONTEXT(ctx);
9254 FLUSH_VERTICES(ctx, 0);
9255 CALL_GetMapdv(ctx->Exec, (target, query, v));
9256 }
9257
9258 static void GLAPIENTRY
9259 exec_GetMapfv(GLenum target, GLenum query, GLfloat * v)
9260 {
9261 GET_CURRENT_CONTEXT(ctx);
9262 FLUSH_VERTICES(ctx, 0);
9263 CALL_GetMapfv(ctx->Exec, (target, query, v));
9264 }
9265
9266 static void GLAPIENTRY
9267 exec_GetMapiv(GLenum target, GLenum query, GLint * v)
9268 {
9269 GET_CURRENT_CONTEXT(ctx);
9270 FLUSH_VERTICES(ctx, 0);
9271 CALL_GetMapiv(ctx->Exec, (target, query, v));
9272 }
9273
9274 static void GLAPIENTRY
9275 exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
9276 {
9277 GET_CURRENT_CONTEXT(ctx);
9278 FLUSH_VERTICES(ctx, 0);
9279 CALL_GetMaterialfv(ctx->Exec, (face, pname, params));
9280 }
9281
9282 static void GLAPIENTRY
9283 exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params)
9284 {
9285 GET_CURRENT_CONTEXT(ctx);
9286 FLUSH_VERTICES(ctx, 0);
9287 CALL_GetMaterialiv(ctx->Exec, (face, pname, params));
9288 }
9289
9290 static void GLAPIENTRY
9291 exec_GetPixelMapfv(GLenum map, GLfloat *values)
9292 {
9293 GET_CURRENT_CONTEXT(ctx);
9294 FLUSH_VERTICES(ctx, 0);
9295 CALL_GetPixelMapfv(ctx->Exec, (map, values));
9296 }
9297
9298 static void GLAPIENTRY
9299 exec_GetPixelMapuiv(GLenum map, GLuint *values)
9300 {
9301 GET_CURRENT_CONTEXT(ctx);
9302 FLUSH_VERTICES(ctx, 0);
9303 CALL_GetPixelMapuiv(ctx->Exec, (map, values));
9304 }
9305
9306 static void GLAPIENTRY
9307 exec_GetPixelMapusv(GLenum map, GLushort *values)
9308 {
9309 GET_CURRENT_CONTEXT(ctx);
9310 FLUSH_VERTICES(ctx, 0);
9311 CALL_GetPixelMapusv(ctx->Exec, (map, values));
9312 }
9313
9314 static void GLAPIENTRY
9315 exec_GetPolygonStipple(GLubyte * dest)
9316 {
9317 GET_CURRENT_CONTEXT(ctx);
9318 FLUSH_VERTICES(ctx, 0);
9319 CALL_GetPolygonStipple(ctx->Exec, (dest));
9320 }
9321
9322 static const GLubyte *GLAPIENTRY
9323 exec_GetString(GLenum name)
9324 {
9325 GET_CURRENT_CONTEXT(ctx);
9326 FLUSH_VERTICES(ctx, 0);
9327 return CALL_GetString(ctx->Exec, (name));
9328 }
9329
9330 static void GLAPIENTRY
9331 exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
9332 {
9333 GET_CURRENT_CONTEXT(ctx);
9334 FLUSH_VERTICES(ctx, 0);
9335 CALL_GetTexEnvfv(ctx->Exec, (target, pname, params));
9336 }
9337
9338 static void GLAPIENTRY
9339 exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params)
9340 {
9341 GET_CURRENT_CONTEXT(ctx);
9342 FLUSH_VERTICES(ctx, 0);
9343 CALL_GetTexEnviv(ctx->Exec, (target, pname, params));
9344 }
9345
9346 static void GLAPIENTRY
9347 exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
9348 {
9349 GET_CURRENT_CONTEXT(ctx);
9350 FLUSH_VERTICES(ctx, 0);
9351 CALL_GetTexGendv(ctx->Exec, (coord, pname, params));
9352 }
9353
9354 static void GLAPIENTRY
9355 exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
9356 {
9357 GET_CURRENT_CONTEXT(ctx);
9358 FLUSH_VERTICES(ctx, 0);
9359 CALL_GetTexGenfv(ctx->Exec, (coord, pname, params));
9360 }
9361
9362 static void GLAPIENTRY
9363 exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params)
9364 {
9365 GET_CURRENT_CONTEXT(ctx);
9366 FLUSH_VERTICES(ctx, 0);
9367 CALL_GetTexGeniv(ctx->Exec, (coord, pname, params));
9368 }
9369
9370 static void GLAPIENTRY
9371 exec_GetTexImage(GLenum target, GLint level, GLenum format,
9372 GLenum type, GLvoid * pixels)
9373 {
9374 GET_CURRENT_CONTEXT(ctx);
9375 FLUSH_VERTICES(ctx, 0);
9376 CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels));
9377 }
9378
9379 static void GLAPIENTRY
9380 exec_GetTexLevelParameterfv(GLenum target, GLint level,
9381 GLenum pname, GLfloat *params)
9382 {
9383 GET_CURRENT_CONTEXT(ctx);
9384 FLUSH_VERTICES(ctx, 0);
9385 CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params));
9386 }
9387
9388 static void GLAPIENTRY
9389 exec_GetTexLevelParameteriv(GLenum target, GLint level,
9390 GLenum pname, GLint *params)
9391 {
9392 GET_CURRENT_CONTEXT(ctx);
9393 FLUSH_VERTICES(ctx, 0);
9394 CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params));
9395 }
9396
9397 static void GLAPIENTRY
9398 exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
9399 {
9400 GET_CURRENT_CONTEXT(ctx);
9401 FLUSH_VERTICES(ctx, 0);
9402 CALL_GetTexParameterfv(ctx->Exec, (target, pname, params));
9403 }
9404
9405 static void GLAPIENTRY
9406 exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
9407 {
9408 GET_CURRENT_CONTEXT(ctx);
9409 FLUSH_VERTICES(ctx, 0);
9410 CALL_GetTexParameteriv(ctx->Exec, (target, pname, params));
9411 }
9412
9413 static GLboolean GLAPIENTRY
9414 exec_IsEnabled(GLenum cap)
9415 {
9416 GET_CURRENT_CONTEXT(ctx);
9417 FLUSH_VERTICES(ctx, 0);
9418 return CALL_IsEnabled(ctx->Exec, (cap));
9419 }
9420
9421 static void GLAPIENTRY
9422 exec_PixelStoref(GLenum pname, GLfloat param)
9423 {
9424 GET_CURRENT_CONTEXT(ctx);
9425 FLUSH_VERTICES(ctx, 0);
9426 CALL_PixelStoref(ctx->Exec, (pname, param));
9427 }
9428
9429 static void GLAPIENTRY
9430 exec_PixelStorei(GLenum pname, GLint param)
9431 {
9432 GET_CURRENT_CONTEXT(ctx);
9433 FLUSH_VERTICES(ctx, 0);
9434 CALL_PixelStorei(ctx->Exec, (pname, param));
9435 }
9436
9437 static void GLAPIENTRY
9438 exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
9439 GLenum format, GLenum type, GLvoid * pixels)
9440 {
9441 GET_CURRENT_CONTEXT(ctx);
9442 FLUSH_VERTICES(ctx, 0);
9443 CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels));
9444 }
9445
9446 static GLint GLAPIENTRY
9447 exec_RenderMode(GLenum mode)
9448 {
9449 GET_CURRENT_CONTEXT(ctx);
9450 FLUSH_VERTICES(ctx, 0);
9451 return CALL_RenderMode(ctx->Exec, (mode));
9452 }
9453
9454 static void GLAPIENTRY
9455 exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
9456 {
9457 GET_CURRENT_CONTEXT(ctx);
9458 FLUSH_VERTICES(ctx, 0);
9459 CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer));
9460 }
9461
9462 static void GLAPIENTRY
9463 exec_SelectBuffer(GLsizei size, GLuint * buffer)
9464 {
9465 GET_CURRENT_CONTEXT(ctx);
9466 FLUSH_VERTICES(ctx, 0);
9467 CALL_SelectBuffer(ctx->Exec, (size, buffer));
9468 }
9469
9470 static GLboolean GLAPIENTRY
9471 exec_AreTexturesResident(GLsizei n, const GLuint * texName,
9472 GLboolean * residences)
9473 {
9474 GET_CURRENT_CONTEXT(ctx);
9475 FLUSH_VERTICES(ctx, 0);
9476 return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences));
9477 }
9478
9479 static void GLAPIENTRY
9480 exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
9481 {
9482 GET_CURRENT_CONTEXT(ctx);
9483 FLUSH_VERTICES(ctx, 0);
9484 CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr));
9485 }
9486
9487 static void GLAPIENTRY
9488 exec_DeleteTextures(GLsizei n, const GLuint * texName)
9489 {
9490 GET_CURRENT_CONTEXT(ctx);
9491 FLUSH_VERTICES(ctx, 0);
9492 CALL_DeleteTextures(ctx->Exec, (n, texName));
9493 }
9494
9495 static void GLAPIENTRY
9496 exec_DisableClientState(GLenum cap)
9497 {
9498 GET_CURRENT_CONTEXT(ctx);
9499 FLUSH_VERTICES(ctx, 0);
9500 CALL_DisableClientState(ctx->Exec, (cap));
9501 }
9502
9503 static void GLAPIENTRY
9504 exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr)
9505 {
9506 GET_CURRENT_CONTEXT(ctx);
9507 FLUSH_VERTICES(ctx, 0);
9508 CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr));
9509 }
9510
9511 static void GLAPIENTRY
9512 exec_EnableClientState(GLenum cap)
9513 {
9514 GET_CURRENT_CONTEXT(ctx);
9515 FLUSH_VERTICES(ctx, 0);
9516 CALL_EnableClientState(ctx->Exec, (cap));
9517 }
9518
9519 static void GLAPIENTRY
9520 exec_GenTextures(GLsizei n, GLuint * texName)
9521 {
9522 GET_CURRENT_CONTEXT(ctx);
9523 FLUSH_VERTICES(ctx, 0);
9524 CALL_GenTextures(ctx->Exec, (n, texName));
9525 }
9526
9527 static void GLAPIENTRY
9528 exec_GetPointerv(GLenum pname, GLvoid **params)
9529 {
9530 GET_CURRENT_CONTEXT(ctx);
9531 FLUSH_VERTICES(ctx, 0);
9532 CALL_GetPointerv(ctx->Exec, (pname, params));
9533 }
9534
9535 static void GLAPIENTRY
9536 exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
9537 {
9538 GET_CURRENT_CONTEXT(ctx);
9539 FLUSH_VERTICES(ctx, 0);
9540 CALL_IndexPointer(ctx->Exec, (type, stride, ptr));
9541 }
9542
9543 static void GLAPIENTRY
9544 exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer)
9545 {
9546 GET_CURRENT_CONTEXT(ctx);
9547 FLUSH_VERTICES(ctx, 0);
9548 CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer));
9549 }
9550
9551 static GLboolean GLAPIENTRY
9552 exec_IsTexture(GLuint texture)
9553 {
9554 GET_CURRENT_CONTEXT(ctx);
9555 FLUSH_VERTICES(ctx, 0);
9556 return CALL_IsTexture(ctx->Exec, (texture));
9557 }
9558
9559 static void GLAPIENTRY
9560 exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
9561 {
9562 GET_CURRENT_CONTEXT(ctx);
9563 FLUSH_VERTICES(ctx, 0);
9564 CALL_NormalPointer(ctx->Exec, (type, stride, ptr));
9565 }
9566
9567 static void GLAPIENTRY
9568 exec_PopClientAttrib(void)
9569 {
9570 GET_CURRENT_CONTEXT(ctx);
9571 FLUSH_VERTICES(ctx, 0);
9572 CALL_PopClientAttrib(ctx->Exec, ());
9573 }
9574
9575 static void GLAPIENTRY
9576 exec_PushClientAttrib(GLbitfield mask)
9577 {
9578 GET_CURRENT_CONTEXT(ctx);
9579 FLUSH_VERTICES(ctx, 0);
9580 CALL_PushClientAttrib(ctx->Exec, (mask));
9581 }
9582
9583 static void GLAPIENTRY
9584 exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
9585 const GLvoid *ptr)
9586 {
9587 GET_CURRENT_CONTEXT(ctx);
9588 FLUSH_VERTICES(ctx, 0);
9589 CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
9590 }
9591
9592 static void GLAPIENTRY
9593 exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
9594 {
9595 GET_CURRENT_CONTEXT(ctx);
9596 FLUSH_VERTICES(ctx, 0);
9597 CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img));
9598 }
9599
9600 static void GLAPIENTRY
9601 exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
9602 const GLvoid *ptr)
9603 {
9604 GET_CURRENT_CONTEXT(ctx);
9605 FLUSH_VERTICES(ctx, 0);
9606 CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr));
9607 }
9608
9609 static void GLAPIENTRY
9610 exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
9611 GLint x, GLint y, GLsizei width)
9612 {
9613 GET_CURRENT_CONTEXT(ctx);
9614 FLUSH_VERTICES(ctx, 0);
9615 CALL_CopyConvolutionFilter1D(ctx->Exec,
9616 (target, internalFormat, x, y, width));
9617 }
9618
9619 static void GLAPIENTRY
9620 exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
9621 GLint x, GLint y, GLsizei width, GLsizei height)
9622 {
9623 GET_CURRENT_CONTEXT(ctx);
9624 FLUSH_VERTICES(ctx, 0);
9625 CALL_CopyConvolutionFilter2D(ctx->Exec,
9626 (target, internalFormat, x, y, width,
9627 height));
9628 }
9629
9630 static void GLAPIENTRY
9631 exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data)
9632 {
9633 GET_CURRENT_CONTEXT(ctx);
9634 FLUSH_VERTICES(ctx, 0);
9635 CALL_GetColorTable(ctx->Exec, (target, format, type, data));
9636 }
9637
9638 static void GLAPIENTRY
9639 exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params)
9640 {
9641 GET_CURRENT_CONTEXT(ctx);
9642 FLUSH_VERTICES(ctx, 0);
9643 CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params));
9644 }
9645
9646 static void GLAPIENTRY
9647 exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params)
9648 {
9649 GET_CURRENT_CONTEXT(ctx);
9650 FLUSH_VERTICES(ctx, 0);
9651 CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params));
9652 }
9653
9654 static void GLAPIENTRY
9655 exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
9656 GLvoid * image)
9657 {
9658 GET_CURRENT_CONTEXT(ctx);
9659 FLUSH_VERTICES(ctx, 0);
9660 CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image));
9661 }
9662
9663 static void GLAPIENTRY
9664 exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
9665 {
9666 GET_CURRENT_CONTEXT(ctx);
9667 FLUSH_VERTICES(ctx, 0);
9668 CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params));
9669 }
9670
9671 static void GLAPIENTRY
9672 exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
9673 {
9674 GET_CURRENT_CONTEXT(ctx);
9675 FLUSH_VERTICES(ctx, 0);
9676 CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params));
9677 }
9678
9679 static void GLAPIENTRY
9680 exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
9681 GLenum type, GLvoid *values)
9682 {
9683 GET_CURRENT_CONTEXT(ctx);
9684 FLUSH_VERTICES(ctx, 0);
9685 CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values));
9686 }
9687
9688 static void GLAPIENTRY
9689 exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
9690 {
9691 GET_CURRENT_CONTEXT(ctx);
9692 FLUSH_VERTICES(ctx, 0);
9693 CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params));
9694 }
9695
9696 static void GLAPIENTRY
9697 exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
9698 {
9699 GET_CURRENT_CONTEXT(ctx);
9700 FLUSH_VERTICES(ctx, 0);
9701 CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params));
9702 }
9703
9704 static void GLAPIENTRY
9705 exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
9706 GLenum type, GLvoid *values)
9707 {
9708 GET_CURRENT_CONTEXT(ctx);
9709 FLUSH_VERTICES(ctx, 0);
9710 CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values));
9711 }
9712
9713 static void GLAPIENTRY
9714 exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
9715 {
9716 GET_CURRENT_CONTEXT(ctx);
9717 FLUSH_VERTICES(ctx, 0);
9718 CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params));
9719 }
9720
9721 static void GLAPIENTRY
9722 exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
9723 {
9724 GET_CURRENT_CONTEXT(ctx);
9725 FLUSH_VERTICES(ctx, 0);
9726 CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params));
9727 }
9728
9729 static void GLAPIENTRY
9730 exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
9731 GLvoid *row, GLvoid *column, GLvoid *span)
9732 {
9733 GET_CURRENT_CONTEXT(ctx);
9734 FLUSH_VERTICES(ctx, 0);
9735 CALL_GetSeparableFilter(ctx->Exec,
9736 (target, format, type, row, column, span));
9737 }
9738
9739 static void GLAPIENTRY
9740 exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
9741 GLsizei width, GLsizei height, GLenum format,
9742 GLenum type, const GLvoid *row, const GLvoid *column)
9743 {
9744 GET_CURRENT_CONTEXT(ctx);
9745 FLUSH_VERTICES(ctx, 0);
9746 CALL_SeparableFilter2D(ctx->Exec,
9747 (target, internalFormat, width, height, format,
9748 type, row, column));
9749 }
9750
9751 static void GLAPIENTRY
9752 exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
9753 GLsizei count, const GLvoid *ptr)
9754 {
9755 GET_CURRENT_CONTEXT(ctx);
9756 FLUSH_VERTICES(ctx, 0);
9757 CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
9758 }
9759
9760 static void GLAPIENTRY
9761 exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
9762 {
9763 GET_CURRENT_CONTEXT(ctx);
9764 FLUSH_VERTICES(ctx, 0);
9765 CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr));
9766 }
9767
9768 static void GLAPIENTRY
9769 exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
9770 const GLvoid *ptr)
9771 {
9772 GET_CURRENT_CONTEXT(ctx);
9773 FLUSH_VERTICES(ctx, 0);
9774 CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr));
9775 }
9776
9777 static void GLAPIENTRY
9778 exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
9779 const GLvoid *ptr)
9780 {
9781 GET_CURRENT_CONTEXT(ctx);
9782 FLUSH_VERTICES(ctx, 0);
9783 CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr));
9784 }
9785
9786 static void GLAPIENTRY
9787 exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
9788 GLsizei count, const GLvoid *ptr)
9789 {
9790 GET_CURRENT_CONTEXT(ctx);
9791 FLUSH_VERTICES(ctx, 0);
9792 CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
9793 }
9794
9795 static void GLAPIENTRY
9796 exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
9797 GLsizei count, const GLvoid *ptr)
9798 {
9799 GET_CURRENT_CONTEXT(ctx);
9800 FLUSH_VERTICES(ctx, 0);
9801 CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr));
9802 }
9803
9804 static void GLAPIENTRY
9805 exec_LockArraysEXT(GLint first, GLsizei count)
9806 {
9807 GET_CURRENT_CONTEXT(ctx);
9808 FLUSH_VERTICES(ctx, 0);
9809 CALL_LockArraysEXT(ctx->Exec, (first, count));
9810 }
9811
9812 static void GLAPIENTRY
9813 exec_UnlockArraysEXT(void)
9814 {
9815 GET_CURRENT_CONTEXT(ctx);
9816 FLUSH_VERTICES(ctx, 0);
9817 CALL_UnlockArraysEXT(ctx->Exec, ());
9818 }
9819
9820 static void GLAPIENTRY
9821 exec_ClientActiveTextureARB(GLenum target)
9822 {
9823 GET_CURRENT_CONTEXT(ctx);
9824 FLUSH_VERTICES(ctx, 0);
9825 CALL_ClientActiveTextureARB(ctx->Exec, (target));
9826 }
9827
9828 static void GLAPIENTRY
9829 exec_SecondaryColorPointerEXT(GLint size, GLenum type,
9830 GLsizei stride, const GLvoid *ptr)
9831 {
9832 GET_CURRENT_CONTEXT(ctx);
9833 FLUSH_VERTICES(ctx, 0);
9834 CALL_SecondaryColorPointerEXT(ctx->Exec, (size, type, stride, ptr));
9835 }
9836
9837 static void GLAPIENTRY
9838 exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
9839 {
9840 GET_CURRENT_CONTEXT(ctx);
9841 FLUSH_VERTICES(ctx, 0);
9842 CALL_FogCoordPointerEXT(ctx->Exec, (type, stride, ptr));
9843 }
9844
9845 /* GL_EXT_multi_draw_arrays */
9846 static void GLAPIENTRY
9847 exec_MultiDrawArraysEXT(GLenum mode, const GLint *first,
9848 const GLsizei *count, GLsizei primcount)
9849 {
9850 GET_CURRENT_CONTEXT(ctx);
9851 FLUSH_VERTICES(ctx, 0);
9852 CALL_MultiDrawArraysEXT(ctx->Exec, (mode, first, count, primcount));
9853 }
9854
9855 /* GL_IBM_multimode_draw_arrays */
9856 static void GLAPIENTRY
9857 exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first,
9858 const GLsizei * count, GLsizei primcount,
9859 GLint modestride)
9860 {
9861 GET_CURRENT_CONTEXT(ctx);
9862 FLUSH_VERTICES(ctx, 0);
9863 CALL_MultiModeDrawArraysIBM(ctx->Exec,
9864 (mode, first, count, primcount, modestride));
9865 }
9866
9867 /* GL_IBM_multimode_draw_arrays */
9868 static void GLAPIENTRY
9869 exec_MultiModeDrawElementsIBM(const GLenum * mode,
9870 const GLsizei * count,
9871 GLenum type,
9872 const GLvoid * const *indices,
9873 GLsizei primcount, GLint modestride)
9874 {
9875 GET_CURRENT_CONTEXT(ctx);
9876 FLUSH_VERTICES(ctx, 0);
9877 CALL_MultiModeDrawElementsIBM(ctx->Exec,
9878 (mode, count, type, indices, primcount,
9879 modestride));
9880 }
9881
9882 /**
9883 * Setup the given dispatch table to point to Mesa's display list
9884 * building functions.
9885 *
9886 * This does not include any of the tnl functions - they are
9887 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9888 * struct.
9889 */
9890 struct _glapi_table *
9891 _mesa_create_save_table(void)
9892 {
9893 struct _glapi_table *table;
9894
9895 table = _mesa_alloc_dispatch_table(_gloffset_COUNT);
9896 if (table == NULL)
9897 return NULL;
9898
9899 _mesa_loopback_init_api_table(table);
9900
9901 /* GL 1.0 */
9902 SET_Accum(table, save_Accum);
9903 SET_AlphaFunc(table, save_AlphaFunc);
9904 SET_Bitmap(table, save_Bitmap);
9905 SET_BlendFunc(table, save_BlendFunc);
9906 SET_CallList(table, save_CallList);
9907 SET_CallLists(table, save_CallLists);
9908 SET_Clear(table, save_Clear);
9909 SET_ClearAccum(table, save_ClearAccum);
9910 SET_ClearColor(table, save_ClearColor);
9911 SET_ClearDepth(table, save_ClearDepth);
9912 SET_ClearIndex(table, save_ClearIndex);
9913 SET_ClearStencil(table, save_ClearStencil);
9914 SET_ClipPlane(table, save_ClipPlane);
9915 SET_ColorMask(table, save_ColorMask);
9916 SET_ColorMaskIndexedEXT(table, save_ColorMaskIndexed);
9917 SET_ColorMaterial(table, save_ColorMaterial);
9918 SET_CopyPixels(table, save_CopyPixels);
9919 SET_CullFace(table, save_CullFace);
9920 SET_DeleteLists(table, _mesa_DeleteLists);
9921 SET_DepthFunc(table, save_DepthFunc);
9922 SET_DepthMask(table, save_DepthMask);
9923 SET_DepthRange(table, save_DepthRange);
9924 SET_Disable(table, save_Disable);
9925 SET_DisableIndexedEXT(table, save_DisableIndexed);
9926 SET_DrawBuffer(table, save_DrawBuffer);
9927 SET_DrawPixels(table, save_DrawPixels);
9928 SET_Enable(table, save_Enable);
9929 SET_EnableIndexedEXT(table, save_EnableIndexed);
9930 SET_EndList(table, _mesa_EndList);
9931 SET_EvalMesh1(table, save_EvalMesh1);
9932 SET_EvalMesh2(table, save_EvalMesh2);
9933 SET_Finish(table, exec_Finish);
9934 SET_Flush(table, exec_Flush);
9935 SET_Fogf(table, save_Fogf);
9936 SET_Fogfv(table, save_Fogfv);
9937 SET_Fogi(table, save_Fogi);
9938 SET_Fogiv(table, save_Fogiv);
9939 SET_FrontFace(table, save_FrontFace);
9940 SET_Frustum(table, save_Frustum);
9941 SET_GenLists(table, _mesa_GenLists);
9942 SET_GetBooleanv(table, exec_GetBooleanv);
9943 SET_GetClipPlane(table, exec_GetClipPlane);
9944 SET_GetDoublev(table, exec_GetDoublev);
9945 SET_GetError(table, exec_GetError);
9946 SET_GetFloatv(table, exec_GetFloatv);
9947 SET_GetIntegerv(table, exec_GetIntegerv);
9948 SET_GetLightfv(table, exec_GetLightfv);
9949 SET_GetLightiv(table, exec_GetLightiv);
9950 SET_GetMapdv(table, exec_GetMapdv);
9951 SET_GetMapfv(table, exec_GetMapfv);
9952 SET_GetMapiv(table, exec_GetMapiv);
9953 SET_GetMaterialfv(table, exec_GetMaterialfv);
9954 SET_GetMaterialiv(table, exec_GetMaterialiv);
9955 SET_GetPixelMapfv(table, exec_GetPixelMapfv);
9956 SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
9957 SET_GetPixelMapusv(table, exec_GetPixelMapusv);
9958 SET_GetPolygonStipple(table, exec_GetPolygonStipple);
9959 SET_GetString(table, exec_GetString);
9960 SET_GetTexEnvfv(table, exec_GetTexEnvfv);
9961 SET_GetTexEnviv(table, exec_GetTexEnviv);
9962 SET_GetTexGendv(table, exec_GetTexGendv);
9963 SET_GetTexGenfv(table, exec_GetTexGenfv);
9964 SET_GetTexGeniv(table, exec_GetTexGeniv);
9965 SET_GetTexImage(table, exec_GetTexImage);
9966 SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
9967 SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
9968 SET_GetTexParameterfv(table, exec_GetTexParameterfv);
9969 SET_GetTexParameteriv(table, exec_GetTexParameteriv);
9970 SET_Hint(table, save_Hint);
9971 SET_IndexMask(table, save_IndexMask);
9972 SET_InitNames(table, save_InitNames);
9973 SET_IsEnabled(table, exec_IsEnabled);
9974 SET_IsList(table, _mesa_IsList);
9975 SET_LightModelf(table, save_LightModelf);
9976 SET_LightModelfv(table, save_LightModelfv);
9977 SET_LightModeli(table, save_LightModeli);
9978 SET_LightModeliv(table, save_LightModeliv);
9979 SET_Lightf(table, save_Lightf);
9980 SET_Lightfv(table, save_Lightfv);
9981 SET_Lighti(table, save_Lighti);
9982 SET_Lightiv(table, save_Lightiv);
9983 SET_LineStipple(table, save_LineStipple);
9984 SET_LineWidth(table, save_LineWidth);
9985 SET_ListBase(table, save_ListBase);
9986 SET_LoadIdentity(table, save_LoadIdentity);
9987 SET_LoadMatrixd(table, save_LoadMatrixd);
9988 SET_LoadMatrixf(table, save_LoadMatrixf);
9989 SET_LoadName(table, save_LoadName);
9990 SET_LogicOp(table, save_LogicOp);
9991 SET_Map1d(table, save_Map1d);
9992 SET_Map1f(table, save_Map1f);
9993 SET_Map2d(table, save_Map2d);
9994 SET_Map2f(table, save_Map2f);
9995 SET_MapGrid1d(table, save_MapGrid1d);
9996 SET_MapGrid1f(table, save_MapGrid1f);
9997 SET_MapGrid2d(table, save_MapGrid2d);
9998 SET_MapGrid2f(table, save_MapGrid2f);
9999 SET_MatrixMode(table, save_MatrixMode);
10000 SET_MultMatrixd(table, save_MultMatrixd);
10001 SET_MultMatrixf(table, save_MultMatrixf);
10002 SET_NewList(table, save_NewList);
10003 SET_Ortho(table, save_Ortho);
10004 SET_PassThrough(table, save_PassThrough);
10005 SET_PixelMapfv(table, save_PixelMapfv);
10006 SET_PixelMapuiv(table, save_PixelMapuiv);
10007 SET_PixelMapusv(table, save_PixelMapusv);
10008 SET_PixelStoref(table, exec_PixelStoref);
10009 SET_PixelStorei(table, exec_PixelStorei);
10010 SET_PixelTransferf(table, save_PixelTransferf);
10011 SET_PixelTransferi(table, save_PixelTransferi);
10012 SET_PixelZoom(table, save_PixelZoom);
10013 SET_PointSize(table, save_PointSize);
10014 SET_PolygonMode(table, save_PolygonMode);
10015 SET_PolygonOffset(table, save_PolygonOffset);
10016 SET_PolygonStipple(table, save_PolygonStipple);
10017 SET_PopAttrib(table, save_PopAttrib);
10018 SET_PopMatrix(table, save_PopMatrix);
10019 SET_PopName(table, save_PopName);
10020 SET_PushAttrib(table, save_PushAttrib);
10021 SET_PushMatrix(table, save_PushMatrix);
10022 SET_PushName(table, save_PushName);
10023 SET_RasterPos2d(table, save_RasterPos2d);
10024 SET_RasterPos2dv(table, save_RasterPos2dv);
10025 SET_RasterPos2f(table, save_RasterPos2f);
10026 SET_RasterPos2fv(table, save_RasterPos2fv);
10027 SET_RasterPos2i(table, save_RasterPos2i);
10028 SET_RasterPos2iv(table, save_RasterPos2iv);
10029 SET_RasterPos2s(table, save_RasterPos2s);
10030 SET_RasterPos2sv(table, save_RasterPos2sv);
10031 SET_RasterPos3d(table, save_RasterPos3d);
10032 SET_RasterPos3dv(table, save_RasterPos3dv);
10033 SET_RasterPos3f(table, save_RasterPos3f);
10034 SET_RasterPos3fv(table, save_RasterPos3fv);
10035 SET_RasterPos3i(table, save_RasterPos3i);
10036 SET_RasterPos3iv(table, save_RasterPos3iv);
10037 SET_RasterPos3s(table, save_RasterPos3s);
10038 SET_RasterPos3sv(table, save_RasterPos3sv);
10039 SET_RasterPos4d(table, save_RasterPos4d);
10040 SET_RasterPos4dv(table, save_RasterPos4dv);
10041 SET_RasterPos4f(table, save_RasterPos4f);
10042 SET_RasterPos4fv(table, save_RasterPos4fv);
10043 SET_RasterPos4i(table, save_RasterPos4i);
10044 SET_RasterPos4iv(table, save_RasterPos4iv);
10045 SET_RasterPos4s(table, save_RasterPos4s);
10046 SET_RasterPos4sv(table, save_RasterPos4sv);
10047 SET_ReadBuffer(table, save_ReadBuffer);
10048 SET_ReadPixels(table, exec_ReadPixels);
10049 SET_RenderMode(table, exec_RenderMode);
10050 SET_Rotated(table, save_Rotated);
10051 SET_Rotatef(table, save_Rotatef);
10052 SET_Scaled(table, save_Scaled);
10053 SET_Scalef(table, save_Scalef);
10054 SET_Scissor(table, save_Scissor);
10055 SET_FeedbackBuffer(table, exec_FeedbackBuffer);
10056 SET_SelectBuffer(table, exec_SelectBuffer);
10057 SET_ShadeModel(table, save_ShadeModel);
10058 SET_StencilFunc(table, save_StencilFunc);
10059 SET_StencilMask(table, save_StencilMask);
10060 SET_StencilOp(table, save_StencilOp);
10061 SET_TexEnvf(table, save_TexEnvf);
10062 SET_TexEnvfv(table, save_TexEnvfv);
10063 SET_TexEnvi(table, save_TexEnvi);
10064 SET_TexEnviv(table, save_TexEnviv);
10065 SET_TexGend(table, save_TexGend);
10066 SET_TexGendv(table, save_TexGendv);
10067 SET_TexGenf(table, save_TexGenf);
10068 SET_TexGenfv(table, save_TexGenfv);
10069 SET_TexGeni(table, save_TexGeni);
10070 SET_TexGeniv(table, save_TexGeniv);
10071 SET_TexImage1D(table, save_TexImage1D);
10072 SET_TexImage2D(table, save_TexImage2D);
10073 SET_TexParameterf(table, save_TexParameterf);
10074 SET_TexParameterfv(table, save_TexParameterfv);
10075 SET_TexParameteri(table, save_TexParameteri);
10076 SET_TexParameteriv(table, save_TexParameteriv);
10077 SET_Translated(table, save_Translated);
10078 SET_Translatef(table, save_Translatef);
10079 SET_Viewport(table, save_Viewport);
10080
10081 /* GL 1.1 */
10082 SET_AreTexturesResident(table, exec_AreTexturesResident);
10083 SET_BindTexture(table, save_BindTexture);
10084 SET_ColorPointer(table, exec_ColorPointer);
10085 SET_CopyTexImage1D(table, save_CopyTexImage1D);
10086 SET_CopyTexImage2D(table, save_CopyTexImage2D);
10087 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
10088 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
10089 SET_DeleteTextures(table, exec_DeleteTextures);
10090 SET_DisableClientState(table, exec_DisableClientState);
10091 SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
10092 SET_EnableClientState(table, exec_EnableClientState);
10093 SET_GenTextures(table, exec_GenTextures);
10094 SET_GetPointerv(table, exec_GetPointerv);
10095 SET_IndexPointer(table, exec_IndexPointer);
10096 SET_InterleavedArrays(table, exec_InterleavedArrays);
10097 SET_IsTexture(table, exec_IsTexture);
10098 SET_NormalPointer(table, exec_NormalPointer);
10099 SET_PopClientAttrib(table, exec_PopClientAttrib);
10100 SET_PrioritizeTextures(table, save_PrioritizeTextures);
10101 SET_PushClientAttrib(table, exec_PushClientAttrib);
10102 SET_TexCoordPointer(table, exec_TexCoordPointer);
10103 SET_TexSubImage1D(table, save_TexSubImage1D);
10104 SET_TexSubImage2D(table, save_TexSubImage2D);
10105 SET_VertexPointer(table, exec_VertexPointer);
10106
10107 /* GL 1.2 */
10108 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
10109 SET_TexImage3D(table, save_TexImage3D);
10110 SET_TexSubImage3D(table, save_TexSubImage3D);
10111
10112 /* GL 2.0 */
10113 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
10114 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
10115 SET_StencilOpSeparate(table, save_StencilOpSeparate);
10116
10117 /* ATI_separate_stencil */
10118 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
10119
10120 /* GL_ARB_imaging */
10121 /* Not all are supported */
10122 SET_BlendColor(table, save_BlendColor);
10123 SET_BlendEquation(table, save_BlendEquation);
10124 SET_ColorSubTable(table, save_ColorSubTable);
10125 SET_ColorTable(table, save_ColorTable);
10126 SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
10127 SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
10128 SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
10129 SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
10130 SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
10131 SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
10132 SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
10133 SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
10134 SET_CopyColorSubTable(table, save_CopyColorSubTable);
10135 SET_CopyColorTable(table, save_CopyColorTable);
10136 SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
10137 SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
10138 SET_GetColorTable(table, exec_GetColorTable);
10139 SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
10140 SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
10141 SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
10142 SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
10143 SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
10144 SET_GetHistogram(table, exec_GetHistogram);
10145 SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
10146 SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
10147 SET_GetMinmax(table, exec_GetMinmax);
10148 SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
10149 SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
10150 SET_GetSeparableFilter(table, exec_GetSeparableFilter);
10151 SET_Histogram(table, save_Histogram);
10152 SET_Minmax(table, save_Minmax);
10153 SET_ResetHistogram(table, save_ResetHistogram);
10154 SET_ResetMinmax(table, save_ResetMinmax);
10155 SET_SeparableFilter2D(table, exec_SeparableFilter2D);
10156
10157 /* 2. GL_EXT_blend_color */
10158 #if 0
10159 SET_BlendColorEXT(table, save_BlendColorEXT);
10160 #endif
10161
10162 /* 3. GL_EXT_polygon_offset */
10163 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
10164
10165 /* 6. GL_EXT_texture3d */
10166 #if 0
10167 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
10168 SET_TexImage3DEXT(table, save_TexImage3DEXT);
10169 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
10170 #endif
10171
10172 /* 14. GL_SGI_color_table */
10173 #if 0
10174 SET_ColorTableSGI(table, save_ColorTable);
10175 SET_ColorSubTableSGI(table, save_ColorSubTable);
10176 SET_GetColorTableSGI(table, exec_GetColorTable);
10177 SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv);
10178 SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv);
10179 #endif
10180
10181 /* 30. GL_EXT_vertex_array */
10182 SET_ColorPointerEXT(table, exec_ColorPointerEXT);
10183 SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
10184 SET_IndexPointerEXT(table, exec_IndexPointerEXT);
10185 SET_NormalPointerEXT(table, exec_NormalPointerEXT);
10186 SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
10187 SET_VertexPointerEXT(table, exec_VertexPointerEXT);
10188
10189 /* 37. GL_EXT_blend_minmax */
10190 #if 0
10191 SET_BlendEquationEXT(table, save_BlendEquationEXT);
10192 #endif
10193
10194 /* 54. GL_EXT_point_parameters */
10195 SET_PointParameterfEXT(table, save_PointParameterfEXT);
10196 SET_PointParameterfvEXT(table, save_PointParameterfvEXT);
10197
10198 /* 97. GL_EXT_compiled_vertex_array */
10199 SET_LockArraysEXT(table, exec_LockArraysEXT);
10200 SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
10201
10202 /* 145. GL_EXT_secondary_color */
10203 SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT);
10204
10205 /* 148. GL_EXT_multi_draw_arrays */
10206 SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT);
10207
10208 /* 149. GL_EXT_fog_coord */
10209 SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT);
10210
10211 /* 173. GL_EXT_blend_func_separate */
10212 SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT);
10213
10214 /* 196. GL_MESA_resize_buffers */
10215 SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
10216
10217 /* 197. GL_MESA_window_pos */
10218 SET_WindowPos2dMESA(table, save_WindowPos2dMESA);
10219 SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA);
10220 SET_WindowPos2fMESA(table, save_WindowPos2fMESA);
10221 SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA);
10222 SET_WindowPos2iMESA(table, save_WindowPos2iMESA);
10223 SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA);
10224 SET_WindowPos2sMESA(table, save_WindowPos2sMESA);
10225 SET_WindowPos2svMESA(table, save_WindowPos2svMESA);
10226 SET_WindowPos3dMESA(table, save_WindowPos3dMESA);
10227 SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA);
10228 SET_WindowPos3fMESA(table, save_WindowPos3fMESA);
10229 SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA);
10230 SET_WindowPos3iMESA(table, save_WindowPos3iMESA);
10231 SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA);
10232 SET_WindowPos3sMESA(table, save_WindowPos3sMESA);
10233 SET_WindowPos3svMESA(table, save_WindowPos3svMESA);
10234 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
10235 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
10236 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
10237 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
10238 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
10239 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
10240 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
10241 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
10242
10243 /* 200. GL_IBM_multimode_draw_arrays */
10244 SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
10245 SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
10246
10247 /* 233. GL_NV_vertex_program */
10248 /* The following commands DO NOT go into display lists:
10249 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
10250 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
10251 */
10252 SET_BindProgramNV(table, save_BindProgramNV);
10253 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
10254 SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
10255 SET_GenProgramsNV(table, _mesa_GenPrograms);
10256 SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
10257 SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
10258 SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
10259 SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
10260 SET_GetProgramivNV(table, _mesa_GetProgramivNV);
10261 SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
10262 SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
10263 SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
10264 SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
10265 SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
10266 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
10267 SET_IsProgramNV(table, _mesa_IsProgramARB);
10268 SET_LoadProgramNV(table, save_LoadProgramNV);
10269 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
10270 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
10271 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
10272 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
10273 SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
10274 SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
10275 SET_TrackMatrixNV(table, save_TrackMatrixNV);
10276 SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
10277
10278 /* 244. GL_ATI_envmap_bumpmap */
10279 SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
10280 SET_TexBumpParameterfvATI(table, save_TexBumpParameterfvATI);
10281
10282 /* 245. GL_ATI_fragment_shader */
10283 #if FEATURE_ATI_fragment_shader
10284 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
10285 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
10286 #endif
10287
10288 /* 282. GL_NV_fragment_program */
10289 SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
10290 SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
10291 SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
10292 SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
10293 SET_GetProgramNamedParameterfvNV(table,
10294 _mesa_GetProgramNamedParameterfvNV);
10295 SET_GetProgramNamedParameterdvNV(table,
10296 _mesa_GetProgramNamedParameterdvNV);
10297 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
10298 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
10299 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
10300 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
10301 SET_GetProgramLocalParameterdvARB(table,
10302 _mesa_GetProgramLocalParameterdvARB);
10303 SET_GetProgramLocalParameterfvARB(table,
10304 _mesa_GetProgramLocalParameterfvARB);
10305
10306 /* 262. GL_NV_point_sprite */
10307 SET_PointParameteriNV(table, save_PointParameteriNV);
10308 SET_PointParameterivNV(table, save_PointParameterivNV);
10309
10310 /* 268. GL_EXT_stencil_two_side */
10311 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
10312
10313 /* 273. GL_APPLE_vertex_array_object */
10314 SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
10315 SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE);
10316 SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
10317 SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE);
10318
10319 /* 310. GL_EXT_framebuffer_object */
10320 SET_GenFramebuffersEXT(table, _mesa_GenFramebuffersEXT);
10321 SET_BindFramebufferEXT(table, _mesa_BindFramebufferEXT);
10322 SET_DeleteFramebuffersEXT(table, _mesa_DeleteFramebuffersEXT);
10323 SET_CheckFramebufferStatusEXT(table, _mesa_CheckFramebufferStatusEXT);
10324 SET_GenRenderbuffersEXT(table, _mesa_GenRenderbuffersEXT);
10325 SET_BindRenderbufferEXT(table, _mesa_BindRenderbufferEXT);
10326 SET_DeleteRenderbuffersEXT(table, _mesa_DeleteRenderbuffersEXT);
10327 SET_RenderbufferStorageEXT(table, _mesa_RenderbufferStorageEXT);
10328 SET_FramebufferTexture1DEXT(table, _mesa_FramebufferTexture1DEXT);
10329 SET_FramebufferTexture2DEXT(table, _mesa_FramebufferTexture2DEXT);
10330 SET_FramebufferTexture3DEXT(table, _mesa_FramebufferTexture3DEXT);
10331 SET_FramebufferRenderbufferEXT(table, _mesa_FramebufferRenderbufferEXT);
10332 SET_GenerateMipmapEXT(table, _mesa_GenerateMipmapEXT);
10333
10334 /* 317. GL_EXT_framebuffer_multisample */
10335 SET_RenderbufferStorageMultisample(table, _mesa_RenderbufferStorageMultisample);
10336
10337 /* GL_ARB_vertex_array_object */
10338 SET_BindVertexArray(table, _mesa_BindVertexArray);
10339 SET_GenVertexArrays(table, _mesa_GenVertexArrays);
10340
10341 /* ???. GL_EXT_depth_bounds_test */
10342 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
10343
10344 /* ARB 1. GL_ARB_multitexture */
10345 SET_ActiveTextureARB(table, save_ActiveTextureARB);
10346 SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB);
10347
10348 /* ARB 3. GL_ARB_transpose_matrix */
10349 SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB);
10350 SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB);
10351 SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB);
10352 SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB);
10353
10354 /* ARB 5. GL_ARB_multisample */
10355 SET_SampleCoverageARB(table, save_SampleCoverageARB);
10356
10357 /* ARB 12. GL_ARB_texture_compression */
10358 SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
10359 SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
10360 SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
10361 SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
10362 SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
10363 SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
10364 SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
10365
10366 /* ARB 14. GL_ARB_point_parameters */
10367 /* aliased with EXT_point_parameters functions */
10368
10369 /* ARB 25. GL_ARB_window_pos */
10370 /* aliased with MESA_window_pos functions */
10371
10372 /* ARB 26. GL_ARB_vertex_program */
10373 /* ARB 27. GL_ARB_fragment_program */
10374 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
10375 SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB);
10376 SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB);
10377 SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB);
10378 SET_ProgramStringARB(table, save_ProgramStringARB);
10379 SET_BindProgramNV(table, save_BindProgramNV);
10380 SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
10381 SET_GenProgramsNV(table, _mesa_GenPrograms);
10382 SET_IsProgramNV(table, _mesa_IsProgramARB);
10383 SET_GetVertexAttribdvARB(table, _mesa_GetVertexAttribdvARB);
10384 SET_GetVertexAttribfvARB(table, _mesa_GetVertexAttribfvARB);
10385 SET_GetVertexAttribivARB(table, _mesa_GetVertexAttribivARB);
10386 SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
10387 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
10388 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
10389 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
10390 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
10391 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
10392 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
10393 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
10394 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
10395 SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
10396 SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
10397 SET_GetProgramLocalParameterdvARB(table,
10398 _mesa_GetProgramLocalParameterdvARB);
10399 SET_GetProgramLocalParameterfvARB(table,
10400 _mesa_GetProgramLocalParameterfvARB);
10401 SET_GetProgramivARB(table, _mesa_GetProgramivARB);
10402 SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
10403
10404 /* ARB 28. GL_ARB_vertex_buffer_object */
10405 /* None of the extension's functions get compiled */
10406 SET_BindBufferARB(table, _mesa_BindBufferARB);
10407 SET_BufferDataARB(table, _mesa_BufferDataARB);
10408 SET_BufferSubDataARB(table, _mesa_BufferSubDataARB);
10409 SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB);
10410 SET_GenBuffersARB(table, _mesa_GenBuffersARB);
10411 SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB);
10412 SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB);
10413 SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB);
10414 SET_IsBufferARB(table, _mesa_IsBufferARB);
10415 SET_MapBufferARB(table, _mesa_MapBufferARB);
10416 SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
10417
10418 _mesa_init_queryobj_dispatch(table); /* glGetQuery, etc */
10419 SET_BeginQueryARB(table, save_BeginQueryARB);
10420 SET_EndQueryARB(table, save_EndQueryARB);
10421 SET_QueryCounter(table, save_QueryCounter);
10422
10423 SET_DrawBuffersARB(table, save_DrawBuffersARB);
10424
10425 #if FEATURE_EXT_framebuffer_blit
10426 SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT);
10427 #endif
10428
10429 /* GL_ARB_shader_objects */
10430 _mesa_init_shader_dispatch(table); /* Plug in glCreate/Delete/Get, etc */
10431 SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
10432 SET_Uniform1fARB(table, save_Uniform1fARB);
10433 SET_Uniform2fARB(table, save_Uniform2fARB);
10434 SET_Uniform3fARB(table, save_Uniform3fARB);
10435 SET_Uniform4fARB(table, save_Uniform4fARB);
10436 SET_Uniform1fvARB(table, save_Uniform1fvARB);
10437 SET_Uniform2fvARB(table, save_Uniform2fvARB);
10438 SET_Uniform3fvARB(table, save_Uniform3fvARB);
10439 SET_Uniform4fvARB(table, save_Uniform4fvARB);
10440 SET_Uniform1iARB(table, save_Uniform1iARB);
10441 SET_Uniform2iARB(table, save_Uniform2iARB);
10442 SET_Uniform3iARB(table, save_Uniform3iARB);
10443 SET_Uniform4iARB(table, save_Uniform4iARB);
10444 SET_Uniform1ivARB(table, save_Uniform1ivARB);
10445 SET_Uniform2ivARB(table, save_Uniform2ivARB);
10446 SET_Uniform3ivARB(table, save_Uniform3ivARB);
10447 SET_Uniform4ivARB(table, save_Uniform4ivARB);
10448 SET_UniformMatrix2fvARB(table, save_UniformMatrix2fvARB);
10449 SET_UniformMatrix3fvARB(table, save_UniformMatrix3fvARB);
10450 SET_UniformMatrix4fvARB(table, save_UniformMatrix4fvARB);
10451 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
10452 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
10453 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
10454 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
10455 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
10456 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
10457
10458 /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */
10459 SET_BindAttribLocationARB(table, exec_BindAttribLocationARB);
10460 SET_GetAttribLocationARB(table, exec_GetAttribLocationARB);
10461 SET_GetUniformLocationARB(table, exec_GetUniformLocationARB);
10462 /* XXX additional functions need to be implemented here! */
10463
10464 /* 299. GL_EXT_blend_equation_separate */
10465 SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
10466
10467 /* GL_EXT_gpu_program_parameters */
10468 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
10469 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
10470
10471 /* ARB 50. GL_ARB_map_buffer_range */
10472 #if FEATURE_ARB_map_buffer_range
10473 SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */
10474 SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */
10475 #endif
10476
10477 /* ARB 51. GL_ARB_texture_buffer_object */
10478 SET_TexBufferARB(table, _mesa_TexBuffer); /* no dlist save */
10479
10480 /* ARB 59. GL_ARB_copy_buffer */
10481 SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
10482
10483 /* 364. GL_EXT_provoking_vertex */
10484 SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT);
10485
10486 /* 371. GL_APPLE_object_purgeable */
10487 #if FEATURE_APPLE_object_purgeable
10488 SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
10489 SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
10490 SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE);
10491 #endif
10492
10493 /* GL_EXT_texture_integer */
10494 SET_ClearColorIiEXT(table, save_ClearColorIi);
10495 SET_ClearColorIuiEXT(table, save_ClearColorIui);
10496 SET_TexParameterIivEXT(table, save_TexParameterIiv);
10497 SET_TexParameterIuivEXT(table, save_TexParameterIuiv);
10498 SET_GetTexParameterIivEXT(table, exec_GetTexParameterIiv);
10499 SET_GetTexParameterIuivEXT(table, exec_GetTexParameterIuiv);
10500
10501 /* 377. GL_EXT_separate_shader_objects */
10502 SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT);
10503 SET_ActiveProgramEXT(table, save_ActiveProgramEXT);
10504
10505 /* GL_ARB_color_buffer_float */
10506 SET_ClampColorARB(table, save_ClampColorARB);
10507 SET_ClampColor(table, save_ClampColorARB);
10508
10509 /* GL 3.0 */
10510 SET_ClearBufferiv(table, save_ClearBufferiv);
10511 SET_ClearBufferuiv(table, save_ClearBufferuiv);
10512 SET_ClearBufferfv(table, save_ClearBufferfv);
10513 SET_ClearBufferfi(table, save_ClearBufferfi);
10514 #if 0
10515 SET_Uniform1ui(table, save_Uniform1ui);
10516 SET_Uniform2ui(table, save_Uniform2ui);
10517 SET_Uniform3ui(table, save_Uniform3ui);
10518 SET_Uniform4ui(table, save_Uniform4ui);
10519 SET_Uniform1uiv(table, save_Uniform1uiv);
10520 SET_Uniform2uiv(table, save_Uniform2uiv);
10521 SET_Uniform3uiv(table, save_Uniform3uiv);
10522 SET_Uniform4uiv(table, save_Uniform4uiv);
10523 #else
10524 (void) save_Uniform1ui;
10525 (void) save_Uniform2ui;
10526 (void) save_Uniform3ui;
10527 (void) save_Uniform4ui;
10528 (void) save_Uniform1uiv;
10529 (void) save_Uniform2uiv;
10530 (void) save_Uniform3uiv;
10531 (void) save_Uniform4uiv;
10532 #endif
10533
10534 #if FEATURE_EXT_transform_feedback
10535 /* These are not compiled into display lists: */
10536 SET_BindBufferBaseEXT(table, _mesa_BindBufferBase);
10537 SET_BindBufferOffsetEXT(table, _mesa_BindBufferOffsetEXT);
10538 SET_BindBufferRangeEXT(table, _mesa_BindBufferRange);
10539 SET_TransformFeedbackVaryingsEXT(table, _mesa_TransformFeedbackVaryings);
10540 /* These are: */
10541 SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback);
10542 SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback);
10543 SET_BindTransformFeedback(table, save_BindTransformFeedback);
10544 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
10545 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
10546 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
10547 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
10548 SET_DrawTransformFeedbackInstanced(table,
10549 save_DrawTransformFeedbackInstanced);
10550 SET_DrawTransformFeedbackStreamInstanced(table,
10551 save_DrawTransformFeedbackStreamInstanced);
10552 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
10553 SET_EndQueryIndexed(table, save_EndQueryIndexed);
10554 #endif
10555
10556 /* GL_ARB_instanced_arrays */
10557 SET_VertexAttribDivisorARB(table, save_VertexAttribDivisor);
10558
10559 /* GL_NV_texture_barrier */
10560 SET_TextureBarrierNV(table, save_TextureBarrierNV);
10561
10562 /* GL_ARB_sampler_objects */
10563 _mesa_init_sampler_object_dispatch(table); /* plug in Gen/Get/etc functions */
10564 SET_BindSampler(table, save_BindSampler);
10565 SET_SamplerParameteri(table, save_SamplerParameteri);
10566 SET_SamplerParameterf(table, save_SamplerParameterf);
10567 SET_SamplerParameteriv(table, save_SamplerParameteriv);
10568 SET_SamplerParameterfv(table, save_SamplerParameterfv);
10569 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
10570 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
10571
10572 /* GL_ARB_draw_buffer_blend */
10573 SET_BlendFunciARB(table, save_BlendFunci);
10574 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
10575 SET_BlendEquationiARB(table, save_BlendEquationi);
10576 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
10577
10578 /* GL_ARB_geometry_shader4 */
10579 SET_ProgramParameteriARB(table, save_ProgramParameteri);
10580 SET_FramebufferTextureARB(table, save_FramebufferTexture);
10581 SET_FramebufferTextureFaceARB(table, save_FramebufferTextureFace);
10582
10583 /* GL_NV_conditional_render */
10584 SET_BeginConditionalRenderNV(table, save_BeginConditionalRender);
10585 SET_EndConditionalRenderNV(table, save_EndConditionalRender);
10586
10587 /* GL_ARB_sync */
10588 _mesa_init_sync_dispatch(table);
10589 SET_WaitSync(table, save_WaitSync);
10590
10591 /* GL_ARB_texture_storage (no dlist support) */
10592 SET_TexStorage1D(table, _mesa_TexStorage1D);
10593 SET_TexStorage2D(table, _mesa_TexStorage2D);
10594 SET_TexStorage3D(table, _mesa_TexStorage3D);
10595 SET_TextureStorage1DEXT(table, _mesa_TextureStorage1DEXT);
10596 SET_TextureStorage2DEXT(table, _mesa_TextureStorage2DEXT);
10597 SET_TextureStorage3DEXT(table, _mesa_TextureStorage3DEXT);
10598
10599 /* GL_ARB_debug_output (no dlist support) */
10600 _mesa_init_errors_dispatch(table);
10601
10602 /* GL_ARB_uniform_buffer_object */
10603 SET_UniformBlockBinding(table, save_UniformBlockBinding);
10604
10605 /* GL_NV_primitive_restart */
10606 SET_PrimitiveRestartIndexNV(table, _mesa_PrimitiveRestartIndex);
10607
10608 return table;
10609 }
10610
10611
10612
10613 static const char *
10614 enum_string(GLenum k)
10615 {
10616 return _mesa_lookup_enum_by_nr(k);
10617 }
10618
10619
10620 /**
10621 * Print the commands in a display list. For debugging only.
10622 * TODO: many commands aren't handled yet.
10623 */
10624 static void GLAPIENTRY
10625 print_list(struct gl_context *ctx, GLuint list)
10626 {
10627 struct gl_display_list *dlist;
10628 Node *n;
10629 GLboolean done;
10630
10631 if (!islist(ctx, list)) {
10632 printf("%u is not a display list ID\n", list);
10633 return;
10634 }
10635
10636 dlist = lookup_list(ctx, list);
10637 if (!dlist)
10638 return;
10639
10640 n = dlist->Head;
10641
10642 printf("START-LIST %u, address %p\n", list, (void *) n);
10643
10644 done = n ? GL_FALSE : GL_TRUE;
10645 while (!done) {
10646 const OpCode opcode = n[0].opcode;
10647
10648 if (is_ext_opcode(opcode)) {
10649 n += ext_opcode_print(ctx, n);
10650 }
10651 else {
10652 switch (opcode) {
10653 case OPCODE_ACCUM:
10654 printf("Accum %s %g\n", enum_string(n[1].e), n[2].f);
10655 break;
10656 case OPCODE_BITMAP:
10657 printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
10658 n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data);
10659 break;
10660 case OPCODE_CALL_LIST:
10661 printf("CallList %d\n", (int) n[1].ui);
10662 break;
10663 case OPCODE_CALL_LIST_OFFSET:
10664 printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
10665 ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
10666 break;
10667 case OPCODE_COLOR_TABLE_PARAMETER_FV:
10668 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
10669 enum_string(n[1].e), enum_string(n[2].e),
10670 n[3].f, n[4].f, n[5].f, n[6].f);
10671 break;
10672 case OPCODE_COLOR_TABLE_PARAMETER_IV:
10673 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
10674 enum_string(n[1].e), enum_string(n[2].e),
10675 n[3].i, n[4].i, n[5].i, n[6].i);
10676 break;
10677 case OPCODE_DISABLE:
10678 printf("Disable %s\n", enum_string(n[1].e));
10679 break;
10680 case OPCODE_ENABLE:
10681 printf("Enable %s\n", enum_string(n[1].e));
10682 break;
10683 case OPCODE_FRUSTUM:
10684 printf("Frustum %g %g %g %g %g %g\n",
10685 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
10686 break;
10687 case OPCODE_LINE_STIPPLE:
10688 printf("LineStipple %d %x\n", n[1].i, (int) n[2].us);
10689 break;
10690 case OPCODE_LOAD_IDENTITY:
10691 printf("LoadIdentity\n");
10692 break;
10693 case OPCODE_LOAD_MATRIX:
10694 printf("LoadMatrix\n");
10695 printf(" %8f %8f %8f %8f\n",
10696 n[1].f, n[5].f, n[9].f, n[13].f);
10697 printf(" %8f %8f %8f %8f\n",
10698 n[2].f, n[6].f, n[10].f, n[14].f);
10699 printf(" %8f %8f %8f %8f\n",
10700 n[3].f, n[7].f, n[11].f, n[15].f);
10701 printf(" %8f %8f %8f %8f\n",
10702 n[4].f, n[8].f, n[12].f, n[16].f);
10703 break;
10704 case OPCODE_MULT_MATRIX:
10705 printf("MultMatrix (or Rotate)\n");
10706 printf(" %8f %8f %8f %8f\n",
10707 n[1].f, n[5].f, n[9].f, n[13].f);
10708 printf(" %8f %8f %8f %8f\n",
10709 n[2].f, n[6].f, n[10].f, n[14].f);
10710 printf(" %8f %8f %8f %8f\n",
10711 n[3].f, n[7].f, n[11].f, n[15].f);
10712 printf(" %8f %8f %8f %8f\n",
10713 n[4].f, n[8].f, n[12].f, n[16].f);
10714 break;
10715 case OPCODE_ORTHO:
10716 printf("Ortho %g %g %g %g %g %g\n",
10717 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
10718 break;
10719 case OPCODE_POP_ATTRIB:
10720 printf("PopAttrib\n");
10721 break;
10722 case OPCODE_POP_MATRIX:
10723 printf("PopMatrix\n");
10724 break;
10725 case OPCODE_POP_NAME:
10726 printf("PopName\n");
10727 break;
10728 case OPCODE_PUSH_ATTRIB:
10729 printf("PushAttrib %x\n", n[1].bf);
10730 break;
10731 case OPCODE_PUSH_MATRIX:
10732 printf("PushMatrix\n");
10733 break;
10734 case OPCODE_PUSH_NAME:
10735 printf("PushName %d\n", (int) n[1].ui);
10736 break;
10737 case OPCODE_RASTER_POS:
10738 printf("RasterPos %g %g %g %g\n",
10739 n[1].f, n[2].f, n[3].f, n[4].f);
10740 break;
10741 case OPCODE_ROTATE:
10742 printf("Rotate %g %g %g %g\n",
10743 n[1].f, n[2].f, n[3].f, n[4].f);
10744 break;
10745 case OPCODE_SCALE:
10746 printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
10747 break;
10748 case OPCODE_TRANSLATE:
10749 printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
10750 break;
10751 case OPCODE_BIND_TEXTURE:
10752 printf("BindTexture %s %d\n",
10753 _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui);
10754 break;
10755 case OPCODE_SHADE_MODEL:
10756 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui));
10757 break;
10758 case OPCODE_MAP1:
10759 printf("Map1 %s %.3f %.3f %d %d\n",
10760 _mesa_lookup_enum_by_nr(n[1].ui),
10761 n[2].f, n[3].f, n[4].i, n[5].i);
10762 break;
10763 case OPCODE_MAP2:
10764 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
10765 _mesa_lookup_enum_by_nr(n[1].ui),
10766 n[2].f, n[3].f, n[4].f, n[5].f,
10767 n[6].i, n[7].i, n[8].i, n[9].i);
10768 break;
10769 case OPCODE_MAPGRID1:
10770 printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
10771 break;
10772 case OPCODE_MAPGRID2:
10773 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
10774 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
10775 break;
10776 case OPCODE_EVALMESH1:
10777 printf("EvalMesh1 %d %d\n", n[1].i, n[2].i);
10778 break;
10779 case OPCODE_EVALMESH2:
10780 printf("EvalMesh2 %d %d %d %d\n",
10781 n[1].i, n[2].i, n[3].i, n[4].i);
10782 break;
10783
10784 case OPCODE_ATTR_1F_NV:
10785 printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
10786 break;
10787 case OPCODE_ATTR_2F_NV:
10788 printf("ATTR_2F_NV attr %d: %f %f\n",
10789 n[1].i, n[2].f, n[3].f);
10790 break;
10791 case OPCODE_ATTR_3F_NV:
10792 printf("ATTR_3F_NV attr %d: %f %f %f\n",
10793 n[1].i, n[2].f, n[3].f, n[4].f);
10794 break;
10795 case OPCODE_ATTR_4F_NV:
10796 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
10797 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
10798 break;
10799 case OPCODE_ATTR_1F_ARB:
10800 printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
10801 break;
10802 case OPCODE_ATTR_2F_ARB:
10803 printf("ATTR_2F_ARB attr %d: %f %f\n",
10804 n[1].i, n[2].f, n[3].f);
10805 break;
10806 case OPCODE_ATTR_3F_ARB:
10807 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
10808 n[1].i, n[2].f, n[3].f, n[4].f);
10809 break;
10810 case OPCODE_ATTR_4F_ARB:
10811 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
10812 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
10813 break;
10814
10815 case OPCODE_MATERIAL:
10816 printf("MATERIAL %x %x: %f %f %f %f\n",
10817 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
10818 break;
10819 case OPCODE_BEGIN:
10820 printf("BEGIN %x\n", n[1].i);
10821 break;
10822 case OPCODE_END:
10823 printf("END\n");
10824 break;
10825 case OPCODE_RECTF:
10826 printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
10827 n[4].f);
10828 break;
10829 case OPCODE_EVAL_C1:
10830 printf("EVAL_C1 %f\n", n[1].f);
10831 break;
10832 case OPCODE_EVAL_C2:
10833 printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
10834 break;
10835 case OPCODE_EVAL_P1:
10836 printf("EVAL_P1 %d\n", n[1].i);
10837 break;
10838 case OPCODE_EVAL_P2:
10839 printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
10840 break;
10841
10842 case OPCODE_PROVOKING_VERTEX:
10843 printf("ProvokingVertex %s\n",
10844 _mesa_lookup_enum_by_nr(n[1].ui));
10845 break;
10846
10847 /*
10848 * meta opcodes/commands
10849 */
10850 case OPCODE_ERROR:
10851 printf("Error: %s %s\n",
10852 enum_string(n[1].e), (const char *) n[2].data);
10853 break;
10854 case OPCODE_CONTINUE:
10855 printf("DISPLAY-LIST-CONTINUE\n");
10856 n = (Node *) n[1].next;
10857 break;
10858 case OPCODE_END_OF_LIST:
10859 printf("END-LIST %u\n", list);
10860 done = GL_TRUE;
10861 break;
10862 default:
10863 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
10864 printf
10865 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10866 opcode, (void *) n);
10867 return;
10868 }
10869 else {
10870 printf("command %d, %u operands\n", opcode,
10871 InstSize[opcode]);
10872 }
10873 }
10874 /* increment n to point to next compiled command */
10875 if (opcode != OPCODE_CONTINUE) {
10876 n += InstSize[opcode];
10877 }
10878 }
10879 }
10880 }
10881
10882
10883
10884 /**
10885 * Clients may call this function to help debug display list problems.
10886 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10887 * changed, or break in the future without notice.
10888 */
10889 void
10890 mesa_print_display_list(GLuint list)
10891 {
10892 GET_CURRENT_CONTEXT(ctx);
10893 print_list(ctx, list);
10894 }
10895
10896
10897 /**********************************************************************/
10898 /***** Initialization *****/
10899 /**********************************************************************/
10900
10901 void
10902 _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
10903 {
10904 _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
10905
10906 vfmt->Begin = save_Begin;
10907
10908 _MESA_INIT_DLIST_VTXFMT(vfmt, save_);
10909
10910 vfmt->Color3f = save_Color3f;
10911 vfmt->Color3fv = save_Color3fv;
10912 vfmt->Color4f = save_Color4f;
10913 vfmt->Color4fv = save_Color4fv;
10914 vfmt->EdgeFlag = save_EdgeFlag;
10915 vfmt->End = save_End;
10916
10917 _MESA_INIT_EVAL_VTXFMT(vfmt, save_);
10918
10919 vfmt->FogCoordfEXT = save_FogCoordfEXT;
10920 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
10921 vfmt->Indexf = save_Indexf;
10922 vfmt->Indexfv = save_Indexfv;
10923 vfmt->Materialfv = save_Materialfv;
10924 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
10925 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
10926 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
10927 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
10928 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
10929 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
10930 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
10931 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
10932 vfmt->Normal3f = save_Normal3f;
10933 vfmt->Normal3fv = save_Normal3fv;
10934 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
10935 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
10936 vfmt->TexCoord1f = save_TexCoord1f;
10937 vfmt->TexCoord1fv = save_TexCoord1fv;
10938 vfmt->TexCoord2f = save_TexCoord2f;
10939 vfmt->TexCoord2fv = save_TexCoord2fv;
10940 vfmt->TexCoord3f = save_TexCoord3f;
10941 vfmt->TexCoord3fv = save_TexCoord3fv;
10942 vfmt->TexCoord4f = save_TexCoord4f;
10943 vfmt->TexCoord4fv = save_TexCoord4fv;
10944 vfmt->Vertex2f = save_Vertex2f;
10945 vfmt->Vertex2fv = save_Vertex2fv;
10946 vfmt->Vertex3f = save_Vertex3f;
10947 vfmt->Vertex3fv = save_Vertex3fv;
10948 vfmt->Vertex4f = save_Vertex4f;
10949 vfmt->Vertex4fv = save_Vertex4fv;
10950 vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
10951 vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
10952 vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
10953 vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
10954 vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
10955 vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
10956 vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
10957 vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
10958 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
10959 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
10960 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
10961 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
10962 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
10963 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
10964 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
10965 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
10966
10967 vfmt->Rectf = save_Rectf;
10968
10969 /* GL_ARB_draw_instanced */
10970 vfmt->DrawArraysInstanced = save_DrawArraysInstancedARB;
10971 vfmt->DrawElementsInstanced = save_DrawElementsInstancedARB;
10972
10973 /* GL_ARB_draw_elements_base_vertex */
10974 vfmt->DrawElementsInstancedBaseVertex = save_DrawElementsInstancedBaseVertexARB;
10975
10976 /* GL_ARB_base_instance */
10977 vfmt->DrawArraysInstancedBaseInstance = save_DrawArraysInstancedBaseInstance;
10978 vfmt->DrawElementsInstancedBaseInstance = save_DrawElementsInstancedBaseInstance;
10979 vfmt->DrawElementsInstancedBaseVertexBaseInstance = save_DrawElementsInstancedBaseVertexBaseInstance;
10980
10981 /* The driver is required to implement these as
10982 * 1) They can probably do a better job.
10983 * 2) A lot of new mechanisms would have to be added to this module
10984 * to support it. That code would probably never get used,
10985 * because of (1).
10986 */
10987 #if 0
10988 vfmt->DrawArrays = 0;
10989 vfmt->DrawElements = 0;
10990 vfmt->DrawRangeElements = 0;
10991 vfmt->MultiDrawElemementsEXT = 0;
10992 vfmt->DrawElementsBaseVertex = 0;
10993 vfmt->DrawRangeElementsBaseVertex = 0;
10994 vfmt->MultiDrawElemementsBaseVertex = 0;
10995 #endif
10996 }
10997
10998
10999 void
11000 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
11001 const GLvertexformat *vfmt)
11002 {
11003 SET_CallList(disp, vfmt->CallList);
11004 SET_CallLists(disp, vfmt->CallLists);
11005 }
11006
11007
11008 void _mesa_init_dlist_dispatch(struct _glapi_table *disp)
11009 {
11010 SET_CallList(disp, _mesa_CallList);
11011 SET_CallLists(disp, _mesa_CallLists);
11012
11013 SET_DeleteLists(disp, _mesa_DeleteLists);
11014 SET_EndList(disp, _mesa_EndList);
11015 SET_GenLists(disp, _mesa_GenLists);
11016 SET_IsList(disp, _mesa_IsList);
11017 SET_ListBase(disp, _mesa_ListBase);
11018 SET_NewList(disp, _mesa_NewList);
11019 }
11020
11021
11022 /**
11023 * Initialize display list state for given context.
11024 */
11025 void
11026 _mesa_init_display_list(struct gl_context *ctx)
11027 {
11028 static GLboolean tableInitialized = GL_FALSE;
11029
11030 /* zero-out the instruction size table, just once */
11031 if (!tableInitialized) {
11032 memset(InstSize, 0, sizeof(InstSize));
11033 tableInitialized = GL_TRUE;
11034 }
11035
11036 /* extension info */
11037 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
11038
11039 /* Display list */
11040 ctx->ListState.CallDepth = 0;
11041 ctx->ExecuteFlag = GL_TRUE;
11042 ctx->CompileFlag = GL_FALSE;
11043 ctx->ListState.CurrentBlock = NULL;
11044 ctx->ListState.CurrentPos = 0;
11045
11046 /* Display List group */
11047 ctx->List.ListBase = 0;
11048
11049 _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
11050 }
11051
11052
11053 void
11054 _mesa_free_display_list_data(struct gl_context *ctx)
11055 {
11056 free(ctx->ListExt);
11057 ctx->ListExt = NULL;
11058 }