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