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