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