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