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