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