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