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