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