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