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