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