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