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