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