Merge remote-tracking branch 'mesa-public/master' 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 /* aka UseProgram() */
5986 static void GLAPIENTRY
5987 save_UseProgramObjectARB(GLhandleARB program)
5988 {
5989 GET_CURRENT_CONTEXT(ctx);
5990 Node *n;
5991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5992 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
5993 if (n) {
5994 n[1].ui = program;
5995 }
5996 if (ctx->ExecuteFlag) {
5997 CALL_UseProgram(ctx->Exec, (program));
5998 }
5999 }
6000
6001
6002 static void GLAPIENTRY
6003 save_Uniform1fARB(GLint location, GLfloat x)
6004 {
6005 GET_CURRENT_CONTEXT(ctx);
6006 Node *n;
6007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6008 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6009 if (n) {
6010 n[1].i = location;
6011 n[2].f = x;
6012 }
6013 if (ctx->ExecuteFlag) {
6014 CALL_Uniform1f(ctx->Exec, (location, x));
6015 }
6016 }
6017
6018
6019 static void GLAPIENTRY
6020 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6021 {
6022 GET_CURRENT_CONTEXT(ctx);
6023 Node *n;
6024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6025 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6026 if (n) {
6027 n[1].i = location;
6028 n[2].f = x;
6029 n[3].f = y;
6030 }
6031 if (ctx->ExecuteFlag) {
6032 CALL_Uniform2f(ctx->Exec, (location, x, y));
6033 }
6034 }
6035
6036
6037 static void GLAPIENTRY
6038 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6039 {
6040 GET_CURRENT_CONTEXT(ctx);
6041 Node *n;
6042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6043 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6044 if (n) {
6045 n[1].i = location;
6046 n[2].f = x;
6047 n[3].f = y;
6048 n[4].f = z;
6049 }
6050 if (ctx->ExecuteFlag) {
6051 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6052 }
6053 }
6054
6055
6056 static void GLAPIENTRY
6057 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6058 {
6059 GET_CURRENT_CONTEXT(ctx);
6060 Node *n;
6061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6062 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6063 if (n) {
6064 n[1].i = location;
6065 n[2].f = x;
6066 n[3].f = y;
6067 n[4].f = z;
6068 n[5].f = w;
6069 }
6070 if (ctx->ExecuteFlag) {
6071 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6072 }
6073 }
6074
6075
6076 static void GLAPIENTRY
6077 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6078 {
6079 GET_CURRENT_CONTEXT(ctx);
6080 Node *n;
6081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6082 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6083 if (n) {
6084 n[1].i = location;
6085 n[2].i = count;
6086 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6087 }
6088 if (ctx->ExecuteFlag) {
6089 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6090 }
6091 }
6092
6093 static void GLAPIENTRY
6094 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6095 {
6096 GET_CURRENT_CONTEXT(ctx);
6097 Node *n;
6098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6099 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6100 if (n) {
6101 n[1].i = location;
6102 n[2].i = count;
6103 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6104 }
6105 if (ctx->ExecuteFlag) {
6106 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6107 }
6108 }
6109
6110 static void GLAPIENTRY
6111 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6112 {
6113 GET_CURRENT_CONTEXT(ctx);
6114 Node *n;
6115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6116 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6117 if (n) {
6118 n[1].i = location;
6119 n[2].i = count;
6120 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6121 }
6122 if (ctx->ExecuteFlag) {
6123 CALL_Uniform3fv(ctx->Exec, (location, count, v));
6124 }
6125 }
6126
6127 static void GLAPIENTRY
6128 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6129 {
6130 GET_CURRENT_CONTEXT(ctx);
6131 Node *n;
6132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6133 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
6134 if (n) {
6135 n[1].i = location;
6136 n[2].i = count;
6137 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6138 }
6139 if (ctx->ExecuteFlag) {
6140 CALL_Uniform4fv(ctx->Exec, (location, count, v));
6141 }
6142 }
6143
6144
6145 static void GLAPIENTRY
6146 save_Uniform1iARB(GLint location, GLint x)
6147 {
6148 GET_CURRENT_CONTEXT(ctx);
6149 Node *n;
6150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6151 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6152 if (n) {
6153 n[1].i = location;
6154 n[2].i = x;
6155 }
6156 if (ctx->ExecuteFlag) {
6157 CALL_Uniform1i(ctx->Exec, (location, x));
6158 }
6159 }
6160
6161 static void GLAPIENTRY
6162 save_Uniform2iARB(GLint location, GLint x, GLint y)
6163 {
6164 GET_CURRENT_CONTEXT(ctx);
6165 Node *n;
6166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6167 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6168 if (n) {
6169 n[1].i = location;
6170 n[2].i = x;
6171 n[3].i = y;
6172 }
6173 if (ctx->ExecuteFlag) {
6174 CALL_Uniform2i(ctx->Exec, (location, x, y));
6175 }
6176 }
6177
6178 static void GLAPIENTRY
6179 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6180 {
6181 GET_CURRENT_CONTEXT(ctx);
6182 Node *n;
6183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6184 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6185 if (n) {
6186 n[1].i = location;
6187 n[2].i = x;
6188 n[3].i = y;
6189 n[4].i = z;
6190 }
6191 if (ctx->ExecuteFlag) {
6192 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
6193 }
6194 }
6195
6196 static void GLAPIENTRY
6197 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6198 {
6199 GET_CURRENT_CONTEXT(ctx);
6200 Node *n;
6201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6202 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6203 if (n) {
6204 n[1].i = location;
6205 n[2].i = x;
6206 n[3].i = y;
6207 n[4].i = z;
6208 n[5].i = w;
6209 }
6210 if (ctx->ExecuteFlag) {
6211 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
6212 }
6213 }
6214
6215
6216
6217 static void GLAPIENTRY
6218 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6219 {
6220 GET_CURRENT_CONTEXT(ctx);
6221 Node *n;
6222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6223 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
6224 if (n) {
6225 n[1].i = location;
6226 n[2].i = count;
6227 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
6228 }
6229 if (ctx->ExecuteFlag) {
6230 CALL_Uniform1iv(ctx->Exec, (location, count, v));
6231 }
6232 }
6233
6234 static void GLAPIENTRY
6235 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
6236 {
6237 GET_CURRENT_CONTEXT(ctx);
6238 Node *n;
6239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6240 n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
6241 if (n) {
6242 n[1].i = location;
6243 n[2].i = count;
6244 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
6245 }
6246 if (ctx->ExecuteFlag) {
6247 CALL_Uniform2iv(ctx->Exec, (location, count, v));
6248 }
6249 }
6250
6251 static void GLAPIENTRY
6252 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6253 {
6254 GET_CURRENT_CONTEXT(ctx);
6255 Node *n;
6256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6257 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
6258 if (n) {
6259 n[1].i = location;
6260 n[2].i = count;
6261 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
6262 }
6263 if (ctx->ExecuteFlag) {
6264 CALL_Uniform3iv(ctx->Exec, (location, count, v));
6265 }
6266 }
6267
6268 static void GLAPIENTRY
6269 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6270 {
6271 GET_CURRENT_CONTEXT(ctx);
6272 Node *n;
6273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6274 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
6275 if (n) {
6276 n[1].i = location;
6277 n[2].i = count;
6278 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6279 }
6280 if (ctx->ExecuteFlag) {
6281 CALL_Uniform4iv(ctx->Exec, (location, count, v));
6282 }
6283 }
6284
6285
6286
6287 static void GLAPIENTRY
6288 save_Uniform1ui(GLint location, GLuint x)
6289 {
6290 GET_CURRENT_CONTEXT(ctx);
6291 Node *n;
6292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6293 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6294 if (n) {
6295 n[1].i = location;
6296 n[2].i = x;
6297 }
6298 if (ctx->ExecuteFlag) {
6299 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6300 }
6301 }
6302
6303 static void GLAPIENTRY
6304 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6305 {
6306 GET_CURRENT_CONTEXT(ctx);
6307 Node *n;
6308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6309 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6310 if (n) {
6311 n[1].i = location;
6312 n[2].i = x;
6313 n[3].i = y;
6314 }
6315 if (ctx->ExecuteFlag) {
6316 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6317 }
6318 }
6319
6320 static void GLAPIENTRY
6321 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6322 {
6323 GET_CURRENT_CONTEXT(ctx);
6324 Node *n;
6325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6326 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6327 if (n) {
6328 n[1].i = location;
6329 n[2].i = x;
6330 n[3].i = y;
6331 n[4].i = z;
6332 }
6333 if (ctx->ExecuteFlag) {
6334 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6335 }
6336 }
6337
6338 static void GLAPIENTRY
6339 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6340 {
6341 GET_CURRENT_CONTEXT(ctx);
6342 Node *n;
6343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6344 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
6345 if (n) {
6346 n[1].i = location;
6347 n[2].i = x;
6348 n[3].i = y;
6349 n[4].i = z;
6350 n[5].i = w;
6351 }
6352 if (ctx->ExecuteFlag) {
6353 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6354 }
6355 }
6356
6357
6358
6359 static void GLAPIENTRY
6360 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
6361 {
6362 GET_CURRENT_CONTEXT(ctx);
6363 Node *n;
6364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6365 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
6366 if (n) {
6367 n[1].i = location;
6368 n[2].i = count;
6369 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
6370 }
6371 if (ctx->ExecuteFlag) {
6372 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6373 }
6374 }
6375
6376 static void GLAPIENTRY
6377 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
6378 {
6379 GET_CURRENT_CONTEXT(ctx);
6380 Node *n;
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6382 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
6383 if (n) {
6384 n[1].i = location;
6385 n[2].i = count;
6386 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
6387 }
6388 if (ctx->ExecuteFlag) {
6389 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6390 }
6391 }
6392
6393 static void GLAPIENTRY
6394 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
6395 {
6396 GET_CURRENT_CONTEXT(ctx);
6397 Node *n;
6398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6399 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
6400 if (n) {
6401 n[1].i = location;
6402 n[2].i = count;
6403 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
6404 }
6405 if (ctx->ExecuteFlag) {
6406 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6407 }
6408 }
6409
6410 static void GLAPIENTRY
6411 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
6412 {
6413 GET_CURRENT_CONTEXT(ctx);
6414 Node *n;
6415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6416 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
6417 if (n) {
6418 n[1].i = location;
6419 n[2].i = count;
6420 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
6421 }
6422 if (ctx->ExecuteFlag) {
6423 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6424 }
6425 }
6426
6427
6428
6429 static void GLAPIENTRY
6430 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
6431 const GLfloat *m)
6432 {
6433 GET_CURRENT_CONTEXT(ctx);
6434 Node *n;
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6436 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
6437 if (n) {
6438 n[1].i = location;
6439 n[2].i = count;
6440 n[3].b = transpose;
6441 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
6442 }
6443 if (ctx->ExecuteFlag) {
6444 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
6445 }
6446 }
6447
6448 static void GLAPIENTRY
6449 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
6450 const GLfloat *m)
6451 {
6452 GET_CURRENT_CONTEXT(ctx);
6453 Node *n;
6454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6455 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
6456 if (n) {
6457 n[1].i = location;
6458 n[2].i = count;
6459 n[3].b = transpose;
6460 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
6461 }
6462 if (ctx->ExecuteFlag) {
6463 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
6464 }
6465 }
6466
6467 static void GLAPIENTRY
6468 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
6469 const GLfloat *m)
6470 {
6471 GET_CURRENT_CONTEXT(ctx);
6472 Node *n;
6473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6474 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
6475 if (n) {
6476 n[1].i = location;
6477 n[2].i = count;
6478 n[3].b = transpose;
6479 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
6480 }
6481 if (ctx->ExecuteFlag) {
6482 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
6483 }
6484 }
6485
6486
6487 static void GLAPIENTRY
6488 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
6489 const GLfloat *m)
6490 {
6491 GET_CURRENT_CONTEXT(ctx);
6492 Node *n;
6493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6494 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
6495 if (n) {
6496 n[1].i = location;
6497 n[2].i = count;
6498 n[3].b = transpose;
6499 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
6500 }
6501 if (ctx->ExecuteFlag) {
6502 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
6503 }
6504 }
6505
6506 static void GLAPIENTRY
6507 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
6508 const GLfloat *m)
6509 {
6510 GET_CURRENT_CONTEXT(ctx);
6511 Node *n;
6512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6513 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
6514 if (n) {
6515 n[1].i = location;
6516 n[2].i = count;
6517 n[3].b = transpose;
6518 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
6519 }
6520 if (ctx->ExecuteFlag) {
6521 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
6522 }
6523 }
6524
6525
6526 static void GLAPIENTRY
6527 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
6528 const GLfloat *m)
6529 {
6530 GET_CURRENT_CONTEXT(ctx);
6531 Node *n;
6532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6533 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
6534 if (n) {
6535 n[1].i = location;
6536 n[2].i = count;
6537 n[3].b = transpose;
6538 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
6539 }
6540 if (ctx->ExecuteFlag) {
6541 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
6542 }
6543 }
6544
6545 static void GLAPIENTRY
6546 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
6547 const GLfloat *m)
6548 {
6549 GET_CURRENT_CONTEXT(ctx);
6550 Node *n;
6551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6552 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
6553 if (n) {
6554 n[1].i = location;
6555 n[2].i = count;
6556 n[3].b = transpose;
6557 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
6558 }
6559 if (ctx->ExecuteFlag) {
6560 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
6561 }
6562 }
6563
6564
6565 static void GLAPIENTRY
6566 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
6567 const GLfloat *m)
6568 {
6569 GET_CURRENT_CONTEXT(ctx);
6570 Node *n;
6571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6572 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
6573 if (n) {
6574 n[1].i = location;
6575 n[2].i = count;
6576 n[3].b = transpose;
6577 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
6578 }
6579 if (ctx->ExecuteFlag) {
6580 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
6581 }
6582 }
6583
6584 static void GLAPIENTRY
6585 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
6586 const GLfloat *m)
6587 {
6588 GET_CURRENT_CONTEXT(ctx);
6589 Node *n;
6590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6591 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
6592 if (n) {
6593 n[1].i = location;
6594 n[2].i = count;
6595 n[3].b = transpose;
6596 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
6597 }
6598 if (ctx->ExecuteFlag) {
6599 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
6600 }
6601 }
6602
6603 static void GLAPIENTRY
6604 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
6605 {
6606 GET_CURRENT_CONTEXT(ctx);
6607 Node *n;
6608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6609 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
6610 if (n) {
6611 n[1].ui = pipeline;
6612 n[2].ui = stages;
6613 n[3].ui = program;
6614 }
6615 if (ctx->ExecuteFlag) {
6616 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
6617 }
6618 }
6619
6620 static void GLAPIENTRY
6621 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
6622 {
6623 GET_CURRENT_CONTEXT(ctx);
6624 Node *n;
6625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6626 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
6627 if (n) {
6628 n[1].ui = program;
6629 n[2].i = location;
6630 n[3].f = x;
6631 }
6632 if (ctx->ExecuteFlag) {
6633 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
6634 }
6635 }
6636
6637 static void GLAPIENTRY
6638 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
6639 {
6640 GET_CURRENT_CONTEXT(ctx);
6641 Node *n;
6642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6643 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
6644 if (n) {
6645 n[1].ui = program;
6646 n[2].i = location;
6647 n[3].f = x;
6648 n[4].f = y;
6649 }
6650 if (ctx->ExecuteFlag) {
6651 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
6652 }
6653 }
6654
6655 static void GLAPIENTRY
6656 save_ProgramUniform3f(GLuint program, GLint location,
6657 GLfloat x, GLfloat y, GLfloat z)
6658 {
6659 GET_CURRENT_CONTEXT(ctx);
6660 Node *n;
6661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6662 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
6663 if (n) {
6664 n[1].ui = program;
6665 n[2].i = location;
6666 n[3].f = x;
6667 n[4].f = y;
6668 n[5].f = z;
6669 }
6670 if (ctx->ExecuteFlag) {
6671 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
6672 }
6673 }
6674
6675 static void GLAPIENTRY
6676 save_ProgramUniform4f(GLuint program, GLint location,
6677 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6678 {
6679 GET_CURRENT_CONTEXT(ctx);
6680 Node *n;
6681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6682 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
6683 if (n) {
6684 n[1].ui = program;
6685 n[2].i = location;
6686 n[3].f = x;
6687 n[4].f = y;
6688 n[5].f = z;
6689 n[6].f = w;
6690 }
6691 if (ctx->ExecuteFlag) {
6692 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
6693 }
6694 }
6695
6696 static void GLAPIENTRY
6697 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
6698 const GLfloat *v)
6699 {
6700 GET_CURRENT_CONTEXT(ctx);
6701 Node *n;
6702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6703 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
6704 if (n) {
6705 n[1].ui = program;
6706 n[2].i = location;
6707 n[3].i = count;
6708 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
6709 }
6710 if (ctx->ExecuteFlag) {
6711 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
6712 }
6713 }
6714
6715 static void GLAPIENTRY
6716 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
6717 const GLfloat *v)
6718 {
6719 GET_CURRENT_CONTEXT(ctx);
6720 Node *n;
6721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6722 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
6723 if (n) {
6724 n[1].ui = program;
6725 n[2].i = location;
6726 n[3].i = count;
6727 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
6728 }
6729 if (ctx->ExecuteFlag) {
6730 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
6731 }
6732 }
6733
6734 static void GLAPIENTRY
6735 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
6736 const GLfloat *v)
6737 {
6738 GET_CURRENT_CONTEXT(ctx);
6739 Node *n;
6740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6741 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
6742 if (n) {
6743 n[1].ui = program;
6744 n[2].i = location;
6745 n[3].i = count;
6746 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
6747 }
6748 if (ctx->ExecuteFlag) {
6749 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
6750 }
6751 }
6752
6753 static void GLAPIENTRY
6754 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
6755 const GLfloat *v)
6756 {
6757 GET_CURRENT_CONTEXT(ctx);
6758 Node *n;
6759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6760 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
6761 if (n) {
6762 n[1].ui = program;
6763 n[2].i = location;
6764 n[3].i = count;
6765 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
6766 }
6767 if (ctx->ExecuteFlag) {
6768 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
6769 }
6770 }
6771
6772 static void GLAPIENTRY
6773 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
6774 {
6775 GET_CURRENT_CONTEXT(ctx);
6776 Node *n;
6777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6778 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
6779 if (n) {
6780 n[1].ui = program;
6781 n[2].i = location;
6782 n[3].i = x;
6783 }
6784 if (ctx->ExecuteFlag) {
6785 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
6786 }
6787 }
6788
6789 static void GLAPIENTRY
6790 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
6791 {
6792 GET_CURRENT_CONTEXT(ctx);
6793 Node *n;
6794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6795 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
6796 if (n) {
6797 n[1].ui = program;
6798 n[2].i = location;
6799 n[3].i = x;
6800 n[4].i = y;
6801 }
6802 if (ctx->ExecuteFlag) {
6803 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
6804 }
6805 }
6806
6807 static void GLAPIENTRY
6808 save_ProgramUniform3i(GLuint program, GLint location,
6809 GLint x, GLint y, GLint z)
6810 {
6811 GET_CURRENT_CONTEXT(ctx);
6812 Node *n;
6813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6814 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
6815 if (n) {
6816 n[1].ui = program;
6817 n[2].i = location;
6818 n[3].i = x;
6819 n[4].i = y;
6820 n[5].i = z;
6821 }
6822 if (ctx->ExecuteFlag) {
6823 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
6824 }
6825 }
6826
6827 static void GLAPIENTRY
6828 save_ProgramUniform4i(GLuint program, GLint location,
6829 GLint x, GLint y, GLint z, GLint w)
6830 {
6831 GET_CURRENT_CONTEXT(ctx);
6832 Node *n;
6833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6834 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
6835 if (n) {
6836 n[1].ui = program;
6837 n[2].i = location;
6838 n[3].i = x;
6839 n[4].i = y;
6840 n[5].i = z;
6841 n[6].i = w;
6842 }
6843 if (ctx->ExecuteFlag) {
6844 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
6845 }
6846 }
6847
6848 static void GLAPIENTRY
6849 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
6850 const GLint *v)
6851 {
6852 GET_CURRENT_CONTEXT(ctx);
6853 Node *n;
6854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6855 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
6856 if (n) {
6857 n[1].ui = program;
6858 n[2].i = location;
6859 n[3].i = count;
6860 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
6861 }
6862 if (ctx->ExecuteFlag) {
6863 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
6864 }
6865 }
6866
6867 static void GLAPIENTRY
6868 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
6869 const GLint *v)
6870 {
6871 GET_CURRENT_CONTEXT(ctx);
6872 Node *n;
6873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6874 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
6875 if (n) {
6876 n[1].ui = program;
6877 n[2].i = location;
6878 n[3].i = count;
6879 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
6880 }
6881 if (ctx->ExecuteFlag) {
6882 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
6883 }
6884 }
6885
6886 static void GLAPIENTRY
6887 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
6888 const GLint *v)
6889 {
6890 GET_CURRENT_CONTEXT(ctx);
6891 Node *n;
6892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6893 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
6894 if (n) {
6895 n[1].ui = program;
6896 n[2].i = location;
6897 n[3].i = count;
6898 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
6899 }
6900 if (ctx->ExecuteFlag) {
6901 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
6902 }
6903 }
6904
6905 static void GLAPIENTRY
6906 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
6907 const GLint *v)
6908 {
6909 GET_CURRENT_CONTEXT(ctx);
6910 Node *n;
6911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6912 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
6913 if (n) {
6914 n[1].ui = program;
6915 n[2].i = location;
6916 n[3].i = count;
6917 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
6918 }
6919 if (ctx->ExecuteFlag) {
6920 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
6921 }
6922 }
6923
6924 static void GLAPIENTRY
6925 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
6926 {
6927 GET_CURRENT_CONTEXT(ctx);
6928 Node *n;
6929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6930 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
6931 if (n) {
6932 n[1].ui = program;
6933 n[2].i = location;
6934 n[3].ui = x;
6935 }
6936 if (ctx->ExecuteFlag) {
6937 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
6938 }
6939 }
6940
6941 static void GLAPIENTRY
6942 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
6943 {
6944 GET_CURRENT_CONTEXT(ctx);
6945 Node *n;
6946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6947 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
6948 if (n) {
6949 n[1].ui = program;
6950 n[2].i = location;
6951 n[3].ui = x;
6952 n[4].ui = y;
6953 }
6954 if (ctx->ExecuteFlag) {
6955 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
6956 }
6957 }
6958
6959 static void GLAPIENTRY
6960 save_ProgramUniform3ui(GLuint program, GLint location,
6961 GLuint x, GLuint y, GLuint z)
6962 {
6963 GET_CURRENT_CONTEXT(ctx);
6964 Node *n;
6965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6966 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
6967 if (n) {
6968 n[1].ui = program;
6969 n[2].i = location;
6970 n[3].ui = x;
6971 n[4].ui = y;
6972 n[5].ui = z;
6973 }
6974 if (ctx->ExecuteFlag) {
6975 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
6976 }
6977 }
6978
6979 static void GLAPIENTRY
6980 save_ProgramUniform4ui(GLuint program, GLint location,
6981 GLuint x, GLuint y, GLuint z, GLuint w)
6982 {
6983 GET_CURRENT_CONTEXT(ctx);
6984 Node *n;
6985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6986 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
6987 if (n) {
6988 n[1].ui = program;
6989 n[2].i = location;
6990 n[3].ui = x;
6991 n[4].ui = y;
6992 n[5].ui = z;
6993 n[6].ui = w;
6994 }
6995 if (ctx->ExecuteFlag) {
6996 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
6997 }
6998 }
6999
7000 static void GLAPIENTRY
7001 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
7002 const GLuint *v)
7003 {
7004 GET_CURRENT_CONTEXT(ctx);
7005 Node *n;
7006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7007 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
7008 if (n) {
7009 n[1].ui = program;
7010 n[2].i = location;
7011 n[3].i = count;
7012 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
7013 }
7014 if (ctx->ExecuteFlag) {
7015 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
7016 }
7017 }
7018
7019 static void GLAPIENTRY
7020 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
7021 const GLuint *v)
7022 {
7023 GET_CURRENT_CONTEXT(ctx);
7024 Node *n;
7025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7026 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
7027 if (n) {
7028 n[1].ui = program;
7029 n[2].i = location;
7030 n[3].i = count;
7031 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
7032 }
7033 if (ctx->ExecuteFlag) {
7034 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
7035 }
7036 }
7037
7038 static void GLAPIENTRY
7039 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
7040 const GLuint *v)
7041 {
7042 GET_CURRENT_CONTEXT(ctx);
7043 Node *n;
7044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7045 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
7046 if (n) {
7047 n[1].ui = program;
7048 n[2].i = location;
7049 n[3].i = count;
7050 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
7051 }
7052 if (ctx->ExecuteFlag) {
7053 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
7054 }
7055 }
7056
7057 static void GLAPIENTRY
7058 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
7059 const GLuint *v)
7060 {
7061 GET_CURRENT_CONTEXT(ctx);
7062 Node *n;
7063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7064 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
7065 if (n) {
7066 n[1].ui = program;
7067 n[2].i = location;
7068 n[3].i = count;
7069 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
7070 }
7071 if (ctx->ExecuteFlag) {
7072 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
7073 }
7074 }
7075
7076 static void GLAPIENTRY
7077 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
7078 GLboolean transpose, const GLfloat *v)
7079 {
7080 GET_CURRENT_CONTEXT(ctx);
7081 Node *n;
7082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7083 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
7084 4 + POINTER_DWORDS);
7085 if (n) {
7086 n[1].ui = program;
7087 n[2].i = location;
7088 n[3].i = count;
7089 n[4].b = transpose;
7090 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
7091 }
7092 if (ctx->ExecuteFlag) {
7093 CALL_ProgramUniformMatrix2fv(ctx->Exec,
7094 (program, location, count, transpose, v));
7095 }
7096 }
7097
7098 static void GLAPIENTRY
7099 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
7100 GLboolean transpose, const GLfloat *v)
7101 {
7102 GET_CURRENT_CONTEXT(ctx);
7103 Node *n;
7104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7105 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
7106 4 + POINTER_DWORDS);
7107 if (n) {
7108 n[1].ui = program;
7109 n[2].i = location;
7110 n[3].i = count;
7111 n[4].b = transpose;
7112 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
7113 }
7114 if (ctx->ExecuteFlag) {
7115 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
7116 (program, location, count, transpose, v));
7117 }
7118 }
7119
7120 static void GLAPIENTRY
7121 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
7122 GLboolean transpose, const GLfloat *v)
7123 {
7124 GET_CURRENT_CONTEXT(ctx);
7125 Node *n;
7126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7127 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
7128 4 + POINTER_DWORDS);
7129 if (n) {
7130 n[1].ui = program;
7131 n[2].i = location;
7132 n[3].i = count;
7133 n[4].b = transpose;
7134 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
7135 }
7136 if (ctx->ExecuteFlag) {
7137 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
7138 (program, location, count, transpose, v));
7139 }
7140 }
7141
7142 static void GLAPIENTRY
7143 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
7144 GLboolean transpose, const GLfloat *v)
7145 {
7146 GET_CURRENT_CONTEXT(ctx);
7147 Node *n;
7148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7149 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
7150 4 + POINTER_DWORDS);
7151 if (n) {
7152 n[1].ui = program;
7153 n[2].i = location;
7154 n[3].i = count;
7155 n[4].b = transpose;
7156 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
7157 }
7158 if (ctx->ExecuteFlag) {
7159 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
7160 (program, location, count, transpose, v));
7161 }
7162 }
7163
7164 static void GLAPIENTRY
7165 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
7166 GLboolean transpose, const GLfloat *v)
7167 {
7168 GET_CURRENT_CONTEXT(ctx);
7169 Node *n;
7170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7171 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
7172 4 + POINTER_DWORDS);
7173 if (n) {
7174 n[1].ui = program;
7175 n[2].i = location;
7176 n[3].i = count;
7177 n[4].b = transpose;
7178 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
7179 }
7180 if (ctx->ExecuteFlag) {
7181 CALL_ProgramUniformMatrix3fv(ctx->Exec,
7182 (program, location, count, transpose, v));
7183 }
7184 }
7185
7186 static void GLAPIENTRY
7187 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
7188 GLboolean transpose, const GLfloat *v)
7189 {
7190 GET_CURRENT_CONTEXT(ctx);
7191 Node *n;
7192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7193 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
7194 4 + POINTER_DWORDS);
7195 if (n) {
7196 n[1].ui = program;
7197 n[2].i = location;
7198 n[3].i = count;
7199 n[4].b = transpose;
7200 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
7201 }
7202 if (ctx->ExecuteFlag) {
7203 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
7204 (program, location, count, transpose, v));
7205 }
7206 }
7207
7208 static void GLAPIENTRY
7209 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
7210 GLboolean transpose, const GLfloat *v)
7211 {
7212 GET_CURRENT_CONTEXT(ctx);
7213 Node *n;
7214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7215 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
7216 4 + POINTER_DWORDS);
7217 if (n) {
7218 n[1].ui = program;
7219 n[2].i = location;
7220 n[3].i = count;
7221 n[4].b = transpose;
7222 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
7223 }
7224 if (ctx->ExecuteFlag) {
7225 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
7226 (program, location, count, transpose, v));
7227 }
7228 }
7229
7230 static void GLAPIENTRY
7231 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
7232 GLboolean transpose, const GLfloat *v)
7233 {
7234 GET_CURRENT_CONTEXT(ctx);
7235 Node *n;
7236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7237 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
7238 4 + POINTER_DWORDS);
7239 if (n) {
7240 n[1].ui = program;
7241 n[2].i = location;
7242 n[3].i = count;
7243 n[4].b = transpose;
7244 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
7245 }
7246 if (ctx->ExecuteFlag) {
7247 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
7248 (program, location, count, transpose, v));
7249 }
7250 }
7251
7252 static void GLAPIENTRY
7253 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
7254 GLboolean transpose, const GLfloat *v)
7255 {
7256 GET_CURRENT_CONTEXT(ctx);
7257 Node *n;
7258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7259 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
7260 4 + POINTER_DWORDS);
7261 if (n) {
7262 n[1].ui = program;
7263 n[2].i = location;
7264 n[3].i = count;
7265 n[4].b = transpose;
7266 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
7267 }
7268 if (ctx->ExecuteFlag) {
7269 CALL_ProgramUniformMatrix4fv(ctx->Exec,
7270 (program, location, count, transpose, v));
7271 }
7272 }
7273
7274 static void GLAPIENTRY
7275 save_ClipControl(GLenum origin, GLenum depth)
7276 {
7277 GET_CURRENT_CONTEXT(ctx);
7278 Node *n;
7279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7280 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
7281 if (n) {
7282 n[1].e = origin;
7283 n[2].e = depth;
7284 }
7285 if (ctx->ExecuteFlag) {
7286 CALL_ClipControl(ctx->Exec, (origin, depth));
7287 }
7288 }
7289
7290 static void GLAPIENTRY
7291 save_ClampColorARB(GLenum target, GLenum clamp)
7292 {
7293 GET_CURRENT_CONTEXT(ctx);
7294 Node *n;
7295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7296 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
7297 if (n) {
7298 n[1].e = target;
7299 n[2].e = clamp;
7300 }
7301 if (ctx->ExecuteFlag) {
7302 CALL_ClampColor(ctx->Exec, (target, clamp));
7303 }
7304 }
7305
7306 /** GL_EXT_texture_integer */
7307 static void GLAPIENTRY
7308 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
7309 {
7310 GET_CURRENT_CONTEXT(ctx);
7311 Node *n;
7312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7313 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
7314 if (n) {
7315 n[1].i = red;
7316 n[2].i = green;
7317 n[3].i = blue;
7318 n[4].i = alpha;
7319 }
7320 if (ctx->ExecuteFlag) {
7321 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
7322 }
7323 }
7324
7325 /** GL_EXT_texture_integer */
7326 static void GLAPIENTRY
7327 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
7328 {
7329 GET_CURRENT_CONTEXT(ctx);
7330 Node *n;
7331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7332 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
7333 if (n) {
7334 n[1].ui = red;
7335 n[2].ui = green;
7336 n[3].ui = blue;
7337 n[4].ui = alpha;
7338 }
7339 if (ctx->ExecuteFlag) {
7340 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
7341 }
7342 }
7343
7344 /** GL_EXT_texture_integer */
7345 static void GLAPIENTRY
7346 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
7347 {
7348 GET_CURRENT_CONTEXT(ctx);
7349 Node *n;
7350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7351 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
7352 if (n) {
7353 n[1].e = target;
7354 n[2].e = pname;
7355 n[3].i = params[0];
7356 n[4].i = params[1];
7357 n[5].i = params[2];
7358 n[6].i = params[3];
7359 }
7360 if (ctx->ExecuteFlag) {
7361 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
7362 }
7363 }
7364
7365 /** GL_EXT_texture_integer */
7366 static void GLAPIENTRY
7367 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
7368 {
7369 GET_CURRENT_CONTEXT(ctx);
7370 Node *n;
7371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7372 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
7373 if (n) {
7374 n[1].e = target;
7375 n[2].e = pname;
7376 n[3].ui = params[0];
7377 n[4].ui = params[1];
7378 n[5].ui = params[2];
7379 n[6].ui = params[3];
7380 }
7381 if (ctx->ExecuteFlag) {
7382 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
7383 }
7384 }
7385
7386 /* GL_ARB_instanced_arrays */
7387 static void GLAPIENTRY
7388 save_VertexAttribDivisor(GLuint index, GLuint divisor)
7389 {
7390 GET_CURRENT_CONTEXT(ctx);
7391 Node *n;
7392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7393 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
7394 if (n) {
7395 n[1].ui = index;
7396 n[2].ui = divisor;
7397 }
7398 if (ctx->ExecuteFlag) {
7399 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
7400 }
7401 }
7402
7403
7404 /* GL_NV_texture_barrier */
7405 static void GLAPIENTRY
7406 save_TextureBarrierNV(void)
7407 {
7408 GET_CURRENT_CONTEXT(ctx);
7409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7410 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
7411 if (ctx->ExecuteFlag) {
7412 CALL_TextureBarrierNV(ctx->Exec, ());
7413 }
7414 }
7415
7416
7417 /* GL_ARB_sampler_objects */
7418 static void GLAPIENTRY
7419 save_BindSampler(GLuint unit, GLuint sampler)
7420 {
7421 Node *n;
7422 GET_CURRENT_CONTEXT(ctx);
7423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7424 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
7425 if (n) {
7426 n[1].ui = unit;
7427 n[2].ui = sampler;
7428 }
7429 if (ctx->ExecuteFlag) {
7430 CALL_BindSampler(ctx->Exec, (unit, sampler));
7431 }
7432 }
7433
7434 static void GLAPIENTRY
7435 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
7436 {
7437 Node *n;
7438 GET_CURRENT_CONTEXT(ctx);
7439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7440 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
7441 if (n) {
7442 n[1].ui = sampler;
7443 n[2].e = pname;
7444 n[3].i = params[0];
7445 if (pname == GL_TEXTURE_BORDER_COLOR) {
7446 n[4].i = params[1];
7447 n[5].i = params[2];
7448 n[6].i = params[3];
7449 }
7450 else {
7451 n[4].i = n[5].i = n[6].i = 0;
7452 }
7453 }
7454 if (ctx->ExecuteFlag) {
7455 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
7456 }
7457 }
7458
7459 static void GLAPIENTRY
7460 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
7461 {
7462 GLint parray[4];
7463 parray[0] = param;
7464 parray[1] = parray[2] = parray[3] = 0;
7465 save_SamplerParameteriv(sampler, pname, parray);
7466 }
7467
7468 static void GLAPIENTRY
7469 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
7470 {
7471 Node *n;
7472 GET_CURRENT_CONTEXT(ctx);
7473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7474 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
7475 if (n) {
7476 n[1].ui = sampler;
7477 n[2].e = pname;
7478 n[3].f = params[0];
7479 if (pname == GL_TEXTURE_BORDER_COLOR) {
7480 n[4].f = params[1];
7481 n[5].f = params[2];
7482 n[6].f = params[3];
7483 }
7484 else {
7485 n[4].f = n[5].f = n[6].f = 0.0F;
7486 }
7487 }
7488 if (ctx->ExecuteFlag) {
7489 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
7490 }
7491 }
7492
7493 static void GLAPIENTRY
7494 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
7495 {
7496 GLfloat parray[4];
7497 parray[0] = param;
7498 parray[1] = parray[2] = parray[3] = 0.0F;
7499 save_SamplerParameterfv(sampler, pname, parray);
7500 }
7501
7502 static void GLAPIENTRY
7503 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
7504 {
7505 Node *n;
7506 GET_CURRENT_CONTEXT(ctx);
7507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7508 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
7509 if (n) {
7510 n[1].ui = sampler;
7511 n[2].e = pname;
7512 n[3].i = params[0];
7513 if (pname == GL_TEXTURE_BORDER_COLOR) {
7514 n[4].i = params[1];
7515 n[5].i = params[2];
7516 n[6].i = params[3];
7517 }
7518 else {
7519 n[4].i = n[5].i = n[6].i = 0;
7520 }
7521 }
7522 if (ctx->ExecuteFlag) {
7523 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
7524 }
7525 }
7526
7527 static void GLAPIENTRY
7528 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
7529 {
7530 Node *n;
7531 GET_CURRENT_CONTEXT(ctx);
7532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7533 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
7534 if (n) {
7535 n[1].ui = sampler;
7536 n[2].e = pname;
7537 n[3].ui = params[0];
7538 if (pname == GL_TEXTURE_BORDER_COLOR) {
7539 n[4].ui = params[1];
7540 n[5].ui = params[2];
7541 n[6].ui = params[3];
7542 }
7543 else {
7544 n[4].ui = n[5].ui = n[6].ui = 0;
7545 }
7546 }
7547 if (ctx->ExecuteFlag) {
7548 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
7549 }
7550 }
7551
7552 static void GLAPIENTRY
7553 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
7554 {
7555 Node *n;
7556 GET_CURRENT_CONTEXT(ctx);
7557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7558 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
7559 if (n) {
7560 union uint64_pair p;
7561 p.uint64 = timeout;
7562 n[1].bf = flags;
7563 n[2].ui = p.uint32[0];
7564 n[3].ui = p.uint32[1];
7565 save_pointer(&n[4], sync);
7566 }
7567 if (ctx->ExecuteFlag) {
7568 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
7569 }
7570 }
7571
7572
7573 /** GL_NV_conditional_render */
7574 static void GLAPIENTRY
7575 save_BeginConditionalRender(GLuint queryId, GLenum mode)
7576 {
7577 GET_CURRENT_CONTEXT(ctx);
7578 Node *n;
7579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7580 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
7581 if (n) {
7582 n[1].i = queryId;
7583 n[2].e = mode;
7584 }
7585 if (ctx->ExecuteFlag) {
7586 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
7587 }
7588 }
7589
7590 static void GLAPIENTRY
7591 save_EndConditionalRender(void)
7592 {
7593 GET_CURRENT_CONTEXT(ctx);
7594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7595 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
7596 if (ctx->ExecuteFlag) {
7597 CALL_EndConditionalRender(ctx->Exec, ());
7598 }
7599 }
7600
7601 static void GLAPIENTRY
7602 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
7603 {
7604 GET_CURRENT_CONTEXT(ctx);
7605 Node *n;
7606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7607 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
7608 if (n) {
7609 n[1].ui = prog;
7610 n[2].ui = index;
7611 n[3].ui = binding;
7612 }
7613 if (ctx->ExecuteFlag) {
7614 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
7615 }
7616 }
7617
7618
7619 /**
7620 * Save an error-generating command into display list.
7621 *
7622 * KW: Will appear in the list before the vertex buffer containing the
7623 * command that provoked the error. I don't see this as a problem.
7624 */
7625 static void
7626 save_error(struct gl_context *ctx, GLenum error, const char *s)
7627 {
7628 Node *n;
7629 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
7630 if (n) {
7631 n[1].e = error;
7632 save_pointer(&n[2], (void *) s);
7633 /* note: the data/string here doesn't have to be freed in
7634 * _mesa_delete_list() since the string is never dynamically
7635 * allocated.
7636 */
7637 }
7638 }
7639
7640
7641 /**
7642 * Compile an error into current display list.
7643 */
7644 void
7645 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
7646 {
7647 if (ctx->CompileFlag)
7648 save_error(ctx, error, s);
7649 if (ctx->ExecuteFlag)
7650 _mesa_error(ctx, error, "%s", s);
7651 }
7652
7653
7654 /**
7655 * Test if ID names a display list.
7656 */
7657 static GLboolean
7658 islist(struct gl_context *ctx, GLuint list)
7659 {
7660 if (list > 0 && _mesa_lookup_list(ctx, list)) {
7661 return GL_TRUE;
7662 }
7663 else {
7664 return GL_FALSE;
7665 }
7666 }
7667
7668
7669
7670 /**********************************************************************/
7671 /* Display list execution */
7672 /**********************************************************************/
7673
7674
7675 /*
7676 * Execute a display list. Note that the ListBase offset must have already
7677 * been added before calling this function. I.e. the list argument is
7678 * the absolute list number, not relative to ListBase.
7679 * \param list - display list number
7680 */
7681 static void
7682 execute_list(struct gl_context *ctx, GLuint list)
7683 {
7684 struct gl_display_list *dlist;
7685 Node *n;
7686 GLboolean done;
7687
7688 if (list == 0 || !islist(ctx, list))
7689 return;
7690
7691 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
7692 /* raise an error? */
7693 return;
7694 }
7695
7696 dlist = _mesa_lookup_list(ctx, list);
7697 if (!dlist)
7698 return;
7699
7700 ctx->ListState.CallDepth++;
7701
7702 vbo_save_BeginCallList(ctx, dlist);
7703
7704 n = dlist->Head;
7705
7706 done = GL_FALSE;
7707 while (!done) {
7708 const OpCode opcode = n[0].opcode;
7709
7710 if (is_ext_opcode(opcode)) {
7711 n += ext_opcode_execute(ctx, n);
7712 }
7713 else {
7714 switch (opcode) {
7715 case OPCODE_ERROR:
7716 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
7717 break;
7718 case OPCODE_ACCUM:
7719 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
7720 break;
7721 case OPCODE_ALPHA_FUNC:
7722 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
7723 break;
7724 case OPCODE_BIND_TEXTURE:
7725 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
7726 break;
7727 case OPCODE_BITMAP:
7728 {
7729 const struct gl_pixelstore_attrib save = ctx->Unpack;
7730 ctx->Unpack = ctx->DefaultPacking;
7731 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
7732 n[3].f, n[4].f, n[5].f, n[6].f,
7733 get_pointer(&n[7])));
7734 ctx->Unpack = save; /* restore */
7735 }
7736 break;
7737 case OPCODE_BLEND_COLOR:
7738 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7739 break;
7740 case OPCODE_BLEND_EQUATION:
7741 CALL_BlendEquation(ctx->Exec, (n[1].e));
7742 break;
7743 case OPCODE_BLEND_EQUATION_SEPARATE:
7744 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
7745 break;
7746 case OPCODE_BLEND_FUNC_SEPARATE:
7747 CALL_BlendFuncSeparate(ctx->Exec,
7748 (n[1].e, n[2].e, n[3].e, n[4].e));
7749 break;
7750
7751 case OPCODE_BLEND_FUNC_I:
7752 /* GL_ARB_draw_buffers_blend */
7753 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
7754 break;
7755 case OPCODE_BLEND_FUNC_SEPARATE_I:
7756 /* GL_ARB_draw_buffers_blend */
7757 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
7758 n[4].e, n[5].e));
7759 break;
7760 case OPCODE_BLEND_EQUATION_I:
7761 /* GL_ARB_draw_buffers_blend */
7762 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
7763 break;
7764 case OPCODE_BLEND_EQUATION_SEPARATE_I:
7765 /* GL_ARB_draw_buffers_blend */
7766 CALL_BlendEquationSeparateiARB(ctx->Exec,
7767 (n[1].ui, n[2].e, n[3].e));
7768 break;
7769
7770 case OPCODE_CALL_LIST:
7771 /* Generated by glCallList(), don't add ListBase */
7772 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
7773 execute_list(ctx, n[1].ui);
7774 }
7775 break;
7776 case OPCODE_CALL_LIST_OFFSET:
7777 /* Generated by glCallLists() so we must add ListBase */
7778 if (n[2].b) {
7779 /* user specified a bad data type at compile time */
7780 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
7781 }
7782 else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
7783 GLuint list = (GLuint) (ctx->List.ListBase + n[1].i);
7784 execute_list(ctx, list);
7785 }
7786 break;
7787 case OPCODE_CLEAR:
7788 CALL_Clear(ctx->Exec, (n[1].bf));
7789 break;
7790 case OPCODE_CLEAR_BUFFER_IV:
7791 {
7792 GLint value[4];
7793 value[0] = n[3].i;
7794 value[1] = n[4].i;
7795 value[2] = n[5].i;
7796 value[3] = n[6].i;
7797 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
7798 }
7799 break;
7800 case OPCODE_CLEAR_BUFFER_UIV:
7801 {
7802 GLuint value[4];
7803 value[0] = n[3].ui;
7804 value[1] = n[4].ui;
7805 value[2] = n[5].ui;
7806 value[3] = n[6].ui;
7807 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
7808 }
7809 break;
7810 case OPCODE_CLEAR_BUFFER_FV:
7811 {
7812 GLfloat value[4];
7813 value[0] = n[3].f;
7814 value[1] = n[4].f;
7815 value[2] = n[5].f;
7816 value[3] = n[6].f;
7817 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
7818 }
7819 break;
7820 case OPCODE_CLEAR_BUFFER_FI:
7821 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
7822 break;
7823 case OPCODE_CLEAR_COLOR:
7824 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7825 break;
7826 case OPCODE_CLEAR_ACCUM:
7827 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
7828 break;
7829 case OPCODE_CLEAR_DEPTH:
7830 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
7831 break;
7832 case OPCODE_CLEAR_INDEX:
7833 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
7834 break;
7835 case OPCODE_CLEAR_STENCIL:
7836 CALL_ClearStencil(ctx->Exec, (n[1].i));
7837 break;
7838 case OPCODE_CLIP_PLANE:
7839 {
7840 GLdouble eq[4];
7841 eq[0] = n[2].f;
7842 eq[1] = n[3].f;
7843 eq[2] = n[4].f;
7844 eq[3] = n[5].f;
7845 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
7846 }
7847 break;
7848 case OPCODE_COLOR_MASK:
7849 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
7850 break;
7851 case OPCODE_COLOR_MASK_INDEXED:
7852 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
7853 n[4].b, n[5].b));
7854 break;
7855 case OPCODE_COLOR_MATERIAL:
7856 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
7857 break;
7858 case OPCODE_COPY_PIXELS:
7859 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
7860 (GLsizei) n[3].i, (GLsizei) n[4].i,
7861 n[5].e));
7862 break;
7863 case OPCODE_COPY_TEX_IMAGE1D:
7864 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
7865 n[5].i, n[6].i, n[7].i));
7866 break;
7867 case OPCODE_COPY_TEX_IMAGE2D:
7868 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
7869 n[5].i, n[6].i, n[7].i, n[8].i));
7870 break;
7871 case OPCODE_COPY_TEX_SUB_IMAGE1D:
7872 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7873 n[4].i, n[5].i, n[6].i));
7874 break;
7875 case OPCODE_COPY_TEX_SUB_IMAGE2D:
7876 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7877 n[4].i, n[5].i, n[6].i, n[7].i,
7878 n[8].i));
7879 break;
7880 case OPCODE_COPY_TEX_SUB_IMAGE3D:
7881 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
7882 n[4].i, n[5].i, n[6].i, n[7].i,
7883 n[8].i, n[9].i));
7884 break;
7885 case OPCODE_CULL_FACE:
7886 CALL_CullFace(ctx->Exec, (n[1].e));
7887 break;
7888 case OPCODE_DEPTH_FUNC:
7889 CALL_DepthFunc(ctx->Exec, (n[1].e));
7890 break;
7891 case OPCODE_DEPTH_MASK:
7892 CALL_DepthMask(ctx->Exec, (n[1].b));
7893 break;
7894 case OPCODE_DEPTH_RANGE:
7895 CALL_DepthRange(ctx->Exec,
7896 ((GLclampd) n[1].f, (GLclampd) n[2].f));
7897 break;
7898 case OPCODE_DISABLE:
7899 CALL_Disable(ctx->Exec, (n[1].e));
7900 break;
7901 case OPCODE_DISABLE_INDEXED:
7902 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
7903 break;
7904 case OPCODE_DRAW_BUFFER:
7905 CALL_DrawBuffer(ctx->Exec, (n[1].e));
7906 break;
7907 case OPCODE_DRAW_PIXELS:
7908 {
7909 const struct gl_pixelstore_attrib save = ctx->Unpack;
7910 ctx->Unpack = ctx->DefaultPacking;
7911 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
7912 get_pointer(&n[5])));
7913 ctx->Unpack = save; /* restore */
7914 }
7915 break;
7916 case OPCODE_ENABLE:
7917 CALL_Enable(ctx->Exec, (n[1].e));
7918 break;
7919 case OPCODE_ENABLE_INDEXED:
7920 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
7921 break;
7922 case OPCODE_EVALMESH1:
7923 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
7924 break;
7925 case OPCODE_EVALMESH2:
7926 CALL_EvalMesh2(ctx->Exec,
7927 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
7928 break;
7929 case OPCODE_FOG:
7930 {
7931 GLfloat p[4];
7932 p[0] = n[2].f;
7933 p[1] = n[3].f;
7934 p[2] = n[4].f;
7935 p[3] = n[5].f;
7936 CALL_Fogfv(ctx->Exec, (n[1].e, p));
7937 }
7938 break;
7939 case OPCODE_FRONT_FACE:
7940 CALL_FrontFace(ctx->Exec, (n[1].e));
7941 break;
7942 case OPCODE_FRUSTUM:
7943 CALL_Frustum(ctx->Exec,
7944 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
7945 break;
7946 case OPCODE_HINT:
7947 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
7948 break;
7949 case OPCODE_INDEX_MASK:
7950 CALL_IndexMask(ctx->Exec, (n[1].ui));
7951 break;
7952 case OPCODE_INIT_NAMES:
7953 CALL_InitNames(ctx->Exec, ());
7954 break;
7955 case OPCODE_LIGHT:
7956 {
7957 GLfloat p[4];
7958 p[0] = n[3].f;
7959 p[1] = n[4].f;
7960 p[2] = n[5].f;
7961 p[3] = n[6].f;
7962 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
7963 }
7964 break;
7965 case OPCODE_LIGHT_MODEL:
7966 {
7967 GLfloat p[4];
7968 p[0] = n[2].f;
7969 p[1] = n[3].f;
7970 p[2] = n[4].f;
7971 p[3] = n[5].f;
7972 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
7973 }
7974 break;
7975 case OPCODE_LINE_STIPPLE:
7976 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
7977 break;
7978 case OPCODE_LINE_WIDTH:
7979 CALL_LineWidth(ctx->Exec, (n[1].f));
7980 break;
7981 case OPCODE_LIST_BASE:
7982 CALL_ListBase(ctx->Exec, (n[1].ui));
7983 break;
7984 case OPCODE_LOAD_IDENTITY:
7985 CALL_LoadIdentity(ctx->Exec, ());
7986 break;
7987 case OPCODE_LOAD_MATRIX:
7988 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
7989 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
7990 break;
7991 case OPCODE_LOAD_NAME:
7992 CALL_LoadName(ctx->Exec, (n[1].ui));
7993 break;
7994 case OPCODE_LOGIC_OP:
7995 CALL_LogicOp(ctx->Exec, (n[1].e));
7996 break;
7997 case OPCODE_MAP1:
7998 {
7999 GLenum target = n[1].e;
8000 GLint ustride = _mesa_evaluator_components(target);
8001 GLint uorder = n[5].i;
8002 GLfloat u1 = n[2].f;
8003 GLfloat u2 = n[3].f;
8004 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
8005 (GLfloat *) get_pointer(&n[6])));
8006 }
8007 break;
8008 case OPCODE_MAP2:
8009 {
8010 GLenum target = n[1].e;
8011 GLfloat u1 = n[2].f;
8012 GLfloat u2 = n[3].f;
8013 GLfloat v1 = n[4].f;
8014 GLfloat v2 = n[5].f;
8015 GLint ustride = n[6].i;
8016 GLint vstride = n[7].i;
8017 GLint uorder = n[8].i;
8018 GLint vorder = n[9].i;
8019 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
8020 v1, v2, vstride, vorder,
8021 (GLfloat *) get_pointer(&n[10])));
8022 }
8023 break;
8024 case OPCODE_MAPGRID1:
8025 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
8026 break;
8027 case OPCODE_MAPGRID2:
8028 CALL_MapGrid2f(ctx->Exec,
8029 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
8030 break;
8031 case OPCODE_MATRIX_MODE:
8032 CALL_MatrixMode(ctx->Exec, (n[1].e));
8033 break;
8034 case OPCODE_MULT_MATRIX:
8035 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
8036 break;
8037 case OPCODE_ORTHO:
8038 CALL_Ortho(ctx->Exec,
8039 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
8040 break;
8041 case OPCODE_PASSTHROUGH:
8042 CALL_PassThrough(ctx->Exec, (n[1].f));
8043 break;
8044 case OPCODE_PIXEL_MAP:
8045 CALL_PixelMapfv(ctx->Exec,
8046 (n[1].e, n[2].i, get_pointer(&n[3])));
8047 break;
8048 case OPCODE_PIXEL_TRANSFER:
8049 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
8050 break;
8051 case OPCODE_PIXEL_ZOOM:
8052 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
8053 break;
8054 case OPCODE_POINT_SIZE:
8055 CALL_PointSize(ctx->Exec, (n[1].f));
8056 break;
8057 case OPCODE_POINT_PARAMETERS:
8058 {
8059 GLfloat params[3];
8060 params[0] = n[2].f;
8061 params[1] = n[3].f;
8062 params[2] = n[4].f;
8063 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
8064 }
8065 break;
8066 case OPCODE_POLYGON_MODE:
8067 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
8068 break;
8069 case OPCODE_POLYGON_STIPPLE:
8070 {
8071 const struct gl_pixelstore_attrib save = ctx->Unpack;
8072 ctx->Unpack = ctx->DefaultPacking;
8073 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
8074 ctx->Unpack = save; /* restore */
8075 }
8076 break;
8077 case OPCODE_POLYGON_OFFSET:
8078 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
8079 break;
8080 case OPCODE_POLYGON_OFFSET_CLAMP:
8081 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8082 break;
8083 case OPCODE_POP_ATTRIB:
8084 CALL_PopAttrib(ctx->Exec, ());
8085 break;
8086 case OPCODE_POP_MATRIX:
8087 CALL_PopMatrix(ctx->Exec, ());
8088 break;
8089 case OPCODE_POP_NAME:
8090 CALL_PopName(ctx->Exec, ());
8091 break;
8092 case OPCODE_PRIORITIZE_TEXTURE:
8093 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
8094 break;
8095 case OPCODE_PUSH_ATTRIB:
8096 CALL_PushAttrib(ctx->Exec, (n[1].bf));
8097 break;
8098 case OPCODE_PUSH_MATRIX:
8099 CALL_PushMatrix(ctx->Exec, ());
8100 break;
8101 case OPCODE_PUSH_NAME:
8102 CALL_PushName(ctx->Exec, (n[1].ui));
8103 break;
8104 case OPCODE_RASTER_POS:
8105 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8106 break;
8107 case OPCODE_READ_BUFFER:
8108 CALL_ReadBuffer(ctx->Exec, (n[1].e));
8109 break;
8110 case OPCODE_ROTATE:
8111 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8112 break;
8113 case OPCODE_SCALE:
8114 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8115 break;
8116 case OPCODE_SCISSOR:
8117 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8118 break;
8119 case OPCODE_SHADE_MODEL:
8120 CALL_ShadeModel(ctx->Exec, (n[1].e));
8121 break;
8122 case OPCODE_PROVOKING_VERTEX:
8123 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
8124 break;
8125 case OPCODE_STENCIL_FUNC:
8126 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
8127 break;
8128 case OPCODE_STENCIL_MASK:
8129 CALL_StencilMask(ctx->Exec, (n[1].ui));
8130 break;
8131 case OPCODE_STENCIL_OP:
8132 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
8133 break;
8134 case OPCODE_STENCIL_FUNC_SEPARATE:
8135 CALL_StencilFuncSeparate(ctx->Exec,
8136 (n[1].e, n[2].e, n[3].i, n[4].ui));
8137 break;
8138 case OPCODE_STENCIL_MASK_SEPARATE:
8139 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
8140 break;
8141 case OPCODE_STENCIL_OP_SEPARATE:
8142 CALL_StencilOpSeparate(ctx->Exec,
8143 (n[1].e, n[2].e, n[3].e, n[4].e));
8144 break;
8145 case OPCODE_TEXENV:
8146 {
8147 GLfloat params[4];
8148 params[0] = n[3].f;
8149 params[1] = n[4].f;
8150 params[2] = n[5].f;
8151 params[3] = n[6].f;
8152 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
8153 }
8154 break;
8155 case OPCODE_TEXGEN:
8156 {
8157 GLfloat params[4];
8158 params[0] = n[3].f;
8159 params[1] = n[4].f;
8160 params[2] = n[5].f;
8161 params[3] = n[6].f;
8162 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
8163 }
8164 break;
8165 case OPCODE_TEXPARAMETER:
8166 {
8167 GLfloat params[4];
8168 params[0] = n[3].f;
8169 params[1] = n[4].f;
8170 params[2] = n[5].f;
8171 params[3] = n[6].f;
8172 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
8173 }
8174 break;
8175 case OPCODE_TEX_IMAGE1D:
8176 {
8177 const struct gl_pixelstore_attrib save = ctx->Unpack;
8178 ctx->Unpack = ctx->DefaultPacking;
8179 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
8180 n[2].i, /* level */
8181 n[3].i, /* components */
8182 n[4].i, /* width */
8183 n[5].e, /* border */
8184 n[6].e, /* format */
8185 n[7].e, /* type */
8186 get_pointer(&n[8])));
8187 ctx->Unpack = save; /* restore */
8188 }
8189 break;
8190 case OPCODE_TEX_IMAGE2D:
8191 {
8192 const struct gl_pixelstore_attrib save = ctx->Unpack;
8193 ctx->Unpack = ctx->DefaultPacking;
8194 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
8195 n[2].i, /* level */
8196 n[3].i, /* components */
8197 n[4].i, /* width */
8198 n[5].i, /* height */
8199 n[6].e, /* border */
8200 n[7].e, /* format */
8201 n[8].e, /* type */
8202 get_pointer(&n[9])));
8203 ctx->Unpack = save; /* restore */
8204 }
8205 break;
8206 case OPCODE_TEX_IMAGE3D:
8207 {
8208 const struct gl_pixelstore_attrib save = ctx->Unpack;
8209 ctx->Unpack = ctx->DefaultPacking;
8210 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
8211 n[2].i, /* level */
8212 n[3].i, /* components */
8213 n[4].i, /* width */
8214 n[5].i, /* height */
8215 n[6].i, /* depth */
8216 n[7].e, /* border */
8217 n[8].e, /* format */
8218 n[9].e, /* type */
8219 get_pointer(&n[10])));
8220 ctx->Unpack = save; /* restore */
8221 }
8222 break;
8223 case OPCODE_TEX_SUB_IMAGE1D:
8224 {
8225 const struct gl_pixelstore_attrib save = ctx->Unpack;
8226 ctx->Unpack = ctx->DefaultPacking;
8227 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8228 n[4].i, n[5].e,
8229 n[6].e, get_pointer(&n[7])));
8230 ctx->Unpack = save; /* restore */
8231 }
8232 break;
8233 case OPCODE_TEX_SUB_IMAGE2D:
8234 {
8235 const struct gl_pixelstore_attrib save = ctx->Unpack;
8236 ctx->Unpack = ctx->DefaultPacking;
8237 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8238 n[4].i, n[5].e,
8239 n[6].i, n[7].e, n[8].e,
8240 get_pointer(&n[9])));
8241 ctx->Unpack = save; /* restore */
8242 }
8243 break;
8244 case OPCODE_TEX_SUB_IMAGE3D:
8245 {
8246 const struct gl_pixelstore_attrib save = ctx->Unpack;
8247 ctx->Unpack = ctx->DefaultPacking;
8248 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
8249 n[4].i, n[5].i, n[6].i, n[7].i,
8250 n[8].i, n[9].e, n[10].e,
8251 get_pointer(&n[11])));
8252 ctx->Unpack = save; /* restore */
8253 }
8254 break;
8255 case OPCODE_TRANSLATE:
8256 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8257 break;
8258 case OPCODE_VIEWPORT:
8259 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
8260 (GLsizei) n[3].i, (GLsizei) n[4].i));
8261 break;
8262 case OPCODE_WINDOW_POS:
8263 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8264 break;
8265 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
8266 CALL_ActiveTexture(ctx->Exec, (n[1].e));
8267 break;
8268 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
8269 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8270 n[4].i, n[5].i, n[6].i,
8271 get_pointer(&n[7])));
8272 break;
8273 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
8274 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8275 n[4].i, n[5].i, n[6].i,
8276 n[7].i, get_pointer(&n[8])));
8277 break;
8278 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
8279 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
8280 n[4].i, n[5].i, n[6].i,
8281 n[7].i, n[8].i,
8282 get_pointer(&n[9])));
8283 break;
8284 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
8285 CALL_CompressedTexSubImage1D(ctx->Exec,
8286 (n[1].e, n[2].i, n[3].i, n[4].i,
8287 n[5].e, n[6].i,
8288 get_pointer(&n[7])));
8289 break;
8290 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
8291 CALL_CompressedTexSubImage2D(ctx->Exec,
8292 (n[1].e, n[2].i, n[3].i, n[4].i,
8293 n[5].i, n[6].i, n[7].e, n[8].i,
8294 get_pointer(&n[9])));
8295 break;
8296 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
8297 CALL_CompressedTexSubImage3D(ctx->Exec,
8298 (n[1].e, n[2].i, n[3].i, n[4].i,
8299 n[5].i, n[6].i, n[7].i, n[8].i,
8300 n[9].e, n[10].i,
8301 get_pointer(&n[11])));
8302 break;
8303 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
8304 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
8305 break;
8306 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
8307 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
8308 break;
8309 case OPCODE_BIND_PROGRAM_NV: /* GL_ARB_vertex_program */
8310 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
8311 break;
8312 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
8313 CALL_ProgramLocalParameter4fARB(ctx->Exec,
8314 (n[1].e, n[2].ui, n[3].f, n[4].f,
8315 n[5].f, n[6].f));
8316 break;
8317 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
8318 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
8319 break;
8320 case OPCODE_DEPTH_BOUNDS_EXT:
8321 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
8322 break;
8323 case OPCODE_PROGRAM_STRING_ARB:
8324 CALL_ProgramStringARB(ctx->Exec,
8325 (n[1].e, n[2].e, n[3].i,
8326 get_pointer(&n[4])));
8327 break;
8328 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
8329 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
8330 n[4].f, n[5].f,
8331 n[6].f));
8332 break;
8333 case OPCODE_BEGIN_QUERY_ARB:
8334 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
8335 break;
8336 case OPCODE_END_QUERY_ARB:
8337 CALL_EndQuery(ctx->Exec, (n[1].e));
8338 break;
8339 case OPCODE_QUERY_COUNTER:
8340 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
8341 break;
8342 case OPCODE_BEGIN_QUERY_INDEXED:
8343 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
8344 break;
8345 case OPCODE_END_QUERY_INDEXED:
8346 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
8347 break;
8348 case OPCODE_DRAW_BUFFERS_ARB:
8349 {
8350 GLenum buffers[MAX_DRAW_BUFFERS];
8351 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
8352 for (i = 0; i < count; i++)
8353 buffers[i] = n[2 + i].e;
8354 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
8355 }
8356 break;
8357 case OPCODE_BLIT_FRAMEBUFFER:
8358 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
8359 n[5].i, n[6].i, n[7].i, n[8].i,
8360 n[9].i, n[10].e));
8361 break;
8362 case OPCODE_USE_PROGRAM:
8363 CALL_UseProgram(ctx->Exec, (n[1].ui));
8364 break;
8365 case OPCODE_UNIFORM_1F:
8366 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
8367 break;
8368 case OPCODE_UNIFORM_2F:
8369 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
8370 break;
8371 case OPCODE_UNIFORM_3F:
8372 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
8373 break;
8374 case OPCODE_UNIFORM_4F:
8375 CALL_Uniform4f(ctx->Exec,
8376 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
8377 break;
8378 case OPCODE_UNIFORM_1FV:
8379 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8380 break;
8381 case OPCODE_UNIFORM_2FV:
8382 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8383 break;
8384 case OPCODE_UNIFORM_3FV:
8385 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8386 break;
8387 case OPCODE_UNIFORM_4FV:
8388 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8389 break;
8390 case OPCODE_UNIFORM_1I:
8391 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
8392 break;
8393 case OPCODE_UNIFORM_2I:
8394 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
8395 break;
8396 case OPCODE_UNIFORM_3I:
8397 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8398 break;
8399 case OPCODE_UNIFORM_4I:
8400 CALL_Uniform4i(ctx->Exec,
8401 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8402 break;
8403 case OPCODE_UNIFORM_1IV:
8404 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8405 break;
8406 case OPCODE_UNIFORM_2IV:
8407 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8408 break;
8409 case OPCODE_UNIFORM_3IV:
8410 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8411 break;
8412 case OPCODE_UNIFORM_4IV:
8413 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
8414 break;
8415 case OPCODE_UNIFORM_1UI:
8416 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8417 break;
8418 case OPCODE_UNIFORM_2UI:
8419 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8420 break;
8421 case OPCODE_UNIFORM_3UI:
8422 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8423 break;
8424 case OPCODE_UNIFORM_4UI:
8425 /*CALL_Uniform4uiARB(ctx->Exec,
8426 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8427 */
8428 break;
8429 case OPCODE_UNIFORM_1UIV:
8430 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8431 get_pointer(&n[3])));*/
8432 break;
8433 case OPCODE_UNIFORM_2UIV:
8434 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8435 get_pointer(&n[3])));*/
8436 break;
8437 case OPCODE_UNIFORM_3UIV:
8438 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8439 get_pointer(&n[3])));*/
8440 break;
8441 case OPCODE_UNIFORM_4UIV:
8442 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8443 get_pointer(&n[3])));*/
8444 break;
8445 case OPCODE_UNIFORM_MATRIX22:
8446 CALL_UniformMatrix2fv(ctx->Exec,
8447 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8448 break;
8449 case OPCODE_UNIFORM_MATRIX33:
8450 CALL_UniformMatrix3fv(ctx->Exec,
8451 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8452 break;
8453 case OPCODE_UNIFORM_MATRIX44:
8454 CALL_UniformMatrix4fv(ctx->Exec,
8455 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8456 break;
8457 case OPCODE_UNIFORM_MATRIX23:
8458 CALL_UniformMatrix2x3fv(ctx->Exec,
8459 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8460 break;
8461 case OPCODE_UNIFORM_MATRIX32:
8462 CALL_UniformMatrix3x2fv(ctx->Exec,
8463 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8464 break;
8465 case OPCODE_UNIFORM_MATRIX24:
8466 CALL_UniformMatrix2x4fv(ctx->Exec,
8467 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8468 break;
8469 case OPCODE_UNIFORM_MATRIX42:
8470 CALL_UniformMatrix4x2fv(ctx->Exec,
8471 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8472 break;
8473 case OPCODE_UNIFORM_MATRIX34:
8474 CALL_UniformMatrix3x4fv(ctx->Exec,
8475 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8476 break;
8477 case OPCODE_UNIFORM_MATRIX43:
8478 CALL_UniformMatrix4x3fv(ctx->Exec,
8479 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
8480 break;
8481
8482 case OPCODE_USE_PROGRAM_STAGES:
8483 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
8484 break;
8485 case OPCODE_PROGRAM_UNIFORM_1F:
8486 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
8487 break;
8488 case OPCODE_PROGRAM_UNIFORM_2F:
8489 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
8490 break;
8491 case OPCODE_PROGRAM_UNIFORM_3F:
8492 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
8493 n[3].f, n[4].f, n[5].f));
8494 break;
8495 case OPCODE_PROGRAM_UNIFORM_4F:
8496 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
8497 n[3].f, n[4].f, n[5].f, n[6].f));
8498 break;
8499 case OPCODE_PROGRAM_UNIFORM_1FV:
8500 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8501 get_pointer(&n[4])));
8502 break;
8503 case OPCODE_PROGRAM_UNIFORM_2FV:
8504 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8505 get_pointer(&n[4])));
8506 break;
8507 case OPCODE_PROGRAM_UNIFORM_3FV:
8508 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8509 get_pointer(&n[4])));
8510 break;
8511 case OPCODE_PROGRAM_UNIFORM_4FV:
8512 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8513 get_pointer(&n[4])));
8514 break;
8515 case OPCODE_PROGRAM_UNIFORM_1I:
8516 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
8517 break;
8518 case OPCODE_PROGRAM_UNIFORM_2I:
8519 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
8520 break;
8521 case OPCODE_PROGRAM_UNIFORM_3I:
8522 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
8523 n[3].i, n[4].i, n[5].i));
8524 break;
8525 case OPCODE_PROGRAM_UNIFORM_4I:
8526 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
8527 n[3].i, n[4].i, n[5].i, n[6].i));
8528 break;
8529 case OPCODE_PROGRAM_UNIFORM_1IV:
8530 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8531 get_pointer(&n[4])));
8532 break;
8533 case OPCODE_PROGRAM_UNIFORM_2IV:
8534 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8535 get_pointer(&n[4])));
8536 break;
8537 case OPCODE_PROGRAM_UNIFORM_3IV:
8538 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8539 get_pointer(&n[4])));
8540 break;
8541 case OPCODE_PROGRAM_UNIFORM_4IV:
8542 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8543 get_pointer(&n[4])));
8544 break;
8545 case OPCODE_PROGRAM_UNIFORM_1UI:
8546 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
8547 break;
8548 case OPCODE_PROGRAM_UNIFORM_2UI:
8549 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
8550 n[3].ui, n[4].ui));
8551 break;
8552 case OPCODE_PROGRAM_UNIFORM_3UI:
8553 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
8554 n[3].ui, n[4].ui, n[5].ui));
8555 break;
8556 case OPCODE_PROGRAM_UNIFORM_4UI:
8557 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
8558 n[3].ui,
8559 n[4].ui, n[5].ui, n[6].ui));
8560 break;
8561 case OPCODE_PROGRAM_UNIFORM_1UIV:
8562 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8563 get_pointer(&n[4])));
8564 break;
8565 case OPCODE_PROGRAM_UNIFORM_2UIV:
8566 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8567 get_pointer(&n[4])));
8568 break;
8569 case OPCODE_PROGRAM_UNIFORM_3UIV:
8570 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8571 get_pointer(&n[4])));
8572 break;
8573 case OPCODE_PROGRAM_UNIFORM_4UIV:
8574 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
8575 get_pointer(&n[4])));
8576 break;
8577 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
8578 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8579 (n[1].ui, n[2].i, n[3].i, n[4].b,
8580 get_pointer(&n[5])));
8581 break;
8582 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
8583 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8584 (n[1].ui, n[2].i, n[3].i, n[4].b,
8585 get_pointer(&n[5])));
8586 break;
8587 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
8588 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8589 (n[1].ui, n[2].i, n[3].i, n[4].b,
8590 get_pointer(&n[5])));
8591 break;
8592 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
8593 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8594 (n[1].ui, n[2].i, n[3].i, n[4].b,
8595 get_pointer(&n[5])));
8596 break;
8597 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
8598 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8599 (n[1].ui, n[2].i, n[3].i, n[4].b,
8600 get_pointer(&n[5])));
8601 break;
8602 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
8603 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8604 (n[1].ui, n[2].i, n[3].i, n[4].b,
8605 get_pointer(&n[5])));
8606 break;
8607 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
8608 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8609 (n[1].ui, n[2].i, n[3].i, n[4].b,
8610 get_pointer(&n[5])));
8611 break;
8612 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
8613 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8614 (n[1].ui, n[2].i, n[3].i, n[4].b,
8615 get_pointer(&n[5])));
8616 break;
8617 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
8618 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8619 (n[1].ui, n[2].i, n[3].i, n[4].b,
8620 get_pointer(&n[5])));
8621 break;
8622
8623 case OPCODE_CLIP_CONTROL:
8624 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
8625 break;
8626
8627 case OPCODE_CLAMP_COLOR:
8628 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
8629 break;
8630
8631 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
8632 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
8633 break;
8634 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
8635 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
8636 break;
8637 case OPCODE_ATTR_1F_NV:
8638 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
8639 break;
8640 case OPCODE_ATTR_2F_NV:
8641 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
8642 break;
8643 case OPCODE_ATTR_3F_NV:
8644 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
8645 break;
8646 case OPCODE_ATTR_4F_NV:
8647 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
8648 break;
8649 case OPCODE_ATTR_1F_ARB:
8650 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
8651 break;
8652 case OPCODE_ATTR_2F_ARB:
8653 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
8654 break;
8655 case OPCODE_ATTR_3F_ARB:
8656 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
8657 break;
8658 case OPCODE_ATTR_4F_ARB:
8659 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
8660 break;
8661 case OPCODE_MATERIAL:
8662 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
8663 break;
8664 case OPCODE_BEGIN:
8665 CALL_Begin(ctx->Exec, (n[1].e));
8666 break;
8667 case OPCODE_END:
8668 CALL_End(ctx->Exec, ());
8669 break;
8670 case OPCODE_RECTF:
8671 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
8672 break;
8673 case OPCODE_EVAL_C1:
8674 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
8675 break;
8676 case OPCODE_EVAL_C2:
8677 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
8678 break;
8679 case OPCODE_EVAL_P1:
8680 CALL_EvalPoint1(ctx->Exec, (n[1].i));
8681 break;
8682 case OPCODE_EVAL_P2:
8683 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
8684 break;
8685
8686 /* GL_EXT_texture_integer */
8687 case OPCODE_CLEARCOLOR_I:
8688 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
8689 break;
8690 case OPCODE_CLEARCOLOR_UI:
8691 CALL_ClearColorIuiEXT(ctx->Exec,
8692 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
8693 break;
8694 case OPCODE_TEXPARAMETER_I:
8695 {
8696 GLint params[4];
8697 params[0] = n[3].i;
8698 params[1] = n[4].i;
8699 params[2] = n[5].i;
8700 params[3] = n[6].i;
8701 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
8702 }
8703 break;
8704 case OPCODE_TEXPARAMETER_UI:
8705 {
8706 GLuint params[4];
8707 params[0] = n[3].ui;
8708 params[1] = n[4].ui;
8709 params[2] = n[5].ui;
8710 params[3] = n[6].ui;
8711 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
8712 }
8713 break;
8714
8715 case OPCODE_VERTEX_ATTRIB_DIVISOR:
8716 /* GL_ARB_instanced_arrays */
8717 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
8718 break;
8719
8720 case OPCODE_TEXTURE_BARRIER_NV:
8721 CALL_TextureBarrierNV(ctx->Exec, ());
8722 break;
8723
8724 /* GL_EXT/ARB_transform_feedback */
8725 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
8726 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
8727 break;
8728 case OPCODE_END_TRANSFORM_FEEDBACK:
8729 CALL_EndTransformFeedback(ctx->Exec, ());
8730 break;
8731 case OPCODE_BIND_TRANSFORM_FEEDBACK:
8732 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
8733 break;
8734 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
8735 CALL_PauseTransformFeedback(ctx->Exec, ());
8736 break;
8737 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
8738 CALL_ResumeTransformFeedback(ctx->Exec, ());
8739 break;
8740 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
8741 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
8742 break;
8743 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
8744 CALL_DrawTransformFeedbackStream(ctx->Exec,
8745 (n[1].e, n[2].ui, n[3].ui));
8746 break;
8747 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
8748 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
8749 (n[1].e, n[2].ui, n[3].si));
8750 break;
8751 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
8752 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
8753 (n[1].e, n[2].ui, n[3].ui, n[4].si));
8754 break;
8755
8756
8757 case OPCODE_BIND_SAMPLER:
8758 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
8759 break;
8760 case OPCODE_SAMPLER_PARAMETERIV:
8761 {
8762 GLint params[4];
8763 params[0] = n[3].i;
8764 params[1] = n[4].i;
8765 params[2] = n[5].i;
8766 params[3] = n[6].i;
8767 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
8768 }
8769 break;
8770 case OPCODE_SAMPLER_PARAMETERFV:
8771 {
8772 GLfloat params[4];
8773 params[0] = n[3].f;
8774 params[1] = n[4].f;
8775 params[2] = n[5].f;
8776 params[3] = n[6].f;
8777 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
8778 }
8779 break;
8780 case OPCODE_SAMPLER_PARAMETERIIV:
8781 {
8782 GLint params[4];
8783 params[0] = n[3].i;
8784 params[1] = n[4].i;
8785 params[2] = n[5].i;
8786 params[3] = n[6].i;
8787 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
8788 }
8789 break;
8790 case OPCODE_SAMPLER_PARAMETERUIV:
8791 {
8792 GLuint params[4];
8793 params[0] = n[3].ui;
8794 params[1] = n[4].ui;
8795 params[2] = n[5].ui;
8796 params[3] = n[6].ui;
8797 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
8798 }
8799 break;
8800
8801 /* GL_ARB_sync */
8802 case OPCODE_WAIT_SYNC:
8803 {
8804 union uint64_pair p;
8805 p.uint32[0] = n[2].ui;
8806 p.uint32[1] = n[3].ui;
8807 CALL_WaitSync(ctx->Exec,
8808 (get_pointer(&n[4]), n[1].bf, p.uint64));
8809 }
8810 break;
8811
8812 /* GL_NV_conditional_render */
8813 case OPCODE_BEGIN_CONDITIONAL_RENDER:
8814 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
8815 break;
8816 case OPCODE_END_CONDITIONAL_RENDER:
8817 CALL_EndConditionalRender(ctx->Exec, ());
8818 break;
8819
8820 case OPCODE_UNIFORM_BLOCK_BINDING:
8821 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
8822 break;
8823
8824 case OPCODE_CONTINUE:
8825 n = (Node *) get_pointer(&n[1]);
8826 break;
8827 case OPCODE_NOP:
8828 /* no-op */
8829 break;
8830 case OPCODE_END_OF_LIST:
8831 done = GL_TRUE;
8832 break;
8833 default:
8834 {
8835 char msg[1000];
8836 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
8837 (int) opcode);
8838 _mesa_problem(ctx, "%s", msg);
8839 }
8840 done = GL_TRUE;
8841 }
8842
8843 /* increment n to point to next compiled command */
8844 if (opcode != OPCODE_CONTINUE) {
8845 n += InstSize[opcode];
8846 }
8847 }
8848 }
8849
8850 vbo_save_EndCallList(ctx);
8851
8852 ctx->ListState.CallDepth--;
8853 }
8854
8855
8856
8857 /**********************************************************************/
8858 /* GL functions */
8859 /**********************************************************************/
8860
8861 /**
8862 * Test if a display list number is valid.
8863 */
8864 GLboolean GLAPIENTRY
8865 _mesa_IsList(GLuint list)
8866 {
8867 GET_CURRENT_CONTEXT(ctx);
8868 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8869 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
8870 return islist(ctx, list);
8871 }
8872
8873
8874 /**
8875 * Delete a sequence of consecutive display lists.
8876 */
8877 void GLAPIENTRY
8878 _mesa_DeleteLists(GLuint list, GLsizei range)
8879 {
8880 GET_CURRENT_CONTEXT(ctx);
8881 GLuint i;
8882 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8883 ASSERT_OUTSIDE_BEGIN_END(ctx);
8884
8885 if (range < 0) {
8886 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
8887 return;
8888 }
8889 for (i = list; i < list + range; i++) {
8890 destroy_list(ctx, i);
8891 }
8892 }
8893
8894
8895 /**
8896 * Return a display list number, n, such that lists n through n+range-1
8897 * are free.
8898 */
8899 GLuint GLAPIENTRY
8900 _mesa_GenLists(GLsizei range)
8901 {
8902 GET_CURRENT_CONTEXT(ctx);
8903 GLuint base;
8904 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
8905 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
8906
8907 if (range < 0) {
8908 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
8909 return 0;
8910 }
8911 if (range == 0) {
8912 return 0;
8913 }
8914
8915 /*
8916 * Make this an atomic operation
8917 */
8918 mtx_lock(&ctx->Shared->Mutex);
8919
8920 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
8921 if (base) {
8922 /* reserve the list IDs by with empty/dummy lists */
8923 GLint i;
8924 for (i = 0; i < range; i++) {
8925 _mesa_HashInsert(ctx->Shared->DisplayList, base + i,
8926 make_list(base + i, 1));
8927 }
8928 }
8929
8930 mtx_unlock(&ctx->Shared->Mutex);
8931
8932 return base;
8933 }
8934
8935
8936 /**
8937 * Begin a new display list.
8938 */
8939 void GLAPIENTRY
8940 _mesa_NewList(GLuint name, GLenum mode)
8941 {
8942 GET_CURRENT_CONTEXT(ctx);
8943
8944 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
8945 ASSERT_OUTSIDE_BEGIN_END(ctx);
8946
8947 if (MESA_VERBOSE & VERBOSE_API)
8948 _mesa_debug(ctx, "glNewList %u %s\n", name,
8949 _mesa_enum_to_string(mode));
8950
8951 if (name == 0) {
8952 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
8953 return;
8954 }
8955
8956 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
8957 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
8958 return;
8959 }
8960
8961 if (ctx->ListState.CurrentList) {
8962 /* already compiling a display list */
8963 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
8964 return;
8965 }
8966
8967 ctx->CompileFlag = GL_TRUE;
8968 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
8969
8970 /* Reset accumulated list state */
8971 invalidate_saved_current_state( ctx );
8972
8973 /* Allocate new display list */
8974 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
8975 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
8976 ctx->ListState.CurrentPos = 0;
8977
8978 vbo_save_NewList(ctx, name, mode);
8979
8980 ctx->CurrentDispatch = ctx->Save;
8981 _glapi_set_dispatch(ctx->CurrentDispatch);
8982 }
8983
8984
8985 /**
8986 * End definition of current display list.
8987 */
8988 void GLAPIENTRY
8989 _mesa_EndList(void)
8990 {
8991 GET_CURRENT_CONTEXT(ctx);
8992 SAVE_FLUSH_VERTICES(ctx);
8993 FLUSH_VERTICES(ctx, 0);
8994
8995 if (MESA_VERBOSE & VERBOSE_API)
8996 _mesa_debug(ctx, "glEndList\n");
8997
8998 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
8999 _mesa_error(ctx, GL_INVALID_OPERATION,
9000 "glEndList() called inside glBegin/End");
9001 }
9002
9003 /* Check that a list is under construction */
9004 if (!ctx->ListState.CurrentList) {
9005 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
9006 return;
9007 }
9008
9009 /* Call before emitting END_OF_LIST, in case the driver wants to
9010 * emit opcodes itself.
9011 */
9012 vbo_save_EndList(ctx);
9013
9014 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
9015
9016 trim_list(ctx);
9017
9018 /* Destroy old list, if any */
9019 destroy_list(ctx, ctx->ListState.CurrentList->Name);
9020
9021 /* Install the new list */
9022 _mesa_HashInsert(ctx->Shared->DisplayList,
9023 ctx->ListState.CurrentList->Name,
9024 ctx->ListState.CurrentList);
9025
9026
9027 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
9028 mesa_print_display_list(ctx->ListState.CurrentList->Name);
9029
9030 ctx->ListState.CurrentList = NULL;
9031 ctx->ListState.CurrentBlock = NULL;
9032 ctx->ListState.CurrentPos = 0;
9033 ctx->ExecuteFlag = GL_TRUE;
9034 ctx->CompileFlag = GL_FALSE;
9035
9036 ctx->CurrentDispatch = ctx->Exec;
9037 _glapi_set_dispatch(ctx->CurrentDispatch);
9038 }
9039
9040
9041 void GLAPIENTRY
9042 _mesa_CallList(GLuint list)
9043 {
9044 GLboolean save_compile_flag;
9045 GET_CURRENT_CONTEXT(ctx);
9046 FLUSH_CURRENT(ctx, 0);
9047
9048 if (MESA_VERBOSE & VERBOSE_API)
9049 _mesa_debug(ctx, "glCallList %d\n", list);
9050
9051 if (list == 0) {
9052 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
9053 return;
9054 }
9055
9056 if (0)
9057 mesa_print_display_list( list );
9058
9059 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9060 * execute the display list, and restore the CompileFlag.
9061 */
9062 save_compile_flag = ctx->CompileFlag;
9063 if (save_compile_flag) {
9064 ctx->CompileFlag = GL_FALSE;
9065 }
9066
9067 execute_list(ctx, list);
9068 ctx->CompileFlag = save_compile_flag;
9069
9070 /* also restore API function pointers to point to "save" versions */
9071 if (save_compile_flag) {
9072 ctx->CurrentDispatch = ctx->Save;
9073 _glapi_set_dispatch(ctx->CurrentDispatch);
9074 }
9075 }
9076
9077
9078 /**
9079 * Execute glCallLists: call multiple display lists.
9080 */
9081 void GLAPIENTRY
9082 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
9083 {
9084 GET_CURRENT_CONTEXT(ctx);
9085 GLint i;
9086 GLboolean save_compile_flag;
9087
9088 if (MESA_VERBOSE & VERBOSE_API)
9089 _mesa_debug(ctx, "glCallLists %d\n", n);
9090
9091 switch (type) {
9092 case GL_BYTE:
9093 case GL_UNSIGNED_BYTE:
9094 case GL_SHORT:
9095 case GL_UNSIGNED_SHORT:
9096 case GL_INT:
9097 case GL_UNSIGNED_INT:
9098 case GL_FLOAT:
9099 case GL_2_BYTES:
9100 case GL_3_BYTES:
9101 case GL_4_BYTES:
9102 /* OK */
9103 break;
9104 default:
9105 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
9106 return;
9107 }
9108
9109 /* Save the CompileFlag status, turn it off, execute display list,
9110 * and restore the CompileFlag.
9111 */
9112 save_compile_flag = ctx->CompileFlag;
9113 ctx->CompileFlag = GL_FALSE;
9114
9115 for (i = 0; i < n; i++) {
9116 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
9117 execute_list(ctx, list);
9118 }
9119
9120 ctx->CompileFlag = save_compile_flag;
9121
9122 /* also restore API function pointers to point to "save" versions */
9123 if (save_compile_flag) {
9124 ctx->CurrentDispatch = ctx->Save;
9125 _glapi_set_dispatch(ctx->CurrentDispatch);
9126 }
9127 }
9128
9129
9130 /**
9131 * Set the offset added to list numbers in glCallLists.
9132 */
9133 void GLAPIENTRY
9134 _mesa_ListBase(GLuint base)
9135 {
9136 GET_CURRENT_CONTEXT(ctx);
9137 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
9138 ASSERT_OUTSIDE_BEGIN_END(ctx);
9139 ctx->List.ListBase = base;
9140 }
9141
9142 /**
9143 * Setup the given dispatch table to point to Mesa's display list
9144 * building functions.
9145 *
9146 * This does not include any of the tnl functions - they are
9147 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9148 * struct.
9149 */
9150 void
9151 _mesa_initialize_save_table(const struct gl_context *ctx)
9152 {
9153 struct _glapi_table *table = ctx->Save;
9154 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
9155
9156 /* Initially populate the dispatch table with the contents of the
9157 * normal-execution dispatch table. This lets us skip populating functions
9158 * that should be called directly instead of compiled into display lists.
9159 */
9160 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
9161
9162 _mesa_loopback_init_api_table(ctx, table);
9163
9164 /* VBO functions */
9165 vbo_initialize_save_dispatch(ctx, table);
9166
9167 /* GL 1.0 */
9168 SET_Accum(table, save_Accum);
9169 SET_AlphaFunc(table, save_AlphaFunc);
9170 SET_Bitmap(table, save_Bitmap);
9171 SET_BlendFunc(table, save_BlendFunc);
9172 SET_CallList(table, save_CallList);
9173 SET_CallLists(table, save_CallLists);
9174 SET_Clear(table, save_Clear);
9175 SET_ClearAccum(table, save_ClearAccum);
9176 SET_ClearColor(table, save_ClearColor);
9177 SET_ClearDepth(table, save_ClearDepth);
9178 SET_ClearIndex(table, save_ClearIndex);
9179 SET_ClearStencil(table, save_ClearStencil);
9180 SET_ClipPlane(table, save_ClipPlane);
9181 SET_ColorMask(table, save_ColorMask);
9182 SET_ColorMaski(table, save_ColorMaskIndexed);
9183 SET_ColorMaterial(table, save_ColorMaterial);
9184 SET_CopyPixels(table, save_CopyPixels);
9185 SET_CullFace(table, save_CullFace);
9186 SET_DepthFunc(table, save_DepthFunc);
9187 SET_DepthMask(table, save_DepthMask);
9188 SET_DepthRange(table, save_DepthRange);
9189 SET_Disable(table, save_Disable);
9190 SET_Disablei(table, save_DisableIndexed);
9191 SET_DrawBuffer(table, save_DrawBuffer);
9192 SET_DrawPixels(table, save_DrawPixels);
9193 SET_Enable(table, save_Enable);
9194 SET_Enablei(table, save_EnableIndexed);
9195 SET_EvalMesh1(table, save_EvalMesh1);
9196 SET_EvalMesh2(table, save_EvalMesh2);
9197 SET_Fogf(table, save_Fogf);
9198 SET_Fogfv(table, save_Fogfv);
9199 SET_Fogi(table, save_Fogi);
9200 SET_Fogiv(table, save_Fogiv);
9201 SET_FrontFace(table, save_FrontFace);
9202 SET_Frustum(table, save_Frustum);
9203 SET_Hint(table, save_Hint);
9204 SET_IndexMask(table, save_IndexMask);
9205 SET_InitNames(table, save_InitNames);
9206 SET_LightModelf(table, save_LightModelf);
9207 SET_LightModelfv(table, save_LightModelfv);
9208 SET_LightModeli(table, save_LightModeli);
9209 SET_LightModeliv(table, save_LightModeliv);
9210 SET_Lightf(table, save_Lightf);
9211 SET_Lightfv(table, save_Lightfv);
9212 SET_Lighti(table, save_Lighti);
9213 SET_Lightiv(table, save_Lightiv);
9214 SET_LineStipple(table, save_LineStipple);
9215 SET_LineWidth(table, save_LineWidth);
9216 SET_ListBase(table, save_ListBase);
9217 SET_LoadIdentity(table, save_LoadIdentity);
9218 SET_LoadMatrixd(table, save_LoadMatrixd);
9219 SET_LoadMatrixf(table, save_LoadMatrixf);
9220 SET_LoadName(table, save_LoadName);
9221 SET_LogicOp(table, save_LogicOp);
9222 SET_Map1d(table, save_Map1d);
9223 SET_Map1f(table, save_Map1f);
9224 SET_Map2d(table, save_Map2d);
9225 SET_Map2f(table, save_Map2f);
9226 SET_MapGrid1d(table, save_MapGrid1d);
9227 SET_MapGrid1f(table, save_MapGrid1f);
9228 SET_MapGrid2d(table, save_MapGrid2d);
9229 SET_MapGrid2f(table, save_MapGrid2f);
9230 SET_MatrixMode(table, save_MatrixMode);
9231 SET_MultMatrixd(table, save_MultMatrixd);
9232 SET_MultMatrixf(table, save_MultMatrixf);
9233 SET_NewList(table, save_NewList);
9234 SET_Ortho(table, save_Ortho);
9235 SET_PassThrough(table, save_PassThrough);
9236 SET_PixelMapfv(table, save_PixelMapfv);
9237 SET_PixelMapuiv(table, save_PixelMapuiv);
9238 SET_PixelMapusv(table, save_PixelMapusv);
9239 SET_PixelTransferf(table, save_PixelTransferf);
9240 SET_PixelTransferi(table, save_PixelTransferi);
9241 SET_PixelZoom(table, save_PixelZoom);
9242 SET_PointSize(table, save_PointSize);
9243 SET_PolygonMode(table, save_PolygonMode);
9244 SET_PolygonOffset(table, save_PolygonOffset);
9245 SET_PolygonStipple(table, save_PolygonStipple);
9246 SET_PopAttrib(table, save_PopAttrib);
9247 SET_PopMatrix(table, save_PopMatrix);
9248 SET_PopName(table, save_PopName);
9249 SET_PushAttrib(table, save_PushAttrib);
9250 SET_PushMatrix(table, save_PushMatrix);
9251 SET_PushName(table, save_PushName);
9252 SET_RasterPos2d(table, save_RasterPos2d);
9253 SET_RasterPos2dv(table, save_RasterPos2dv);
9254 SET_RasterPos2f(table, save_RasterPos2f);
9255 SET_RasterPos2fv(table, save_RasterPos2fv);
9256 SET_RasterPos2i(table, save_RasterPos2i);
9257 SET_RasterPos2iv(table, save_RasterPos2iv);
9258 SET_RasterPos2s(table, save_RasterPos2s);
9259 SET_RasterPos2sv(table, save_RasterPos2sv);
9260 SET_RasterPos3d(table, save_RasterPos3d);
9261 SET_RasterPos3dv(table, save_RasterPos3dv);
9262 SET_RasterPos3f(table, save_RasterPos3f);
9263 SET_RasterPos3fv(table, save_RasterPos3fv);
9264 SET_RasterPos3i(table, save_RasterPos3i);
9265 SET_RasterPos3iv(table, save_RasterPos3iv);
9266 SET_RasterPos3s(table, save_RasterPos3s);
9267 SET_RasterPos3sv(table, save_RasterPos3sv);
9268 SET_RasterPos4d(table, save_RasterPos4d);
9269 SET_RasterPos4dv(table, save_RasterPos4dv);
9270 SET_RasterPos4f(table, save_RasterPos4f);
9271 SET_RasterPos4fv(table, save_RasterPos4fv);
9272 SET_RasterPos4i(table, save_RasterPos4i);
9273 SET_RasterPos4iv(table, save_RasterPos4iv);
9274 SET_RasterPos4s(table, save_RasterPos4s);
9275 SET_RasterPos4sv(table, save_RasterPos4sv);
9276 SET_ReadBuffer(table, save_ReadBuffer);
9277 SET_Rectf(table, save_Rectf);
9278 SET_Rotated(table, save_Rotated);
9279 SET_Rotatef(table, save_Rotatef);
9280 SET_Scaled(table, save_Scaled);
9281 SET_Scalef(table, save_Scalef);
9282 SET_Scissor(table, save_Scissor);
9283 SET_ShadeModel(table, save_ShadeModel);
9284 SET_StencilFunc(table, save_StencilFunc);
9285 SET_StencilMask(table, save_StencilMask);
9286 SET_StencilOp(table, save_StencilOp);
9287 SET_TexEnvf(table, save_TexEnvf);
9288 SET_TexEnvfv(table, save_TexEnvfv);
9289 SET_TexEnvi(table, save_TexEnvi);
9290 SET_TexEnviv(table, save_TexEnviv);
9291 SET_TexGend(table, save_TexGend);
9292 SET_TexGendv(table, save_TexGendv);
9293 SET_TexGenf(table, save_TexGenf);
9294 SET_TexGenfv(table, save_TexGenfv);
9295 SET_TexGeni(table, save_TexGeni);
9296 SET_TexGeniv(table, save_TexGeniv);
9297 SET_TexImage1D(table, save_TexImage1D);
9298 SET_TexImage2D(table, save_TexImage2D);
9299 SET_TexParameterf(table, save_TexParameterf);
9300 SET_TexParameterfv(table, save_TexParameterfv);
9301 SET_TexParameteri(table, save_TexParameteri);
9302 SET_TexParameteriv(table, save_TexParameteriv);
9303 SET_Translated(table, save_Translated);
9304 SET_Translatef(table, save_Translatef);
9305 SET_Viewport(table, save_Viewport);
9306
9307 /* GL 1.1 */
9308 SET_BindTexture(table, save_BindTexture);
9309 SET_CopyTexImage1D(table, save_CopyTexImage1D);
9310 SET_CopyTexImage2D(table, save_CopyTexImage2D);
9311 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
9312 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
9313 SET_PrioritizeTextures(table, save_PrioritizeTextures);
9314 SET_TexSubImage1D(table, save_TexSubImage1D);
9315 SET_TexSubImage2D(table, save_TexSubImage2D);
9316
9317 /* GL 1.2 */
9318 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
9319 SET_TexImage3D(table, save_TexImage3D);
9320 SET_TexSubImage3D(table, save_TexSubImage3D);
9321
9322 /* GL 2.0 */
9323 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
9324 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
9325 SET_StencilOpSeparate(table, save_StencilOpSeparate);
9326
9327 /* ATI_separate_stencil */
9328 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
9329
9330 /* GL_ARB_imaging */
9331 /* Not all are supported */
9332 SET_BlendColor(table, save_BlendColor);
9333 SET_BlendEquation(table, save_BlendEquation);
9334
9335 /* 2. GL_EXT_blend_color */
9336 #if 0
9337 SET_BlendColorEXT(table, save_BlendColorEXT);
9338 #endif
9339
9340 /* 3. GL_EXT_polygon_offset */
9341 SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
9342
9343 /* 6. GL_EXT_texture3d */
9344 #if 0
9345 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
9346 SET_TexImage3DEXT(table, save_TexImage3DEXT);
9347 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
9348 #endif
9349
9350 /* 37. GL_EXT_blend_minmax */
9351 #if 0
9352 SET_BlendEquationEXT(table, save_BlendEquationEXT);
9353 #endif
9354
9355 /* 54. GL_EXT_point_parameters */
9356 SET_PointParameterf(table, save_PointParameterfEXT);
9357 SET_PointParameterfv(table, save_PointParameterfvEXT);
9358
9359 /* 173. GL_EXT_blend_func_separate */
9360 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
9361
9362 /* 197. GL_MESA_window_pos */
9363 SET_WindowPos2d(table, save_WindowPos2dMESA);
9364 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
9365 SET_WindowPos2f(table, save_WindowPos2fMESA);
9366 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
9367 SET_WindowPos2i(table, save_WindowPos2iMESA);
9368 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
9369 SET_WindowPos2s(table, save_WindowPos2sMESA);
9370 SET_WindowPos2sv(table, save_WindowPos2svMESA);
9371 SET_WindowPos3d(table, save_WindowPos3dMESA);
9372 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
9373 SET_WindowPos3f(table, save_WindowPos3fMESA);
9374 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
9375 SET_WindowPos3i(table, save_WindowPos3iMESA);
9376 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
9377 SET_WindowPos3s(table, save_WindowPos3sMESA);
9378 SET_WindowPos3sv(table, save_WindowPos3svMESA);
9379 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
9380 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
9381 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
9382 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
9383 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
9384 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
9385 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
9386 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
9387
9388 /* 233. GL_NV_vertex_program */
9389 /* The following commands DO NOT go into display lists:
9390 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9391 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9392 */
9393 SET_BindProgramARB(table, save_BindProgramNV);
9394
9395 /* 245. GL_ATI_fragment_shader */
9396 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
9397 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
9398
9399 /* 262. GL_NV_point_sprite */
9400 SET_PointParameteri(table, save_PointParameteriNV);
9401 SET_PointParameteriv(table, save_PointParameterivNV);
9402
9403 /* 268. GL_EXT_stencil_two_side */
9404 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
9405
9406 /* ???. GL_EXT_depth_bounds_test */
9407 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
9408
9409 /* ARB 1. GL_ARB_multitexture */
9410 SET_ActiveTexture(table, save_ActiveTextureARB);
9411
9412 /* ARB 3. GL_ARB_transpose_matrix */
9413 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
9414 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
9415 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
9416 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
9417
9418 /* ARB 5. GL_ARB_multisample */
9419 SET_SampleCoverage(table, save_SampleCoverageARB);
9420
9421 /* ARB 12. GL_ARB_texture_compression */
9422 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
9423 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
9424 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
9425 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
9426 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
9427 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
9428
9429 /* ARB 14. GL_ARB_point_parameters */
9430 /* aliased with EXT_point_parameters functions */
9431
9432 /* ARB 25. GL_ARB_window_pos */
9433 /* aliased with MESA_window_pos functions */
9434
9435 /* ARB 26. GL_ARB_vertex_program */
9436 /* ARB 27. GL_ARB_fragment_program */
9437 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9438 SET_ProgramStringARB(table, save_ProgramStringARB);
9439 SET_BindProgramARB(table, save_BindProgramNV);
9440 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
9441 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
9442 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
9443 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
9444 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
9445 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
9446 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
9447 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
9448
9449 SET_BeginQuery(table, save_BeginQueryARB);
9450 SET_EndQuery(table, save_EndQueryARB);
9451 SET_QueryCounter(table, save_QueryCounter);
9452
9453 SET_DrawBuffers(table, save_DrawBuffersARB);
9454
9455 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
9456
9457 SET_UseProgram(table, save_UseProgramObjectARB);
9458 SET_Uniform1f(table, save_Uniform1fARB);
9459 SET_Uniform2f(table, save_Uniform2fARB);
9460 SET_Uniform3f(table, save_Uniform3fARB);
9461 SET_Uniform4f(table, save_Uniform4fARB);
9462 SET_Uniform1fv(table, save_Uniform1fvARB);
9463 SET_Uniform2fv(table, save_Uniform2fvARB);
9464 SET_Uniform3fv(table, save_Uniform3fvARB);
9465 SET_Uniform4fv(table, save_Uniform4fvARB);
9466 SET_Uniform1i(table, save_Uniform1iARB);
9467 SET_Uniform2i(table, save_Uniform2iARB);
9468 SET_Uniform3i(table, save_Uniform3iARB);
9469 SET_Uniform4i(table, save_Uniform4iARB);
9470 SET_Uniform1iv(table, save_Uniform1ivARB);
9471 SET_Uniform2iv(table, save_Uniform2ivARB);
9472 SET_Uniform3iv(table, save_Uniform3ivARB);
9473 SET_Uniform4iv(table, save_Uniform4ivARB);
9474 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
9475 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
9476 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
9477 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
9478 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
9479 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
9480 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
9481 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
9482 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
9483
9484 /* 299. GL_EXT_blend_equation_separate */
9485 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
9486
9487 /* GL_EXT_gpu_program_parameters */
9488 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
9489 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
9490
9491 /* 364. GL_EXT_provoking_vertex */
9492 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
9493
9494 /* GL_EXT_texture_integer */
9495 SET_ClearColorIiEXT(table, save_ClearColorIi);
9496 SET_ClearColorIuiEXT(table, save_ClearColorIui);
9497 SET_TexParameterIiv(table, save_TexParameterIiv);
9498 SET_TexParameterIuiv(table, save_TexParameterIuiv);
9499
9500 /* GL_ARB_clip_control */
9501 SET_ClipControl(table, save_ClipControl);
9502
9503 /* GL_ARB_color_buffer_float */
9504 SET_ClampColor(table, save_ClampColorARB);
9505
9506 /* GL 3.0 */
9507 SET_ClearBufferiv(table, save_ClearBufferiv);
9508 SET_ClearBufferuiv(table, save_ClearBufferuiv);
9509 SET_ClearBufferfv(table, save_ClearBufferfv);
9510 SET_ClearBufferfi(table, save_ClearBufferfi);
9511 #if 0
9512 SET_Uniform1ui(table, save_Uniform1ui);
9513 SET_Uniform2ui(table, save_Uniform2ui);
9514 SET_Uniform3ui(table, save_Uniform3ui);
9515 SET_Uniform4ui(table, save_Uniform4ui);
9516 SET_Uniform1uiv(table, save_Uniform1uiv);
9517 SET_Uniform2uiv(table, save_Uniform2uiv);
9518 SET_Uniform3uiv(table, save_Uniform3uiv);
9519 SET_Uniform4uiv(table, save_Uniform4uiv);
9520 #else
9521 (void) save_Uniform1ui;
9522 (void) save_Uniform2ui;
9523 (void) save_Uniform3ui;
9524 (void) save_Uniform4ui;
9525 (void) save_Uniform1uiv;
9526 (void) save_Uniform2uiv;
9527 (void) save_Uniform3uiv;
9528 (void) save_Uniform4uiv;
9529 #endif
9530
9531 /* These are: */
9532 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
9533 SET_EndTransformFeedback(table, save_EndTransformFeedback);
9534 SET_BindTransformFeedback(table, save_BindTransformFeedback);
9535 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
9536 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
9537 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
9538 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
9539 SET_DrawTransformFeedbackInstanced(table,
9540 save_DrawTransformFeedbackInstanced);
9541 SET_DrawTransformFeedbackStreamInstanced(table,
9542 save_DrawTransformFeedbackStreamInstanced);
9543 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
9544 SET_EndQueryIndexed(table, save_EndQueryIndexed);
9545
9546 /* GL_ARB_instanced_arrays */
9547 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
9548
9549 /* GL_NV_texture_barrier */
9550 SET_TextureBarrierNV(table, save_TextureBarrierNV);
9551
9552 SET_BindSampler(table, save_BindSampler);
9553 SET_SamplerParameteri(table, save_SamplerParameteri);
9554 SET_SamplerParameterf(table, save_SamplerParameterf);
9555 SET_SamplerParameteriv(table, save_SamplerParameteriv);
9556 SET_SamplerParameterfv(table, save_SamplerParameterfv);
9557 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
9558 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
9559
9560 /* GL_ARB_draw_buffer_blend */
9561 SET_BlendFunciARB(table, save_BlendFunci);
9562 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
9563 SET_BlendEquationiARB(table, save_BlendEquationi);
9564 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
9565
9566 /* GL_NV_conditional_render */
9567 SET_BeginConditionalRender(table, save_BeginConditionalRender);
9568 SET_EndConditionalRender(table, save_EndConditionalRender);
9569
9570 /* GL_ARB_sync */
9571 SET_WaitSync(table, save_WaitSync);
9572
9573 /* GL_ARB_uniform_buffer_object */
9574 SET_UniformBlockBinding(table, save_UniformBlockBinding);
9575
9576 /* GL_ARB_draw_instanced */
9577 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
9578 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
9579
9580 /* GL_ARB_draw_elements_base_vertex */
9581 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
9582
9583 /* GL_ARB_base_instance */
9584 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
9585 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
9586 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
9587
9588 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9589 SET_UseProgramStages(table, save_UseProgramStages);
9590 SET_ProgramUniform1f(table, save_ProgramUniform1f);
9591 SET_ProgramUniform2f(table, save_ProgramUniform2f);
9592 SET_ProgramUniform3f(table, save_ProgramUniform3f);
9593 SET_ProgramUniform4f(table, save_ProgramUniform4f);
9594 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
9595 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
9596 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
9597 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
9598 SET_ProgramUniform1i(table, save_ProgramUniform1i);
9599 SET_ProgramUniform2i(table, save_ProgramUniform2i);
9600 SET_ProgramUniform3i(table, save_ProgramUniform3i);
9601 SET_ProgramUniform4i(table, save_ProgramUniform4i);
9602 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
9603 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
9604 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
9605 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
9606 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
9607 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
9608 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
9609 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
9610 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
9611 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
9612 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
9613 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
9614 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
9615 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
9616 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
9617 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
9618 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
9619 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
9620 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
9621 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
9622 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
9623
9624 /* GL_EXT_polygon_offset_clamp */
9625 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
9626 }
9627
9628
9629
9630 static const char *
9631 enum_string(GLenum k)
9632 {
9633 return _mesa_enum_to_string(k);
9634 }
9635
9636
9637 /**
9638 * Print the commands in a display list. For debugging only.
9639 * TODO: many commands aren't handled yet.
9640 * \param fname filename to write display list to. If null, use stdout.
9641 */
9642 static void GLAPIENTRY
9643 print_list(struct gl_context *ctx, GLuint list, const char *fname)
9644 {
9645 struct gl_display_list *dlist;
9646 Node *n;
9647 GLboolean done;
9648 FILE *f = stdout;
9649
9650 if (fname) {
9651 f = fopen(fname, "w");
9652 if (!f)
9653 return;
9654 }
9655
9656 if (!islist(ctx, list)) {
9657 fprintf(f, "%u is not a display list ID\n", list);
9658 return;
9659 }
9660
9661 dlist = _mesa_lookup_list(ctx, list);
9662 if (!dlist)
9663 return;
9664
9665 n = dlist->Head;
9666
9667 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
9668
9669 done = n ? GL_FALSE : GL_TRUE;
9670 while (!done) {
9671 const OpCode opcode = n[0].opcode;
9672
9673 if (is_ext_opcode(opcode)) {
9674 n += ext_opcode_print(ctx, n, f);
9675 }
9676 else {
9677 switch (opcode) {
9678 case OPCODE_ACCUM:
9679 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
9680 break;
9681 case OPCODE_ACTIVE_TEXTURE:
9682 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
9683 break;
9684 case OPCODE_BITMAP:
9685 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
9686 n[3].f, n[4].f, n[5].f, n[6].f,
9687 get_pointer(&n[7]));
9688 break;
9689 case OPCODE_BLEND_COLOR:
9690 fprintf(f, "BlendColor %f, %f, %f, %f\n",
9691 n[1].f, n[2].f, n[3].f, n[4].f);
9692 break;
9693 case OPCODE_BLEND_EQUATION:
9694 fprintf(f, "BlendEquation %s\n",
9695 enum_string(n[1].e));
9696 break;
9697 case OPCODE_BLEND_EQUATION_SEPARATE:
9698 fprintf(f, "BlendEquationSeparate %s, %s\n",
9699 enum_string(n[1].e),
9700 enum_string(n[2].e));
9701 break;
9702 case OPCODE_BLEND_FUNC_SEPARATE:
9703 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
9704 enum_string(n[1].e),
9705 enum_string(n[2].e),
9706 enum_string(n[3].e),
9707 enum_string(n[4].e));
9708 break;
9709 case OPCODE_BLEND_EQUATION_I:
9710 fprintf(f, "BlendEquationi %u, %s\n",
9711 n[1].ui, enum_string(n[2].e));
9712 break;
9713 case OPCODE_BLEND_EQUATION_SEPARATE_I:
9714 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
9715 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
9716 break;
9717 case OPCODE_BLEND_FUNC_I:
9718 fprintf(f, "BlendFunci %u, %s, %s\n",
9719 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
9720 break;
9721 case OPCODE_BLEND_FUNC_SEPARATE_I:
9722 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
9723 n[1].ui,
9724 enum_string(n[2].e),
9725 enum_string(n[3].e),
9726 enum_string(n[4].e),
9727 enum_string(n[5].e));
9728 break;
9729 case OPCODE_CALL_LIST:
9730 fprintf(f, "CallList %d\n", (int) n[1].ui);
9731 break;
9732 case OPCODE_CALL_LIST_OFFSET:
9733 fprintf(f, "CallList %d + offset %u = %u\n", (int) n[1].ui,
9734 ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
9735 break;
9736 case OPCODE_DISABLE:
9737 fprintf(f, "Disable %s\n", enum_string(n[1].e));
9738 break;
9739 case OPCODE_ENABLE:
9740 fprintf(f, "Enable %s\n", enum_string(n[1].e));
9741 break;
9742 case OPCODE_FRUSTUM:
9743 fprintf(f, "Frustum %g %g %g %g %g %g\n",
9744 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
9745 break;
9746 case OPCODE_LINE_STIPPLE:
9747 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
9748 break;
9749 case OPCODE_LINE_WIDTH:
9750 fprintf(f, "LineWidth %f\n", n[1].f);
9751 break;
9752 case OPCODE_LOAD_IDENTITY:
9753 fprintf(f, "LoadIdentity\n");
9754 break;
9755 case OPCODE_LOAD_MATRIX:
9756 fprintf(f, "LoadMatrix\n");
9757 fprintf(f, " %8f %8f %8f %8f\n",
9758 n[1].f, n[5].f, n[9].f, n[13].f);
9759 fprintf(f, " %8f %8f %8f %8f\n",
9760 n[2].f, n[6].f, n[10].f, n[14].f);
9761 fprintf(f, " %8f %8f %8f %8f\n",
9762 n[3].f, n[7].f, n[11].f, n[15].f);
9763 fprintf(f, " %8f %8f %8f %8f\n",
9764 n[4].f, n[8].f, n[12].f, n[16].f);
9765 break;
9766 case OPCODE_MULT_MATRIX:
9767 fprintf(f, "MultMatrix (or Rotate)\n");
9768 fprintf(f, " %8f %8f %8f %8f\n",
9769 n[1].f, n[5].f, n[9].f, n[13].f);
9770 fprintf(f, " %8f %8f %8f %8f\n",
9771 n[2].f, n[6].f, n[10].f, n[14].f);
9772 fprintf(f, " %8f %8f %8f %8f\n",
9773 n[3].f, n[7].f, n[11].f, n[15].f);
9774 fprintf(f, " %8f %8f %8f %8f\n",
9775 n[4].f, n[8].f, n[12].f, n[16].f);
9776 break;
9777 case OPCODE_ORTHO:
9778 fprintf(f, "Ortho %g %g %g %g %g %g\n",
9779 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
9780 break;
9781 case OPCODE_POINT_SIZE:
9782 fprintf(f, "PointSize %f\n", n[1].f);
9783 break;
9784 case OPCODE_POP_ATTRIB:
9785 fprintf(f, "PopAttrib\n");
9786 break;
9787 case OPCODE_POP_MATRIX:
9788 fprintf(f, "PopMatrix\n");
9789 break;
9790 case OPCODE_POP_NAME:
9791 fprintf(f, "PopName\n");
9792 break;
9793 case OPCODE_PUSH_ATTRIB:
9794 fprintf(f, "PushAttrib %x\n", n[1].bf);
9795 break;
9796 case OPCODE_PUSH_MATRIX:
9797 fprintf(f, "PushMatrix\n");
9798 break;
9799 case OPCODE_PUSH_NAME:
9800 fprintf(f, "PushName %d\n", (int) n[1].ui);
9801 break;
9802 case OPCODE_RASTER_POS:
9803 fprintf(f, "RasterPos %g %g %g %g\n",
9804 n[1].f, n[2].f, n[3].f, n[4].f);
9805 break;
9806 case OPCODE_ROTATE:
9807 fprintf(f, "Rotate %g %g %g %g\n",
9808 n[1].f, n[2].f, n[3].f, n[4].f);
9809 break;
9810 case OPCODE_SCALE:
9811 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
9812 break;
9813 case OPCODE_TRANSLATE:
9814 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
9815 break;
9816 case OPCODE_BIND_TEXTURE:
9817 fprintf(f, "BindTexture %s %d\n",
9818 _mesa_enum_to_string(n[1].ui), n[2].ui);
9819 break;
9820 case OPCODE_SHADE_MODEL:
9821 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
9822 break;
9823 case OPCODE_MAP1:
9824 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
9825 _mesa_enum_to_string(n[1].ui),
9826 n[2].f, n[3].f, n[4].i, n[5].i);
9827 break;
9828 case OPCODE_MAP2:
9829 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9830 _mesa_enum_to_string(n[1].ui),
9831 n[2].f, n[3].f, n[4].f, n[5].f,
9832 n[6].i, n[7].i, n[8].i, n[9].i);
9833 break;
9834 case OPCODE_MAPGRID1:
9835 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
9836 break;
9837 case OPCODE_MAPGRID2:
9838 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9839 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
9840 break;
9841 case OPCODE_EVALMESH1:
9842 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
9843 break;
9844 case OPCODE_EVALMESH2:
9845 fprintf(f, "EvalMesh2 %d %d %d %d\n",
9846 n[1].i, n[2].i, n[3].i, n[4].i);
9847 break;
9848
9849 case OPCODE_ATTR_1F_NV:
9850 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
9851 break;
9852 case OPCODE_ATTR_2F_NV:
9853 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
9854 n[1].i, n[2].f, n[3].f);
9855 break;
9856 case OPCODE_ATTR_3F_NV:
9857 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
9858 n[1].i, n[2].f, n[3].f, n[4].f);
9859 break;
9860 case OPCODE_ATTR_4F_NV:
9861 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9862 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
9863 break;
9864 case OPCODE_ATTR_1F_ARB:
9865 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
9866 break;
9867 case OPCODE_ATTR_2F_ARB:
9868 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
9869 n[1].i, n[2].f, n[3].f);
9870 break;
9871 case OPCODE_ATTR_3F_ARB:
9872 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
9873 n[1].i, n[2].f, n[3].f, n[4].f);
9874 break;
9875 case OPCODE_ATTR_4F_ARB:
9876 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9877 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
9878 break;
9879
9880 case OPCODE_MATERIAL:
9881 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
9882 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
9883 break;
9884 case OPCODE_BEGIN:
9885 fprintf(f, "BEGIN %x\n", n[1].i);
9886 break;
9887 case OPCODE_END:
9888 fprintf(f, "END\n");
9889 break;
9890 case OPCODE_RECTF:
9891 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
9892 n[4].f);
9893 break;
9894 case OPCODE_EVAL_C1:
9895 fprintf(f, "EVAL_C1 %f\n", n[1].f);
9896 break;
9897 case OPCODE_EVAL_C2:
9898 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
9899 break;
9900 case OPCODE_EVAL_P1:
9901 fprintf(f, "EVAL_P1 %d\n", n[1].i);
9902 break;
9903 case OPCODE_EVAL_P2:
9904 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
9905 break;
9906
9907 case OPCODE_PROVOKING_VERTEX:
9908 fprintf(f, "ProvokingVertex %s\n",
9909 _mesa_enum_to_string(n[1].ui));
9910 break;
9911
9912 /*
9913 * meta opcodes/commands
9914 */
9915 case OPCODE_ERROR:
9916 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
9917 (const char *) get_pointer(&n[2]));
9918 break;
9919 case OPCODE_CONTINUE:
9920 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
9921 n = (Node *) get_pointer(&n[1]);
9922 break;
9923 case OPCODE_NOP:
9924 fprintf(f, "NOP\n");
9925 break;
9926 case OPCODE_END_OF_LIST:
9927 fprintf(f, "END-LIST %u\n", list);
9928 done = GL_TRUE;
9929 break;
9930 default:
9931 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
9932 printf
9933 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9934 opcode, (void *) n);
9935 return;
9936 }
9937 else {
9938 fprintf(f, "command %d, %u operands\n", opcode,
9939 InstSize[opcode]);
9940 }
9941 }
9942 /* increment n to point to next compiled command */
9943 if (opcode != OPCODE_CONTINUE) {
9944 n += InstSize[opcode];
9945 }
9946 }
9947 }
9948
9949 fflush(f);
9950 if (fname)
9951 fclose(f);
9952 }
9953
9954
9955
9956 /**
9957 * Clients may call this function to help debug display list problems.
9958 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9959 * changed, or break in the future without notice.
9960 */
9961 void
9962 mesa_print_display_list(GLuint list)
9963 {
9964 GET_CURRENT_CONTEXT(ctx);
9965 print_list(ctx, list, NULL);
9966 }
9967
9968
9969 /**********************************************************************/
9970 /***** Initialization *****/
9971 /**********************************************************************/
9972
9973 static void
9974 save_vtxfmt_init(GLvertexformat * vfmt)
9975 {
9976 vfmt->ArrayElement = _ae_ArrayElement;
9977
9978 vfmt->Begin = save_Begin;
9979
9980 vfmt->CallList = save_CallList;
9981 vfmt->CallLists = save_CallLists;
9982
9983 vfmt->Color3f = save_Color3f;
9984 vfmt->Color3fv = save_Color3fv;
9985 vfmt->Color4f = save_Color4f;
9986 vfmt->Color4fv = save_Color4fv;
9987 vfmt->EdgeFlag = save_EdgeFlag;
9988 vfmt->End = save_End;
9989
9990 vfmt->EvalCoord1f = save_EvalCoord1f;
9991 vfmt->EvalCoord1fv = save_EvalCoord1fv;
9992 vfmt->EvalCoord2f = save_EvalCoord2f;
9993 vfmt->EvalCoord2fv = save_EvalCoord2fv;
9994 vfmt->EvalPoint1 = save_EvalPoint1;
9995 vfmt->EvalPoint2 = save_EvalPoint2;
9996
9997 vfmt->FogCoordfEXT = save_FogCoordfEXT;
9998 vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
9999 vfmt->Indexf = save_Indexf;
10000 vfmt->Indexfv = save_Indexfv;
10001 vfmt->Materialfv = save_Materialfv;
10002 vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
10003 vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
10004 vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
10005 vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
10006 vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
10007 vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
10008 vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
10009 vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
10010 vfmt->Normal3f = save_Normal3f;
10011 vfmt->Normal3fv = save_Normal3fv;
10012 vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
10013 vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
10014 vfmt->TexCoord1f = save_TexCoord1f;
10015 vfmt->TexCoord1fv = save_TexCoord1fv;
10016 vfmt->TexCoord2f = save_TexCoord2f;
10017 vfmt->TexCoord2fv = save_TexCoord2fv;
10018 vfmt->TexCoord3f = save_TexCoord3f;
10019 vfmt->TexCoord3fv = save_TexCoord3fv;
10020 vfmt->TexCoord4f = save_TexCoord4f;
10021 vfmt->TexCoord4fv = save_TexCoord4fv;
10022 vfmt->Vertex2f = save_Vertex2f;
10023 vfmt->Vertex2fv = save_Vertex2fv;
10024 vfmt->Vertex3f = save_Vertex3f;
10025 vfmt->Vertex3fv = save_Vertex3fv;
10026 vfmt->Vertex4f = save_Vertex4f;
10027 vfmt->Vertex4fv = save_Vertex4fv;
10028 vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
10029 vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
10030 vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
10031 vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
10032 vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
10033 vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
10034 vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
10035 vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
10036 }
10037
10038
10039 void
10040 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
10041 const GLvertexformat *vfmt)
10042 {
10043 SET_CallList(disp, vfmt->CallList);
10044 SET_CallLists(disp, vfmt->CallLists);
10045 }
10046
10047
10048 /**
10049 * Initialize display list state for given context.
10050 */
10051 void
10052 _mesa_init_display_list(struct gl_context *ctx)
10053 {
10054 static GLboolean tableInitialized = GL_FALSE;
10055
10056 /* zero-out the instruction size table, just once */
10057 if (!tableInitialized) {
10058 memset(InstSize, 0, sizeof(InstSize));
10059 tableInitialized = GL_TRUE;
10060 }
10061
10062 /* extension info */
10063 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
10064
10065 /* Display list */
10066 ctx->ListState.CallDepth = 0;
10067 ctx->ExecuteFlag = GL_TRUE;
10068 ctx->CompileFlag = GL_FALSE;
10069 ctx->ListState.CurrentBlock = NULL;
10070 ctx->ListState.CurrentPos = 0;
10071
10072 /* Display List group */
10073 ctx->List.ListBase = 0;
10074
10075 save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
10076
10077 InstSize[OPCODE_NOP] = 1;
10078 }
10079
10080
10081 void
10082 _mesa_free_display_list_data(struct gl_context *ctx)
10083 {
10084 free(ctx->ListExt);
10085 ctx->ListExt = NULL;
10086 }