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