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