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