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