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