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