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