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