glthread: rename marshal.h/c to glthread_marshal.h and glthread_shaderobj.c
[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 #include "vbo/vbo_util.h"
74 #include "util/format_r11g11b10f.h"
75
76
77 #define USE_BITMAP_ATLAS 1
78
79
80
81 /**
82 * Other parts of Mesa (such as the VBO module) can plug into the display
83 * list system. This structure describes new display list instructions.
84 */
85 struct gl_list_instruction
86 {
87 GLuint Size;
88 void (*Execute)( struct gl_context *ctx, void *data );
89 void (*Destroy)( struct gl_context *ctx, void *data );
90 void (*Print)( struct gl_context *ctx, void *data, FILE *f );
91 };
92
93
94 #define MAX_DLIST_EXT_OPCODES 16
95
96 /**
97 * Used by device drivers to hook new commands into display lists.
98 */
99 struct gl_list_extensions
100 {
101 struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES];
102 GLuint NumOpcodes;
103 };
104
105
106
107 /**
108 * Flush vertices.
109 *
110 * \param ctx GL context.
111 *
112 * Checks if dd_function_table::SaveNeedFlush is marked to flush
113 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
114 */
115 #define SAVE_FLUSH_VERTICES(ctx) \
116 do { \
117 if (ctx->Driver.SaveNeedFlush) \
118 vbo_save_SaveFlushVertices(ctx); \
119 } while (0)
120
121
122 /**
123 * Macro to assert that the API call was made outside the
124 * glBegin()/glEnd() pair, with return value.
125 *
126 * \param ctx GL context.
127 * \param retval value to return value in case the assertion fails.
128 */
129 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
130 do { \
131 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
132 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
133 return retval; \
134 } \
135 } while (0)
136
137 /**
138 * Macro to assert that the API call was made outside the
139 * glBegin()/glEnd() pair.
140 *
141 * \param ctx GL context.
142 */
143 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
144 do { \
145 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
146 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
147 return; \
148 } \
149 } while (0)
150
151 /**
152 * Macro to assert that the API call was made outside the
153 * glBegin()/glEnd() pair and flush the vertices.
154 *
155 * \param ctx GL context.
156 */
157 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
158 do { \
159 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
160 SAVE_FLUSH_VERTICES(ctx); \
161 } while (0)
162
163 /**
164 * Macro to assert that the API call was made outside the
165 * glBegin()/glEnd() pair and flush the vertices, with return value.
166 *
167 * \param ctx GL context.
168 * \param retval value to return value in case the assertion fails.
169 */
170 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
171 do { \
172 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
173 SAVE_FLUSH_VERTICES(ctx); \
174 } while (0)
175
176
177 /**
178 * Display list opcodes.
179 *
180 * The fact that these identifiers are assigned consecutive
181 * integer values starting at 0 is very important, see InstSize array usage)
182 */
183 typedef enum
184 {
185 OPCODE_INVALID = -1, /* Force signed enum */
186 OPCODE_ACCUM,
187 OPCODE_ALPHA_FUNC,
188 OPCODE_BIND_TEXTURE,
189 OPCODE_BITMAP,
190 OPCODE_BLEND_COLOR,
191 OPCODE_BLEND_EQUATION,
192 OPCODE_BLEND_EQUATION_SEPARATE,
193 OPCODE_BLEND_FUNC_SEPARATE,
194
195 OPCODE_BLEND_EQUATION_I,
196 OPCODE_BLEND_EQUATION_SEPARATE_I,
197 OPCODE_BLEND_FUNC_I,
198 OPCODE_BLEND_FUNC_SEPARATE_I,
199
200 OPCODE_CALL_LIST,
201 OPCODE_CALL_LISTS,
202 OPCODE_CLEAR,
203 OPCODE_CLEAR_ACCUM,
204 OPCODE_CLEAR_COLOR,
205 OPCODE_CLEAR_DEPTH,
206 OPCODE_CLEAR_INDEX,
207 OPCODE_CLEAR_STENCIL,
208 OPCODE_CLEAR_BUFFER_IV,
209 OPCODE_CLEAR_BUFFER_UIV,
210 OPCODE_CLEAR_BUFFER_FV,
211 OPCODE_CLEAR_BUFFER_FI,
212 OPCODE_CLIP_PLANE,
213 OPCODE_COLOR_MASK,
214 OPCODE_COLOR_MASK_INDEXED,
215 OPCODE_COLOR_MATERIAL,
216 OPCODE_COPY_PIXELS,
217 OPCODE_COPY_TEX_IMAGE1D,
218 OPCODE_COPY_TEX_IMAGE2D,
219 OPCODE_COPY_TEX_SUB_IMAGE1D,
220 OPCODE_COPY_TEX_SUB_IMAGE2D,
221 OPCODE_COPY_TEX_SUB_IMAGE3D,
222 OPCODE_CULL_FACE,
223 OPCODE_DEPTH_FUNC,
224 OPCODE_DEPTH_MASK,
225 OPCODE_DEPTH_RANGE,
226 OPCODE_DISABLE,
227 OPCODE_DISABLE_INDEXED,
228 OPCODE_DRAW_BUFFER,
229 OPCODE_DRAW_PIXELS,
230 OPCODE_ENABLE,
231 OPCODE_ENABLE_INDEXED,
232 OPCODE_EVALMESH1,
233 OPCODE_EVALMESH2,
234 OPCODE_FOG,
235 OPCODE_FRONT_FACE,
236 OPCODE_FRUSTUM,
237 OPCODE_HINT,
238 OPCODE_INDEX_MASK,
239 OPCODE_INIT_NAMES,
240 OPCODE_LIGHT,
241 OPCODE_LIGHT_MODEL,
242 OPCODE_LINE_STIPPLE,
243 OPCODE_LINE_WIDTH,
244 OPCODE_LIST_BASE,
245 OPCODE_LOAD_IDENTITY,
246 OPCODE_LOAD_MATRIX,
247 OPCODE_LOAD_NAME,
248 OPCODE_LOGIC_OP,
249 OPCODE_MAP1,
250 OPCODE_MAP2,
251 OPCODE_MAPGRID1,
252 OPCODE_MAPGRID2,
253 OPCODE_MATRIX_MODE,
254 OPCODE_MULT_MATRIX,
255 OPCODE_ORTHO,
256 OPCODE_PASSTHROUGH,
257 OPCODE_PIXEL_MAP,
258 OPCODE_PIXEL_TRANSFER,
259 OPCODE_PIXEL_ZOOM,
260 OPCODE_POINT_SIZE,
261 OPCODE_POINT_PARAMETERS,
262 OPCODE_POLYGON_MODE,
263 OPCODE_POLYGON_STIPPLE,
264 OPCODE_POLYGON_OFFSET,
265 OPCODE_POP_ATTRIB,
266 OPCODE_POP_MATRIX,
267 OPCODE_POP_NAME,
268 OPCODE_PRIORITIZE_TEXTURE,
269 OPCODE_PUSH_ATTRIB,
270 OPCODE_PUSH_MATRIX,
271 OPCODE_PUSH_NAME,
272 OPCODE_RASTER_POS,
273 OPCODE_READ_BUFFER,
274 OPCODE_ROTATE,
275 OPCODE_SCALE,
276 OPCODE_SCISSOR,
277 OPCODE_SELECT_TEXTURE_SGIS,
278 OPCODE_SELECT_TEXTURE_COORD_SET,
279 OPCODE_SHADE_MODEL,
280 OPCODE_STENCIL_FUNC,
281 OPCODE_STENCIL_MASK,
282 OPCODE_STENCIL_OP,
283 OPCODE_TEXENV,
284 OPCODE_TEXGEN,
285 OPCODE_TEXPARAMETER,
286 OPCODE_TEX_IMAGE1D,
287 OPCODE_TEX_IMAGE2D,
288 OPCODE_TEX_IMAGE3D,
289 OPCODE_TEX_SUB_IMAGE1D,
290 OPCODE_TEX_SUB_IMAGE2D,
291 OPCODE_TEX_SUB_IMAGE3D,
292 OPCODE_TRANSLATE,
293 OPCODE_VIEWPORT,
294 OPCODE_WINDOW_POS,
295 /* ARB_viewport_array */
296 OPCODE_VIEWPORT_ARRAY_V,
297 OPCODE_VIEWPORT_INDEXED_F,
298 OPCODE_VIEWPORT_INDEXED_FV,
299 OPCODE_SCISSOR_ARRAY_V,
300 OPCODE_SCISSOR_INDEXED,
301 OPCODE_SCISSOR_INDEXED_V,
302 OPCODE_DEPTH_ARRAY_V,
303 OPCODE_DEPTH_INDEXED,
304 /* GL_ARB_multitexture */
305 OPCODE_ACTIVE_TEXTURE,
306 /* GL_ARB_texture_compression */
307 OPCODE_COMPRESSED_TEX_IMAGE_1D,
308 OPCODE_COMPRESSED_TEX_IMAGE_2D,
309 OPCODE_COMPRESSED_TEX_IMAGE_3D,
310 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
311 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
312 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
313 /* GL_ARB_multisample */
314 OPCODE_SAMPLE_COVERAGE,
315 /* GL_ARB_window_pos */
316 OPCODE_WINDOW_POS_ARB,
317 /* GL_ARB_vertex_program */
318 OPCODE_BIND_PROGRAM_ARB,
319 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
320 /* GL_EXT_stencil_two_side */
321 OPCODE_ACTIVE_STENCIL_FACE_EXT,
322 /* GL_EXT_depth_bounds_test */
323 OPCODE_DEPTH_BOUNDS_EXT,
324 /* GL_ARB_vertex/fragment_program */
325 OPCODE_PROGRAM_STRING_ARB,
326 OPCODE_PROGRAM_ENV_PARAMETER_ARB,
327 /* GL_ARB_occlusion_query */
328 OPCODE_BEGIN_QUERY_ARB,
329 OPCODE_END_QUERY_ARB,
330 /* GL_ARB_draw_buffers */
331 OPCODE_DRAW_BUFFERS_ARB,
332 /* GL_ATI_fragment_shader */
333 OPCODE_BIND_FRAGMENT_SHADER_ATI,
334 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
335 /* OpenGL 2.0 */
336 OPCODE_STENCIL_FUNC_SEPARATE,
337 OPCODE_STENCIL_OP_SEPARATE,
338 OPCODE_STENCIL_MASK_SEPARATE,
339 /* GL_NV_primitive_restart */
340 OPCODE_PRIMITIVE_RESTART_NV,
341 /* GL_ARB_shader_objects */
342 OPCODE_USE_PROGRAM,
343 OPCODE_UNIFORM_1F,
344 OPCODE_UNIFORM_2F,
345 OPCODE_UNIFORM_3F,
346 OPCODE_UNIFORM_4F,
347 OPCODE_UNIFORM_1FV,
348 OPCODE_UNIFORM_2FV,
349 OPCODE_UNIFORM_3FV,
350 OPCODE_UNIFORM_4FV,
351 OPCODE_UNIFORM_1I,
352 OPCODE_UNIFORM_2I,
353 OPCODE_UNIFORM_3I,
354 OPCODE_UNIFORM_4I,
355 OPCODE_UNIFORM_1IV,
356 OPCODE_UNIFORM_2IV,
357 OPCODE_UNIFORM_3IV,
358 OPCODE_UNIFORM_4IV,
359 OPCODE_UNIFORM_MATRIX22,
360 OPCODE_UNIFORM_MATRIX33,
361 OPCODE_UNIFORM_MATRIX44,
362 OPCODE_UNIFORM_MATRIX23,
363 OPCODE_UNIFORM_MATRIX32,
364 OPCODE_UNIFORM_MATRIX24,
365 OPCODE_UNIFORM_MATRIX42,
366 OPCODE_UNIFORM_MATRIX34,
367 OPCODE_UNIFORM_MATRIX43,
368
369 /* OpenGL 3.0 */
370 OPCODE_UNIFORM_1UI,
371 OPCODE_UNIFORM_2UI,
372 OPCODE_UNIFORM_3UI,
373 OPCODE_UNIFORM_4UI,
374 OPCODE_UNIFORM_1UIV,
375 OPCODE_UNIFORM_2UIV,
376 OPCODE_UNIFORM_3UIV,
377 OPCODE_UNIFORM_4UIV,
378
379 /* GL_ARB_gpu_shader_fp64 */
380 OPCODE_UNIFORM_1D,
381 OPCODE_UNIFORM_2D,
382 OPCODE_UNIFORM_3D,
383 OPCODE_UNIFORM_4D,
384 OPCODE_UNIFORM_1DV,
385 OPCODE_UNIFORM_2DV,
386 OPCODE_UNIFORM_3DV,
387 OPCODE_UNIFORM_4DV,
388 OPCODE_UNIFORM_MATRIX22D,
389 OPCODE_UNIFORM_MATRIX33D,
390 OPCODE_UNIFORM_MATRIX44D,
391 OPCODE_UNIFORM_MATRIX23D,
392 OPCODE_UNIFORM_MATRIX32D,
393 OPCODE_UNIFORM_MATRIX24D,
394 OPCODE_UNIFORM_MATRIX42D,
395 OPCODE_UNIFORM_MATRIX34D,
396 OPCODE_UNIFORM_MATRIX43D,
397
398 /* GL_ARB_gpu_shader_int64 */
399 OPCODE_UNIFORM_1I64,
400 OPCODE_UNIFORM_2I64,
401 OPCODE_UNIFORM_3I64,
402 OPCODE_UNIFORM_4I64,
403 OPCODE_UNIFORM_1I64V,
404 OPCODE_UNIFORM_2I64V,
405 OPCODE_UNIFORM_3I64V,
406 OPCODE_UNIFORM_4I64V,
407 OPCODE_UNIFORM_1UI64,
408 OPCODE_UNIFORM_2UI64,
409 OPCODE_UNIFORM_3UI64,
410 OPCODE_UNIFORM_4UI64,
411 OPCODE_UNIFORM_1UI64V,
412 OPCODE_UNIFORM_2UI64V,
413 OPCODE_UNIFORM_3UI64V,
414 OPCODE_UNIFORM_4UI64V,
415 OPCODE_PROGRAM_UNIFORM_1I64,
416 OPCODE_PROGRAM_UNIFORM_2I64,
417 OPCODE_PROGRAM_UNIFORM_3I64,
418 OPCODE_PROGRAM_UNIFORM_4I64,
419 OPCODE_PROGRAM_UNIFORM_1I64V,
420 OPCODE_PROGRAM_UNIFORM_2I64V,
421 OPCODE_PROGRAM_UNIFORM_3I64V,
422 OPCODE_PROGRAM_UNIFORM_4I64V,
423 OPCODE_PROGRAM_UNIFORM_1UI64,
424 OPCODE_PROGRAM_UNIFORM_2UI64,
425 OPCODE_PROGRAM_UNIFORM_3UI64,
426 OPCODE_PROGRAM_UNIFORM_4UI64,
427 OPCODE_PROGRAM_UNIFORM_1UI64V,
428 OPCODE_PROGRAM_UNIFORM_2UI64V,
429 OPCODE_PROGRAM_UNIFORM_3UI64V,
430 OPCODE_PROGRAM_UNIFORM_4UI64V,
431
432 /* OpenGL 4.0 / GL_ARB_tessellation_shader */
433 OPCODE_PATCH_PARAMETER_I,
434 OPCODE_PATCH_PARAMETER_FV_INNER,
435 OPCODE_PATCH_PARAMETER_FV_OUTER,
436
437 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
438 OPCODE_USE_PROGRAM_STAGES,
439 OPCODE_PROGRAM_UNIFORM_1F,
440 OPCODE_PROGRAM_UNIFORM_2F,
441 OPCODE_PROGRAM_UNIFORM_3F,
442 OPCODE_PROGRAM_UNIFORM_4F,
443 OPCODE_PROGRAM_UNIFORM_1FV,
444 OPCODE_PROGRAM_UNIFORM_2FV,
445 OPCODE_PROGRAM_UNIFORM_3FV,
446 OPCODE_PROGRAM_UNIFORM_4FV,
447 OPCODE_PROGRAM_UNIFORM_1D,
448 OPCODE_PROGRAM_UNIFORM_2D,
449 OPCODE_PROGRAM_UNIFORM_3D,
450 OPCODE_PROGRAM_UNIFORM_4D,
451 OPCODE_PROGRAM_UNIFORM_1DV,
452 OPCODE_PROGRAM_UNIFORM_2DV,
453 OPCODE_PROGRAM_UNIFORM_3DV,
454 OPCODE_PROGRAM_UNIFORM_4DV,
455 OPCODE_PROGRAM_UNIFORM_1I,
456 OPCODE_PROGRAM_UNIFORM_2I,
457 OPCODE_PROGRAM_UNIFORM_3I,
458 OPCODE_PROGRAM_UNIFORM_4I,
459 OPCODE_PROGRAM_UNIFORM_1IV,
460 OPCODE_PROGRAM_UNIFORM_2IV,
461 OPCODE_PROGRAM_UNIFORM_3IV,
462 OPCODE_PROGRAM_UNIFORM_4IV,
463 OPCODE_PROGRAM_UNIFORM_1UI,
464 OPCODE_PROGRAM_UNIFORM_2UI,
465 OPCODE_PROGRAM_UNIFORM_3UI,
466 OPCODE_PROGRAM_UNIFORM_4UI,
467 OPCODE_PROGRAM_UNIFORM_1UIV,
468 OPCODE_PROGRAM_UNIFORM_2UIV,
469 OPCODE_PROGRAM_UNIFORM_3UIV,
470 OPCODE_PROGRAM_UNIFORM_4UIV,
471 OPCODE_PROGRAM_UNIFORM_MATRIX22F,
472 OPCODE_PROGRAM_UNIFORM_MATRIX33F,
473 OPCODE_PROGRAM_UNIFORM_MATRIX44F,
474 OPCODE_PROGRAM_UNIFORM_MATRIX23F,
475 OPCODE_PROGRAM_UNIFORM_MATRIX32F,
476 OPCODE_PROGRAM_UNIFORM_MATRIX24F,
477 OPCODE_PROGRAM_UNIFORM_MATRIX42F,
478 OPCODE_PROGRAM_UNIFORM_MATRIX34F,
479 OPCODE_PROGRAM_UNIFORM_MATRIX43F,
480 OPCODE_PROGRAM_UNIFORM_MATRIX22D,
481 OPCODE_PROGRAM_UNIFORM_MATRIX33D,
482 OPCODE_PROGRAM_UNIFORM_MATRIX44D,
483 OPCODE_PROGRAM_UNIFORM_MATRIX23D,
484 OPCODE_PROGRAM_UNIFORM_MATRIX32D,
485 OPCODE_PROGRAM_UNIFORM_MATRIX24D,
486 OPCODE_PROGRAM_UNIFORM_MATRIX42D,
487 OPCODE_PROGRAM_UNIFORM_MATRIX34D,
488 OPCODE_PROGRAM_UNIFORM_MATRIX43D,
489
490 /* GL_ARB_clip_control */
491 OPCODE_CLIP_CONTROL,
492
493 /* GL_ARB_color_buffer_float */
494 OPCODE_CLAMP_COLOR,
495
496 /* GL_EXT_framebuffer_blit */
497 OPCODE_BLIT_FRAMEBUFFER,
498
499 /* Vertex attributes -- fallback for when optimized display
500 * list build isn't active.
501 */
502 OPCODE_ATTR_1F_NV,
503 OPCODE_ATTR_2F_NV,
504 OPCODE_ATTR_3F_NV,
505 OPCODE_ATTR_4F_NV,
506 OPCODE_ATTR_1F_ARB,
507 OPCODE_ATTR_2F_ARB,
508 OPCODE_ATTR_3F_ARB,
509 OPCODE_ATTR_4F_ARB,
510 OPCODE_ATTR_1I,
511 OPCODE_ATTR_2I,
512 OPCODE_ATTR_3I,
513 OPCODE_ATTR_4I,
514 OPCODE_ATTR_1D,
515 OPCODE_ATTR_2D,
516 OPCODE_ATTR_3D,
517 OPCODE_ATTR_4D,
518 OPCODE_ATTR_1UI64,
519 OPCODE_MATERIAL,
520 OPCODE_BEGIN,
521 OPCODE_END,
522 OPCODE_RECTF,
523 OPCODE_EVAL_C1,
524 OPCODE_EVAL_C2,
525 OPCODE_EVAL_P1,
526 OPCODE_EVAL_P2,
527
528 /* GL_EXT_provoking_vertex */
529 OPCODE_PROVOKING_VERTEX,
530
531 /* GL_EXT_transform_feedback */
532 OPCODE_BEGIN_TRANSFORM_FEEDBACK,
533 OPCODE_END_TRANSFORM_FEEDBACK,
534 OPCODE_BIND_TRANSFORM_FEEDBACK,
535 OPCODE_PAUSE_TRANSFORM_FEEDBACK,
536 OPCODE_RESUME_TRANSFORM_FEEDBACK,
537 OPCODE_DRAW_TRANSFORM_FEEDBACK,
538
539 /* GL_EXT_texture_integer */
540 OPCODE_CLEARCOLOR_I,
541 OPCODE_CLEARCOLOR_UI,
542 OPCODE_TEXPARAMETER_I,
543 OPCODE_TEXPARAMETER_UI,
544
545 /* GL_ARB_instanced_arrays */
546 OPCODE_VERTEX_ATTRIB_DIVISOR,
547
548 /* GL_NV_texture_barrier */
549 OPCODE_TEXTURE_BARRIER_NV,
550
551 /* GL_ARB_sampler_object */
552 OPCODE_BIND_SAMPLER,
553 OPCODE_SAMPLER_PARAMETERIV,
554 OPCODE_SAMPLER_PARAMETERFV,
555 OPCODE_SAMPLER_PARAMETERIIV,
556 OPCODE_SAMPLER_PARAMETERUIV,
557
558 /* ARB_compute_shader */
559 OPCODE_DISPATCH_COMPUTE,
560
561 /* GL_ARB_sync */
562 OPCODE_WAIT_SYNC,
563
564 /* GL_NV_conditional_render */
565 OPCODE_BEGIN_CONDITIONAL_RENDER,
566 OPCODE_END_CONDITIONAL_RENDER,
567
568 /* ARB_timer_query */
569 OPCODE_QUERY_COUNTER,
570
571 /* ARB_transform_feedback3 */
572 OPCODE_BEGIN_QUERY_INDEXED,
573 OPCODE_END_QUERY_INDEXED,
574 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM,
575
576 /* ARB_transform_feedback_instanced */
577 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
578 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
579
580 /* ARB_uniform_buffer_object */
581 OPCODE_UNIFORM_BLOCK_BINDING,
582
583 /* ARB_shader_subroutines */
584 OPCODE_UNIFORM_SUBROUTINES,
585
586 /* EXT_polygon_offset_clamp */
587 OPCODE_POLYGON_OFFSET_CLAMP,
588
589 /* EXT_window_rectangles */
590 OPCODE_WINDOW_RECTANGLES,
591
592 /* NV_conservative_raster */
593 OPCODE_SUBPIXEL_PRECISION_BIAS,
594
595 /* NV_conservative_raster_dilate */
596 OPCODE_CONSERVATIVE_RASTER_PARAMETER_F,
597
598 /* NV_conservative_raster_pre_snap_triangles */
599 OPCODE_CONSERVATIVE_RASTER_PARAMETER_I,
600
601 /* EXT_direct_state_access */
602 OPCODE_MATRIX_LOAD,
603 OPCODE_MATRIX_MULT,
604 OPCODE_MATRIX_ROTATE,
605 OPCODE_MATRIX_SCALE,
606 OPCODE_MATRIX_TRANSLATE,
607 OPCODE_MATRIX_LOAD_IDENTITY,
608 OPCODE_MATRIX_ORTHO,
609 OPCODE_MATRIX_FRUSTUM,
610 OPCODE_MATRIX_PUSH,
611 OPCODE_MATRIX_POP,
612 OPCODE_TEXTUREPARAMETER_F,
613 OPCODE_TEXTUREPARAMETER_I,
614 OPCODE_TEXTUREPARAMETER_II,
615 OPCODE_TEXTUREPARAMETER_IUI,
616 OPCODE_TEXTURE_IMAGE1D,
617 OPCODE_TEXTURE_IMAGE2D,
618 OPCODE_TEXTURE_IMAGE3D,
619 OPCODE_TEXTURE_SUB_IMAGE1D,
620 OPCODE_TEXTURE_SUB_IMAGE2D,
621 OPCODE_TEXTURE_SUB_IMAGE3D,
622 OPCODE_COPY_TEXTURE_IMAGE1D,
623 OPCODE_COPY_TEXTURE_IMAGE2D,
624 OPCODE_COPY_TEXTURE_SUB_IMAGE1D,
625 OPCODE_COPY_TEXTURE_SUB_IMAGE2D,
626 OPCODE_COPY_TEXTURE_SUB_IMAGE3D,
627 OPCODE_BIND_MULTITEXTURE,
628 OPCODE_MULTITEXPARAMETER_F,
629 OPCODE_MULTITEXPARAMETER_I,
630 OPCODE_MULTITEXPARAMETER_II,
631 OPCODE_MULTITEXPARAMETER_IUI,
632 OPCODE_MULTITEX_IMAGE1D,
633 OPCODE_MULTITEX_IMAGE2D,
634 OPCODE_MULTITEX_IMAGE3D,
635 OPCODE_MULTITEX_SUB_IMAGE1D,
636 OPCODE_MULTITEX_SUB_IMAGE2D,
637 OPCODE_MULTITEX_SUB_IMAGE3D,
638 OPCODE_COPY_MULTITEX_IMAGE1D,
639 OPCODE_COPY_MULTITEX_IMAGE2D,
640 OPCODE_COPY_MULTITEX_SUB_IMAGE1D,
641 OPCODE_COPY_MULTITEX_SUB_IMAGE2D,
642 OPCODE_COPY_MULTITEX_SUB_IMAGE3D,
643 OPCODE_MULTITEXENV,
644 OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
645 OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
646 OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
647 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
648 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
649 OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
650 OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
651 OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
652 OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
653 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
654 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
655 OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
656 OPCODE_NAMED_PROGRAM_STRING,
657 OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER,
658
659 /* The following three are meta instructions */
660 OPCODE_ERROR, /* raise compiled-in error */
661 OPCODE_CONTINUE,
662 OPCODE_NOP, /* No-op (used for 8-byte alignment */
663 OPCODE_END_OF_LIST,
664 OPCODE_EXT_0
665 } OpCode;
666
667
668
669 /**
670 * Display list node.
671 *
672 * Display list instructions are stored as sequences of "nodes". Nodes
673 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
674 * are linked together with a pointer.
675 *
676 * Each instruction in the display list is stored as a sequence of
677 * contiguous nodes in memory.
678 * Each node is the union of a variety of data types.
679 *
680 * Note, all of these members should be 4 bytes in size or less for the
681 * sake of compact display lists. We store 8-byte pointers in a pair of
682 * these nodes using the save/get_pointer() functions below.
683 */
684 union gl_dlist_node
685 {
686 OpCode opcode;
687 GLboolean b;
688 GLbitfield bf;
689 GLubyte ub;
690 GLshort s;
691 GLushort us;
692 GLint i;
693 GLuint ui;
694 GLenum e;
695 GLfloat f;
696 GLsizei si;
697 };
698
699
700 typedef union gl_dlist_node Node;
701
702
703 /** How many 4-byte dwords to store a pointer */
704 #define POINTER_DWORDS (sizeof(void *) / 4)
705
706 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
707 * space for display lists. The following types and functions are
708 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
709 */
710 union pointer
711 {
712 void *ptr;
713 GLuint dwords[POINTER_DWORDS];
714 };
715
716
717 /**
718 * Save a 4 or 8-byte pointer at dest (and dest+1).
719 */
720 static inline void
721 save_pointer(Node *dest, void *src)
722 {
723 union pointer p;
724 unsigned i;
725
726 STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
727 STATIC_ASSERT(sizeof(Node) == 4);
728
729 p.ptr = src;
730
731 for (i = 0; i < POINTER_DWORDS; i++)
732 dest[i].ui = p.dwords[i];
733 }
734
735
736 /**
737 * Retrieve a 4 or 8-byte pointer from node (node+1).
738 */
739 static inline void *
740 get_pointer(const Node *node)
741 {
742 union pointer p;
743 unsigned i;
744
745 for (i = 0; i < POINTER_DWORDS; i++)
746 p.dwords[i] = node[i].ui;
747
748 return p.ptr;
749 }
750
751
752 /**
753 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
754 * environment.
755 */
756 union uint64_pair
757 {
758 GLuint64 uint64;
759 GLuint uint32[2];
760 };
761
762
763 union float64_pair
764 {
765 GLdouble d;
766 GLuint uint32[2];
767 };
768
769 union int64_pair
770 {
771 GLint64 int64;
772 GLint int32[2];
773 };
774
775 #define ASSIGN_DOUBLE_TO_NODES(n, idx, value) \
776 do { \
777 union float64_pair tmp; \
778 tmp.d = value; \
779 n[idx].ui = tmp.uint32[0]; \
780 n[idx+1].ui = tmp.uint32[1]; \
781 } while (0)
782
783 #define ASSIGN_UINT64_TO_NODES(n, idx, value) \
784 do { \
785 union uint64_pair tmp; \
786 tmp.uint64 = value; \
787 n[idx].ui = tmp.uint32[0]; \
788 n[idx+1].ui = tmp.uint32[1]; \
789 } while (0)
790
791 #define ASSIGN_INT64_TO_NODES(n, idx, value) \
792 do { \
793 union int64_pair tmp; \
794 tmp.int64 = value; \
795 n[idx].i = tmp.int32[0]; \
796 n[idx+1].i = tmp.int32[1]; \
797 } while (0)
798
799 /**
800 * How many nodes to allocate at a time. Note that bulk vertex data
801 * from glBegin/glVertex/glEnd primitives will typically wind up in
802 * a VBO, and not directly in the display list itself.
803 */
804 #define BLOCK_SIZE 256
805
806
807
808 /**
809 * Number of nodes of storage needed for each instruction.
810 * Sizes for dynamically allocated opcodes are stored in the context struct.
811 */
812 static GLuint InstSize[OPCODE_END_OF_LIST + 1];
813
814
815 void mesa_print_display_list(GLuint list);
816
817
818 /**
819 * Does the given display list only contain a single glBitmap call?
820 */
821 static bool
822 is_bitmap_list(const struct gl_display_list *dlist)
823 {
824 const Node *n = dlist->Head;
825 if (n[0].opcode == OPCODE_BITMAP) {
826 n += InstSize[OPCODE_BITMAP];
827 if (n[0].opcode == OPCODE_END_OF_LIST)
828 return true;
829 }
830 return false;
831 }
832
833
834 /**
835 * Is the given display list an empty list?
836 */
837 static bool
838 is_empty_list(const struct gl_display_list *dlist)
839 {
840 const Node *n = dlist->Head;
841 return n[0].opcode == OPCODE_END_OF_LIST;
842 }
843
844
845 /**
846 * Delete/free a gl_bitmap_atlas. Called during context tear-down.
847 */
848 void
849 _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas)
850 {
851 if (atlas->texObj) {
852 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
853 }
854 free(atlas->glyphs);
855 free(atlas);
856 }
857
858
859 /**
860 * Lookup a gl_bitmap_atlas by listBase ID.
861 */
862 static struct gl_bitmap_atlas *
863 lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
864 {
865 struct gl_bitmap_atlas *atlas;
866
867 assert(listBase > 0);
868 atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase);
869 return atlas;
870 }
871
872
873 /**
874 * Create new bitmap atlas and insert into hash table.
875 */
876 static struct gl_bitmap_atlas *
877 alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
878 {
879 struct gl_bitmap_atlas *atlas;
880
881 assert(listBase > 0);
882 assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL);
883
884 atlas = calloc(1, sizeof(*atlas));
885 if (atlas) {
886 _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
887 }
888
889 return atlas;
890 }
891
892
893 /**
894 * Try to build a bitmap atlas. This involves examining a sequence of
895 * display lists which contain glBitmap commands and putting the bitmap
896 * images into a texture map (the atlas).
897 * If we succeed, gl_bitmap_atlas::complete will be set to true.
898 * If we fail, gl_bitmap_atlas::incomplete will be set to true.
899 */
900 static void
901 build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas,
902 GLuint listBase)
903 {
904 unsigned i, row_height = 0, xpos = 0, ypos = 0;
905 GLubyte *map;
906 GLint map_stride;
907
908 assert(atlas);
909 assert(!atlas->complete);
910 assert(atlas->numBitmaps > 0);
911
912 /* We use a rectangle texture (non-normalized coords) for the atlas */
913 assert(ctx->Extensions.NV_texture_rectangle);
914 assert(ctx->Const.MaxTextureRectSize >= 1024);
915
916 atlas->texWidth = 1024;
917 atlas->texHeight = 0; /* determined below */
918
919 atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0]));
920 if (!atlas->glyphs) {
921 /* give up */
922 atlas->incomplete = true;
923 return;
924 }
925
926 /* Loop over the display lists. They should all contain a single glBitmap
927 * call. If not, bail out. Also, compute the position and sizes of each
928 * bitmap in the atlas to determine the texture atlas size.
929 */
930 for (i = 0; i < atlas->numBitmaps; i++) {
931 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
932 const Node *n;
933 struct gl_bitmap_glyph *g = &atlas->glyphs[i];
934 unsigned bitmap_width, bitmap_height;
935 float bitmap_xmove, bitmap_ymove, bitmap_xorig, bitmap_yorig;
936
937 if (!list || is_empty_list(list)) {
938 /* stop here */
939 atlas->numBitmaps = i;
940 break;
941 }
942
943 if (!is_bitmap_list(list)) {
944 /* This list does not contain exactly one glBitmap command. Give up. */
945 atlas->incomplete = true;
946 return;
947 }
948
949 /* get bitmap info from the display list command */
950 n = list->Head;
951 assert(n[0].opcode == OPCODE_BITMAP);
952 bitmap_width = n[1].i;
953 bitmap_height = n[2].i;
954 bitmap_xorig = n[3].f;
955 bitmap_yorig = n[4].f;
956 bitmap_xmove = n[5].f;
957 bitmap_ymove = n[6].f;
958
959 if (xpos + bitmap_width > atlas->texWidth) {
960 /* advance to the next row of the texture */
961 xpos = 0;
962 ypos += row_height;
963 row_height = 0;
964 }
965
966 /* save the bitmap's position in the atlas */
967 g->x = xpos;
968 g->y = ypos;
969 g->w = bitmap_width;
970 g->h = bitmap_height;
971 g->xorig = bitmap_xorig;
972 g->yorig = bitmap_yorig;
973 g->xmove = bitmap_xmove;
974 g->ymove = bitmap_ymove;
975
976 xpos += bitmap_width;
977
978 /* keep track of tallest bitmap in the row */
979 row_height = MAX2(row_height, bitmap_height);
980 }
981
982 /* Now we know the texture height */
983 atlas->texHeight = ypos + row_height;
984
985 if (atlas->texHeight == 0) {
986 /* no glyphs found, give up */
987 goto fail;
988 }
989 else if (atlas->texHeight > ctx->Const.MaxTextureRectSize) {
990 /* too large, give up */
991 goto fail;
992 }
993
994 /* Create atlas texture (texture ID is irrelevant) */
995 atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE);
996 if (!atlas->texObj) {
997 goto out_of_memory;
998 }
999
1000 atlas->texObj->Sampler.MinFilter = GL_NEAREST;
1001 atlas->texObj->Sampler.MagFilter = GL_NEAREST;
1002 atlas->texObj->MaxLevel = 0;
1003 atlas->texObj->Immutable = GL_TRUE;
1004
1005 atlas->texImage = _mesa_get_tex_image(ctx, atlas->texObj,
1006 GL_TEXTURE_RECTANGLE, 0);
1007 if (!atlas->texImage) {
1008 goto out_of_memory;
1009 }
1010
1011 if (ctx->Const.BitmapUsesRed)
1012 _mesa_init_teximage_fields(ctx, atlas->texImage,
1013 atlas->texWidth, atlas->texHeight, 1, 0,
1014 GL_RED, MESA_FORMAT_R_UNORM8);
1015 else
1016 _mesa_init_teximage_fields(ctx, atlas->texImage,
1017 atlas->texWidth, atlas->texHeight, 1, 0,
1018 GL_ALPHA, MESA_FORMAT_A_UNORM8);
1019
1020 /* alloc image storage */
1021 if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) {
1022 goto out_of_memory;
1023 }
1024
1025 /* map teximage, load with bitmap glyphs */
1026 ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0,
1027 0, 0, atlas->texWidth, atlas->texHeight,
1028 GL_MAP_WRITE_BIT, &map, &map_stride);
1029 if (!map) {
1030 goto out_of_memory;
1031 }
1032
1033 /* Background/clear pixels are 0xff, foreground/set pixels are 0x0 */
1034 memset(map, 0xff, map_stride * atlas->texHeight);
1035
1036 for (i = 0; i < atlas->numBitmaps; i++) {
1037 const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i);
1038 const Node *n = list->Head;
1039
1040 assert(n[0].opcode == OPCODE_BITMAP ||
1041 n[0].opcode == OPCODE_END_OF_LIST);
1042
1043 if (n[0].opcode == OPCODE_BITMAP) {
1044 unsigned bitmap_width = n[1].i;
1045 unsigned bitmap_height = n[2].i;
1046 unsigned xpos = atlas->glyphs[i].x;
1047 unsigned ypos = atlas->glyphs[i].y;
1048 const void *bitmap_image = get_pointer(&n[7]);
1049
1050 assert(atlas->glyphs[i].w == bitmap_width);
1051 assert(atlas->glyphs[i].h == bitmap_height);
1052
1053 /* put the bitmap image into the texture image */
1054 _mesa_expand_bitmap(bitmap_width, bitmap_height,
1055 &ctx->DefaultPacking, bitmap_image,
1056 map + map_stride * ypos + xpos, /* dest addr */
1057 map_stride, 0x0);
1058 }
1059 }
1060
1061 ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0);
1062
1063 atlas->complete = true;
1064
1065 return;
1066
1067 out_of_memory:
1068 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas");
1069 fail:
1070 if (atlas->texObj) {
1071 ctx->Driver.DeleteTexture(ctx, atlas->texObj);
1072 }
1073 free(atlas->glyphs);
1074 atlas->glyphs = NULL;
1075 atlas->incomplete = true;
1076 }
1077
1078
1079 /**
1080 * Allocate a gl_display_list object with an initial block of storage.
1081 * \param count how many display list nodes/tokens to allocate
1082 */
1083 static struct gl_display_list *
1084 make_list(GLuint name, GLuint count)
1085 {
1086 struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
1087 dlist->Name = name;
1088 dlist->Head = malloc(sizeof(Node) * count);
1089 dlist->Head[0].opcode = OPCODE_END_OF_LIST;
1090 /* All InstSize[] entries must be non-zero */
1091 InstSize[OPCODE_END_OF_LIST] = 1;
1092 return dlist;
1093 }
1094
1095
1096 /**
1097 * Lookup function to just encapsulate casting.
1098 */
1099 struct gl_display_list *
1100 _mesa_lookup_list(struct gl_context *ctx, GLuint list)
1101 {
1102 return (struct gl_display_list *)
1103 _mesa_HashLookup(ctx->Shared->DisplayList, list);
1104 }
1105
1106
1107 /** Is the given opcode an extension code? */
1108 static inline GLboolean
1109 is_ext_opcode(OpCode opcode)
1110 {
1111 return (opcode >= OPCODE_EXT_0);
1112 }
1113
1114
1115 /** Destroy an extended opcode instruction */
1116 static GLint
1117 ext_opcode_destroy(struct gl_context *ctx, Node *node)
1118 {
1119 const GLint i = node[0].opcode - OPCODE_EXT_0;
1120 GLint step;
1121 ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]);
1122 step = ctx->ListExt->Opcode[i].Size;
1123 return step;
1124 }
1125
1126
1127 /** Execute an extended opcode instruction */
1128 static GLint
1129 ext_opcode_execute(struct gl_context *ctx, Node *node)
1130 {
1131 const GLint i = node[0].opcode - OPCODE_EXT_0;
1132 GLint step;
1133 ctx->ListExt->Opcode[i].Execute(ctx, &node[1]);
1134 step = ctx->ListExt->Opcode[i].Size;
1135 return step;
1136 }
1137
1138
1139 /** Print an extended opcode instruction */
1140 static GLint
1141 ext_opcode_print(struct gl_context *ctx, Node *node, FILE *f)
1142 {
1143 const GLint i = node[0].opcode - OPCODE_EXT_0;
1144 GLint step;
1145 ctx->ListExt->Opcode[i].Print(ctx, &node[1], f);
1146 step = ctx->ListExt->Opcode[i].Size;
1147 return step;
1148 }
1149
1150
1151 /**
1152 * Delete the named display list, but don't remove from hash table.
1153 * \param dlist - display list pointer
1154 */
1155 void
1156 _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
1157 {
1158 Node *n, *block;
1159 GLboolean done;
1160
1161 n = block = dlist->Head;
1162
1163 done = block ? GL_FALSE : GL_TRUE;
1164 while (!done) {
1165 const OpCode opcode = n[0].opcode;
1166
1167 /* check for extension opcodes first */
1168 if (is_ext_opcode(opcode)) {
1169 n += ext_opcode_destroy(ctx, n);
1170 }
1171 else {
1172 switch (opcode) {
1173 /* for some commands, we need to free malloc'd memory */
1174 case OPCODE_MAP1:
1175 free(get_pointer(&n[6]));
1176 break;
1177 case OPCODE_MAP2:
1178 free(get_pointer(&n[10]));
1179 break;
1180 case OPCODE_CALL_LISTS:
1181 free(get_pointer(&n[3]));
1182 break;
1183 case OPCODE_DRAW_PIXELS:
1184 free(get_pointer(&n[5]));
1185 break;
1186 case OPCODE_BITMAP:
1187 free(get_pointer(&n[7]));
1188 break;
1189 case OPCODE_POLYGON_STIPPLE:
1190 free(get_pointer(&n[1]));
1191 break;
1192 case OPCODE_TEX_IMAGE1D:
1193 free(get_pointer(&n[8]));
1194 break;
1195 case OPCODE_TEX_IMAGE2D:
1196 free(get_pointer(&n[9]));
1197 break;
1198 case OPCODE_TEX_IMAGE3D:
1199 free(get_pointer(&n[10]));
1200 break;
1201 case OPCODE_TEX_SUB_IMAGE1D:
1202 free(get_pointer(&n[7]));
1203 break;
1204 case OPCODE_TEX_SUB_IMAGE2D:
1205 free(get_pointer(&n[9]));
1206 break;
1207 case OPCODE_TEX_SUB_IMAGE3D:
1208 free(get_pointer(&n[11]));
1209 break;
1210 case OPCODE_COMPRESSED_TEX_IMAGE_1D:
1211 free(get_pointer(&n[7]));
1212 break;
1213 case OPCODE_COMPRESSED_TEX_IMAGE_2D:
1214 free(get_pointer(&n[8]));
1215 break;
1216 case OPCODE_COMPRESSED_TEX_IMAGE_3D:
1217 free(get_pointer(&n[9]));
1218 break;
1219 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
1220 free(get_pointer(&n[7]));
1221 break;
1222 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
1223 free(get_pointer(&n[9]));
1224 break;
1225 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
1226 free(get_pointer(&n[11]));
1227 break;
1228 case OPCODE_PROGRAM_STRING_ARB:
1229 free(get_pointer(&n[4])); /* program string */
1230 break;
1231 case OPCODE_UNIFORM_1FV:
1232 case OPCODE_UNIFORM_2FV:
1233 case OPCODE_UNIFORM_3FV:
1234 case OPCODE_UNIFORM_4FV:
1235 case OPCODE_UNIFORM_1DV:
1236 case OPCODE_UNIFORM_2DV:
1237 case OPCODE_UNIFORM_3DV:
1238 case OPCODE_UNIFORM_4DV:
1239 case OPCODE_UNIFORM_1IV:
1240 case OPCODE_UNIFORM_2IV:
1241 case OPCODE_UNIFORM_3IV:
1242 case OPCODE_UNIFORM_4IV:
1243 case OPCODE_UNIFORM_1UIV:
1244 case OPCODE_UNIFORM_2UIV:
1245 case OPCODE_UNIFORM_3UIV:
1246 case OPCODE_UNIFORM_4UIV:
1247 case OPCODE_UNIFORM_1I64V:
1248 case OPCODE_UNIFORM_2I64V:
1249 case OPCODE_UNIFORM_3I64V:
1250 case OPCODE_UNIFORM_4I64V:
1251 case OPCODE_UNIFORM_1UI64V:
1252 case OPCODE_UNIFORM_2UI64V:
1253 case OPCODE_UNIFORM_3UI64V:
1254 case OPCODE_UNIFORM_4UI64V:
1255 free(get_pointer(&n[3]));
1256 break;
1257 case OPCODE_UNIFORM_MATRIX22:
1258 case OPCODE_UNIFORM_MATRIX33:
1259 case OPCODE_UNIFORM_MATRIX44:
1260 case OPCODE_UNIFORM_MATRIX24:
1261 case OPCODE_UNIFORM_MATRIX42:
1262 case OPCODE_UNIFORM_MATRIX23:
1263 case OPCODE_UNIFORM_MATRIX32:
1264 case OPCODE_UNIFORM_MATRIX34:
1265 case OPCODE_UNIFORM_MATRIX43:
1266 case OPCODE_UNIFORM_MATRIX22D:
1267 case OPCODE_UNIFORM_MATRIX33D:
1268 case OPCODE_UNIFORM_MATRIX44D:
1269 case OPCODE_UNIFORM_MATRIX24D:
1270 case OPCODE_UNIFORM_MATRIX42D:
1271 case OPCODE_UNIFORM_MATRIX23D:
1272 case OPCODE_UNIFORM_MATRIX32D:
1273 case OPCODE_UNIFORM_MATRIX34D:
1274 case OPCODE_UNIFORM_MATRIX43D:
1275 free(get_pointer(&n[4]));
1276 break;
1277 case OPCODE_PROGRAM_UNIFORM_1FV:
1278 case OPCODE_PROGRAM_UNIFORM_2FV:
1279 case OPCODE_PROGRAM_UNIFORM_3FV:
1280 case OPCODE_PROGRAM_UNIFORM_4FV:
1281 case OPCODE_PROGRAM_UNIFORM_1DV:
1282 case OPCODE_PROGRAM_UNIFORM_2DV:
1283 case OPCODE_PROGRAM_UNIFORM_3DV:
1284 case OPCODE_PROGRAM_UNIFORM_4DV:
1285 case OPCODE_PROGRAM_UNIFORM_1IV:
1286 case OPCODE_PROGRAM_UNIFORM_2IV:
1287 case OPCODE_PROGRAM_UNIFORM_3IV:
1288 case OPCODE_PROGRAM_UNIFORM_4IV:
1289 case OPCODE_PROGRAM_UNIFORM_1UIV:
1290 case OPCODE_PROGRAM_UNIFORM_2UIV:
1291 case OPCODE_PROGRAM_UNIFORM_3UIV:
1292 case OPCODE_PROGRAM_UNIFORM_4UIV:
1293 case OPCODE_PROGRAM_UNIFORM_1I64V:
1294 case OPCODE_PROGRAM_UNIFORM_2I64V:
1295 case OPCODE_PROGRAM_UNIFORM_3I64V:
1296 case OPCODE_PROGRAM_UNIFORM_4I64V:
1297 case OPCODE_PROGRAM_UNIFORM_1UI64V:
1298 case OPCODE_PROGRAM_UNIFORM_2UI64V:
1299 case OPCODE_PROGRAM_UNIFORM_3UI64V:
1300 case OPCODE_PROGRAM_UNIFORM_4UI64V:
1301 free(get_pointer(&n[4]));
1302 break;
1303 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
1304 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
1305 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
1306 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
1307 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
1308 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
1309 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
1310 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
1311 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
1312 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
1313 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
1314 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
1315 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
1316 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
1317 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
1318 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
1319 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
1320 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
1321 free(get_pointer(&n[5]));
1322 break;
1323 case OPCODE_PIXEL_MAP:
1324 free(get_pointer(&n[3]));
1325 break;
1326 case OPCODE_VIEWPORT_ARRAY_V:
1327 case OPCODE_SCISSOR_ARRAY_V:
1328 case OPCODE_DEPTH_ARRAY_V:
1329 case OPCODE_UNIFORM_SUBROUTINES:
1330 case OPCODE_WINDOW_RECTANGLES:
1331 free(get_pointer(&n[3]));
1332 break;
1333 case OPCODE_TEXTURE_IMAGE1D:
1334 case OPCODE_MULTITEX_IMAGE1D:
1335 free(get_pointer(&n[9]));
1336 break;
1337 case OPCODE_TEXTURE_IMAGE2D:
1338 case OPCODE_MULTITEX_IMAGE2D:
1339 free(get_pointer(&n[10]));
1340 break;
1341 case OPCODE_TEXTURE_IMAGE3D:
1342 case OPCODE_MULTITEX_IMAGE3D:
1343 free(get_pointer(&n[11]));
1344 break;
1345 case OPCODE_TEXTURE_SUB_IMAGE1D:
1346 case OPCODE_MULTITEX_SUB_IMAGE1D:
1347 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
1348 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
1349 free(get_pointer(&n[8]));
1350 break;
1351 case OPCODE_TEXTURE_SUB_IMAGE2D:
1352 case OPCODE_MULTITEX_SUB_IMAGE2D:
1353 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
1354 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
1355 free(get_pointer(&n[10]));
1356 break;
1357 case OPCODE_TEXTURE_SUB_IMAGE3D:
1358 case OPCODE_MULTITEX_SUB_IMAGE3D:
1359 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
1360 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
1361 free(get_pointer(&n[12]));
1362 break;
1363 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
1364 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
1365 free(get_pointer(&n[8]));
1366 break;
1367 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
1368 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
1369 free(get_pointer(&n[9]));
1370 break;
1371 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
1372 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
1373 free(get_pointer(&n[10]));
1374 break;
1375 case OPCODE_NAMED_PROGRAM_STRING:
1376 free(get_pointer(&n[5]));
1377 break;
1378 case OPCODE_CONTINUE:
1379 n = (Node *) get_pointer(&n[1]);
1380 free(block);
1381 block = n;
1382 break;
1383 case OPCODE_END_OF_LIST:
1384 free(block);
1385 done = GL_TRUE;
1386 break;
1387 default:
1388 /* just increment 'n' pointer, below */
1389 ;
1390 }
1391
1392 if (opcode != OPCODE_CONTINUE) {
1393 assert(InstSize[opcode] > 0);
1394 n += InstSize[opcode];
1395 }
1396 }
1397 }
1398
1399 free(dlist->Label);
1400 free(dlist);
1401 }
1402
1403
1404 /**
1405 * Called by _mesa_HashWalk() to check if a display list which is being
1406 * deleted belongs to a bitmap texture atlas.
1407 */
1408 static void
1409 check_atlas_for_deleted_list(GLuint atlas_id, void *data, void *userData)
1410 {
1411 struct gl_bitmap_atlas *atlas = (struct gl_bitmap_atlas *) data;
1412 GLuint list_id = *((GLuint *) userData); /* the list being deleted */
1413
1414 /* See if the list_id falls in the range contained in this texture atlas */
1415 if (atlas->complete &&
1416 list_id >= atlas_id &&
1417 list_id < atlas_id + atlas->numBitmaps) {
1418 /* Mark the atlas as incomplete so it doesn't get used. But don't
1419 * delete it yet since we don't want to try to recreate it in the next
1420 * glCallLists.
1421 */
1422 atlas->complete = false;
1423 atlas->incomplete = true;
1424 }
1425 }
1426
1427
1428 /**
1429 * Destroy a display list and remove from hash table.
1430 * \param list - display list number
1431 */
1432 static void
1433 destroy_list(struct gl_context *ctx, GLuint list)
1434 {
1435 struct gl_display_list *dlist;
1436
1437 if (list == 0)
1438 return;
1439
1440 dlist = _mesa_lookup_list(ctx, list);
1441 if (!dlist)
1442 return;
1443
1444 if (is_bitmap_list(dlist)) {
1445 /* If we're destroying a simple glBitmap display list, there's a
1446 * chance that we're destroying a bitmap image that's in a texture
1447 * atlas. Examine all atlases to see if that's the case. There's
1448 * usually few (if any) atlases so this isn't expensive.
1449 */
1450 _mesa_HashWalk(ctx->Shared->BitmapAtlas,
1451 check_atlas_for_deleted_list, &list);
1452 }
1453
1454 _mesa_delete_list(ctx, dlist);
1455 _mesa_HashRemove(ctx->Shared->DisplayList, list);
1456 }
1457
1458
1459 /*
1460 * Translate the nth element of list from <type> to GLint.
1461 */
1462 static GLint
1463 translate_id(GLsizei n, GLenum type, const GLvoid * list)
1464 {
1465 GLbyte *bptr;
1466 GLubyte *ubptr;
1467 GLshort *sptr;
1468 GLushort *usptr;
1469 GLint *iptr;
1470 GLuint *uiptr;
1471 GLfloat *fptr;
1472
1473 switch (type) {
1474 case GL_BYTE:
1475 bptr = (GLbyte *) list;
1476 return (GLint) bptr[n];
1477 case GL_UNSIGNED_BYTE:
1478 ubptr = (GLubyte *) list;
1479 return (GLint) ubptr[n];
1480 case GL_SHORT:
1481 sptr = (GLshort *) list;
1482 return (GLint) sptr[n];
1483 case GL_UNSIGNED_SHORT:
1484 usptr = (GLushort *) list;
1485 return (GLint) usptr[n];
1486 case GL_INT:
1487 iptr = (GLint *) list;
1488 return iptr[n];
1489 case GL_UNSIGNED_INT:
1490 uiptr = (GLuint *) list;
1491 return (GLint) uiptr[n];
1492 case GL_FLOAT:
1493 fptr = (GLfloat *) list;
1494 return (GLint) floorf(fptr[n]);
1495 case GL_2_BYTES:
1496 ubptr = ((GLubyte *) list) + 2 * n;
1497 return (GLint) ubptr[0] * 256
1498 + (GLint) ubptr[1];
1499 case GL_3_BYTES:
1500 ubptr = ((GLubyte *) list) + 3 * n;
1501 return (GLint) ubptr[0] * 65536
1502 + (GLint) ubptr[1] * 256
1503 + (GLint) ubptr[2];
1504 case GL_4_BYTES:
1505 ubptr = ((GLubyte *) list) + 4 * n;
1506 return (GLint) ubptr[0] * 16777216
1507 + (GLint) ubptr[1] * 65536
1508 + (GLint) ubptr[2] * 256
1509 + (GLint) ubptr[3];
1510 default:
1511 return 0;
1512 }
1513 }
1514
1515
1516 /**
1517 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
1518 * If width < 0 or height < 0 or format or type are invalid we'll just
1519 * return NULL. We will not generate an error since OpenGL command
1520 * arguments aren't error-checked until the command is actually executed
1521 * (not when they're compiled).
1522 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
1523 */
1524 static GLvoid *
1525 unpack_image(struct gl_context *ctx, GLuint dimensions,
1526 GLsizei width, GLsizei height, GLsizei depth,
1527 GLenum format, GLenum type, const GLvoid * pixels,
1528 const struct gl_pixelstore_attrib *unpack)
1529 {
1530 if (width <= 0 || height <= 0) {
1531 return NULL;
1532 }
1533
1534 if (_mesa_bytes_per_pixel(format, type) < 0) {
1535 /* bad format and/or type */
1536 return NULL;
1537 }
1538
1539 if (!_mesa_is_bufferobj(unpack->BufferObj)) {
1540 /* no PBO */
1541 GLvoid *image;
1542
1543 image = _mesa_unpack_image(dimensions, width, height, depth,
1544 format, type, pixels, unpack);
1545 if (pixels && !image) {
1546 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1547 }
1548 return image;
1549 }
1550 else if (_mesa_validate_pbo_access(dimensions, unpack, width, height,
1551 depth, format, type, INT_MAX, pixels)) {
1552 const GLubyte *map, *src;
1553 GLvoid *image;
1554
1555 map = (GLubyte *)
1556 ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
1557 GL_MAP_READ_BIT, unpack->BufferObj,
1558 MAP_INTERNAL);
1559 if (!map) {
1560 /* unable to map src buffer! */
1561 _mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
1562 return NULL;
1563 }
1564
1565 src = ADD_POINTERS(map, pixels);
1566 image = _mesa_unpack_image(dimensions, width, height, depth,
1567 format, type, src, unpack);
1568
1569 ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj, MAP_INTERNAL);
1570
1571 if (!image) {
1572 _mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
1573 }
1574 return image;
1575 }
1576
1577 /* bad access! */
1578 _mesa_error(ctx, GL_INVALID_OPERATION, "invalid PBO access");
1579 return NULL;
1580 }
1581
1582
1583 /** Return copy of memory */
1584 static void *
1585 memdup(const void *src, GLsizei bytes)
1586 {
1587 void *b = bytes >= 0 ? malloc(bytes) : NULL;
1588 if (b)
1589 memcpy(b, src, bytes);
1590 return b;
1591 }
1592
1593
1594 /**
1595 * Allocate space for a display list instruction (opcode + payload space).
1596 * \param opcode the instruction opcode (OPCODE_* value)
1597 * \param bytes instruction payload size (not counting opcode)
1598 * \param align8 does the payload need to be 8-byte aligned?
1599 * This is only relevant in 64-bit environments.
1600 * \return pointer to allocated memory (the payload will be at pointer+1)
1601 */
1602 static Node *
1603 dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8)
1604 {
1605 const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
1606 const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
1607 GLuint nopNode;
1608 Node *n;
1609
1610 assert(bytes <= BLOCK_SIZE * sizeof(Node));
1611
1612 if (opcode < OPCODE_EXT_0) {
1613 if (InstSize[opcode] == 0) {
1614 /* save instruction size now */
1615 InstSize[opcode] = numNodes;
1616 }
1617 else {
1618 /* make sure instruction size agrees */
1619 assert(numNodes == InstSize[opcode]);
1620 }
1621 }
1622
1623 if (sizeof(void *) > sizeof(Node) && align8
1624 && ctx->ListState.CurrentPos % 2 == 0) {
1625 /* The opcode would get placed at node[0] and the payload would start
1626 * at node[1]. But the payload needs to be at an even offset (8-byte
1627 * multiple).
1628 */
1629 nopNode = 1;
1630 }
1631 else {
1632 nopNode = 0;
1633 }
1634
1635 if (ctx->ListState.CurrentPos + nopNode + numNodes + contNodes
1636 > BLOCK_SIZE) {
1637 /* This block is full. Allocate a new block and chain to it */
1638 Node *newblock;
1639 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1640 n[0].opcode = OPCODE_CONTINUE;
1641 newblock = malloc(sizeof(Node) * BLOCK_SIZE);
1642 if (!newblock) {
1643 _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
1644 return NULL;
1645 }
1646
1647 /* a fresh block should be 8-byte aligned on 64-bit systems */
1648 assert(((GLintptr) newblock) % sizeof(void *) == 0);
1649
1650 save_pointer(&n[1], newblock);
1651 ctx->ListState.CurrentBlock = newblock;
1652 ctx->ListState.CurrentPos = 0;
1653
1654 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1655 * we have to insert a NOP so that the payload of the real opcode lands
1656 * on an even location:
1657 * node[0] = OPCODE_NOP
1658 * node[1] = OPCODE_x;
1659 * node[2] = start of payload
1660 */
1661 nopNode = sizeof(void *) > sizeof(Node) && align8;
1662 }
1663
1664 n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
1665 if (nopNode) {
1666 assert(ctx->ListState.CurrentPos % 2 == 0); /* even value */
1667 n[0].opcode = OPCODE_NOP;
1668 n++;
1669 /* The "real" opcode will now be at an odd location and the payload
1670 * will be at an even location.
1671 */
1672 }
1673 ctx->ListState.CurrentPos += nopNode + numNodes;
1674
1675 n[0].opcode = opcode;
1676
1677 return n;
1678 }
1679
1680
1681
1682 /**
1683 * Allocate space for a display list instruction. Used by callers outside
1684 * this file for things like VBO vertex data.
1685 *
1686 * \param opcode the instruction opcode (OPCODE_* value)
1687 * \param bytes instruction size in bytes, not counting opcode.
1688 * \return pointer to the usable data area (not including the internal
1689 * opcode).
1690 */
1691 void *
1692 _mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1693 {
1694 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, false);
1695 if (n)
1696 return n + 1; /* return pointer to payload area, after opcode */
1697 else
1698 return NULL;
1699 }
1700
1701
1702 /**
1703 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1704 * aligned in 64-bit environments, 4-byte aligned otherwise.
1705 */
1706 void *
1707 _mesa_dlist_alloc_aligned(struct gl_context *ctx, GLuint opcode, GLuint bytes)
1708 {
1709 Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes, true);
1710 if (n)
1711 return n + 1; /* return pointer to payload area, after opcode */
1712 else
1713 return NULL;
1714 }
1715
1716
1717 /**
1718 * This function allows modules and drivers to get their own opcodes
1719 * for extending display list functionality.
1720 * \param ctx the rendering context
1721 * \param size number of bytes for storing the new display list command
1722 * \param execute function to execute the new display list command
1723 * \param destroy function to destroy the new display list command
1724 * \param print function to print the new display list command
1725 * \return the new opcode number or -1 if error
1726 */
1727 GLint
1728 _mesa_dlist_alloc_opcode(struct gl_context *ctx,
1729 GLuint size,
1730 void (*execute) (struct gl_context *, void *),
1731 void (*destroy) (struct gl_context *, void *),
1732 void (*print) (struct gl_context *, void *, FILE *))
1733 {
1734 if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
1735 const GLuint i = ctx->ListExt->NumOpcodes++;
1736 ctx->ListExt->Opcode[i].Size =
1737 1 + (size + sizeof(Node) - 1) / sizeof(Node);
1738 ctx->ListExt->Opcode[i].Execute = execute;
1739 ctx->ListExt->Opcode[i].Destroy = destroy;
1740 ctx->ListExt->Opcode[i].Print = print;
1741 return i + OPCODE_EXT_0;
1742 }
1743 return -1;
1744 }
1745
1746
1747 /**
1748 * Allocate space for a display list instruction. The space is basically
1749 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1750 * function parameter, node[2] is the second parameter, etc.
1751 *
1752 * \param opcode one of OPCODE_x
1753 * \param nparams number of function parameters
1754 * \return pointer to start of instruction space
1755 */
1756 static inline Node *
1757 alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
1758 {
1759 return dlist_alloc(ctx, opcode, nparams * sizeof(Node), false);
1760 }
1761
1762
1763 /**
1764 * Called by EndList to try to reduce memory used for the list.
1765 */
1766 static void
1767 trim_list(struct gl_context *ctx)
1768 {
1769 /* If the list we're ending only has one allocated block of nodes/tokens
1770 * and its size isn't a full block size, realloc the block to use less
1771 * memory. This is important for apps that create many small display
1772 * lists and apps that use glXUseXFont (many lists each containing one
1773 * glBitmap call).
1774 * Note: we currently only trim display lists that allocated one block
1775 * of tokens. That hits the short list case which is what we're mainly
1776 * concerned with. Trimming longer lists would involve traversing the
1777 * linked list of blocks.
1778 */
1779 struct gl_dlist_state *list = &ctx->ListState;
1780
1781 if ((list->CurrentList->Head == list->CurrentBlock) &&
1782 (list->CurrentPos < BLOCK_SIZE)) {
1783 /* There's only one block and it's not full, so realloc */
1784 GLuint newSize = list->CurrentPos * sizeof(Node);
1785 list->CurrentList->Head =
1786 list->CurrentBlock = realloc(list->CurrentBlock, newSize);
1787 if (!list->CurrentBlock) {
1788 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
1789 }
1790 }
1791 }
1792
1793
1794
1795 /*
1796 * Display List compilation functions
1797 */
1798 static void GLAPIENTRY
1799 save_Accum(GLenum op, GLfloat value)
1800 {
1801 GET_CURRENT_CONTEXT(ctx);
1802 Node *n;
1803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1804 n = alloc_instruction(ctx, OPCODE_ACCUM, 2);
1805 if (n) {
1806 n[1].e = op;
1807 n[2].f = value;
1808 }
1809 if (ctx->ExecuteFlag) {
1810 CALL_Accum(ctx->Exec, (op, value));
1811 }
1812 }
1813
1814
1815 static void GLAPIENTRY
1816 save_AlphaFunc(GLenum func, GLclampf ref)
1817 {
1818 GET_CURRENT_CONTEXT(ctx);
1819 Node *n;
1820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1821 n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2);
1822 if (n) {
1823 n[1].e = func;
1824 n[2].f = (GLfloat) ref;
1825 }
1826 if (ctx->ExecuteFlag) {
1827 CALL_AlphaFunc(ctx->Exec, (func, ref));
1828 }
1829 }
1830
1831
1832 static void GLAPIENTRY
1833 save_BindTexture(GLenum target, GLuint texture)
1834 {
1835 GET_CURRENT_CONTEXT(ctx);
1836 Node *n;
1837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1838 n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2);
1839 if (n) {
1840 n[1].e = target;
1841 n[2].ui = texture;
1842 }
1843 if (ctx->ExecuteFlag) {
1844 CALL_BindTexture(ctx->Exec, (target, texture));
1845 }
1846 }
1847
1848
1849 static void GLAPIENTRY
1850 save_Bitmap(GLsizei width, GLsizei height,
1851 GLfloat xorig, GLfloat yorig,
1852 GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
1853 {
1854 GET_CURRENT_CONTEXT(ctx);
1855 Node *n;
1856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1857 n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
1858 if (n) {
1859 n[1].i = (GLint) width;
1860 n[2].i = (GLint) height;
1861 n[3].f = xorig;
1862 n[4].f = yorig;
1863 n[5].f = xmove;
1864 n[6].f = ymove;
1865 save_pointer(&n[7],
1866 unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
1867 GL_BITMAP, pixels, &ctx->Unpack));
1868 }
1869 if (ctx->ExecuteFlag) {
1870 CALL_Bitmap(ctx->Exec, (width, height,
1871 xorig, yorig, xmove, ymove, pixels));
1872 }
1873 }
1874
1875
1876 static void GLAPIENTRY
1877 save_BlendEquation(GLenum mode)
1878 {
1879 GET_CURRENT_CONTEXT(ctx);
1880 Node *n;
1881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1882 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1);
1883 if (n) {
1884 n[1].e = mode;
1885 }
1886 if (ctx->ExecuteFlag) {
1887 CALL_BlendEquation(ctx->Exec, (mode));
1888 }
1889 }
1890
1891
1892 static void GLAPIENTRY
1893 save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA)
1894 {
1895 GET_CURRENT_CONTEXT(ctx);
1896 Node *n;
1897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1898 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2);
1899 if (n) {
1900 n[1].e = modeRGB;
1901 n[2].e = modeA;
1902 }
1903 if (ctx->ExecuteFlag) {
1904 CALL_BlendEquationSeparate(ctx->Exec, (modeRGB, modeA));
1905 }
1906 }
1907
1908
1909 static void GLAPIENTRY
1910 save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
1911 GLenum sfactorA, GLenum dfactorA)
1912 {
1913 GET_CURRENT_CONTEXT(ctx);
1914 Node *n;
1915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1916 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4);
1917 if (n) {
1918 n[1].e = sfactorRGB;
1919 n[2].e = dfactorRGB;
1920 n[3].e = sfactorA;
1921 n[4].e = dfactorA;
1922 }
1923 if (ctx->ExecuteFlag) {
1924 CALL_BlendFuncSeparate(ctx->Exec,
1925 (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
1926 }
1927 }
1928
1929
1930 static void GLAPIENTRY
1931 save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
1932 {
1933 save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
1934 }
1935
1936
1937 static void GLAPIENTRY
1938 save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
1939 {
1940 GET_CURRENT_CONTEXT(ctx);
1941 Node *n;
1942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1943 n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4);
1944 if (n) {
1945 n[1].f = red;
1946 n[2].f = green;
1947 n[3].f = blue;
1948 n[4].f = alpha;
1949 }
1950 if (ctx->ExecuteFlag) {
1951 CALL_BlendColor(ctx->Exec, (red, green, blue, alpha));
1952 }
1953 }
1954
1955 /* GL_ARB_draw_buffers_blend */
1956 static void GLAPIENTRY
1957 save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
1958 GLenum sfactorA, GLenum dfactorA)
1959 {
1960 GET_CURRENT_CONTEXT(ctx);
1961 Node *n;
1962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1963 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5);
1964 if (n) {
1965 n[1].ui = buf;
1966 n[2].e = sfactorRGB;
1967 n[3].e = dfactorRGB;
1968 n[4].e = sfactorA;
1969 n[5].e = dfactorA;
1970 }
1971 if (ctx->ExecuteFlag) {
1972 CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB,
1973 sfactorA, dfactorA));
1974 }
1975 }
1976
1977 /* GL_ARB_draw_buffers_blend */
1978 static void GLAPIENTRY
1979 save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
1980 {
1981 GET_CURRENT_CONTEXT(ctx);
1982 Node *n;
1983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
1984 n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_I, 3);
1985 if (n) {
1986 n[1].ui = buf;
1987 n[2].e = sfactor;
1988 n[3].e = dfactor;
1989 }
1990 if (ctx->ExecuteFlag) {
1991 CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor));
1992 }
1993 }
1994
1995 /* GL_ARB_draw_buffers_blend */
1996 static void GLAPIENTRY
1997 save_BlendEquationi(GLuint buf, GLenum mode)
1998 {
1999 GET_CURRENT_CONTEXT(ctx);
2000 Node *n;
2001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2002 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2);
2003 if (n) {
2004 n[1].ui = buf;
2005 n[2].e = mode;
2006 }
2007 if (ctx->ExecuteFlag) {
2008 CALL_BlendEquationiARB(ctx->Exec, (buf, mode));
2009 }
2010 }
2011
2012 /* GL_ARB_draw_buffers_blend */
2013 static void GLAPIENTRY
2014 save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
2015 {
2016 GET_CURRENT_CONTEXT(ctx);
2017 Node *n;
2018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2019 n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3);
2020 if (n) {
2021 n[1].ui = buf;
2022 n[2].e = modeRGB;
2023 n[3].e = modeA;
2024 }
2025 if (ctx->ExecuteFlag) {
2026 CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA));
2027 }
2028 }
2029
2030
2031 /* GL_ARB_draw_instanced. */
2032 static void GLAPIENTRY
2033 save_DrawArraysInstancedARB(UNUSED GLenum mode,
2034 UNUSED GLint first,
2035 UNUSED GLsizei count,
2036 UNUSED GLsizei primcount)
2037 {
2038 GET_CURRENT_CONTEXT(ctx);
2039 _mesa_error(ctx, GL_INVALID_OPERATION,
2040 "glDrawArraysInstanced() during display list compile");
2041 }
2042
2043 static void GLAPIENTRY
2044 save_DrawElementsInstancedARB(UNUSED GLenum mode,
2045 UNUSED GLsizei count,
2046 UNUSED GLenum type,
2047 UNUSED const GLvoid *indices,
2048 UNUSED GLsizei primcount)
2049 {
2050 GET_CURRENT_CONTEXT(ctx);
2051 _mesa_error(ctx, GL_INVALID_OPERATION,
2052 "glDrawElementsInstanced() during display list compile");
2053 }
2054
2055 static void GLAPIENTRY
2056 save_DrawElementsInstancedBaseVertexARB(UNUSED GLenum mode,
2057 UNUSED GLsizei count,
2058 UNUSED GLenum type,
2059 UNUSED const GLvoid *indices,
2060 UNUSED GLsizei primcount,
2061 UNUSED GLint basevertex)
2062 {
2063 GET_CURRENT_CONTEXT(ctx);
2064 _mesa_error(ctx, GL_INVALID_OPERATION,
2065 "glDrawElementsInstancedBaseVertex() during display list compile");
2066 }
2067
2068 /* GL_ARB_base_instance. */
2069 static void GLAPIENTRY
2070 save_DrawArraysInstancedBaseInstance(UNUSED GLenum mode,
2071 UNUSED GLint first,
2072 UNUSED GLsizei count,
2073 UNUSED GLsizei primcount,
2074 UNUSED GLuint baseinstance)
2075 {
2076 GET_CURRENT_CONTEXT(ctx);
2077 _mesa_error(ctx, GL_INVALID_OPERATION,
2078 "glDrawArraysInstancedBaseInstance() during display list compile");
2079 }
2080
2081 static void APIENTRY
2082 save_DrawElementsInstancedBaseInstance(UNUSED GLenum mode,
2083 UNUSED GLsizei count,
2084 UNUSED GLenum type,
2085 UNUSED const void *indices,
2086 UNUSED GLsizei primcount,
2087 UNUSED GLuint baseinstance)
2088 {
2089 GET_CURRENT_CONTEXT(ctx);
2090 _mesa_error(ctx, GL_INVALID_OPERATION,
2091 "glDrawElementsInstancedBaseInstance() during display list compile");
2092 }
2093
2094 static void APIENTRY
2095 save_DrawElementsInstancedBaseVertexBaseInstance(UNUSED GLenum mode,
2096 UNUSED GLsizei count,
2097 UNUSED GLenum type,
2098 UNUSED const void *indices,
2099 UNUSED GLsizei primcount,
2100 UNUSED GLint basevertex,
2101 UNUSED GLuint baseinstance)
2102 {
2103 GET_CURRENT_CONTEXT(ctx);
2104 _mesa_error(ctx, GL_INVALID_OPERATION,
2105 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
2106 }
2107
2108 static void APIENTRY
2109 save_DrawArraysIndirect(UNUSED GLenum mode,
2110 UNUSED const void *indirect)
2111 {
2112 GET_CURRENT_CONTEXT(ctx);
2113 _mesa_error(ctx, GL_INVALID_OPERATION,
2114 "glDrawArraysIndirect() during display list compile");
2115 }
2116
2117 static void APIENTRY
2118 save_DrawElementsIndirect(UNUSED GLenum mode,
2119 UNUSED GLenum type,
2120 UNUSED const void *indirect)
2121 {
2122 GET_CURRENT_CONTEXT(ctx);
2123 _mesa_error(ctx, GL_INVALID_OPERATION,
2124 "glDrawElementsIndirect() during display list compile");
2125 }
2126
2127 static void APIENTRY
2128 save_MultiDrawArraysIndirect(UNUSED GLenum mode,
2129 UNUSED const void *indirect,
2130 UNUSED GLsizei primcount,
2131 UNUSED GLsizei stride)
2132 {
2133 GET_CURRENT_CONTEXT(ctx);
2134 _mesa_error(ctx, GL_INVALID_OPERATION,
2135 "glMultiDrawArraysIndirect() during display list compile");
2136 }
2137
2138 static void APIENTRY
2139 save_MultiDrawElementsIndirect(UNUSED GLenum mode,
2140 UNUSED GLenum type,
2141 UNUSED const void *indirect,
2142 UNUSED GLsizei primcount,
2143 UNUSED GLsizei stride)
2144 {
2145 GET_CURRENT_CONTEXT(ctx);
2146 _mesa_error(ctx, GL_INVALID_OPERATION,
2147 "glMultiDrawElementsIndirect() during display list compile");
2148 }
2149
2150 /**
2151 * While building a display list we cache some OpenGL state.
2152 * Under some circumstances we need to invalidate that state (immediately
2153 * when we start compiling a list, or after glCallList(s)).
2154 */
2155 static void
2156 invalidate_saved_current_state(struct gl_context *ctx)
2157 {
2158 GLint i;
2159
2160 for (i = 0; i < VERT_ATTRIB_MAX; i++)
2161 ctx->ListState.ActiveAttribSize[i] = 0;
2162
2163 for (i = 0; i < MAT_ATTRIB_MAX; i++)
2164 ctx->ListState.ActiveMaterialSize[i] = 0;
2165
2166 memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current);
2167
2168 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
2169 }
2170
2171
2172 static void GLAPIENTRY
2173 save_CallList(GLuint list)
2174 {
2175 GET_CURRENT_CONTEXT(ctx);
2176 Node *n;
2177 SAVE_FLUSH_VERTICES(ctx);
2178
2179 n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1);
2180 if (n) {
2181 n[1].ui = list;
2182 }
2183
2184 /* After this, we don't know what state we're in. Invalidate all
2185 * cached information previously gathered:
2186 */
2187 invalidate_saved_current_state( ctx );
2188
2189 if (ctx->ExecuteFlag) {
2190 _mesa_CallList(list);
2191 }
2192 }
2193
2194
2195 static void GLAPIENTRY
2196 save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
2197 {
2198 GET_CURRENT_CONTEXT(ctx);
2199 unsigned type_size;
2200 Node *n;
2201 void *lists_copy;
2202
2203 SAVE_FLUSH_VERTICES(ctx);
2204
2205 switch (type) {
2206 case GL_BYTE:
2207 case GL_UNSIGNED_BYTE:
2208 type_size = 1;
2209 break;
2210 case GL_SHORT:
2211 case GL_UNSIGNED_SHORT:
2212 case GL_2_BYTES:
2213 type_size = 2;
2214 break;
2215 case GL_3_BYTES:
2216 type_size = 3;
2217 break;
2218 case GL_INT:
2219 case GL_UNSIGNED_INT:
2220 case GL_FLOAT:
2221 case GL_4_BYTES:
2222 type_size = 4;
2223 break;
2224 default:
2225 type_size = 0;
2226 }
2227
2228 if (num > 0 && type_size > 0) {
2229 /* create a copy of the array of list IDs to save in the display list */
2230 lists_copy = memdup(lists, num * type_size);
2231 } else {
2232 lists_copy = NULL;
2233 }
2234
2235 n = alloc_instruction(ctx, OPCODE_CALL_LISTS, 2 + POINTER_DWORDS);
2236 if (n) {
2237 n[1].i = num;
2238 n[2].e = type;
2239 save_pointer(&n[3], lists_copy);
2240 }
2241
2242 /* After this, we don't know what state we're in. Invalidate all
2243 * cached information previously gathered:
2244 */
2245 invalidate_saved_current_state( ctx );
2246
2247 if (ctx->ExecuteFlag) {
2248 CALL_CallLists(ctx->Exec, (num, type, lists));
2249 }
2250 }
2251
2252
2253 static void GLAPIENTRY
2254 save_Clear(GLbitfield mask)
2255 {
2256 GET_CURRENT_CONTEXT(ctx);
2257 Node *n;
2258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2259 n = alloc_instruction(ctx, OPCODE_CLEAR, 1);
2260 if (n) {
2261 n[1].bf = mask;
2262 }
2263 if (ctx->ExecuteFlag) {
2264 CALL_Clear(ctx->Exec, (mask));
2265 }
2266 }
2267
2268
2269 static void GLAPIENTRY
2270 save_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
2271 {
2272 GET_CURRENT_CONTEXT(ctx);
2273 Node *n;
2274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2275 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_IV, 6);
2276 if (n) {
2277 n[1].e = buffer;
2278 n[2].i = drawbuffer;
2279 n[3].i = value[0];
2280 if (buffer == GL_COLOR) {
2281 n[4].i = value[1];
2282 n[5].i = value[2];
2283 n[6].i = value[3];
2284 }
2285 else {
2286 n[4].i = 0;
2287 n[5].i = 0;
2288 n[6].i = 0;
2289 }
2290 }
2291 if (ctx->ExecuteFlag) {
2292 CALL_ClearBufferiv(ctx->Exec, (buffer, drawbuffer, value));
2293 }
2294 }
2295
2296
2297 static void GLAPIENTRY
2298 save_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
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_BUFFER_UIV, 6);
2304 if (n) {
2305 n[1].e = buffer;
2306 n[2].i = drawbuffer;
2307 n[3].ui = value[0];
2308 if (buffer == GL_COLOR) {
2309 n[4].ui = value[1];
2310 n[5].ui = value[2];
2311 n[6].ui = value[3];
2312 }
2313 else {
2314 n[4].ui = 0;
2315 n[5].ui = 0;
2316 n[6].ui = 0;
2317 }
2318 }
2319 if (ctx->ExecuteFlag) {
2320 CALL_ClearBufferuiv(ctx->Exec, (buffer, drawbuffer, value));
2321 }
2322 }
2323
2324
2325 static void GLAPIENTRY
2326 save_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
2327 {
2328 GET_CURRENT_CONTEXT(ctx);
2329 Node *n;
2330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2331 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FV, 6);
2332 if (n) {
2333 n[1].e = buffer;
2334 n[2].i = drawbuffer;
2335 n[3].f = value[0];
2336 if (buffer == GL_COLOR) {
2337 n[4].f = value[1];
2338 n[5].f = value[2];
2339 n[6].f = value[3];
2340 }
2341 else {
2342 n[4].f = 0.0F;
2343 n[5].f = 0.0F;
2344 n[6].f = 0.0F;
2345 }
2346 }
2347 if (ctx->ExecuteFlag) {
2348 CALL_ClearBufferfv(ctx->Exec, (buffer, drawbuffer, value));
2349 }
2350 }
2351
2352
2353 static void GLAPIENTRY
2354 save_ClearBufferfi(GLenum buffer, GLint drawbuffer,
2355 GLfloat depth, GLint stencil)
2356 {
2357 GET_CURRENT_CONTEXT(ctx);
2358 Node *n;
2359 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2360 n = alloc_instruction(ctx, OPCODE_CLEAR_BUFFER_FI, 4);
2361 if (n) {
2362 n[1].e = buffer;
2363 n[2].i = drawbuffer;
2364 n[3].f = depth;
2365 n[4].i = stencil;
2366 }
2367 if (ctx->ExecuteFlag) {
2368 CALL_ClearBufferfi(ctx->Exec, (buffer, drawbuffer, depth, stencil));
2369 }
2370 }
2371
2372
2373 static void GLAPIENTRY
2374 save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
2375 {
2376 GET_CURRENT_CONTEXT(ctx);
2377 Node *n;
2378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2379 n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4);
2380 if (n) {
2381 n[1].f = red;
2382 n[2].f = green;
2383 n[3].f = blue;
2384 n[4].f = alpha;
2385 }
2386 if (ctx->ExecuteFlag) {
2387 CALL_ClearAccum(ctx->Exec, (red, green, blue, alpha));
2388 }
2389 }
2390
2391
2392 static void GLAPIENTRY
2393 save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2394 {
2395 GET_CURRENT_CONTEXT(ctx);
2396 Node *n;
2397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2398 n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4);
2399 if (n) {
2400 n[1].f = red;
2401 n[2].f = green;
2402 n[3].f = blue;
2403 n[4].f = alpha;
2404 }
2405 if (ctx->ExecuteFlag) {
2406 CALL_ClearColor(ctx->Exec, (red, green, blue, alpha));
2407 }
2408 }
2409
2410
2411 static void GLAPIENTRY
2412 save_ClearDepth(GLclampd depth)
2413 {
2414 GET_CURRENT_CONTEXT(ctx);
2415 Node *n;
2416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2417 n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1);
2418 if (n) {
2419 n[1].f = (GLfloat) depth;
2420 }
2421 if (ctx->ExecuteFlag) {
2422 CALL_ClearDepth(ctx->Exec, (depth));
2423 }
2424 }
2425
2426
2427 static void GLAPIENTRY
2428 save_ClearIndex(GLfloat c)
2429 {
2430 GET_CURRENT_CONTEXT(ctx);
2431 Node *n;
2432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2433 n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1);
2434 if (n) {
2435 n[1].f = c;
2436 }
2437 if (ctx->ExecuteFlag) {
2438 CALL_ClearIndex(ctx->Exec, (c));
2439 }
2440 }
2441
2442
2443 static void GLAPIENTRY
2444 save_ClearStencil(GLint s)
2445 {
2446 GET_CURRENT_CONTEXT(ctx);
2447 Node *n;
2448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2449 n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1);
2450 if (n) {
2451 n[1].i = s;
2452 }
2453 if (ctx->ExecuteFlag) {
2454 CALL_ClearStencil(ctx->Exec, (s));
2455 }
2456 }
2457
2458
2459 static void GLAPIENTRY
2460 save_ClipPlane(GLenum plane, const GLdouble * equ)
2461 {
2462 GET_CURRENT_CONTEXT(ctx);
2463 Node *n;
2464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2465 n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5);
2466 if (n) {
2467 n[1].e = plane;
2468 n[2].f = (GLfloat) equ[0];
2469 n[3].f = (GLfloat) equ[1];
2470 n[4].f = (GLfloat) equ[2];
2471 n[5].f = (GLfloat) equ[3];
2472 }
2473 if (ctx->ExecuteFlag) {
2474 CALL_ClipPlane(ctx->Exec, (plane, equ));
2475 }
2476 }
2477
2478
2479
2480 static void GLAPIENTRY
2481 save_ColorMask(GLboolean red, GLboolean green,
2482 GLboolean blue, GLboolean alpha)
2483 {
2484 GET_CURRENT_CONTEXT(ctx);
2485 Node *n;
2486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2487 n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4);
2488 if (n) {
2489 n[1].b = red;
2490 n[2].b = green;
2491 n[3].b = blue;
2492 n[4].b = alpha;
2493 }
2494 if (ctx->ExecuteFlag) {
2495 CALL_ColorMask(ctx->Exec, (red, green, blue, alpha));
2496 }
2497 }
2498
2499
2500 static void GLAPIENTRY
2501 save_ColorMaskIndexed(GLuint buf, GLboolean red, GLboolean green,
2502 GLboolean blue, GLboolean alpha)
2503 {
2504 GET_CURRENT_CONTEXT(ctx);
2505 Node *n;
2506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2507 n = alloc_instruction(ctx, OPCODE_COLOR_MASK_INDEXED, 5);
2508 if (n) {
2509 n[1].ui = buf;
2510 n[2].b = red;
2511 n[3].b = green;
2512 n[4].b = blue;
2513 n[5].b = alpha;
2514 }
2515 if (ctx->ExecuteFlag) {
2516 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
2517 }
2518 }
2519
2520
2521 static void GLAPIENTRY
2522 save_ColorMaterial(GLenum face, GLenum mode)
2523 {
2524 GET_CURRENT_CONTEXT(ctx);
2525 Node *n;
2526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2527
2528 n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2);
2529 if (n) {
2530 n[1].e = face;
2531 n[2].e = mode;
2532 }
2533 if (ctx->ExecuteFlag) {
2534 CALL_ColorMaterial(ctx->Exec, (face, mode));
2535 }
2536 }
2537
2538
2539 static void GLAPIENTRY
2540 save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
2541 {
2542 GET_CURRENT_CONTEXT(ctx);
2543 Node *n;
2544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2545 n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5);
2546 if (n) {
2547 n[1].i = x;
2548 n[2].i = y;
2549 n[3].i = (GLint) width;
2550 n[4].i = (GLint) height;
2551 n[5].e = type;
2552 }
2553 if (ctx->ExecuteFlag) {
2554 CALL_CopyPixels(ctx->Exec, (x, y, width, height, type));
2555 }
2556 }
2557
2558
2559
2560 static void GLAPIENTRY
2561 save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat,
2562 GLint x, GLint y, GLsizei width, GLint border)
2563 {
2564 GET_CURRENT_CONTEXT(ctx);
2565 Node *n;
2566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2567 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7);
2568 if (n) {
2569 n[1].e = target;
2570 n[2].i = level;
2571 n[3].e = internalformat;
2572 n[4].i = x;
2573 n[5].i = y;
2574 n[6].i = width;
2575 n[7].i = border;
2576 }
2577 if (ctx->ExecuteFlag) {
2578 CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat,
2579 x, y, width, border));
2580 }
2581 }
2582
2583
2584 static void GLAPIENTRY
2585 save_CopyTexImage2D(GLenum target, GLint level,
2586 GLenum internalformat,
2587 GLint x, GLint y, GLsizei width,
2588 GLsizei height, GLint border)
2589 {
2590 GET_CURRENT_CONTEXT(ctx);
2591 Node *n;
2592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2593 n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8);
2594 if (n) {
2595 n[1].e = target;
2596 n[2].i = level;
2597 n[3].e = internalformat;
2598 n[4].i = x;
2599 n[5].i = y;
2600 n[6].i = width;
2601 n[7].i = height;
2602 n[8].i = border;
2603 }
2604 if (ctx->ExecuteFlag) {
2605 CALL_CopyTexImage2D(ctx->Exec, (target, level, internalformat,
2606 x, y, width, height, border));
2607 }
2608 }
2609
2610
2611
2612 static void GLAPIENTRY
2613 save_CopyTexSubImage1D(GLenum target, GLint level,
2614 GLint xoffset, GLint x, GLint y, GLsizei width)
2615 {
2616 GET_CURRENT_CONTEXT(ctx);
2617 Node *n;
2618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2619 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6);
2620 if (n) {
2621 n[1].e = target;
2622 n[2].i = level;
2623 n[3].i = xoffset;
2624 n[4].i = x;
2625 n[5].i = y;
2626 n[6].i = width;
2627 }
2628 if (ctx->ExecuteFlag) {
2629 CALL_CopyTexSubImage1D(ctx->Exec,
2630 (target, level, xoffset, x, y, width));
2631 }
2632 }
2633
2634
2635 static void GLAPIENTRY
2636 save_CopyTexSubImage2D(GLenum target, GLint level,
2637 GLint xoffset, GLint yoffset,
2638 GLint x, GLint y, GLsizei width, GLint height)
2639 {
2640 GET_CURRENT_CONTEXT(ctx);
2641 Node *n;
2642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2643 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8);
2644 if (n) {
2645 n[1].e = target;
2646 n[2].i = level;
2647 n[3].i = xoffset;
2648 n[4].i = yoffset;
2649 n[5].i = x;
2650 n[6].i = y;
2651 n[7].i = width;
2652 n[8].i = height;
2653 }
2654 if (ctx->ExecuteFlag) {
2655 CALL_CopyTexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
2656 x, y, width, height));
2657 }
2658 }
2659
2660
2661 static void GLAPIENTRY
2662 save_CopyTexSubImage3D(GLenum target, GLint level,
2663 GLint xoffset, GLint yoffset, GLint zoffset,
2664 GLint x, GLint y, GLsizei width, GLint height)
2665 {
2666 GET_CURRENT_CONTEXT(ctx);
2667 Node *n;
2668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2669 n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
2670 if (n) {
2671 n[1].e = target;
2672 n[2].i = level;
2673 n[3].i = xoffset;
2674 n[4].i = yoffset;
2675 n[5].i = zoffset;
2676 n[6].i = x;
2677 n[7].i = y;
2678 n[8].i = width;
2679 n[9].i = height;
2680 }
2681 if (ctx->ExecuteFlag) {
2682 CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
2683 xoffset, yoffset, zoffset,
2684 x, y, width, height));
2685 }
2686 }
2687
2688
2689 static void GLAPIENTRY
2690 save_CullFace(GLenum mode)
2691 {
2692 GET_CURRENT_CONTEXT(ctx);
2693 Node *n;
2694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2695 n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1);
2696 if (n) {
2697 n[1].e = mode;
2698 }
2699 if (ctx->ExecuteFlag) {
2700 CALL_CullFace(ctx->Exec, (mode));
2701 }
2702 }
2703
2704
2705 static void GLAPIENTRY
2706 save_DepthFunc(GLenum func)
2707 {
2708 GET_CURRENT_CONTEXT(ctx);
2709 Node *n;
2710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2711 n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1);
2712 if (n) {
2713 n[1].e = func;
2714 }
2715 if (ctx->ExecuteFlag) {
2716 CALL_DepthFunc(ctx->Exec, (func));
2717 }
2718 }
2719
2720
2721 static void GLAPIENTRY
2722 save_DepthMask(GLboolean mask)
2723 {
2724 GET_CURRENT_CONTEXT(ctx);
2725 Node *n;
2726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2727 n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1);
2728 if (n) {
2729 n[1].b = mask;
2730 }
2731 if (ctx->ExecuteFlag) {
2732 CALL_DepthMask(ctx->Exec, (mask));
2733 }
2734 }
2735
2736
2737 static void GLAPIENTRY
2738 save_DepthRange(GLclampd nearval, GLclampd farval)
2739 {
2740 GET_CURRENT_CONTEXT(ctx);
2741 Node *n;
2742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2743 n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2);
2744 if (n) {
2745 n[1].f = (GLfloat) nearval;
2746 n[2].f = (GLfloat) farval;
2747 }
2748 if (ctx->ExecuteFlag) {
2749 CALL_DepthRange(ctx->Exec, (nearval, farval));
2750 }
2751 }
2752
2753
2754 static void GLAPIENTRY
2755 save_Disable(GLenum cap)
2756 {
2757 GET_CURRENT_CONTEXT(ctx);
2758 Node *n;
2759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2760 n = alloc_instruction(ctx, OPCODE_DISABLE, 1);
2761 if (n) {
2762 n[1].e = cap;
2763 }
2764 if (ctx->ExecuteFlag) {
2765 CALL_Disable(ctx->Exec, (cap));
2766 }
2767 }
2768
2769
2770 static void GLAPIENTRY
2771 save_DisableIndexed(GLuint index, GLenum cap)
2772 {
2773 GET_CURRENT_CONTEXT(ctx);
2774 Node *n;
2775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2776 n = alloc_instruction(ctx, OPCODE_DISABLE_INDEXED, 2);
2777 if (n) {
2778 n[1].ui = index;
2779 n[2].e = cap;
2780 }
2781 if (ctx->ExecuteFlag) {
2782 CALL_Disablei(ctx->Exec, (index, cap));
2783 }
2784 }
2785
2786
2787 static void GLAPIENTRY
2788 save_DrawBuffer(GLenum mode)
2789 {
2790 GET_CURRENT_CONTEXT(ctx);
2791 Node *n;
2792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2793 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1);
2794 if (n) {
2795 n[1].e = mode;
2796 }
2797 if (ctx->ExecuteFlag) {
2798 CALL_DrawBuffer(ctx->Exec, (mode));
2799 }
2800 }
2801
2802
2803 static void GLAPIENTRY
2804 save_DrawPixels(GLsizei width, GLsizei height,
2805 GLenum format, GLenum type, const GLvoid * pixels)
2806 {
2807 GET_CURRENT_CONTEXT(ctx);
2808 Node *n;
2809
2810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2811
2812 n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
2813 if (n) {
2814 n[1].i = width;
2815 n[2].i = height;
2816 n[3].e = format;
2817 n[4].e = type;
2818 save_pointer(&n[5],
2819 unpack_image(ctx, 2, width, height, 1, format, type,
2820 pixels, &ctx->Unpack));
2821 }
2822 if (ctx->ExecuteFlag) {
2823 CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
2824 }
2825 }
2826
2827
2828
2829 static void GLAPIENTRY
2830 save_Enable(GLenum cap)
2831 {
2832 GET_CURRENT_CONTEXT(ctx);
2833 Node *n;
2834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2835 n = alloc_instruction(ctx, OPCODE_ENABLE, 1);
2836 if (n) {
2837 n[1].e = cap;
2838 }
2839 if (ctx->ExecuteFlag) {
2840 CALL_Enable(ctx->Exec, (cap));
2841 }
2842 }
2843
2844
2845
2846 static void GLAPIENTRY
2847 save_EnableIndexed(GLuint index, GLenum cap)
2848 {
2849 GET_CURRENT_CONTEXT(ctx);
2850 Node *n;
2851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2852 n = alloc_instruction(ctx, OPCODE_ENABLE_INDEXED, 2);
2853 if (n) {
2854 n[1].ui = index;
2855 n[2].e = cap;
2856 }
2857 if (ctx->ExecuteFlag) {
2858 CALL_Enablei(ctx->Exec, (index, cap));
2859 }
2860 }
2861
2862
2863
2864 static void GLAPIENTRY
2865 save_EvalMesh1(GLenum mode, GLint i1, GLint i2)
2866 {
2867 GET_CURRENT_CONTEXT(ctx);
2868 Node *n;
2869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2870 n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3);
2871 if (n) {
2872 n[1].e = mode;
2873 n[2].i = i1;
2874 n[3].i = i2;
2875 }
2876 if (ctx->ExecuteFlag) {
2877 CALL_EvalMesh1(ctx->Exec, (mode, i1, i2));
2878 }
2879 }
2880
2881
2882 static void GLAPIENTRY
2883 save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
2884 {
2885 GET_CURRENT_CONTEXT(ctx);
2886 Node *n;
2887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2888 n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5);
2889 if (n) {
2890 n[1].e = mode;
2891 n[2].i = i1;
2892 n[3].i = i2;
2893 n[4].i = j1;
2894 n[5].i = j2;
2895 }
2896 if (ctx->ExecuteFlag) {
2897 CALL_EvalMesh2(ctx->Exec, (mode, i1, i2, j1, j2));
2898 }
2899 }
2900
2901
2902
2903
2904 static void GLAPIENTRY
2905 save_Fogfv(GLenum pname, const GLfloat *params)
2906 {
2907 GET_CURRENT_CONTEXT(ctx);
2908 Node *n;
2909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2910 n = alloc_instruction(ctx, OPCODE_FOG, 5);
2911 if (n) {
2912 n[1].e = pname;
2913 n[2].f = params[0];
2914 n[3].f = params[1];
2915 n[4].f = params[2];
2916 n[5].f = params[3];
2917 }
2918 if (ctx->ExecuteFlag) {
2919 CALL_Fogfv(ctx->Exec, (pname, params));
2920 }
2921 }
2922
2923
2924 static void GLAPIENTRY
2925 save_Fogf(GLenum pname, GLfloat param)
2926 {
2927 GLfloat parray[4];
2928 parray[0] = param;
2929 parray[1] = parray[2] = parray[3] = 0.0F;
2930 save_Fogfv(pname, parray);
2931 }
2932
2933
2934 static void GLAPIENTRY
2935 save_Fogiv(GLenum pname, const GLint *params)
2936 {
2937 GLfloat p[4];
2938 switch (pname) {
2939 case GL_FOG_MODE:
2940 case GL_FOG_DENSITY:
2941 case GL_FOG_START:
2942 case GL_FOG_END:
2943 case GL_FOG_INDEX:
2944 case GL_FOG_COORDINATE_SOURCE:
2945 p[0] = (GLfloat) *params;
2946 p[1] = 0.0f;
2947 p[2] = 0.0f;
2948 p[3] = 0.0f;
2949 break;
2950 case GL_FOG_COLOR:
2951 p[0] = INT_TO_FLOAT(params[0]);
2952 p[1] = INT_TO_FLOAT(params[1]);
2953 p[2] = INT_TO_FLOAT(params[2]);
2954 p[3] = INT_TO_FLOAT(params[3]);
2955 break;
2956 default:
2957 /* Error will be caught later in gl_Fogfv */
2958 ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
2959 }
2960 save_Fogfv(pname, p);
2961 }
2962
2963
2964 static void GLAPIENTRY
2965 save_Fogi(GLenum pname, GLint param)
2966 {
2967 GLint parray[4];
2968 parray[0] = param;
2969 parray[1] = parray[2] = parray[3] = 0;
2970 save_Fogiv(pname, parray);
2971 }
2972
2973
2974 static void GLAPIENTRY
2975 save_FrontFace(GLenum mode)
2976 {
2977 GET_CURRENT_CONTEXT(ctx);
2978 Node *n;
2979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2980 n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1);
2981 if (n) {
2982 n[1].e = mode;
2983 }
2984 if (ctx->ExecuteFlag) {
2985 CALL_FrontFace(ctx->Exec, (mode));
2986 }
2987 }
2988
2989
2990 static void GLAPIENTRY
2991 save_Frustum(GLdouble left, GLdouble right,
2992 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
2993 {
2994 GET_CURRENT_CONTEXT(ctx);
2995 Node *n;
2996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
2997 n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6);
2998 if (n) {
2999 n[1].f = (GLfloat) left;
3000 n[2].f = (GLfloat) right;
3001 n[3].f = (GLfloat) bottom;
3002 n[4].f = (GLfloat) top;
3003 n[5].f = (GLfloat) nearval;
3004 n[6].f = (GLfloat) farval;
3005 }
3006 if (ctx->ExecuteFlag) {
3007 CALL_Frustum(ctx->Exec, (left, right, bottom, top, nearval, farval));
3008 }
3009 }
3010
3011
3012 static void GLAPIENTRY
3013 save_Hint(GLenum target, GLenum mode)
3014 {
3015 GET_CURRENT_CONTEXT(ctx);
3016 Node *n;
3017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3018 n = alloc_instruction(ctx, OPCODE_HINT, 2);
3019 if (n) {
3020 n[1].e = target;
3021 n[2].e = mode;
3022 }
3023 if (ctx->ExecuteFlag) {
3024 CALL_Hint(ctx->Exec, (target, mode));
3025 }
3026 }
3027
3028
3029 static void GLAPIENTRY
3030 save_IndexMask(GLuint mask)
3031 {
3032 GET_CURRENT_CONTEXT(ctx);
3033 Node *n;
3034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3035 n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1);
3036 if (n) {
3037 n[1].ui = mask;
3038 }
3039 if (ctx->ExecuteFlag) {
3040 CALL_IndexMask(ctx->Exec, (mask));
3041 }
3042 }
3043
3044
3045 static void GLAPIENTRY
3046 save_InitNames(void)
3047 {
3048 GET_CURRENT_CONTEXT(ctx);
3049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3050 (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0);
3051 if (ctx->ExecuteFlag) {
3052 CALL_InitNames(ctx->Exec, ());
3053 }
3054 }
3055
3056
3057 static void GLAPIENTRY
3058 save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
3059 {
3060 GET_CURRENT_CONTEXT(ctx);
3061 Node *n;
3062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3063 n = alloc_instruction(ctx, OPCODE_LIGHT, 6);
3064 if (n) {
3065 GLint i, nParams;
3066 n[1].e = light;
3067 n[2].e = pname;
3068 switch (pname) {
3069 case GL_AMBIENT:
3070 nParams = 4;
3071 break;
3072 case GL_DIFFUSE:
3073 nParams = 4;
3074 break;
3075 case GL_SPECULAR:
3076 nParams = 4;
3077 break;
3078 case GL_POSITION:
3079 nParams = 4;
3080 break;
3081 case GL_SPOT_DIRECTION:
3082 nParams = 3;
3083 break;
3084 case GL_SPOT_EXPONENT:
3085 nParams = 1;
3086 break;
3087 case GL_SPOT_CUTOFF:
3088 nParams = 1;
3089 break;
3090 case GL_CONSTANT_ATTENUATION:
3091 nParams = 1;
3092 break;
3093 case GL_LINEAR_ATTENUATION:
3094 nParams = 1;
3095 break;
3096 case GL_QUADRATIC_ATTENUATION:
3097 nParams = 1;
3098 break;
3099 default:
3100 nParams = 0;
3101 }
3102 for (i = 0; i < nParams; i++) {
3103 n[3 + i].f = params[i];
3104 }
3105 }
3106 if (ctx->ExecuteFlag) {
3107 CALL_Lightfv(ctx->Exec, (light, pname, params));
3108 }
3109 }
3110
3111
3112 static void GLAPIENTRY
3113 save_Lightf(GLenum light, GLenum pname, GLfloat param)
3114 {
3115 GLfloat parray[4];
3116 parray[0] = param;
3117 parray[1] = parray[2] = parray[3] = 0.0F;
3118 save_Lightfv(light, pname, parray);
3119 }
3120
3121
3122 static void GLAPIENTRY
3123 save_Lightiv(GLenum light, GLenum pname, const GLint *params)
3124 {
3125 GLfloat fparam[4];
3126 switch (pname) {
3127 case GL_AMBIENT:
3128 case GL_DIFFUSE:
3129 case GL_SPECULAR:
3130 fparam[0] = INT_TO_FLOAT(params[0]);
3131 fparam[1] = INT_TO_FLOAT(params[1]);
3132 fparam[2] = INT_TO_FLOAT(params[2]);
3133 fparam[3] = INT_TO_FLOAT(params[3]);
3134 break;
3135 case GL_POSITION:
3136 fparam[0] = (GLfloat) params[0];
3137 fparam[1] = (GLfloat) params[1];
3138 fparam[2] = (GLfloat) params[2];
3139 fparam[3] = (GLfloat) params[3];
3140 break;
3141 case GL_SPOT_DIRECTION:
3142 fparam[0] = (GLfloat) params[0];
3143 fparam[1] = (GLfloat) params[1];
3144 fparam[2] = (GLfloat) params[2];
3145 break;
3146 case GL_SPOT_EXPONENT:
3147 case GL_SPOT_CUTOFF:
3148 case GL_CONSTANT_ATTENUATION:
3149 case GL_LINEAR_ATTENUATION:
3150 case GL_QUADRATIC_ATTENUATION:
3151 fparam[0] = (GLfloat) params[0];
3152 break;
3153 default:
3154 /* error will be caught later in gl_Lightfv */
3155 ;
3156 }
3157 save_Lightfv(light, pname, fparam);
3158 }
3159
3160
3161 static void GLAPIENTRY
3162 save_Lighti(GLenum light, GLenum pname, GLint param)
3163 {
3164 GLint parray[4];
3165 parray[0] = param;
3166 parray[1] = parray[2] = parray[3] = 0;
3167 save_Lightiv(light, pname, parray);
3168 }
3169
3170
3171 static void GLAPIENTRY
3172 save_LightModelfv(GLenum pname, const GLfloat *params)
3173 {
3174 GET_CURRENT_CONTEXT(ctx);
3175 Node *n;
3176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3177 n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5);
3178 if (n) {
3179 n[1].e = pname;
3180 n[2].f = params[0];
3181 n[3].f = params[1];
3182 n[4].f = params[2];
3183 n[5].f = params[3];
3184 }
3185 if (ctx->ExecuteFlag) {
3186 CALL_LightModelfv(ctx->Exec, (pname, params));
3187 }
3188 }
3189
3190
3191 static void GLAPIENTRY
3192 save_LightModelf(GLenum pname, GLfloat param)
3193 {
3194 GLfloat parray[4];
3195 parray[0] = param;
3196 parray[1] = parray[2] = parray[3] = 0.0F;
3197 save_LightModelfv(pname, parray);
3198 }
3199
3200
3201 static void GLAPIENTRY
3202 save_LightModeliv(GLenum pname, const GLint *params)
3203 {
3204 GLfloat fparam[4];
3205 switch (pname) {
3206 case GL_LIGHT_MODEL_AMBIENT:
3207 fparam[0] = INT_TO_FLOAT(params[0]);
3208 fparam[1] = INT_TO_FLOAT(params[1]);
3209 fparam[2] = INT_TO_FLOAT(params[2]);
3210 fparam[3] = INT_TO_FLOAT(params[3]);
3211 break;
3212 case GL_LIGHT_MODEL_LOCAL_VIEWER:
3213 case GL_LIGHT_MODEL_TWO_SIDE:
3214 case GL_LIGHT_MODEL_COLOR_CONTROL:
3215 fparam[0] = (GLfloat) params[0];
3216 fparam[1] = 0.0F;
3217 fparam[2] = 0.0F;
3218 fparam[3] = 0.0F;
3219 break;
3220 default:
3221 /* Error will be caught later in gl_LightModelfv */
3222 ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
3223 }
3224 save_LightModelfv(pname, fparam);
3225 }
3226
3227
3228 static void GLAPIENTRY
3229 save_LightModeli(GLenum pname, GLint param)
3230 {
3231 GLint parray[4];
3232 parray[0] = param;
3233 parray[1] = parray[2] = parray[3] = 0;
3234 save_LightModeliv(pname, parray);
3235 }
3236
3237
3238 static void GLAPIENTRY
3239 save_LineStipple(GLint factor, GLushort pattern)
3240 {
3241 GET_CURRENT_CONTEXT(ctx);
3242 Node *n;
3243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3244 n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2);
3245 if (n) {
3246 n[1].i = factor;
3247 n[2].us = pattern;
3248 }
3249 if (ctx->ExecuteFlag) {
3250 CALL_LineStipple(ctx->Exec, (factor, pattern));
3251 }
3252 }
3253
3254
3255 static void GLAPIENTRY
3256 save_LineWidth(GLfloat width)
3257 {
3258 GET_CURRENT_CONTEXT(ctx);
3259 Node *n;
3260 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3261 n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1);
3262 if (n) {
3263 n[1].f = width;
3264 }
3265 if (ctx->ExecuteFlag) {
3266 CALL_LineWidth(ctx->Exec, (width));
3267 }
3268 }
3269
3270
3271 static void GLAPIENTRY
3272 save_ListBase(GLuint base)
3273 {
3274 GET_CURRENT_CONTEXT(ctx);
3275 Node *n;
3276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3277 n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1);
3278 if (n) {
3279 n[1].ui = base;
3280 }
3281 if (ctx->ExecuteFlag) {
3282 CALL_ListBase(ctx->Exec, (base));
3283 }
3284 }
3285
3286
3287 static void GLAPIENTRY
3288 save_LoadIdentity(void)
3289 {
3290 GET_CURRENT_CONTEXT(ctx);
3291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3292 (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0);
3293 if (ctx->ExecuteFlag) {
3294 CALL_LoadIdentity(ctx->Exec, ());
3295 }
3296 }
3297
3298
3299 static void GLAPIENTRY
3300 save_LoadMatrixf(const GLfloat * m)
3301 {
3302 GET_CURRENT_CONTEXT(ctx);
3303 Node *n;
3304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3305 n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16);
3306 if (n) {
3307 GLuint i;
3308 for (i = 0; i < 16; i++) {
3309 n[1 + i].f = m[i];
3310 }
3311 }
3312 if (ctx->ExecuteFlag) {
3313 CALL_LoadMatrixf(ctx->Exec, (m));
3314 }
3315 }
3316
3317
3318 static void GLAPIENTRY
3319 save_LoadMatrixd(const GLdouble * m)
3320 {
3321 GLfloat f[16];
3322 GLint i;
3323 for (i = 0; i < 16; i++) {
3324 f[i] = (GLfloat) m[i];
3325 }
3326 save_LoadMatrixf(f);
3327 }
3328
3329
3330 static void GLAPIENTRY
3331 save_LoadName(GLuint name)
3332 {
3333 GET_CURRENT_CONTEXT(ctx);
3334 Node *n;
3335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3336 n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1);
3337 if (n) {
3338 n[1].ui = name;
3339 }
3340 if (ctx->ExecuteFlag) {
3341 CALL_LoadName(ctx->Exec, (name));
3342 }
3343 }
3344
3345
3346 static void GLAPIENTRY
3347 save_LogicOp(GLenum opcode)
3348 {
3349 GET_CURRENT_CONTEXT(ctx);
3350 Node *n;
3351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3352 n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1);
3353 if (n) {
3354 n[1].e = opcode;
3355 }
3356 if (ctx->ExecuteFlag) {
3357 CALL_LogicOp(ctx->Exec, (opcode));
3358 }
3359 }
3360
3361
3362 static void GLAPIENTRY
3363 save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
3364 GLint order, const GLdouble * points)
3365 {
3366 GET_CURRENT_CONTEXT(ctx);
3367 Node *n;
3368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3369 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3370 if (n) {
3371 GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
3372 n[1].e = target;
3373 n[2].f = (GLfloat) u1;
3374 n[3].f = (GLfloat) u2;
3375 n[4].i = _mesa_evaluator_components(target); /* stride */
3376 n[5].i = order;
3377 save_pointer(&n[6], pnts);
3378 }
3379 if (ctx->ExecuteFlag) {
3380 CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
3381 }
3382 }
3383
3384 static void GLAPIENTRY
3385 save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
3386 GLint order, const GLfloat * points)
3387 {
3388 GET_CURRENT_CONTEXT(ctx);
3389 Node *n;
3390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3391 n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
3392 if (n) {
3393 GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
3394 n[1].e = target;
3395 n[2].f = u1;
3396 n[3].f = u2;
3397 n[4].i = _mesa_evaluator_components(target); /* stride */
3398 n[5].i = order;
3399 save_pointer(&n[6], pnts);
3400 }
3401 if (ctx->ExecuteFlag) {
3402 CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
3403 }
3404 }
3405
3406
3407 static void GLAPIENTRY
3408 save_Map2d(GLenum target,
3409 GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
3410 GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
3411 const GLdouble * points)
3412 {
3413 GET_CURRENT_CONTEXT(ctx);
3414 Node *n;
3415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3416 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3417 if (n) {
3418 GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
3419 vstride, vorder, points);
3420 n[1].e = target;
3421 n[2].f = (GLfloat) u1;
3422 n[3].f = (GLfloat) u2;
3423 n[4].f = (GLfloat) v1;
3424 n[5].f = (GLfloat) v2;
3425 /* XXX verify these strides are correct */
3426 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3427 n[7].i = _mesa_evaluator_components(target); /*vstride */
3428 n[8].i = uorder;
3429 n[9].i = vorder;
3430 save_pointer(&n[10], pnts);
3431 }
3432 if (ctx->ExecuteFlag) {
3433 CALL_Map2d(ctx->Exec, (target,
3434 u1, u2, ustride, uorder,
3435 v1, v2, vstride, vorder, points));
3436 }
3437 }
3438
3439
3440 static void GLAPIENTRY
3441 save_Map2f(GLenum target,
3442 GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
3443 GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
3444 const GLfloat * points)
3445 {
3446 GET_CURRENT_CONTEXT(ctx);
3447 Node *n;
3448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3449 n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
3450 if (n) {
3451 GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
3452 vstride, vorder, points);
3453 n[1].e = target;
3454 n[2].f = u1;
3455 n[3].f = u2;
3456 n[4].f = v1;
3457 n[5].f = v2;
3458 /* XXX verify these strides are correct */
3459 n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride */
3460 n[7].i = _mesa_evaluator_components(target); /*vstride */
3461 n[8].i = uorder;
3462 n[9].i = vorder;
3463 save_pointer(&n[10], pnts);
3464 }
3465 if (ctx->ExecuteFlag) {
3466 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
3467 v1, v2, vstride, vorder, points));
3468 }
3469 }
3470
3471
3472 static void GLAPIENTRY
3473 save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2)
3474 {
3475 GET_CURRENT_CONTEXT(ctx);
3476 Node *n;
3477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3478 n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3);
3479 if (n) {
3480 n[1].i = un;
3481 n[2].f = u1;
3482 n[3].f = u2;
3483 }
3484 if (ctx->ExecuteFlag) {
3485 CALL_MapGrid1f(ctx->Exec, (un, u1, u2));
3486 }
3487 }
3488
3489
3490 static void GLAPIENTRY
3491 save_MapGrid1d(GLint un, GLdouble u1, GLdouble u2)
3492 {
3493 save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
3494 }
3495
3496
3497 static void GLAPIENTRY
3498 save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2,
3499 GLint vn, GLfloat v1, GLfloat v2)
3500 {
3501 GET_CURRENT_CONTEXT(ctx);
3502 Node *n;
3503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3504 n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6);
3505 if (n) {
3506 n[1].i = un;
3507 n[2].f = u1;
3508 n[3].f = u2;
3509 n[4].i = vn;
3510 n[5].f = v1;
3511 n[6].f = v2;
3512 }
3513 if (ctx->ExecuteFlag) {
3514 CALL_MapGrid2f(ctx->Exec, (un, u1, u2, vn, v1, v2));
3515 }
3516 }
3517
3518
3519
3520 static void GLAPIENTRY
3521 save_MapGrid2d(GLint un, GLdouble u1, GLdouble u2,
3522 GLint vn, GLdouble v1, GLdouble v2)
3523 {
3524 save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
3525 vn, (GLfloat) v1, (GLfloat) v2);
3526 }
3527
3528
3529 static void GLAPIENTRY
3530 save_MatrixMode(GLenum mode)
3531 {
3532 GET_CURRENT_CONTEXT(ctx);
3533 Node *n;
3534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3535 n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1);
3536 if (n) {
3537 n[1].e = mode;
3538 }
3539 if (ctx->ExecuteFlag) {
3540 CALL_MatrixMode(ctx->Exec, (mode));
3541 }
3542 }
3543
3544
3545 static void GLAPIENTRY
3546 save_MultMatrixf(const GLfloat * m)
3547 {
3548 GET_CURRENT_CONTEXT(ctx);
3549 Node *n;
3550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3551 n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16);
3552 if (n) {
3553 GLuint i;
3554 for (i = 0; i < 16; i++) {
3555 n[1 + i].f = m[i];
3556 }
3557 }
3558 if (ctx->ExecuteFlag) {
3559 CALL_MultMatrixf(ctx->Exec, (m));
3560 }
3561 }
3562
3563
3564 static void GLAPIENTRY
3565 save_MultMatrixd(const GLdouble * m)
3566 {
3567 GLfloat f[16];
3568 GLint i;
3569 for (i = 0; i < 16; i++) {
3570 f[i] = (GLfloat) m[i];
3571 }
3572 save_MultMatrixf(f);
3573 }
3574
3575
3576 static void GLAPIENTRY
3577 save_NewList(GLuint name, GLenum mode)
3578 {
3579 GET_CURRENT_CONTEXT(ctx);
3580 /* It's an error to call this function while building a display list */
3581 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
3582 (void) name;
3583 (void) mode;
3584 }
3585
3586
3587
3588 static void GLAPIENTRY
3589 save_Ortho(GLdouble left, GLdouble right,
3590 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
3591 {
3592 GET_CURRENT_CONTEXT(ctx);
3593 Node *n;
3594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3595 n = alloc_instruction(ctx, OPCODE_ORTHO, 6);
3596 if (n) {
3597 n[1].f = (GLfloat) left;
3598 n[2].f = (GLfloat) right;
3599 n[3].f = (GLfloat) bottom;
3600 n[4].f = (GLfloat) top;
3601 n[5].f = (GLfloat) nearval;
3602 n[6].f = (GLfloat) farval;
3603 }
3604 if (ctx->ExecuteFlag) {
3605 CALL_Ortho(ctx->Exec, (left, right, bottom, top, nearval, farval));
3606 }
3607 }
3608
3609
3610 static void GLAPIENTRY
3611 save_PatchParameteri(GLenum pname, const GLint value)
3612 {
3613 GET_CURRENT_CONTEXT(ctx);
3614 Node *n;
3615 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3616 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_I, 2);
3617 if (n) {
3618 n[1].e = pname;
3619 n[2].i = value;
3620 }
3621 if (ctx->ExecuteFlag) {
3622 CALL_PatchParameteri(ctx->Exec, (pname, value));
3623 }
3624 }
3625
3626
3627 static void GLAPIENTRY
3628 save_PatchParameterfv(GLenum pname, const GLfloat *params)
3629 {
3630 GET_CURRENT_CONTEXT(ctx);
3631 Node *n;
3632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3633
3634 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3635 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_OUTER, 5);
3636 } else {
3637 assert(pname == GL_PATCH_DEFAULT_INNER_LEVEL);
3638 n = alloc_instruction(ctx, OPCODE_PATCH_PARAMETER_FV_INNER, 3);
3639 }
3640 if (n) {
3641 n[1].e = pname;
3642 if (pname == GL_PATCH_DEFAULT_OUTER_LEVEL) {
3643 n[2].f = params[0];
3644 n[3].f = params[1];
3645 n[4].f = params[2];
3646 n[5].f = params[3];
3647 } else {
3648 n[2].f = params[0];
3649 n[3].f = params[1];
3650 }
3651 }
3652 if (ctx->ExecuteFlag) {
3653 CALL_PatchParameterfv(ctx->Exec, (pname, params));
3654 }
3655 }
3656
3657
3658 static void GLAPIENTRY
3659 save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
3660 {
3661 GET_CURRENT_CONTEXT(ctx);
3662 Node *n;
3663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3664 n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
3665 if (n) {
3666 n[1].e = map;
3667 n[2].i = mapsize;
3668 save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
3669 }
3670 if (ctx->ExecuteFlag) {
3671 CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
3672 }
3673 }
3674
3675
3676 static void GLAPIENTRY
3677 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
3678 {
3679 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3680 GLint i;
3681 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3682 for (i = 0; i < mapsize; i++) {
3683 fvalues[i] = (GLfloat) values[i];
3684 }
3685 }
3686 else {
3687 for (i = 0; i < mapsize; i++) {
3688 fvalues[i] = UINT_TO_FLOAT(values[i]);
3689 }
3690 }
3691 save_PixelMapfv(map, mapsize, fvalues);
3692 }
3693
3694
3695 static void GLAPIENTRY
3696 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
3697 {
3698 GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
3699 GLint i;
3700 if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
3701 for (i = 0; i < mapsize; i++) {
3702 fvalues[i] = (GLfloat) values[i];
3703 }
3704 }
3705 else {
3706 for (i = 0; i < mapsize; i++) {
3707 fvalues[i] = USHORT_TO_FLOAT(values[i]);
3708 }
3709 }
3710 save_PixelMapfv(map, mapsize, fvalues);
3711 }
3712
3713
3714 static void GLAPIENTRY
3715 save_PixelTransferf(GLenum pname, GLfloat param)
3716 {
3717 GET_CURRENT_CONTEXT(ctx);
3718 Node *n;
3719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3720 n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2);
3721 if (n) {
3722 n[1].e = pname;
3723 n[2].f = param;
3724 }
3725 if (ctx->ExecuteFlag) {
3726 CALL_PixelTransferf(ctx->Exec, (pname, param));
3727 }
3728 }
3729
3730
3731 static void GLAPIENTRY
3732 save_PixelTransferi(GLenum pname, GLint param)
3733 {
3734 save_PixelTransferf(pname, (GLfloat) param);
3735 }
3736
3737
3738 static void GLAPIENTRY
3739 save_PixelZoom(GLfloat xfactor, GLfloat yfactor)
3740 {
3741 GET_CURRENT_CONTEXT(ctx);
3742 Node *n;
3743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3744 n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2);
3745 if (n) {
3746 n[1].f = xfactor;
3747 n[2].f = yfactor;
3748 }
3749 if (ctx->ExecuteFlag) {
3750 CALL_PixelZoom(ctx->Exec, (xfactor, yfactor));
3751 }
3752 }
3753
3754
3755 static void GLAPIENTRY
3756 save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
3757 {
3758 GET_CURRENT_CONTEXT(ctx);
3759 Node *n;
3760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3761 n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4);
3762 if (n) {
3763 n[1].e = pname;
3764 n[2].f = params[0];
3765 n[3].f = params[1];
3766 n[4].f = params[2];
3767 }
3768 if (ctx->ExecuteFlag) {
3769 CALL_PointParameterfv(ctx->Exec, (pname, params));
3770 }
3771 }
3772
3773
3774 static void GLAPIENTRY
3775 save_PointParameterfEXT(GLenum pname, GLfloat param)
3776 {
3777 GLfloat parray[3];
3778 parray[0] = param;
3779 parray[1] = parray[2] = 0.0F;
3780 save_PointParameterfvEXT(pname, parray);
3781 }
3782
3783 static void GLAPIENTRY
3784 save_PointParameteriNV(GLenum pname, GLint param)
3785 {
3786 GLfloat parray[3];
3787 parray[0] = (GLfloat) param;
3788 parray[1] = parray[2] = 0.0F;
3789 save_PointParameterfvEXT(pname, parray);
3790 }
3791
3792 static void GLAPIENTRY
3793 save_PointParameterivNV(GLenum pname, const GLint * param)
3794 {
3795 GLfloat parray[3];
3796 parray[0] = (GLfloat) param[0];
3797 parray[1] = parray[2] = 0.0F;
3798 save_PointParameterfvEXT(pname, parray);
3799 }
3800
3801
3802 static void GLAPIENTRY
3803 save_PointSize(GLfloat size)
3804 {
3805 GET_CURRENT_CONTEXT(ctx);
3806 Node *n;
3807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3808 n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1);
3809 if (n) {
3810 n[1].f = size;
3811 }
3812 if (ctx->ExecuteFlag) {
3813 CALL_PointSize(ctx->Exec, (size));
3814 }
3815 }
3816
3817
3818 static void GLAPIENTRY
3819 save_PolygonMode(GLenum face, GLenum mode)
3820 {
3821 GET_CURRENT_CONTEXT(ctx);
3822 Node *n;
3823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3824 n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2);
3825 if (n) {
3826 n[1].e = face;
3827 n[2].e = mode;
3828 }
3829 if (ctx->ExecuteFlag) {
3830 CALL_PolygonMode(ctx->Exec, (face, mode));
3831 }
3832 }
3833
3834
3835 static void GLAPIENTRY
3836 save_PolygonStipple(const GLubyte * pattern)
3837 {
3838 GET_CURRENT_CONTEXT(ctx);
3839 Node *n;
3840
3841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3842
3843 n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
3844 if (n) {
3845 save_pointer(&n[1],
3846 unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
3847 pattern, &ctx->Unpack));
3848 }
3849 if (ctx->ExecuteFlag) {
3850 CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
3851 }
3852 }
3853
3854
3855 static void GLAPIENTRY
3856 save_PolygonOffset(GLfloat factor, GLfloat units)
3857 {
3858 GET_CURRENT_CONTEXT(ctx);
3859 Node *n;
3860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3861 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2);
3862 if (n) {
3863 n[1].f = factor;
3864 n[2].f = units;
3865 }
3866 if (ctx->ExecuteFlag) {
3867 CALL_PolygonOffset(ctx->Exec, (factor, units));
3868 }
3869 }
3870
3871
3872 static void GLAPIENTRY
3873 save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp)
3874 {
3875 GET_CURRENT_CONTEXT(ctx);
3876 Node *n;
3877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3878 n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3);
3879 if (n) {
3880 n[1].f = factor;
3881 n[2].f = units;
3882 n[3].f = clamp;
3883 }
3884 if (ctx->ExecuteFlag) {
3885 CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp));
3886 }
3887 }
3888
3889 static void GLAPIENTRY
3890 save_PopAttrib(void)
3891 {
3892 GET_CURRENT_CONTEXT(ctx);
3893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3894 (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0);
3895 if (ctx->ExecuteFlag) {
3896 CALL_PopAttrib(ctx->Exec, ());
3897 }
3898 }
3899
3900
3901 static void GLAPIENTRY
3902 save_PopMatrix(void)
3903 {
3904 GET_CURRENT_CONTEXT(ctx);
3905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3906 (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0);
3907 if (ctx->ExecuteFlag) {
3908 CALL_PopMatrix(ctx->Exec, ());
3909 }
3910 }
3911
3912
3913 static void GLAPIENTRY
3914 save_PopName(void)
3915 {
3916 GET_CURRENT_CONTEXT(ctx);
3917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3918 (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0);
3919 if (ctx->ExecuteFlag) {
3920 CALL_PopName(ctx->Exec, ());
3921 }
3922 }
3923
3924
3925 static void GLAPIENTRY
3926 save_PrioritizeTextures(GLsizei num, const GLuint * textures,
3927 const GLclampf * priorities)
3928 {
3929 GET_CURRENT_CONTEXT(ctx);
3930 GLint i;
3931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3932
3933 for (i = 0; i < num; i++) {
3934 Node *n;
3935 n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2);
3936 if (n) {
3937 n[1].ui = textures[i];
3938 n[2].f = priorities[i];
3939 }
3940 }
3941 if (ctx->ExecuteFlag) {
3942 CALL_PrioritizeTextures(ctx->Exec, (num, textures, priorities));
3943 }
3944 }
3945
3946
3947 static void GLAPIENTRY
3948 save_PushAttrib(GLbitfield mask)
3949 {
3950 GET_CURRENT_CONTEXT(ctx);
3951 Node *n;
3952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3953 n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1);
3954 if (n) {
3955 n[1].bf = mask;
3956 }
3957 if (ctx->ExecuteFlag) {
3958 CALL_PushAttrib(ctx->Exec, (mask));
3959 }
3960 }
3961
3962
3963 static void GLAPIENTRY
3964 save_PushMatrix(void)
3965 {
3966 GET_CURRENT_CONTEXT(ctx);
3967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3968 (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0);
3969 if (ctx->ExecuteFlag) {
3970 CALL_PushMatrix(ctx->Exec, ());
3971 }
3972 }
3973
3974
3975 static void GLAPIENTRY
3976 save_PushName(GLuint name)
3977 {
3978 GET_CURRENT_CONTEXT(ctx);
3979 Node *n;
3980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3981 n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1);
3982 if (n) {
3983 n[1].ui = name;
3984 }
3985 if (ctx->ExecuteFlag) {
3986 CALL_PushName(ctx->Exec, (name));
3987 }
3988 }
3989
3990
3991 static void GLAPIENTRY
3992 save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3993 {
3994 GET_CURRENT_CONTEXT(ctx);
3995 Node *n;
3996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
3997 n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4);
3998 if (n) {
3999 n[1].f = x;
4000 n[2].f = y;
4001 n[3].f = z;
4002 n[4].f = w;
4003 }
4004 if (ctx->ExecuteFlag) {
4005 CALL_RasterPos4f(ctx->Exec, (x, y, z, w));
4006 }
4007 }
4008
4009 static void GLAPIENTRY
4010 save_RasterPos2d(GLdouble x, GLdouble y)
4011 {
4012 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4013 }
4014
4015 static void GLAPIENTRY
4016 save_RasterPos2f(GLfloat x, GLfloat y)
4017 {
4018 save_RasterPos4f(x, y, 0.0F, 1.0F);
4019 }
4020
4021 static void GLAPIENTRY
4022 save_RasterPos2i(GLint x, GLint y)
4023 {
4024 save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
4025 }
4026
4027 static void GLAPIENTRY
4028 save_RasterPos2s(GLshort x, GLshort y)
4029 {
4030 save_RasterPos4f(x, y, 0.0F, 1.0F);
4031 }
4032
4033 static void GLAPIENTRY
4034 save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
4035 {
4036 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4037 }
4038
4039 static void GLAPIENTRY
4040 save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
4041 {
4042 save_RasterPos4f(x, y, z, 1.0F);
4043 }
4044
4045 static void GLAPIENTRY
4046 save_RasterPos3i(GLint x, GLint y, GLint z)
4047 {
4048 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
4049 }
4050
4051 static void GLAPIENTRY
4052 save_RasterPos3s(GLshort x, GLshort y, GLshort z)
4053 {
4054 save_RasterPos4f(x, y, z, 1.0F);
4055 }
4056
4057 static void GLAPIENTRY
4058 save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
4059 {
4060 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4061 }
4062
4063 static void GLAPIENTRY
4064 save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
4065 {
4066 save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
4067 }
4068
4069 static void GLAPIENTRY
4070 save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
4071 {
4072 save_RasterPos4f(x, y, z, w);
4073 }
4074
4075 static void GLAPIENTRY
4076 save_RasterPos2dv(const GLdouble * v)
4077 {
4078 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4079 }
4080
4081 static void GLAPIENTRY
4082 save_RasterPos2fv(const GLfloat * v)
4083 {
4084 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4085 }
4086
4087 static void GLAPIENTRY
4088 save_RasterPos2iv(const GLint * v)
4089 {
4090 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
4091 }
4092
4093 static void GLAPIENTRY
4094 save_RasterPos2sv(const GLshort * v)
4095 {
4096 save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
4097 }
4098
4099 static void GLAPIENTRY
4100 save_RasterPos3dv(const GLdouble * v)
4101 {
4102 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4103 }
4104
4105 static void GLAPIENTRY
4106 save_RasterPos3fv(const GLfloat * v)
4107 {
4108 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4109 }
4110
4111 static void GLAPIENTRY
4112 save_RasterPos3iv(const GLint * v)
4113 {
4114 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
4115 }
4116
4117 static void GLAPIENTRY
4118 save_RasterPos3sv(const GLshort * v)
4119 {
4120 save_RasterPos4f(v[0], v[1], v[2], 1.0F);
4121 }
4122
4123 static void GLAPIENTRY
4124 save_RasterPos4dv(const GLdouble * v)
4125 {
4126 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4127 (GLfloat) v[2], (GLfloat) v[3]);
4128 }
4129
4130 static void GLAPIENTRY
4131 save_RasterPos4fv(const GLfloat * v)
4132 {
4133 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4134 }
4135
4136 static void GLAPIENTRY
4137 save_RasterPos4iv(const GLint * v)
4138 {
4139 save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
4140 (GLfloat) v[2], (GLfloat) v[3]);
4141 }
4142
4143 static void GLAPIENTRY
4144 save_RasterPos4sv(const GLshort * v)
4145 {
4146 save_RasterPos4f(v[0], v[1], v[2], v[3]);
4147 }
4148
4149
4150 static void GLAPIENTRY
4151 save_PassThrough(GLfloat token)
4152 {
4153 GET_CURRENT_CONTEXT(ctx);
4154 Node *n;
4155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4156 n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1);
4157 if (n) {
4158 n[1].f = token;
4159 }
4160 if (ctx->ExecuteFlag) {
4161 CALL_PassThrough(ctx->Exec, (token));
4162 }
4163 }
4164
4165
4166 static void GLAPIENTRY
4167 save_ReadBuffer(GLenum mode)
4168 {
4169 GET_CURRENT_CONTEXT(ctx);
4170 Node *n;
4171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4172 n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1);
4173 if (n) {
4174 n[1].e = mode;
4175 }
4176 if (ctx->ExecuteFlag) {
4177 CALL_ReadBuffer(ctx->Exec, (mode));
4178 }
4179 }
4180
4181
4182 static void GLAPIENTRY
4183 save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
4184 {
4185 GET_CURRENT_CONTEXT(ctx);
4186 Node *n;
4187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4188 n = alloc_instruction(ctx, OPCODE_ROTATE, 4);
4189 if (n) {
4190 n[1].f = angle;
4191 n[2].f = x;
4192 n[3].f = y;
4193 n[4].f = z;
4194 }
4195 if (ctx->ExecuteFlag) {
4196 CALL_Rotatef(ctx->Exec, (angle, x, y, z));
4197 }
4198 }
4199
4200
4201 static void GLAPIENTRY
4202 save_Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
4203 {
4204 save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
4205 }
4206
4207
4208 static void GLAPIENTRY
4209 save_Scalef(GLfloat x, GLfloat y, GLfloat z)
4210 {
4211 GET_CURRENT_CONTEXT(ctx);
4212 Node *n;
4213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4214 n = alloc_instruction(ctx, OPCODE_SCALE, 3);
4215 if (n) {
4216 n[1].f = x;
4217 n[2].f = y;
4218 n[3].f = z;
4219 }
4220 if (ctx->ExecuteFlag) {
4221 CALL_Scalef(ctx->Exec, (x, y, z));
4222 }
4223 }
4224
4225
4226 static void GLAPIENTRY
4227 save_Scaled(GLdouble x, GLdouble y, GLdouble z)
4228 {
4229 save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4230 }
4231
4232
4233 static void GLAPIENTRY
4234 save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
4235 {
4236 GET_CURRENT_CONTEXT(ctx);
4237 Node *n;
4238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4239 n = alloc_instruction(ctx, OPCODE_SCISSOR, 4);
4240 if (n) {
4241 n[1].i = x;
4242 n[2].i = y;
4243 n[3].i = width;
4244 n[4].i = height;
4245 }
4246 if (ctx->ExecuteFlag) {
4247 CALL_Scissor(ctx->Exec, (x, y, width, height));
4248 }
4249 }
4250
4251
4252 static void GLAPIENTRY
4253 save_ShadeModel(GLenum mode)
4254 {
4255 GET_CURRENT_CONTEXT(ctx);
4256 Node *n;
4257 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);
4258
4259 if (ctx->ExecuteFlag) {
4260 CALL_ShadeModel(ctx->Exec, (mode));
4261 }
4262
4263 /* Don't compile this call if it's a no-op.
4264 * By avoiding this state change we have a better chance of
4265 * coalescing subsequent drawing commands into one batch.
4266 */
4267 if (ctx->ListState.Current.ShadeModel == mode)
4268 return;
4269
4270 SAVE_FLUSH_VERTICES(ctx);
4271
4272 ctx->ListState.Current.ShadeModel = mode;
4273
4274 n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
4275 if (n) {
4276 n[1].e = mode;
4277 }
4278 }
4279
4280
4281 static void GLAPIENTRY
4282 save_StencilFunc(GLenum func, GLint ref, GLuint mask)
4283 {
4284 GET_CURRENT_CONTEXT(ctx);
4285 Node *n;
4286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4287 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3);
4288 if (n) {
4289 n[1].e = func;
4290 n[2].i = ref;
4291 n[3].ui = mask;
4292 }
4293 if (ctx->ExecuteFlag) {
4294 CALL_StencilFunc(ctx->Exec, (func, ref, mask));
4295 }
4296 }
4297
4298
4299 static void GLAPIENTRY
4300 save_StencilMask(GLuint mask)
4301 {
4302 GET_CURRENT_CONTEXT(ctx);
4303 Node *n;
4304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4305 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1);
4306 if (n) {
4307 n[1].ui = mask;
4308 }
4309 if (ctx->ExecuteFlag) {
4310 CALL_StencilMask(ctx->Exec, (mask));
4311 }
4312 }
4313
4314
4315 static void GLAPIENTRY
4316 save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
4317 {
4318 GET_CURRENT_CONTEXT(ctx);
4319 Node *n;
4320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4321 n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3);
4322 if (n) {
4323 n[1].e = fail;
4324 n[2].e = zfail;
4325 n[3].e = zpass;
4326 }
4327 if (ctx->ExecuteFlag) {
4328 CALL_StencilOp(ctx->Exec, (fail, zfail, zpass));
4329 }
4330 }
4331
4332
4333 static void GLAPIENTRY
4334 save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
4335 {
4336 GET_CURRENT_CONTEXT(ctx);
4337 Node *n;
4338 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4339 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4340 if (n) {
4341 n[1].e = face;
4342 n[2].e = func;
4343 n[3].i = ref;
4344 n[4].ui = mask;
4345 }
4346 if (ctx->ExecuteFlag) {
4347 CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
4348 }
4349 }
4350
4351
4352 static void GLAPIENTRY
4353 save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
4354 GLuint mask)
4355 {
4356 GET_CURRENT_CONTEXT(ctx);
4357 Node *n;
4358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4359 /* GL_FRONT */
4360 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4361 if (n) {
4362 n[1].e = GL_FRONT;
4363 n[2].e = frontfunc;
4364 n[3].i = ref;
4365 n[4].ui = mask;
4366 }
4367 /* GL_BACK */
4368 n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
4369 if (n) {
4370 n[1].e = GL_BACK;
4371 n[2].e = backfunc;
4372 n[3].i = ref;
4373 n[4].ui = mask;
4374 }
4375 if (ctx->ExecuteFlag) {
4376 CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
4377 CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
4378 }
4379 }
4380
4381
4382 static void GLAPIENTRY
4383 save_StencilMaskSeparate(GLenum face, GLuint mask)
4384 {
4385 GET_CURRENT_CONTEXT(ctx);
4386 Node *n;
4387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4388 n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
4389 if (n) {
4390 n[1].e = face;
4391 n[2].ui = mask;
4392 }
4393 if (ctx->ExecuteFlag) {
4394 CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
4395 }
4396 }
4397
4398
4399 static void GLAPIENTRY
4400 save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
4401 {
4402 GET_CURRENT_CONTEXT(ctx);
4403 Node *n;
4404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4405 n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4);
4406 if (n) {
4407 n[1].e = face;
4408 n[2].e = fail;
4409 n[3].e = zfail;
4410 n[4].e = zpass;
4411 }
4412 if (ctx->ExecuteFlag) {
4413 CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
4414 }
4415 }
4416
4417
4418 static void GLAPIENTRY
4419 save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
4420 {
4421 GET_CURRENT_CONTEXT(ctx);
4422 Node *n;
4423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4424 n = alloc_instruction(ctx, OPCODE_TEXENV, 6);
4425 if (n) {
4426 n[1].e = target;
4427 n[2].e = pname;
4428 if (pname == GL_TEXTURE_ENV_COLOR) {
4429 n[3].f = params[0];
4430 n[4].f = params[1];
4431 n[5].f = params[2];
4432 n[6].f = params[3];
4433 }
4434 else {
4435 n[3].f = params[0];
4436 n[4].f = n[5].f = n[6].f = 0.0F;
4437 }
4438 }
4439 if (ctx->ExecuteFlag) {
4440 CALL_TexEnvfv(ctx->Exec, (target, pname, params));
4441 }
4442 }
4443
4444
4445 static void GLAPIENTRY
4446 save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
4447 {
4448 GLfloat parray[4];
4449 parray[0] = (GLfloat) param;
4450 parray[1] = parray[2] = parray[3] = 0.0F;
4451 save_TexEnvfv(target, pname, parray);
4452 }
4453
4454
4455 static void GLAPIENTRY
4456 save_TexEnvi(GLenum target, GLenum pname, GLint param)
4457 {
4458 GLfloat p[4];
4459 p[0] = (GLfloat) param;
4460 p[1] = p[2] = p[3] = 0.0F;
4461 save_TexEnvfv(target, pname, p);
4462 }
4463
4464
4465 static void GLAPIENTRY
4466 save_TexEnviv(GLenum target, GLenum pname, const GLint * param)
4467 {
4468 GLfloat p[4];
4469 if (pname == GL_TEXTURE_ENV_COLOR) {
4470 p[0] = INT_TO_FLOAT(param[0]);
4471 p[1] = INT_TO_FLOAT(param[1]);
4472 p[2] = INT_TO_FLOAT(param[2]);
4473 p[3] = INT_TO_FLOAT(param[3]);
4474 }
4475 else {
4476 p[0] = (GLfloat) param[0];
4477 p[1] = p[2] = p[3] = 0.0F;
4478 }
4479 save_TexEnvfv(target, pname, p);
4480 }
4481
4482
4483 static void GLAPIENTRY
4484 save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
4485 {
4486 GET_CURRENT_CONTEXT(ctx);
4487 Node *n;
4488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4489 n = alloc_instruction(ctx, OPCODE_TEXGEN, 6);
4490 if (n) {
4491 n[1].e = coord;
4492 n[2].e = pname;
4493 n[3].f = params[0];
4494 n[4].f = params[1];
4495 n[5].f = params[2];
4496 n[6].f = params[3];
4497 }
4498 if (ctx->ExecuteFlag) {
4499 CALL_TexGenfv(ctx->Exec, (coord, pname, params));
4500 }
4501 }
4502
4503
4504 static void GLAPIENTRY
4505 save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
4506 {
4507 GLfloat p[4];
4508 p[0] = (GLfloat) params[0];
4509 p[1] = (GLfloat) params[1];
4510 p[2] = (GLfloat) params[2];
4511 p[3] = (GLfloat) params[3];
4512 save_TexGenfv(coord, pname, p);
4513 }
4514
4515
4516 static void GLAPIENTRY
4517 save_TexGend(GLenum coord, GLenum pname, GLdouble param)
4518 {
4519 GLfloat parray[4];
4520 parray[0] = (GLfloat) param;
4521 parray[1] = parray[2] = parray[3] = 0.0F;
4522 save_TexGenfv(coord, pname, parray);
4523 }
4524
4525
4526 static void GLAPIENTRY
4527 save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
4528 {
4529 GLfloat p[4];
4530 p[0] = (GLfloat) params[0];
4531 p[1] = (GLfloat) params[1];
4532 p[2] = (GLfloat) params[2];
4533 p[3] = (GLfloat) params[3];
4534 save_TexGenfv(coord, pname, p);
4535 }
4536
4537
4538 static void GLAPIENTRY
4539 save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
4540 {
4541 GLfloat parray[4];
4542 parray[0] = param;
4543 parray[1] = parray[2] = parray[3] = 0.0F;
4544 save_TexGenfv(coord, pname, parray);
4545 }
4546
4547
4548 static void GLAPIENTRY
4549 save_TexGeni(GLenum coord, GLenum pname, GLint param)
4550 {
4551 GLint parray[4];
4552 parray[0] = param;
4553 parray[1] = parray[2] = parray[3] = 0;
4554 save_TexGeniv(coord, pname, parray);
4555 }
4556
4557
4558 static void GLAPIENTRY
4559 save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
4560 {
4561 GET_CURRENT_CONTEXT(ctx);
4562 Node *n;
4563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4564 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6);
4565 if (n) {
4566 n[1].e = target;
4567 n[2].e = pname;
4568 n[3].f = params[0];
4569 n[4].f = params[1];
4570 n[5].f = params[2];
4571 n[6].f = params[3];
4572 }
4573 if (ctx->ExecuteFlag) {
4574 CALL_TexParameterfv(ctx->Exec, (target, pname, params));
4575 }
4576 }
4577
4578
4579 static void GLAPIENTRY
4580 save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
4581 {
4582 GLfloat parray[4];
4583 parray[0] = param;
4584 parray[1] = parray[2] = parray[3] = 0.0F;
4585 save_TexParameterfv(target, pname, parray);
4586 }
4587
4588
4589 static void GLAPIENTRY
4590 save_TexParameteri(GLenum target, GLenum pname, GLint param)
4591 {
4592 GLfloat fparam[4];
4593 fparam[0] = (GLfloat) param;
4594 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4595 save_TexParameterfv(target, pname, fparam);
4596 }
4597
4598
4599 static void GLAPIENTRY
4600 save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
4601 {
4602 GLfloat fparam[4];
4603 fparam[0] = (GLfloat) params[0];
4604 fparam[1] = fparam[2] = fparam[3] = 0.0F;
4605 save_TexParameterfv(target, pname, fparam);
4606 }
4607
4608
4609 static void GLAPIENTRY
4610 save_TexImage1D(GLenum target,
4611 GLint level, GLint components,
4612 GLsizei width, GLint border,
4613 GLenum format, GLenum type, const GLvoid * pixels)
4614 {
4615 GET_CURRENT_CONTEXT(ctx);
4616 if (target == GL_PROXY_TEXTURE_1D) {
4617 /* don't compile, execute immediately */
4618 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4619 border, format, type, pixels));
4620 }
4621 else {
4622 Node *n;
4623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4624 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
4625 if (n) {
4626 n[1].e = target;
4627 n[2].i = level;
4628 n[3].i = components;
4629 n[4].i = (GLint) width;
4630 n[5].i = border;
4631 n[6].e = format;
4632 n[7].e = type;
4633 save_pointer(&n[8],
4634 unpack_image(ctx, 1, width, 1, 1, format, type,
4635 pixels, &ctx->Unpack));
4636 }
4637 if (ctx->ExecuteFlag) {
4638 CALL_TexImage1D(ctx->Exec, (target, level, components, width,
4639 border, format, type, pixels));
4640 }
4641 }
4642 }
4643
4644
4645 static void GLAPIENTRY
4646 save_TexImage2D(GLenum target,
4647 GLint level, GLint components,
4648 GLsizei width, GLsizei height, GLint border,
4649 GLenum format, GLenum type, const GLvoid * pixels)
4650 {
4651 GET_CURRENT_CONTEXT(ctx);
4652 if (target == GL_PROXY_TEXTURE_2D) {
4653 /* don't compile, execute immediately */
4654 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4655 height, border, format, type, pixels));
4656 }
4657 else {
4658 Node *n;
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4660 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
4661 if (n) {
4662 n[1].e = target;
4663 n[2].i = level;
4664 n[3].i = components;
4665 n[4].i = (GLint) width;
4666 n[5].i = (GLint) height;
4667 n[6].i = border;
4668 n[7].e = format;
4669 n[8].e = type;
4670 save_pointer(&n[9],
4671 unpack_image(ctx, 2, width, height, 1, format, type,
4672 pixels, &ctx->Unpack));
4673 }
4674 if (ctx->ExecuteFlag) {
4675 CALL_TexImage2D(ctx->Exec, (target, level, components, width,
4676 height, border, format, type, pixels));
4677 }
4678 }
4679 }
4680
4681
4682 static void GLAPIENTRY
4683 save_TexImage3D(GLenum target,
4684 GLint level, GLint internalFormat,
4685 GLsizei width, GLsizei height, GLsizei depth,
4686 GLint border,
4687 GLenum format, GLenum type, const GLvoid * pixels)
4688 {
4689 GET_CURRENT_CONTEXT(ctx);
4690 if (target == GL_PROXY_TEXTURE_3D) {
4691 /* don't compile, execute immediately */
4692 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4693 height, depth, border, format, type,
4694 pixels));
4695 }
4696 else {
4697 Node *n;
4698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4699 n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
4700 if (n) {
4701 n[1].e = target;
4702 n[2].i = level;
4703 n[3].i = (GLint) internalFormat;
4704 n[4].i = (GLint) width;
4705 n[5].i = (GLint) height;
4706 n[6].i = (GLint) depth;
4707 n[7].i = border;
4708 n[8].e = format;
4709 n[9].e = type;
4710 save_pointer(&n[10],
4711 unpack_image(ctx, 3, width, height, depth, format, type,
4712 pixels, &ctx->Unpack));
4713 }
4714 if (ctx->ExecuteFlag) {
4715 CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
4716 height, depth, border, format, type,
4717 pixels));
4718 }
4719 }
4720 }
4721
4722
4723 static void GLAPIENTRY
4724 save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
4725 GLsizei width, GLenum format, GLenum type,
4726 const GLvoid * pixels)
4727 {
4728 GET_CURRENT_CONTEXT(ctx);
4729 Node *n;
4730
4731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4732
4733 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
4734 if (n) {
4735 n[1].e = target;
4736 n[2].i = level;
4737 n[3].i = xoffset;
4738 n[4].i = (GLint) width;
4739 n[5].e = format;
4740 n[6].e = type;
4741 save_pointer(&n[7],
4742 unpack_image(ctx, 1, width, 1, 1, format, type,
4743 pixels, &ctx->Unpack));
4744 }
4745 if (ctx->ExecuteFlag) {
4746 CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
4747 format, type, pixels));
4748 }
4749 }
4750
4751
4752 static void GLAPIENTRY
4753 save_TexSubImage2D(GLenum target, GLint level,
4754 GLint xoffset, GLint yoffset,
4755 GLsizei width, GLsizei height,
4756 GLenum format, GLenum type, const GLvoid * pixels)
4757 {
4758 GET_CURRENT_CONTEXT(ctx);
4759 Node *n;
4760
4761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4762
4763 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
4764 if (n) {
4765 n[1].e = target;
4766 n[2].i = level;
4767 n[3].i = xoffset;
4768 n[4].i = yoffset;
4769 n[5].i = (GLint) width;
4770 n[6].i = (GLint) height;
4771 n[7].e = format;
4772 n[8].e = type;
4773 save_pointer(&n[9],
4774 unpack_image(ctx, 2, width, height, 1, format, type,
4775 pixels, &ctx->Unpack));
4776 }
4777 if (ctx->ExecuteFlag) {
4778 CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
4779 width, height, format, type, pixels));
4780 }
4781 }
4782
4783
4784 static void GLAPIENTRY
4785 save_TexSubImage3D(GLenum target, GLint level,
4786 GLint xoffset, GLint yoffset, GLint zoffset,
4787 GLsizei width, GLsizei height, GLsizei depth,
4788 GLenum format, GLenum type, const GLvoid * pixels)
4789 {
4790 GET_CURRENT_CONTEXT(ctx);
4791 Node *n;
4792
4793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4794
4795 n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
4796 if (n) {
4797 n[1].e = target;
4798 n[2].i = level;
4799 n[3].i = xoffset;
4800 n[4].i = yoffset;
4801 n[5].i = zoffset;
4802 n[6].i = (GLint) width;
4803 n[7].i = (GLint) height;
4804 n[8].i = (GLint) depth;
4805 n[9].e = format;
4806 n[10].e = type;
4807 save_pointer(&n[11],
4808 unpack_image(ctx, 3, width, height, depth, format, type,
4809 pixels, &ctx->Unpack));
4810 }
4811 if (ctx->ExecuteFlag) {
4812 CALL_TexSubImage3D(ctx->Exec, (target, level,
4813 xoffset, yoffset, zoffset,
4814 width, height, depth, format, type,
4815 pixels));
4816 }
4817 }
4818
4819
4820 static void GLAPIENTRY
4821 save_Translatef(GLfloat x, GLfloat y, GLfloat z)
4822 {
4823 GET_CURRENT_CONTEXT(ctx);
4824 Node *n;
4825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4826 n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3);
4827 if (n) {
4828 n[1].f = x;
4829 n[2].f = y;
4830 n[3].f = z;
4831 }
4832 if (ctx->ExecuteFlag) {
4833 CALL_Translatef(ctx->Exec, (x, y, z));
4834 }
4835 }
4836
4837
4838 static void GLAPIENTRY
4839 save_Translated(GLdouble x, GLdouble y, GLdouble z)
4840 {
4841 save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
4842 }
4843
4844
4845
4846 static void GLAPIENTRY
4847 save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
4848 {
4849 GET_CURRENT_CONTEXT(ctx);
4850 Node *n;
4851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4852 n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4);
4853 if (n) {
4854 n[1].i = x;
4855 n[2].i = y;
4856 n[3].i = (GLint) width;
4857 n[4].i = (GLint) height;
4858 }
4859 if (ctx->ExecuteFlag) {
4860 CALL_Viewport(ctx->Exec, (x, y, width, height));
4861 }
4862 }
4863
4864 static void GLAPIENTRY
4865 save_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat width,
4866 GLfloat height)
4867 {
4868 GET_CURRENT_CONTEXT(ctx);
4869 Node *n;
4870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4871 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_F, 5);
4872 if (n) {
4873 n[1].ui = index;
4874 n[2].f = x;
4875 n[3].f = y;
4876 n[4].f = width;
4877 n[5].f = height;
4878 }
4879 if (ctx->ExecuteFlag) {
4880 CALL_ViewportIndexedf(ctx->Exec, (index, x, y, width, height));
4881 }
4882 }
4883
4884 static void GLAPIENTRY
4885 save_ViewportIndexedfv(GLuint index, const GLfloat *v)
4886 {
4887 GET_CURRENT_CONTEXT(ctx);
4888 Node *n;
4889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4890 n = alloc_instruction(ctx, OPCODE_VIEWPORT_INDEXED_FV, 5);
4891 if (n) {
4892 n[1].ui = index;
4893 n[2].f = v[0];
4894 n[3].f = v[1];
4895 n[4].f = v[2];
4896 n[5].f = v[3];
4897 }
4898 if (ctx->ExecuteFlag) {
4899 CALL_ViewportIndexedfv(ctx->Exec, (index, v));
4900 }
4901 }
4902
4903 static void GLAPIENTRY
4904 save_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
4905 {
4906 GET_CURRENT_CONTEXT(ctx);
4907 Node *n;
4908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4909 n = alloc_instruction(ctx, OPCODE_VIEWPORT_ARRAY_V, 2 + POINTER_DWORDS);
4910 if (n) {
4911 n[1].ui = first;
4912 n[2].si = count;
4913 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
4914 }
4915 if (ctx->ExecuteFlag) {
4916 CALL_ViewportArrayv(ctx->Exec, (first, count, v));
4917 }
4918 }
4919
4920 static void GLAPIENTRY
4921 save_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width,
4922 GLsizei height)
4923 {
4924 GET_CURRENT_CONTEXT(ctx);
4925 Node *n;
4926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4927 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED, 5);
4928 if (n) {
4929 n[1].ui = index;
4930 n[2].i = left;
4931 n[3].i = bottom;
4932 n[4].si = width;
4933 n[5].si = height;
4934 }
4935 if (ctx->ExecuteFlag) {
4936 CALL_ScissorIndexed(ctx->Exec, (index, left, bottom, width, height));
4937 }
4938 }
4939
4940 static void GLAPIENTRY
4941 save_ScissorIndexedv(GLuint index, const GLint *v)
4942 {
4943 GET_CURRENT_CONTEXT(ctx);
4944 Node *n;
4945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4946 n = alloc_instruction(ctx, OPCODE_SCISSOR_INDEXED_V, 5);
4947 if (n) {
4948 n[1].ui = index;
4949 n[2].i = v[0];
4950 n[3].i = v[1];
4951 n[4].si = v[2];
4952 n[5].si = v[3];
4953 }
4954 if (ctx->ExecuteFlag) {
4955 CALL_ScissorIndexedv(ctx->Exec, (index, v));
4956 }
4957 }
4958
4959 static void GLAPIENTRY
4960 save_ScissorArrayv(GLuint first, GLsizei count, const GLint *v)
4961 {
4962 GET_CURRENT_CONTEXT(ctx);
4963 Node *n;
4964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4965 n = alloc_instruction(ctx, OPCODE_SCISSOR_ARRAY_V, 2 + POINTER_DWORDS);
4966 if (n) {
4967 n[1].ui = first;
4968 n[2].si = count;
4969 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint)));
4970 }
4971 if (ctx->ExecuteFlag) {
4972 CALL_ScissorArrayv(ctx->Exec, (first, count, v));
4973 }
4974 }
4975
4976 static void GLAPIENTRY
4977 save_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f)
4978 {
4979 GET_CURRENT_CONTEXT(ctx);
4980 Node *node;
4981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
4982 node = alloc_instruction(ctx, OPCODE_DEPTH_INDEXED, 3);
4983 if (node) {
4984 node[1].ui = index;
4985 /* Mesa stores these as floats internally so we deliberately convert
4986 * them to a float here.
4987 */
4988 node[2].f = n;
4989 node[3].f = f;
4990 }
4991 if (ctx->ExecuteFlag) {
4992 CALL_DepthRangeIndexed(ctx->Exec, (index, n, f));
4993 }
4994 }
4995
4996 static void GLAPIENTRY
4997 save_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v)
4998 {
4999 GET_CURRENT_CONTEXT(ctx);
5000 Node *n;
5001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5002 n = alloc_instruction(ctx, OPCODE_DEPTH_ARRAY_V, 2 + POINTER_DWORDS);
5003 if (n) {
5004 n[1].ui = first;
5005 n[2].si = count;
5006 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLclampd)));
5007 }
5008 if (ctx->ExecuteFlag) {
5009 CALL_DepthRangeArrayv(ctx->Exec, (first, count, v));
5010 }
5011 }
5012
5013 static void GLAPIENTRY
5014 save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5015 {
5016 GET_CURRENT_CONTEXT(ctx);
5017 Node *n;
5018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5019 n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4);
5020 if (n) {
5021 n[1].f = x;
5022 n[2].f = y;
5023 n[3].f = z;
5024 n[4].f = w;
5025 }
5026 if (ctx->ExecuteFlag) {
5027 CALL_WindowPos4fMESA(ctx->Exec, (x, y, z, w));
5028 }
5029 }
5030
5031 static void GLAPIENTRY
5032 save_WindowPos2dMESA(GLdouble x, GLdouble y)
5033 {
5034 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
5035 }
5036
5037 static void GLAPIENTRY
5038 save_WindowPos2fMESA(GLfloat x, GLfloat y)
5039 {
5040 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
5041 }
5042
5043 static void GLAPIENTRY
5044 save_WindowPos2iMESA(GLint x, GLint y)
5045 {
5046 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
5047 }
5048
5049 static void GLAPIENTRY
5050 save_WindowPos2sMESA(GLshort x, GLshort y)
5051 {
5052 save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
5053 }
5054
5055 static void GLAPIENTRY
5056 save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
5057 {
5058 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
5059 }
5060
5061 static void GLAPIENTRY
5062 save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
5063 {
5064 save_WindowPos4fMESA(x, y, z, 1.0F);
5065 }
5066
5067 static void GLAPIENTRY
5068 save_WindowPos3iMESA(GLint x, GLint y, GLint z)
5069 {
5070 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
5071 }
5072
5073 static void GLAPIENTRY
5074 save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
5075 {
5076 save_WindowPos4fMESA(x, y, z, 1.0F);
5077 }
5078
5079 static void GLAPIENTRY
5080 save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5081 {
5082 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5083 }
5084
5085 static void GLAPIENTRY
5086 save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
5087 {
5088 save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
5089 }
5090
5091 static void GLAPIENTRY
5092 save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
5093 {
5094 save_WindowPos4fMESA(x, y, z, w);
5095 }
5096
5097 static void GLAPIENTRY
5098 save_WindowPos2dvMESA(const GLdouble * v)
5099 {
5100 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5101 }
5102
5103 static void GLAPIENTRY
5104 save_WindowPos2fvMESA(const GLfloat * v)
5105 {
5106 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5107 }
5108
5109 static void GLAPIENTRY
5110 save_WindowPos2ivMESA(const GLint * v)
5111 {
5112 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
5113 }
5114
5115 static void GLAPIENTRY
5116 save_WindowPos2svMESA(const GLshort * v)
5117 {
5118 save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
5119 }
5120
5121 static void GLAPIENTRY
5122 save_WindowPos3dvMESA(const GLdouble * v)
5123 {
5124 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5125 }
5126
5127 static void GLAPIENTRY
5128 save_WindowPos3fvMESA(const GLfloat * v)
5129 {
5130 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5131 }
5132
5133 static void GLAPIENTRY
5134 save_WindowPos3ivMESA(const GLint * v)
5135 {
5136 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
5137 }
5138
5139 static void GLAPIENTRY
5140 save_WindowPos3svMESA(const GLshort * v)
5141 {
5142 save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
5143 }
5144
5145 static void GLAPIENTRY
5146 save_WindowPos4dvMESA(const GLdouble * v)
5147 {
5148 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5149 (GLfloat) v[2], (GLfloat) v[3]);
5150 }
5151
5152 static void GLAPIENTRY
5153 save_WindowPos4fvMESA(const GLfloat * v)
5154 {
5155 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5156 }
5157
5158 static void GLAPIENTRY
5159 save_WindowPos4ivMESA(const GLint * v)
5160 {
5161 save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
5162 (GLfloat) v[2], (GLfloat) v[3]);
5163 }
5164
5165 static void GLAPIENTRY
5166 save_WindowPos4svMESA(const GLshort * v)
5167 {
5168 save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
5169 }
5170
5171
5172
5173 /* GL_ARB_multitexture */
5174 static void GLAPIENTRY
5175 save_ActiveTextureARB(GLenum target)
5176 {
5177 GET_CURRENT_CONTEXT(ctx);
5178 Node *n;
5179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5180 n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1);
5181 if (n) {
5182 n[1].e = target;
5183 }
5184 if (ctx->ExecuteFlag) {
5185 CALL_ActiveTexture(ctx->Exec, (target));
5186 }
5187 }
5188
5189
5190 /* GL_ARB_transpose_matrix */
5191
5192 static void GLAPIENTRY
5193 save_LoadTransposeMatrixdARB(const GLdouble m[16])
5194 {
5195 GLfloat tm[16];
5196 _math_transposefd(tm, m);
5197 save_LoadMatrixf(tm);
5198 }
5199
5200
5201 static void GLAPIENTRY
5202 save_LoadTransposeMatrixfARB(const GLfloat m[16])
5203 {
5204 GLfloat tm[16];
5205 _math_transposef(tm, m);
5206 save_LoadMatrixf(tm);
5207 }
5208
5209
5210 static void GLAPIENTRY
5211 save_MultTransposeMatrixdARB(const GLdouble m[16])
5212 {
5213 GLfloat tm[16];
5214 _math_transposefd(tm, m);
5215 save_MultMatrixf(tm);
5216 }
5217
5218
5219 static void GLAPIENTRY
5220 save_MultTransposeMatrixfARB(const GLfloat m[16])
5221 {
5222 GLfloat tm[16];
5223 _math_transposef(tm, m);
5224 save_MultMatrixf(tm);
5225 }
5226
5227 static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
5228 {
5229 GET_CURRENT_CONTEXT(ctx);
5230 GLvoid *image;
5231
5232 if (!data)
5233 return NULL;
5234
5235 image = malloc(size);
5236 if (!image) {
5237 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
5238 return NULL;
5239 }
5240 memcpy(image, data, size);
5241
5242 return image;
5243 }
5244
5245
5246 /* GL_ARB_texture_compression */
5247 static void GLAPIENTRY
5248 save_CompressedTexImage1DARB(GLenum target, GLint level,
5249 GLenum internalFormat, GLsizei width,
5250 GLint border, GLsizei imageSize,
5251 const GLvoid * data)
5252 {
5253 GET_CURRENT_CONTEXT(ctx);
5254 if (target == GL_PROXY_TEXTURE_1D) {
5255 /* don't compile, execute immediately */
5256 CALL_CompressedTexImage1D(ctx->Exec, (target, level, internalFormat,
5257 width, border, imageSize,
5258 data));
5259 }
5260 else {
5261 Node *n;
5262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5263
5264 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
5265 6 + POINTER_DWORDS);
5266 if (n) {
5267 n[1].e = target;
5268 n[2].i = level;
5269 n[3].e = internalFormat;
5270 n[4].i = (GLint) width;
5271 n[5].i = border;
5272 n[6].i = imageSize;
5273 save_pointer(&n[7],
5274 copy_data(data, imageSize, "glCompressedTexImage1DARB"));
5275 }
5276 if (ctx->ExecuteFlag) {
5277 CALL_CompressedTexImage1D(ctx->Exec,
5278 (target, level, internalFormat, width,
5279 border, imageSize, data));
5280 }
5281 }
5282 }
5283
5284
5285 static void GLAPIENTRY
5286 save_CompressedTexImage2DARB(GLenum target, GLint level,
5287 GLenum internalFormat, GLsizei width,
5288 GLsizei height, GLint border, GLsizei imageSize,
5289 const GLvoid * data)
5290 {
5291 GET_CURRENT_CONTEXT(ctx);
5292 if (target == GL_PROXY_TEXTURE_2D) {
5293 /* don't compile, execute immediately */
5294 CALL_CompressedTexImage2D(ctx->Exec, (target, level, internalFormat,
5295 width, height, border,
5296 imageSize, data));
5297 }
5298 else {
5299 Node *n;
5300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5301
5302 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
5303 7 + POINTER_DWORDS);
5304 if (n) {
5305 n[1].e = target;
5306 n[2].i = level;
5307 n[3].e = internalFormat;
5308 n[4].i = (GLint) width;
5309 n[5].i = (GLint) height;
5310 n[6].i = border;
5311 n[7].i = imageSize;
5312 save_pointer(&n[8],
5313 copy_data(data, imageSize, "glCompressedTexImage2DARB"));
5314 }
5315 if (ctx->ExecuteFlag) {
5316 CALL_CompressedTexImage2D(ctx->Exec,
5317 (target, level, internalFormat, width,
5318 height, border, imageSize, data));
5319 }
5320 }
5321 }
5322
5323
5324 static void GLAPIENTRY
5325 save_CompressedTexImage3DARB(GLenum target, GLint level,
5326 GLenum internalFormat, GLsizei width,
5327 GLsizei height, GLsizei depth, GLint border,
5328 GLsizei imageSize, const GLvoid * data)
5329 {
5330 GET_CURRENT_CONTEXT(ctx);
5331 if (target == GL_PROXY_TEXTURE_3D) {
5332 /* don't compile, execute immediately */
5333 CALL_CompressedTexImage3D(ctx->Exec, (target, level, internalFormat,
5334 width, height, depth, border,
5335 imageSize, data));
5336 }
5337 else {
5338 Node *n;
5339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5340
5341 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
5342 8 + POINTER_DWORDS);
5343 if (n) {
5344 n[1].e = target;
5345 n[2].i = level;
5346 n[3].e = internalFormat;
5347 n[4].i = (GLint) width;
5348 n[5].i = (GLint) height;
5349 n[6].i = (GLint) depth;
5350 n[7].i = border;
5351 n[8].i = imageSize;
5352 save_pointer(&n[9],
5353 copy_data(data, imageSize, "glCompressedTexImage3DARB"));
5354 }
5355 if (ctx->ExecuteFlag) {
5356 CALL_CompressedTexImage3D(ctx->Exec,
5357 (target, level, internalFormat, width,
5358 height, depth, border, imageSize,
5359 data));
5360 }
5361 }
5362 }
5363
5364
5365 static void GLAPIENTRY
5366 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
5367 GLsizei width, GLenum format,
5368 GLsizei imageSize, const GLvoid * data)
5369 {
5370 Node *n;
5371 GET_CURRENT_CONTEXT(ctx);
5372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5373
5374 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
5375 6 + POINTER_DWORDS);
5376 if (n) {
5377 n[1].e = target;
5378 n[2].i = level;
5379 n[3].i = xoffset;
5380 n[4].i = (GLint) width;
5381 n[5].e = format;
5382 n[6].i = imageSize;
5383 save_pointer(&n[7],
5384 copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
5385 }
5386 if (ctx->ExecuteFlag) {
5387 CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
5388 width, format, imageSize,
5389 data));
5390 }
5391 }
5392
5393
5394 static void GLAPIENTRY
5395 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
5396 GLint yoffset, GLsizei width, GLsizei height,
5397 GLenum format, GLsizei imageSize,
5398 const GLvoid * data)
5399 {
5400 Node *n;
5401 GET_CURRENT_CONTEXT(ctx);
5402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5403
5404 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
5405 8 + POINTER_DWORDS);
5406 if (n) {
5407 n[1].e = target;
5408 n[2].i = level;
5409 n[3].i = xoffset;
5410 n[4].i = yoffset;
5411 n[5].i = (GLint) width;
5412 n[6].i = (GLint) height;
5413 n[7].e = format;
5414 n[8].i = imageSize;
5415 save_pointer(&n[9],
5416 copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
5417 }
5418 if (ctx->ExecuteFlag) {
5419 CALL_CompressedTexSubImage2D(ctx->Exec,
5420 (target, level, xoffset, yoffset, width,
5421 height, format, imageSize, data));
5422 }
5423 }
5424
5425
5426 static void GLAPIENTRY
5427 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
5428 GLint yoffset, GLint zoffset, GLsizei width,
5429 GLsizei height, GLsizei depth, GLenum format,
5430 GLsizei imageSize, const GLvoid * data)
5431 {
5432 Node *n;
5433 GET_CURRENT_CONTEXT(ctx);
5434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5435
5436 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
5437 10 + POINTER_DWORDS);
5438 if (n) {
5439 n[1].e = target;
5440 n[2].i = level;
5441 n[3].i = xoffset;
5442 n[4].i = yoffset;
5443 n[5].i = zoffset;
5444 n[6].i = (GLint) width;
5445 n[7].i = (GLint) height;
5446 n[8].i = (GLint) depth;
5447 n[9].e = format;
5448 n[10].i = imageSize;
5449 save_pointer(&n[11],
5450 copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
5451 }
5452 if (ctx->ExecuteFlag) {
5453 CALL_CompressedTexSubImage3D(ctx->Exec,
5454 (target, level, xoffset, yoffset,
5455 zoffset, width, height, depth, format,
5456 imageSize, data));
5457 }
5458 }
5459
5460
5461 /* GL_ARB_multisample */
5462 static void GLAPIENTRY
5463 save_SampleCoverageARB(GLclampf value, GLboolean invert)
5464 {
5465 GET_CURRENT_CONTEXT(ctx);
5466 Node *n;
5467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5468 n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2);
5469 if (n) {
5470 n[1].f = value;
5471 n[2].b = invert;
5472 }
5473 if (ctx->ExecuteFlag) {
5474 CALL_SampleCoverage(ctx->Exec, (value, invert));
5475 }
5476 }
5477
5478
5479 /*
5480 * GL_ARB_vertex_program
5481 */
5482 static void GLAPIENTRY
5483 save_BindProgramARB(GLenum target, GLuint id)
5484 {
5485 GET_CURRENT_CONTEXT(ctx);
5486 Node *n;
5487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5488 n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_ARB, 2);
5489 if (n) {
5490 n[1].e = target;
5491 n[2].ui = id;
5492 }
5493 if (ctx->ExecuteFlag) {
5494 CALL_BindProgramARB(ctx->Exec, (target, id));
5495 }
5496 }
5497
5498 static void GLAPIENTRY
5499 save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
5500 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5501 {
5502 GET_CURRENT_CONTEXT(ctx);
5503 Node *n;
5504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5505 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5506 if (n) {
5507 n[1].e = target;
5508 n[2].ui = index;
5509 n[3].f = x;
5510 n[4].f = y;
5511 n[5].f = z;
5512 n[6].f = w;
5513 }
5514 if (ctx->ExecuteFlag) {
5515 CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5516 }
5517 }
5518
5519
5520 static void GLAPIENTRY
5521 save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
5522 const GLfloat *params)
5523 {
5524 save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
5525 params[2], params[3]);
5526 }
5527
5528
5529 static void GLAPIENTRY
5530 save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5531 const GLfloat * params)
5532 {
5533 GET_CURRENT_CONTEXT(ctx);
5534 Node *n;
5535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5536
5537 if (count > 0) {
5538 GLint i;
5539 const GLfloat * p = params;
5540
5541 for (i = 0 ; i < count ; i++) {
5542 n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
5543 if (n) {
5544 n[1].e = target;
5545 n[2].ui = index;
5546 n[3].f = p[0];
5547 n[4].f = p[1];
5548 n[5].f = p[2];
5549 n[6].f = p[3];
5550 p += 4;
5551 }
5552 }
5553 }
5554
5555 if (ctx->ExecuteFlag) {
5556 CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
5557 }
5558 }
5559
5560
5561 static void GLAPIENTRY
5562 save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
5563 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
5564 {
5565 save_ProgramEnvParameter4fARB(target, index,
5566 (GLfloat) x,
5567 (GLfloat) y, (GLfloat) z, (GLfloat) w);
5568 }
5569
5570
5571 static void GLAPIENTRY
5572 save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
5573 const GLdouble *params)
5574 {
5575 save_ProgramEnvParameter4fARB(target, index,
5576 (GLfloat) params[0],
5577 (GLfloat) params[1],
5578 (GLfloat) params[2], (GLfloat) params[3]);
5579 }
5580
5581
5582 static void GLAPIENTRY
5583 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
5584 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
5585 {
5586 GET_CURRENT_CONTEXT(ctx);
5587 Node *n;
5588 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5589 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5590 if (n) {
5591 n[1].e = target;
5592 n[2].ui = index;
5593 n[3].f = x;
5594 n[4].f = y;
5595 n[5].f = z;
5596 n[6].f = w;
5597 }
5598 if (ctx->ExecuteFlag) {
5599 CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
5600 }
5601 }
5602
5603
5604 static void GLAPIENTRY
5605 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
5606 const GLfloat *params)
5607 {
5608 GET_CURRENT_CONTEXT(ctx);
5609 Node *n;
5610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5611 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5612 if (n) {
5613 n[1].e = target;
5614 n[2].ui = index;
5615 n[3].f = params[0];
5616 n[4].f = params[1];
5617 n[5].f = params[2];
5618 n[6].f = params[3];
5619 }
5620 if (ctx->ExecuteFlag) {
5621 CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
5622 }
5623 }
5624
5625
5626 static void GLAPIENTRY
5627 save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
5628 const GLfloat *params)
5629 {
5630 GET_CURRENT_CONTEXT(ctx);
5631 Node *n;
5632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5633
5634 if (count > 0) {
5635 GLint i;
5636 const GLfloat * p = params;
5637
5638 for (i = 0 ; i < count ; i++) {
5639 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5640 if (n) {
5641 n[1].e = target;
5642 n[2].ui = index;
5643 n[3].f = p[0];
5644 n[4].f = p[1];
5645 n[5].f = p[2];
5646 n[6].f = p[3];
5647 p += 4;
5648 }
5649 }
5650 }
5651
5652 if (ctx->ExecuteFlag) {
5653 CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
5654 }
5655 }
5656
5657
5658 static void GLAPIENTRY
5659 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
5660 GLdouble x, GLdouble y,
5661 GLdouble z, GLdouble w)
5662 {
5663 GET_CURRENT_CONTEXT(ctx);
5664 Node *n;
5665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5666 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5667 if (n) {
5668 n[1].e = target;
5669 n[2].ui = index;
5670 n[3].f = (GLfloat) x;
5671 n[4].f = (GLfloat) y;
5672 n[5].f = (GLfloat) z;
5673 n[6].f = (GLfloat) w;
5674 }
5675 if (ctx->ExecuteFlag) {
5676 CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
5677 }
5678 }
5679
5680
5681 static void GLAPIENTRY
5682 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
5683 const GLdouble *params)
5684 {
5685 GET_CURRENT_CONTEXT(ctx);
5686 Node *n;
5687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5688 n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
5689 if (n) {
5690 n[1].e = target;
5691 n[2].ui = index;
5692 n[3].f = (GLfloat) params[0];
5693 n[4].f = (GLfloat) params[1];
5694 n[5].f = (GLfloat) params[2];
5695 n[6].f = (GLfloat) params[3];
5696 }
5697 if (ctx->ExecuteFlag) {
5698 CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
5699 }
5700 }
5701
5702
5703 /* GL_EXT_stencil_two_side */
5704 static void GLAPIENTRY
5705 save_ActiveStencilFaceEXT(GLenum face)
5706 {
5707 GET_CURRENT_CONTEXT(ctx);
5708 Node *n;
5709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5710 n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1);
5711 if (n) {
5712 n[1].e = face;
5713 }
5714 if (ctx->ExecuteFlag) {
5715 CALL_ActiveStencilFaceEXT(ctx->Exec, (face));
5716 }
5717 }
5718
5719
5720 /* GL_EXT_depth_bounds_test */
5721 static void GLAPIENTRY
5722 save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax)
5723 {
5724 GET_CURRENT_CONTEXT(ctx);
5725 Node *n;
5726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5727 n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2);
5728 if (n) {
5729 n[1].f = (GLfloat) zmin;
5730 n[2].f = (GLfloat) zmax;
5731 }
5732 if (ctx->ExecuteFlag) {
5733 CALL_DepthBoundsEXT(ctx->Exec, (zmin, zmax));
5734 }
5735 }
5736
5737
5738
5739 static void GLAPIENTRY
5740 save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
5741 const GLvoid * string)
5742 {
5743 GET_CURRENT_CONTEXT(ctx);
5744 Node *n;
5745
5746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5747
5748 n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
5749 if (n) {
5750 GLubyte *programCopy = malloc(len);
5751 if (!programCopy) {
5752 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
5753 return;
5754 }
5755 memcpy(programCopy, string, len);
5756 n[1].e = target;
5757 n[2].e = format;
5758 n[3].i = len;
5759 save_pointer(&n[4], programCopy);
5760 }
5761 if (ctx->ExecuteFlag) {
5762 CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
5763 }
5764 }
5765
5766
5767 static void GLAPIENTRY
5768 save_BeginQueryARB(GLenum target, GLuint id)
5769 {
5770 GET_CURRENT_CONTEXT(ctx);
5771 Node *n;
5772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5773 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2);
5774 if (n) {
5775 n[1].e = target;
5776 n[2].ui = id;
5777 }
5778 if (ctx->ExecuteFlag) {
5779 CALL_BeginQuery(ctx->Exec, (target, id));
5780 }
5781 }
5782
5783 static void GLAPIENTRY
5784 save_EndQueryARB(GLenum target)
5785 {
5786 GET_CURRENT_CONTEXT(ctx);
5787 Node *n;
5788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5789 n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1);
5790 if (n) {
5791 n[1].e = target;
5792 }
5793 if (ctx->ExecuteFlag) {
5794 CALL_EndQuery(ctx->Exec, (target));
5795 }
5796 }
5797
5798 static void GLAPIENTRY
5799 save_QueryCounter(GLuint id, GLenum target)
5800 {
5801 GET_CURRENT_CONTEXT(ctx);
5802 Node *n;
5803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5804 n = alloc_instruction(ctx, OPCODE_QUERY_COUNTER, 2);
5805 if (n) {
5806 n[1].ui = id;
5807 n[2].e = target;
5808 }
5809 if (ctx->ExecuteFlag) {
5810 CALL_QueryCounter(ctx->Exec, (id, target));
5811 }
5812 }
5813
5814 static void GLAPIENTRY
5815 save_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
5816 {
5817 GET_CURRENT_CONTEXT(ctx);
5818 Node *n;
5819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5820 n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_INDEXED, 3);
5821 if (n) {
5822 n[1].e = target;
5823 n[2].ui = index;
5824 n[3].ui = id;
5825 }
5826 if (ctx->ExecuteFlag) {
5827 CALL_BeginQueryIndexed(ctx->Exec, (target, index, id));
5828 }
5829 }
5830
5831 static void GLAPIENTRY
5832 save_EndQueryIndexed(GLenum target, GLuint index)
5833 {
5834 GET_CURRENT_CONTEXT(ctx);
5835 Node *n;
5836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5837 n = alloc_instruction(ctx, OPCODE_END_QUERY_INDEXED, 2);
5838 if (n) {
5839 n[1].e = target;
5840 n[2].ui = index;
5841 }
5842 if (ctx->ExecuteFlag) {
5843 CALL_EndQueryIndexed(ctx->Exec, (target, index));
5844 }
5845 }
5846
5847
5848 static void GLAPIENTRY
5849 save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
5850 {
5851 GET_CURRENT_CONTEXT(ctx);
5852 Node *n;
5853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
5854 n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS);
5855 if (n) {
5856 GLint i;
5857 n[1].i = count;
5858 if (count > MAX_DRAW_BUFFERS)
5859 count = MAX_DRAW_BUFFERS;
5860 for (i = 0; i < count; i++) {
5861 n[2 + i].e = buffers[i];
5862 }
5863 }
5864 if (ctx->ExecuteFlag) {
5865 CALL_DrawBuffers(ctx->Exec, (count, buffers));
5866 }
5867 }
5868
5869 static void GLAPIENTRY
5870 save_BindFragmentShaderATI(GLuint id)
5871 {
5872 GET_CURRENT_CONTEXT(ctx);
5873 Node *n;
5874
5875 n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
5876 if (n) {
5877 n[1].ui = id;
5878 }
5879 if (ctx->ExecuteFlag) {
5880 CALL_BindFragmentShaderATI(ctx->Exec, (id));
5881 }
5882 }
5883
5884 static void GLAPIENTRY
5885 save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
5886 {
5887 GET_CURRENT_CONTEXT(ctx);
5888 Node *n;
5889
5890 n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
5891 if (n) {
5892 n[1].ui = dst;
5893 n[2].f = value[0];
5894 n[3].f = value[1];
5895 n[4].f = value[2];
5896 n[5].f = value[3];
5897 }
5898 if (ctx->ExecuteFlag) {
5899 CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
5900 }
5901 }
5902
5903 static void GLAPIENTRY
5904 save_EvalCoord1f(GLfloat x)
5905 {
5906 GET_CURRENT_CONTEXT(ctx);
5907 Node *n;
5908 SAVE_FLUSH_VERTICES(ctx);
5909 n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1);
5910 if (n) {
5911 n[1].f = x;
5912 }
5913 if (ctx->ExecuteFlag) {
5914 CALL_EvalCoord1f(ctx->Exec, (x));
5915 }
5916 }
5917
5918 static void GLAPIENTRY
5919 save_EvalCoord1fv(const GLfloat * v)
5920 {
5921 save_EvalCoord1f(v[0]);
5922 }
5923
5924 static void GLAPIENTRY
5925 save_EvalCoord2f(GLfloat x, GLfloat y)
5926 {
5927 GET_CURRENT_CONTEXT(ctx);
5928 Node *n;
5929 SAVE_FLUSH_VERTICES(ctx);
5930 n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2);
5931 if (n) {
5932 n[1].f = x;
5933 n[2].f = y;
5934 }
5935 if (ctx->ExecuteFlag) {
5936 CALL_EvalCoord2f(ctx->Exec, (x, y));
5937 }
5938 }
5939
5940 static void GLAPIENTRY
5941 save_EvalCoord2fv(const GLfloat * v)
5942 {
5943 save_EvalCoord2f(v[0], v[1]);
5944 }
5945
5946
5947 static void GLAPIENTRY
5948 save_EvalPoint1(GLint x)
5949 {
5950 GET_CURRENT_CONTEXT(ctx);
5951 Node *n;
5952 SAVE_FLUSH_VERTICES(ctx);
5953 n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1);
5954 if (n) {
5955 n[1].i = x;
5956 }
5957 if (ctx->ExecuteFlag) {
5958 CALL_EvalPoint1(ctx->Exec, (x));
5959 }
5960 }
5961
5962 static void GLAPIENTRY
5963 save_EvalPoint2(GLint x, GLint y)
5964 {
5965 GET_CURRENT_CONTEXT(ctx);
5966 Node *n;
5967 SAVE_FLUSH_VERTICES(ctx);
5968 n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2);
5969 if (n) {
5970 n[1].i = x;
5971 n[2].i = y;
5972 }
5973 if (ctx->ExecuteFlag) {
5974 CALL_EvalPoint2(ctx->Exec, (x, y));
5975 }
5976 }
5977
5978
5979 /**
5980 * Compare 'count' elements of vectors 'a' and 'b'.
5981 * \return GL_TRUE if equal, GL_FALSE if different.
5982 */
5983 static inline GLboolean
5984 compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
5985 {
5986 return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
5987 }
5988
5989
5990 /**
5991 * This glMaterial function is used for glMaterial calls that are outside
5992 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5993 */
5994 static void GLAPIENTRY
5995 save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
5996 {
5997 GET_CURRENT_CONTEXT(ctx);
5998 Node *n;
5999 int args, i;
6000 GLuint bitmask;
6001
6002 switch (face) {
6003 case GL_BACK:
6004 case GL_FRONT:
6005 case GL_FRONT_AND_BACK:
6006 break;
6007 default:
6008 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
6009 return;
6010 }
6011
6012 switch (pname) {
6013 case GL_EMISSION:
6014 case GL_AMBIENT:
6015 case GL_DIFFUSE:
6016 case GL_SPECULAR:
6017 case GL_AMBIENT_AND_DIFFUSE:
6018 args = 4;
6019 break;
6020 case GL_SHININESS:
6021 args = 1;
6022 break;
6023 case GL_COLOR_INDEXES:
6024 args = 3;
6025 break;
6026 default:
6027 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
6028 return;
6029 }
6030
6031 if (ctx->ExecuteFlag) {
6032 CALL_Materialfv(ctx->Exec, (face, pname, param));
6033 }
6034
6035 bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, NULL);
6036
6037 /* Try to eliminate redundant statechanges. Because it is legal to
6038 * call glMaterial even inside begin/end calls, don't need to worry
6039 * about ctx->Driver.CurrentSavePrimitive here.
6040 */
6041 for (i = 0; i < MAT_ATTRIB_MAX; i++) {
6042 if (bitmask & (1 << i)) {
6043 if (ctx->ListState.ActiveMaterialSize[i] == args &&
6044 compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
6045 /* no change in material value */
6046 bitmask &= ~(1 << i);
6047 }
6048 else {
6049 ctx->ListState.ActiveMaterialSize[i] = args;
6050 COPY_SZ_4V(ctx->ListState.CurrentMaterial[i], args, param);
6051 }
6052 }
6053 }
6054
6055 /* If this call has no effect, return early */
6056 if (bitmask == 0)
6057 return;
6058
6059 SAVE_FLUSH_VERTICES(ctx);
6060
6061 n = alloc_instruction(ctx, OPCODE_MATERIAL, 6);
6062 if (n) {
6063 n[1].e = face;
6064 n[2].e = pname;
6065 for (i = 0; i < args; i++)
6066 n[3 + i].f = param[i];
6067 }
6068 }
6069
6070 static void GLAPIENTRY
6071 save_Begin(GLenum mode)
6072 {
6073 GET_CURRENT_CONTEXT(ctx);
6074
6075 if (!_mesa_is_valid_prim_mode(ctx, mode)) {
6076 /* compile this error into the display list */
6077 _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
6078 }
6079 else if (_mesa_inside_dlist_begin_end(ctx)) {
6080 /* compile this error into the display list */
6081 _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
6082 }
6083 else {
6084 ctx->Driver.CurrentSavePrimitive = mode;
6085
6086 vbo_save_NotifyBegin(ctx, mode, false);
6087 }
6088 }
6089
6090 static void GLAPIENTRY
6091 save_End(void)
6092 {
6093 GET_CURRENT_CONTEXT(ctx);
6094 SAVE_FLUSH_VERTICES(ctx);
6095 (void) alloc_instruction(ctx, OPCODE_END, 0);
6096 ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
6097 if (ctx->ExecuteFlag) {
6098 CALL_End(ctx->Exec, ());
6099 }
6100 }
6101
6102 static void GLAPIENTRY
6103 save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
6104 {
6105 GET_CURRENT_CONTEXT(ctx);
6106 Node *n;
6107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6108 n = alloc_instruction(ctx, OPCODE_RECTF, 4);
6109 if (n) {
6110 n[1].f = a;
6111 n[2].f = b;
6112 n[3].f = c;
6113 n[4].f = d;
6114 }
6115 if (ctx->ExecuteFlag) {
6116 CALL_Rectf(ctx->Exec, (a, b, c, d));
6117 }
6118 }
6119
6120 static void GLAPIENTRY
6121 save_PrimitiveRestartNV(void)
6122 {
6123 /* Note: this is used when outside a glBegin/End pair in a display list */
6124 GET_CURRENT_CONTEXT(ctx);
6125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6126 (void) alloc_instruction(ctx, OPCODE_PRIMITIVE_RESTART_NV, 0);
6127 if (ctx->ExecuteFlag) {
6128 CALL_PrimitiveRestartNV(ctx->Exec, ());
6129 }
6130 }
6131
6132
6133 static void GLAPIENTRY
6134 save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
6135 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
6136 GLbitfield mask, GLenum filter)
6137 {
6138 GET_CURRENT_CONTEXT(ctx);
6139 Node *n;
6140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6141 n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10);
6142 if (n) {
6143 n[1].i = srcX0;
6144 n[2].i = srcY0;
6145 n[3].i = srcX1;
6146 n[4].i = srcY1;
6147 n[5].i = dstX0;
6148 n[6].i = dstY0;
6149 n[7].i = dstX1;
6150 n[8].i = dstY1;
6151 n[9].i = mask;
6152 n[10].e = filter;
6153 }
6154 if (ctx->ExecuteFlag) {
6155 CALL_BlitFramebuffer(ctx->Exec, (srcX0, srcY0, srcX1, srcY1,
6156 dstX0, dstY0, dstX1, dstY1,
6157 mask, filter));
6158 }
6159 }
6160
6161
6162 /** GL_EXT_provoking_vertex */
6163 static void GLAPIENTRY
6164 save_ProvokingVertexEXT(GLenum mode)
6165 {
6166 GET_CURRENT_CONTEXT(ctx);
6167 Node *n;
6168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6169 n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1);
6170 if (n) {
6171 n[1].e = mode;
6172 }
6173 if (ctx->ExecuteFlag) {
6174 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6175 _mesa_ProvokingVertex(mode);
6176 }
6177 }
6178
6179
6180 /** GL_EXT_transform_feedback */
6181 static void GLAPIENTRY
6182 save_BeginTransformFeedback(GLenum mode)
6183 {
6184 GET_CURRENT_CONTEXT(ctx);
6185 Node *n;
6186 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6187 n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
6188 if (n) {
6189 n[1].e = mode;
6190 }
6191 if (ctx->ExecuteFlag) {
6192 CALL_BeginTransformFeedback(ctx->Exec, (mode));
6193 }
6194 }
6195
6196
6197 /** GL_EXT_transform_feedback */
6198 static void GLAPIENTRY
6199 save_EndTransformFeedback(void)
6200 {
6201 GET_CURRENT_CONTEXT(ctx);
6202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6203 (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
6204 if (ctx->ExecuteFlag) {
6205 CALL_EndTransformFeedback(ctx->Exec, ());
6206 }
6207 }
6208
6209 static void GLAPIENTRY
6210 save_BindTransformFeedback(GLenum target, GLuint name)
6211 {
6212 GET_CURRENT_CONTEXT(ctx);
6213 Node *n;
6214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6215 n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
6216 if (n) {
6217 n[1].e = target;
6218 n[2].ui = name;
6219 }
6220 if (ctx->ExecuteFlag) {
6221 CALL_BindTransformFeedback(ctx->Exec, (target, name));
6222 }
6223 }
6224
6225 static void GLAPIENTRY
6226 save_PauseTransformFeedback(void)
6227 {
6228 GET_CURRENT_CONTEXT(ctx);
6229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6230 (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
6231 if (ctx->ExecuteFlag) {
6232 CALL_PauseTransformFeedback(ctx->Exec, ());
6233 }
6234 }
6235
6236 static void GLAPIENTRY
6237 save_ResumeTransformFeedback(void)
6238 {
6239 GET_CURRENT_CONTEXT(ctx);
6240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6241 (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
6242 if (ctx->ExecuteFlag) {
6243 CALL_ResumeTransformFeedback(ctx->Exec, ());
6244 }
6245 }
6246
6247 static void GLAPIENTRY
6248 save_DrawTransformFeedback(GLenum mode, GLuint name)
6249 {
6250 GET_CURRENT_CONTEXT(ctx);
6251 Node *n;
6252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6253 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
6254 if (n) {
6255 n[1].e = mode;
6256 n[2].ui = name;
6257 }
6258 if (ctx->ExecuteFlag) {
6259 CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
6260 }
6261 }
6262
6263 static void GLAPIENTRY
6264 save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
6265 {
6266 GET_CURRENT_CONTEXT(ctx);
6267 Node *n;
6268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6269 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM, 3);
6270 if (n) {
6271 n[1].e = mode;
6272 n[2].ui = name;
6273 n[3].ui = stream;
6274 }
6275 if (ctx->ExecuteFlag) {
6276 CALL_DrawTransformFeedbackStream(ctx->Exec, (mode, name, stream));
6277 }
6278 }
6279
6280 static void GLAPIENTRY
6281 save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
6282 GLsizei primcount)
6283 {
6284 GET_CURRENT_CONTEXT(ctx);
6285 Node *n;
6286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6287 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED, 3);
6288 if (n) {
6289 n[1].e = mode;
6290 n[2].ui = name;
6291 n[3].si = primcount;
6292 }
6293 if (ctx->ExecuteFlag) {
6294 CALL_DrawTransformFeedbackInstanced(ctx->Exec, (mode, name, primcount));
6295 }
6296 }
6297
6298 static void GLAPIENTRY
6299 save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
6300 GLuint stream, GLsizei primcount)
6301 {
6302 GET_CURRENT_CONTEXT(ctx);
6303 Node *n;
6304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6305 n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED, 4);
6306 if (n) {
6307 n[1].e = mode;
6308 n[2].ui = name;
6309 n[3].ui = stream;
6310 n[4].si = primcount;
6311 }
6312 if (ctx->ExecuteFlag) {
6313 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec, (mode, name, stream,
6314 primcount));
6315 }
6316 }
6317
6318 static void GLAPIENTRY
6319 save_DispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
6320 GLuint num_groups_z)
6321 {
6322 GET_CURRENT_CONTEXT(ctx);
6323 Node *n;
6324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6325 n = alloc_instruction(ctx, OPCODE_DISPATCH_COMPUTE, 3);
6326 if (n) {
6327 n[1].ui = num_groups_x;
6328 n[2].ui = num_groups_y;
6329 n[3].ui = num_groups_z;
6330 }
6331 if (ctx->ExecuteFlag) {
6332 CALL_DispatchCompute(ctx->Exec, (num_groups_x, num_groups_y,
6333 num_groups_z));
6334 }
6335 }
6336
6337 static void GLAPIENTRY
6338 save_DispatchComputeIndirect(GLintptr indirect)
6339 {
6340 GET_CURRENT_CONTEXT(ctx);
6341 _mesa_error(ctx, GL_INVALID_OPERATION,
6342 "glDispatchComputeIndirect() during display list compile");
6343 }
6344
6345 static void ALWAYS_INLINE
6346 save_Attr32bit(struct gl_context *ctx, unsigned attr, unsigned size,
6347 GLenum type, uint32_t x, uint32_t y, uint32_t z, uint32_t w)
6348 {
6349 Node *n;
6350 SAVE_FLUSH_VERTICES(ctx);
6351 unsigned base_op;
6352 unsigned index = attr;
6353
6354 /* We don't care about GL_INT vs GL_UNSIGNED_INT. The idea is to get W=1
6355 * right for 3 or lower number of components, so only distinguish between
6356 * FLOAT and INT.
6357 */
6358 if (type == GL_FLOAT) {
6359 if (attr >= VERT_ATTRIB_GENERIC0) {
6360 base_op = OPCODE_ATTR_1F_ARB;
6361 attr -= VERT_ATTRIB_GENERIC0;
6362 } else {
6363 base_op = OPCODE_ATTR_1F_NV;
6364 }
6365 } else {
6366 base_op = OPCODE_ATTR_1I;
6367 attr -= VERT_ATTRIB_GENERIC0;
6368 }
6369
6370 n = alloc_instruction(ctx, base_op + size - 1, 1 + size);
6371 if (n) {
6372 n[1].ui = attr;
6373 n[2].ui = x;
6374 if (size >= 2) n[3].ui = y;
6375 if (size >= 3) n[4].ui = z;
6376 if (size >= 4) n[5].ui = w;
6377 }
6378
6379 ctx->ListState.ActiveAttribSize[index] = size;
6380 ASSIGN_4V(ctx->ListState.CurrentAttrib[index], x, y, z, w);
6381
6382 if (ctx->ExecuteFlag) {
6383 if (type == GL_FLOAT) {
6384 if (base_op == OPCODE_ATTR_1F_NV) {
6385 if (size == 4)
6386 CALL_VertexAttrib4fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6387 else if (size == 3)
6388 CALL_VertexAttrib3fNV(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6389 else if (size == 2)
6390 CALL_VertexAttrib2fNV(ctx->Exec, (attr, uif(x), uif(y)));
6391 else
6392 CALL_VertexAttrib1fNV(ctx->Exec, (attr, uif(x)));
6393 } else {
6394 if (size == 4)
6395 CALL_VertexAttrib4fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z), uif(w)));
6396 else if (size == 3)
6397 CALL_VertexAttrib3fARB(ctx->Exec, (attr, uif(x), uif(y), uif(z)));
6398 else if (size == 2)
6399 CALL_VertexAttrib2fARB(ctx->Exec, (attr, uif(x), uif(y)));
6400 else
6401 CALL_VertexAttrib1fARB(ctx->Exec, (attr, uif(x)));
6402 }
6403 } else {
6404 if (size == 4)
6405 CALL_VertexAttribI4iEXT(ctx->Exec, (attr, x, y, z, w));
6406 else if (size == 3)
6407 CALL_VertexAttribI3iEXT(ctx->Exec, (attr, x, y, z));
6408 else if (size == 2)
6409 CALL_VertexAttribI2iEXT(ctx->Exec, (attr, x, y));
6410 else
6411 CALL_VertexAttribI1iEXT(ctx->Exec, (attr, x));
6412 }
6413 }
6414 }
6415
6416 static void ALWAYS_INLINE
6417 save_Attr64bit(struct gl_context *ctx, unsigned attr, unsigned size,
6418 GLenum type, uint64_t x, uint64_t y, uint64_t z, uint64_t w)
6419 {
6420 Node *n;
6421 SAVE_FLUSH_VERTICES(ctx);
6422 unsigned base_op;
6423 unsigned index = attr;
6424
6425 if (type == GL_DOUBLE) {
6426 base_op = OPCODE_ATTR_1D;
6427 } else {
6428 base_op = OPCODE_ATTR_1UI64;
6429 assert(size == 1);
6430 }
6431
6432 attr -= VERT_ATTRIB_GENERIC0;
6433 n = alloc_instruction(ctx, base_op + size - 1, 1 + size * 2);
6434 if (n) {
6435 n[1].ui = attr;
6436 ASSIGN_UINT64_TO_NODES(n, 2, x);
6437 if (size >= 2) ASSIGN_UINT64_TO_NODES(n, 4, y);
6438 if (size >= 3) ASSIGN_UINT64_TO_NODES(n, 6, z);
6439 if (size >= 4) ASSIGN_UINT64_TO_NODES(n, 8, w);
6440 }
6441
6442 ctx->ListState.ActiveAttribSize[index] = size;
6443 memcpy(ctx->ListState.CurrentAttrib[index], &n[2], size * sizeof(uint64_t));
6444
6445 if (ctx->ExecuteFlag) {
6446 uint64_t v[] = {x, y, z, w};
6447 if (type == GL_DOUBLE) {
6448 if (size == 4)
6449 CALL_VertexAttribL4dv(ctx->Exec, (attr, (GLdouble*)v));
6450 else if (size == 3)
6451 CALL_VertexAttribL3dv(ctx->Exec, (attr, (GLdouble*)v));
6452 else if (size == 2)
6453 CALL_VertexAttribL2dv(ctx->Exec, (attr, (GLdouble*)v));
6454 else
6455 CALL_VertexAttribL1d(ctx->Exec, (attr, UINT64_AS_DOUBLE(x)));
6456 } else {
6457 CALL_VertexAttribL1ui64ARB(ctx->Exec, (attr, x));
6458 }
6459 }
6460 }
6461
6462 /**
6463 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
6464 * It depends on a few things, including whether we're inside or outside
6465 * of glBegin/glEnd.
6466 */
6467 static inline bool
6468 is_vertex_position(const struct gl_context *ctx, GLuint index)
6469 {
6470 return (index == 0 &&
6471 _mesa_attr_zero_aliases_vertex(ctx) &&
6472 _mesa_inside_dlist_begin_end(ctx));
6473 }
6474
6475 /**
6476 * This macro is used to implement all the glVertex, glColor, glTexCoord,
6477 * glVertexAttrib, etc functions.
6478 * \param A VBO_ATTRIB_x attribute index
6479 * \param N attribute size (1..4)
6480 * \param T type (GL_FLOAT, GL_DOUBLE, GL_INT, GL_UNSIGNED_INT)
6481 * \param C cast type (uint32_t or uint64_t)
6482 * \param V0, V1, v2, V3 attribute value
6483 */
6484 #define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) \
6485 do { \
6486 if (sizeof(C) == 4) { \
6487 save_Attr32bit(ctx, A, N, T, V0, V1, V2, V3); \
6488 } else { \
6489 save_Attr64bit(ctx, A, N, T, V0, V1, V2, V3); \
6490 } \
6491 } while (0)
6492
6493 #undef ERROR
6494 #define ERROR(err) _mesa_error(ctx, err, __func__)
6495 #define TAG(x) save_##x
6496
6497 #define VBO_ATTRIB_POS VERT_ATTRIB_POS
6498 #define VBO_ATTRIB_NORMAL VERT_ATTRIB_NORMAL
6499 #define VBO_ATTRIB_COLOR0 VERT_ATTRIB_COLOR0
6500 #define VBO_ATTRIB_COLOR1 VERT_ATTRIB_COLOR1
6501 #define VBO_ATTRIB_FOG VERT_ATTRIB_FOG
6502 #define VBO_ATTRIB_COLOR_INDEX VERT_ATTRIB_COLOR_INDEX
6503 #define VBO_ATTRIB_EDGEFLAG VERT_ATTRIB_EDGEFLAG
6504 #define VBO_ATTRIB_TEX0 VERT_ATTRIB_TEX0
6505 #define VBO_ATTRIB_GENERIC0 VERT_ATTRIB_GENERIC0
6506 #define VBO_ATTRIB_MAX VERT_ATTRIB_MAX
6507
6508 #include "vbo/vbo_attrib_tmp.h"
6509
6510 static void GLAPIENTRY
6511 save_UseProgram(GLuint program)
6512 {
6513 GET_CURRENT_CONTEXT(ctx);
6514 Node *n;
6515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6516 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1);
6517 if (n) {
6518 n[1].ui = program;
6519 }
6520 if (ctx->ExecuteFlag) {
6521 CALL_UseProgram(ctx->Exec, (program));
6522 }
6523 }
6524
6525
6526 static void GLAPIENTRY
6527 save_Uniform1fARB(GLint location, GLfloat x)
6528 {
6529 GET_CURRENT_CONTEXT(ctx);
6530 Node *n;
6531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6532 n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2);
6533 if (n) {
6534 n[1].i = location;
6535 n[2].f = x;
6536 }
6537 if (ctx->ExecuteFlag) {
6538 CALL_Uniform1f(ctx->Exec, (location, x));
6539 }
6540 }
6541
6542
6543 static void GLAPIENTRY
6544 save_Uniform2fARB(GLint location, GLfloat x, GLfloat y)
6545 {
6546 GET_CURRENT_CONTEXT(ctx);
6547 Node *n;
6548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6549 n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3);
6550 if (n) {
6551 n[1].i = location;
6552 n[2].f = x;
6553 n[3].f = y;
6554 }
6555 if (ctx->ExecuteFlag) {
6556 CALL_Uniform2f(ctx->Exec, (location, x, y));
6557 }
6558 }
6559
6560
6561 static void GLAPIENTRY
6562 save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z)
6563 {
6564 GET_CURRENT_CONTEXT(ctx);
6565 Node *n;
6566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6567 n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4);
6568 if (n) {
6569 n[1].i = location;
6570 n[2].f = x;
6571 n[3].f = y;
6572 n[4].f = z;
6573 }
6574 if (ctx->ExecuteFlag) {
6575 CALL_Uniform3f(ctx->Exec, (location, x, y, z));
6576 }
6577 }
6578
6579
6580 static void GLAPIENTRY
6581 save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6582 {
6583 GET_CURRENT_CONTEXT(ctx);
6584 Node *n;
6585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6586 n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5);
6587 if (n) {
6588 n[1].i = location;
6589 n[2].f = x;
6590 n[3].f = y;
6591 n[4].f = z;
6592 n[5].f = w;
6593 }
6594 if (ctx->ExecuteFlag) {
6595 CALL_Uniform4f(ctx->Exec, (location, x, y, z, w));
6596 }
6597 }
6598
6599
6600 static void GLAPIENTRY
6601 save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
6602 {
6603 GET_CURRENT_CONTEXT(ctx);
6604 Node *n;
6605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6606 n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
6607 if (n) {
6608 n[1].i = location;
6609 n[2].i = count;
6610 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
6611 }
6612 if (ctx->ExecuteFlag) {
6613 CALL_Uniform1fv(ctx->Exec, (location, count, v));
6614 }
6615 }
6616
6617 static void GLAPIENTRY
6618 save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
6619 {
6620 GET_CURRENT_CONTEXT(ctx);
6621 Node *n;
6622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6623 n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
6624 if (n) {
6625 n[1].i = location;
6626 n[2].i = count;
6627 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
6628 }
6629 if (ctx->ExecuteFlag) {
6630 CALL_Uniform2fv(ctx->Exec, (location, count, v));
6631 }
6632 }
6633
6634 static void GLAPIENTRY
6635 save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
6636 {
6637 GET_CURRENT_CONTEXT(ctx);
6638 Node *n;
6639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6640 n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
6641 if (n) {
6642 n[1].i = location;
6643 n[2].i = count;
6644 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
6645 }
6646 if (ctx->ExecuteFlag) {
6647 CALL_Uniform3fv(ctx->Exec, (location, count, v));
6648 }
6649 }
6650
6651 static void GLAPIENTRY
6652 save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
6653 {
6654 GET_CURRENT_CONTEXT(ctx);
6655 Node *n;
6656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6657 n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
6658 if (n) {
6659 n[1].i = location;
6660 n[2].i = count;
6661 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6662 }
6663 if (ctx->ExecuteFlag) {
6664 CALL_Uniform4fv(ctx->Exec, (location, count, v));
6665 }
6666 }
6667
6668
6669 static void GLAPIENTRY
6670 save_Uniform1d(GLint location, GLdouble x)
6671 {
6672 GET_CURRENT_CONTEXT(ctx);
6673 Node *n;
6674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6675 n = alloc_instruction(ctx, OPCODE_UNIFORM_1D, 3);
6676 if (n) {
6677 n[1].i = location;
6678 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6679 }
6680 if (ctx->ExecuteFlag) {
6681 CALL_Uniform1d(ctx->Exec, (location, x));
6682 }
6683 }
6684
6685
6686 static void GLAPIENTRY
6687 save_Uniform2d(GLint location, GLdouble x, GLdouble y)
6688 {
6689 GET_CURRENT_CONTEXT(ctx);
6690 Node *n;
6691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6692 n = alloc_instruction(ctx, OPCODE_UNIFORM_2D, 5);
6693 if (n) {
6694 n[1].i = location;
6695 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6696 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6697 }
6698 if (ctx->ExecuteFlag) {
6699 CALL_Uniform2d(ctx->Exec, (location, x, y));
6700 }
6701 }
6702
6703
6704 static void GLAPIENTRY
6705 save_Uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
6706 {
6707 GET_CURRENT_CONTEXT(ctx);
6708 Node *n;
6709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6710 n = alloc_instruction(ctx, OPCODE_UNIFORM_3D, 7);
6711 if (n) {
6712 n[1].i = location;
6713 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6714 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6715 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6716 }
6717 if (ctx->ExecuteFlag) {
6718 CALL_Uniform3d(ctx->Exec, (location, x, y, z));
6719 }
6720 }
6721
6722
6723 static void GLAPIENTRY
6724 save_Uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
6725 {
6726 GET_CURRENT_CONTEXT(ctx);
6727 Node *n;
6728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6729 n = alloc_instruction(ctx, OPCODE_UNIFORM_4D, 9);
6730 if (n) {
6731 n[1].i = location;
6732 ASSIGN_DOUBLE_TO_NODES(n, 2, x);
6733 ASSIGN_DOUBLE_TO_NODES(n, 4, y);
6734 ASSIGN_DOUBLE_TO_NODES(n, 6, z);
6735 ASSIGN_DOUBLE_TO_NODES(n, 8, w);
6736 }
6737 if (ctx->ExecuteFlag) {
6738 CALL_Uniform4d(ctx->Exec, (location, x, y, z, w));
6739 }
6740 }
6741
6742
6743 static void GLAPIENTRY
6744 save_Uniform1dv(GLint location, GLsizei count, const GLdouble *v)
6745 {
6746 GET_CURRENT_CONTEXT(ctx);
6747 Node *n;
6748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6749 n = alloc_instruction(ctx, OPCODE_UNIFORM_1DV, 2 + POINTER_DWORDS);
6750 if (n) {
6751 n[1].i = location;
6752 n[2].i = count;
6753 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLdouble)));
6754 }
6755 if (ctx->ExecuteFlag) {
6756 CALL_Uniform1dv(ctx->Exec, (location, count, v));
6757 }
6758 }
6759
6760
6761 static void GLAPIENTRY
6762 save_Uniform2dv(GLint location, GLsizei count, const GLdouble *v)
6763 {
6764 GET_CURRENT_CONTEXT(ctx);
6765 Node *n;
6766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6767 n = alloc_instruction(ctx, OPCODE_UNIFORM_2DV, 2 + POINTER_DWORDS);
6768 if (n) {
6769 n[1].i = location;
6770 n[2].i = count;
6771 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLdouble)));
6772 }
6773 if (ctx->ExecuteFlag) {
6774 CALL_Uniform2dv(ctx->Exec, (location, count, v));
6775 }
6776 }
6777
6778
6779 static void GLAPIENTRY
6780 save_Uniform3dv(GLint location, GLsizei count, const GLdouble *v)
6781 {
6782 GET_CURRENT_CONTEXT(ctx);
6783 Node *n;
6784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6785 n = alloc_instruction(ctx, OPCODE_UNIFORM_3DV, 2 + POINTER_DWORDS);
6786 if (n) {
6787 n[1].i = location;
6788 n[2].i = count;
6789 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLdouble)));
6790 }
6791 if (ctx->ExecuteFlag) {
6792 CALL_Uniform3dv(ctx->Exec, (location, count, v));
6793 }
6794 }
6795
6796
6797 static void GLAPIENTRY
6798 save_Uniform4dv(GLint location, GLsizei count, const GLdouble *v)
6799 {
6800 GET_CURRENT_CONTEXT(ctx);
6801 Node *n;
6802 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6803 n = alloc_instruction(ctx, OPCODE_UNIFORM_4DV, 2 + POINTER_DWORDS);
6804 if (n) {
6805 n[1].i = location;
6806 n[2].i = count;
6807 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLdouble)));
6808 }
6809 if (ctx->ExecuteFlag) {
6810 CALL_Uniform4dv(ctx->Exec, (location, count, v));
6811 }
6812 }
6813
6814
6815 static void GLAPIENTRY
6816 save_Uniform1iARB(GLint location, GLint x)
6817 {
6818 GET_CURRENT_CONTEXT(ctx);
6819 Node *n;
6820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6821 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2);
6822 if (n) {
6823 n[1].i = location;
6824 n[2].i = x;
6825 }
6826 if (ctx->ExecuteFlag) {
6827 CALL_Uniform1i(ctx->Exec, (location, x));
6828 }
6829 }
6830
6831 static void GLAPIENTRY
6832 save_Uniform2iARB(GLint location, GLint x, GLint y)
6833 {
6834 GET_CURRENT_CONTEXT(ctx);
6835 Node *n;
6836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6837 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3);
6838 if (n) {
6839 n[1].i = location;
6840 n[2].i = x;
6841 n[3].i = y;
6842 }
6843 if (ctx->ExecuteFlag) {
6844 CALL_Uniform2i(ctx->Exec, (location, x, y));
6845 }
6846 }
6847
6848 static void GLAPIENTRY
6849 save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z)
6850 {
6851 GET_CURRENT_CONTEXT(ctx);
6852 Node *n;
6853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6854 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4);
6855 if (n) {
6856 n[1].i = location;
6857 n[2].i = x;
6858 n[3].i = y;
6859 n[4].i = z;
6860 }
6861 if (ctx->ExecuteFlag) {
6862 CALL_Uniform3i(ctx->Exec, (location, x, y, z));
6863 }
6864 }
6865
6866 static void GLAPIENTRY
6867 save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w)
6868 {
6869 GET_CURRENT_CONTEXT(ctx);
6870 Node *n;
6871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6872 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5);
6873 if (n) {
6874 n[1].i = location;
6875 n[2].i = x;
6876 n[3].i = y;
6877 n[4].i = z;
6878 n[5].i = w;
6879 }
6880 if (ctx->ExecuteFlag) {
6881 CALL_Uniform4i(ctx->Exec, (location, x, y, z, w));
6882 }
6883 }
6884
6885
6886
6887 static void GLAPIENTRY
6888 save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
6889 {
6890 GET_CURRENT_CONTEXT(ctx);
6891 Node *n;
6892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6893 n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
6894 if (n) {
6895 n[1].i = location;
6896 n[2].i = count;
6897 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
6898 }
6899 if (ctx->ExecuteFlag) {
6900 CALL_Uniform1iv(ctx->Exec, (location, count, v));
6901 }
6902 }
6903
6904 static void GLAPIENTRY
6905 save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
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_2IV, 2 + POINTER_DWORDS);
6911 if (n) {
6912 n[1].i = location;
6913 n[2].i = count;
6914 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
6915 }
6916 if (ctx->ExecuteFlag) {
6917 CALL_Uniform2iv(ctx->Exec, (location, count, v));
6918 }
6919 }
6920
6921 static void GLAPIENTRY
6922 save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
6923 {
6924 GET_CURRENT_CONTEXT(ctx);
6925 Node *n;
6926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6927 n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
6928 if (n) {
6929 n[1].i = location;
6930 n[2].i = count;
6931 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
6932 }
6933 if (ctx->ExecuteFlag) {
6934 CALL_Uniform3iv(ctx->Exec, (location, count, v));
6935 }
6936 }
6937
6938 static void GLAPIENTRY
6939 save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
6940 {
6941 GET_CURRENT_CONTEXT(ctx);
6942 Node *n;
6943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6944 n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
6945 if (n) {
6946 n[1].i = location;
6947 n[2].i = count;
6948 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
6949 }
6950 if (ctx->ExecuteFlag) {
6951 CALL_Uniform4iv(ctx->Exec, (location, count, v));
6952 }
6953 }
6954
6955
6956
6957 static void GLAPIENTRY
6958 save_Uniform1ui(GLint location, GLuint x)
6959 {
6960 GET_CURRENT_CONTEXT(ctx);
6961 Node *n;
6962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6963 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2);
6964 if (n) {
6965 n[1].i = location;
6966 n[2].i = x;
6967 }
6968 if (ctx->ExecuteFlag) {
6969 CALL_Uniform1ui(ctx->Exec, (location, x));
6970 }
6971 }
6972
6973 static void GLAPIENTRY
6974 save_Uniform2ui(GLint location, GLuint x, GLuint y)
6975 {
6976 GET_CURRENT_CONTEXT(ctx);
6977 Node *n;
6978 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6979 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3);
6980 if (n) {
6981 n[1].i = location;
6982 n[2].i = x;
6983 n[3].i = y;
6984 }
6985 if (ctx->ExecuteFlag) {
6986 CALL_Uniform2ui(ctx->Exec, (location, x, y));
6987 }
6988 }
6989
6990 static void GLAPIENTRY
6991 save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z)
6992 {
6993 GET_CURRENT_CONTEXT(ctx);
6994 Node *n;
6995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
6996 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4);
6997 if (n) {
6998 n[1].i = location;
6999 n[2].i = x;
7000 n[3].i = y;
7001 n[4].i = z;
7002 }
7003 if (ctx->ExecuteFlag) {
7004 CALL_Uniform3ui(ctx->Exec, (location, x, y, z));
7005 }
7006 }
7007
7008 static void GLAPIENTRY
7009 save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
7010 {
7011 GET_CURRENT_CONTEXT(ctx);
7012 Node *n;
7013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7014 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5);
7015 if (n) {
7016 n[1].i = location;
7017 n[2].i = x;
7018 n[3].i = y;
7019 n[4].i = z;
7020 n[5].i = w;
7021 }
7022 if (ctx->ExecuteFlag) {
7023 CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));
7024 }
7025 }
7026
7027
7028
7029 static void GLAPIENTRY
7030 save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
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_1UIV, 2 + POINTER_DWORDS);
7036 if (n) {
7037 n[1].i = location;
7038 n[2].i = count;
7039 save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
7040 }
7041 if (ctx->ExecuteFlag) {
7042 CALL_Uniform1uiv(ctx->Exec, (location, count, v));
7043 }
7044 }
7045
7046 static void GLAPIENTRY
7047 save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
7048 {
7049 GET_CURRENT_CONTEXT(ctx);
7050 Node *n;
7051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7052 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
7053 if (n) {
7054 n[1].i = location;
7055 n[2].i = count;
7056 save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
7057 }
7058 if (ctx->ExecuteFlag) {
7059 CALL_Uniform2uiv(ctx->Exec, (location, count, v));
7060 }
7061 }
7062
7063 static void GLAPIENTRY
7064 save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
7065 {
7066 GET_CURRENT_CONTEXT(ctx);
7067 Node *n;
7068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7069 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
7070 if (n) {
7071 n[1].i = location;
7072 n[2].i = count;
7073 save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
7074 }
7075 if (ctx->ExecuteFlag) {
7076 CALL_Uniform3uiv(ctx->Exec, (location, count, v));
7077 }
7078 }
7079
7080 static void GLAPIENTRY
7081 save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
7082 {
7083 GET_CURRENT_CONTEXT(ctx);
7084 Node *n;
7085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7086 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
7087 if (n) {
7088 n[1].i = location;
7089 n[2].i = count;
7090 save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
7091 }
7092 if (ctx->ExecuteFlag) {
7093 CALL_Uniform4uiv(ctx->Exec, (location, count, v));
7094 }
7095 }
7096
7097
7098
7099 static void GLAPIENTRY
7100 save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
7101 const GLfloat *m)
7102 {
7103 GET_CURRENT_CONTEXT(ctx);
7104 Node *n;
7105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7106 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
7107 if (n) {
7108 n[1].i = location;
7109 n[2].i = count;
7110 n[3].b = transpose;
7111 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
7112 }
7113 if (ctx->ExecuteFlag) {
7114 CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
7115 }
7116 }
7117
7118 static void GLAPIENTRY
7119 save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
7120 const GLfloat *m)
7121 {
7122 GET_CURRENT_CONTEXT(ctx);
7123 Node *n;
7124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7125 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
7126 if (n) {
7127 n[1].i = location;
7128 n[2].i = count;
7129 n[3].b = transpose;
7130 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
7131 }
7132 if (ctx->ExecuteFlag) {
7133 CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
7134 }
7135 }
7136
7137 static void GLAPIENTRY
7138 save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
7139 const GLfloat *m)
7140 {
7141 GET_CURRENT_CONTEXT(ctx);
7142 Node *n;
7143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7144 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
7145 if (n) {
7146 n[1].i = location;
7147 n[2].i = count;
7148 n[3].b = transpose;
7149 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
7150 }
7151 if (ctx->ExecuteFlag) {
7152 CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
7153 }
7154 }
7155
7156
7157 static void GLAPIENTRY
7158 save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7159 const GLfloat *m)
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_MATRIX23, 3 + POINTER_DWORDS);
7165 if (n) {
7166 n[1].i = location;
7167 n[2].i = count;
7168 n[3].b = transpose;
7169 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
7170 }
7171 if (ctx->ExecuteFlag) {
7172 CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
7173 }
7174 }
7175
7176 static void GLAPIENTRY
7177 save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7178 const GLfloat *m)
7179 {
7180 GET_CURRENT_CONTEXT(ctx);
7181 Node *n;
7182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7183 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
7184 if (n) {
7185 n[1].i = location;
7186 n[2].i = count;
7187 n[3].b = transpose;
7188 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
7189 }
7190 if (ctx->ExecuteFlag) {
7191 CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
7192 }
7193 }
7194
7195
7196 static void GLAPIENTRY
7197 save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
7198 const GLfloat *m)
7199 {
7200 GET_CURRENT_CONTEXT(ctx);
7201 Node *n;
7202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7203 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
7204 if (n) {
7205 n[1].i = location;
7206 n[2].i = count;
7207 n[3].b = transpose;
7208 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
7209 }
7210 if (ctx->ExecuteFlag) {
7211 CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
7212 }
7213 }
7214
7215 static void GLAPIENTRY
7216 save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
7217 const GLfloat *m)
7218 {
7219 GET_CURRENT_CONTEXT(ctx);
7220 Node *n;
7221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7222 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
7223 if (n) {
7224 n[1].i = location;
7225 n[2].i = count;
7226 n[3].b = transpose;
7227 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
7228 }
7229 if (ctx->ExecuteFlag) {
7230 CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
7231 }
7232 }
7233
7234
7235 static void GLAPIENTRY
7236 save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
7237 const GLfloat *m)
7238 {
7239 GET_CURRENT_CONTEXT(ctx);
7240 Node *n;
7241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7242 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
7243 if (n) {
7244 n[1].i = location;
7245 n[2].i = count;
7246 n[3].b = transpose;
7247 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
7248 }
7249 if (ctx->ExecuteFlag) {
7250 CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
7251 }
7252 }
7253
7254 static void GLAPIENTRY
7255 save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
7256 const GLfloat *m)
7257 {
7258 GET_CURRENT_CONTEXT(ctx);
7259 Node *n;
7260 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7261 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
7262 if (n) {
7263 n[1].i = location;
7264 n[2].i = count;
7265 n[3].b = transpose;
7266 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
7267 }
7268 if (ctx->ExecuteFlag) {
7269 CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
7270 }
7271 }
7272
7273
7274 static void GLAPIENTRY
7275 save_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
7276 const GLdouble *m)
7277 {
7278 GET_CURRENT_CONTEXT(ctx);
7279 Node *n;
7280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7281 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22D, 3 + POINTER_DWORDS);
7282 if (n) {
7283 n[1].i = location;
7284 n[2].i = count;
7285 n[3].b = transpose;
7286 save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLdouble)));
7287 }
7288 if (ctx->ExecuteFlag) {
7289 CALL_UniformMatrix2dv(ctx->Exec, (location, count, transpose, m));
7290 }
7291 }
7292
7293 static void GLAPIENTRY
7294 save_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
7295 const GLdouble *m)
7296 {
7297 GET_CURRENT_CONTEXT(ctx);
7298 Node *n;
7299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7300 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33D, 3 + POINTER_DWORDS);
7301 if (n) {
7302 n[1].i = location;
7303 n[2].i = count;
7304 n[3].b = transpose;
7305 save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLdouble)));
7306 }
7307 if (ctx->ExecuteFlag) {
7308 CALL_UniformMatrix3dv(ctx->Exec, (location, count, transpose, m));
7309 }
7310 }
7311
7312 static void GLAPIENTRY
7313 save_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
7314 const GLdouble *m)
7315 {
7316 GET_CURRENT_CONTEXT(ctx);
7317 Node *n;
7318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7319 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44D, 3 + POINTER_DWORDS);
7320 if (n) {
7321 n[1].i = location;
7322 n[2].i = count;
7323 n[3].b = transpose;
7324 save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLdouble)));
7325 }
7326 if (ctx->ExecuteFlag) {
7327 CALL_UniformMatrix4dv(ctx->Exec, (location, count, transpose, m));
7328 }
7329 }
7330
7331
7332 static void GLAPIENTRY
7333 save_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
7334 const GLdouble *m)
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_MATRIX23D, 3 + POINTER_DWORDS);
7340 if (n) {
7341 n[1].i = location;
7342 n[2].i = count;
7343 n[3].b = transpose;
7344 save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLdouble)));
7345 }
7346 if (ctx->ExecuteFlag) {
7347 CALL_UniformMatrix2x3dv(ctx->Exec, (location, count, transpose, m));
7348 }
7349 }
7350
7351
7352 static void GLAPIENTRY
7353 save_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
7354 const GLdouble *m)
7355 {
7356 GET_CURRENT_CONTEXT(ctx);
7357 Node *n;
7358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7359 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32D, 3 + POINTER_DWORDS);
7360 if (n) {
7361 n[1].i = location;
7362 n[2].i = count;
7363 n[3].b = transpose;
7364 save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLdouble)));
7365 }
7366 if (ctx->ExecuteFlag) {
7367 CALL_UniformMatrix3x2dv(ctx->Exec, (location, count, transpose, m));
7368 }
7369 }
7370
7371
7372 static void GLAPIENTRY
7373 save_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
7374 const GLdouble *m)
7375 {
7376 GET_CURRENT_CONTEXT(ctx);
7377 Node *n;
7378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7379 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24D, 3 + POINTER_DWORDS);
7380 if (n) {
7381 n[1].i = location;
7382 n[2].i = count;
7383 n[3].b = transpose;
7384 save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLdouble)));
7385 }
7386 if (ctx->ExecuteFlag) {
7387 CALL_UniformMatrix2x4dv(ctx->Exec, (location, count, transpose, m));
7388 }
7389 }
7390
7391 static void GLAPIENTRY
7392 save_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
7393 const GLdouble *m)
7394 {
7395 GET_CURRENT_CONTEXT(ctx);
7396 Node *n;
7397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7398 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42D, 3 + POINTER_DWORDS);
7399 if (n) {
7400 n[1].i = location;
7401 n[2].i = count;
7402 n[3].b = transpose;
7403 save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLdouble)));
7404 }
7405 if (ctx->ExecuteFlag) {
7406 CALL_UniformMatrix4x2dv(ctx->Exec, (location, count, transpose, m));
7407 }
7408 }
7409
7410
7411 static void GLAPIENTRY
7412 save_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
7413 const GLdouble *m)
7414 {
7415 GET_CURRENT_CONTEXT(ctx);
7416 Node *n;
7417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7418 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34D, 3 + POINTER_DWORDS);
7419 if (n) {
7420 n[1].i = location;
7421 n[2].i = count;
7422 n[3].b = transpose;
7423 save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLdouble)));
7424 }
7425 if (ctx->ExecuteFlag) {
7426 CALL_UniformMatrix3x4dv(ctx->Exec, (location, count, transpose, m));
7427 }
7428 }
7429
7430
7431 static void GLAPIENTRY
7432 save_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
7433 const GLdouble *m)
7434 {
7435 GET_CURRENT_CONTEXT(ctx);
7436 Node *n;
7437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7438 n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43D, 3 + POINTER_DWORDS);
7439 if (n) {
7440 n[1].i = location;
7441 n[2].i = count;
7442 n[3].b = transpose;
7443 save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLdouble)));
7444 }
7445 if (ctx->ExecuteFlag) {
7446 CALL_UniformMatrix4x3dv(ctx->Exec, (location, count, transpose, m));
7447 }
7448 }
7449
7450 static void GLAPIENTRY
7451 save_Uniform1i64ARB(GLint location, GLint64 x)
7452 {
7453 GET_CURRENT_CONTEXT(ctx);
7454 Node *n;
7455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7456 n = alloc_instruction(ctx, OPCODE_UNIFORM_1I64, 3);
7457 if (n) {
7458 n[1].i = location;
7459 ASSIGN_INT64_TO_NODES(n, 2, x);
7460 }
7461 if (ctx->ExecuteFlag) {
7462 CALL_Uniform1i64ARB(ctx->Exec, (location, x));
7463 }
7464 }
7465
7466 static void GLAPIENTRY
7467 save_Uniform2i64ARB(GLint location, GLint64 x, GLint64 y)
7468 {
7469 GET_CURRENT_CONTEXT(ctx);
7470 Node *n;
7471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7472 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64, 5);
7473 if (n) {
7474 n[1].i = location;
7475 ASSIGN_INT64_TO_NODES(n, 2, x);
7476 ASSIGN_INT64_TO_NODES(n, 4, y);
7477 }
7478 if (ctx->ExecuteFlag) {
7479 CALL_Uniform2i64ARB(ctx->Exec, (location, x, y));
7480 }
7481 }
7482
7483 static void GLAPIENTRY
7484 save_Uniform3i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z)
7485 {
7486 GET_CURRENT_CONTEXT(ctx);
7487 Node *n;
7488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7489 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64, 7);
7490 if (n) {
7491 n[1].i = location;
7492 ASSIGN_INT64_TO_NODES(n, 2, x);
7493 ASSIGN_INT64_TO_NODES(n, 4, y);
7494 ASSIGN_INT64_TO_NODES(n, 6, z);
7495 }
7496 if (ctx->ExecuteFlag) {
7497 CALL_Uniform3i64ARB(ctx->Exec, (location, x, y, z));
7498 }
7499 }
7500
7501 static void GLAPIENTRY
7502 save_Uniform4i64ARB(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w)
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_4I64, 9);
7508 if (n) {
7509 n[1].i = location;
7510 ASSIGN_INT64_TO_NODES(n, 2, x);
7511 ASSIGN_INT64_TO_NODES(n, 4, y);
7512 ASSIGN_INT64_TO_NODES(n, 6, z);
7513 ASSIGN_INT64_TO_NODES(n, 8, w);
7514 }
7515 if (ctx->ExecuteFlag) {
7516 CALL_Uniform4i64ARB(ctx->Exec, (location, x, y, z, w));
7517 }
7518 }
7519
7520 static void GLAPIENTRY
7521 save_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *v)
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_1I64V, 2 + POINTER_DWORDS);
7527 if (n) {
7528 n[1].i = location;
7529 n[2].i = count;
7530 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint64)));
7531 }
7532 if (ctx->ExecuteFlag) {
7533 CALL_Uniform1i64vARB(ctx->Exec, (location, count, v));
7534 }
7535 }
7536
7537 static void GLAPIENTRY
7538 save_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *v)
7539 {
7540 GET_CURRENT_CONTEXT(ctx);
7541 Node *n;
7542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7543 n = alloc_instruction(ctx, OPCODE_UNIFORM_2I64V, 2 + POINTER_DWORDS);
7544 if (n) {
7545 n[1].i = location;
7546 n[2].i = count;
7547 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint64)));
7548 }
7549 if (ctx->ExecuteFlag) {
7550 CALL_Uniform2i64vARB(ctx->Exec, (location, count, v));
7551 }
7552 }
7553
7554 static void GLAPIENTRY
7555 save_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *v)
7556 {
7557 GET_CURRENT_CONTEXT(ctx);
7558 Node *n;
7559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7560 n = alloc_instruction(ctx, OPCODE_UNIFORM_3I64V, 2 + POINTER_DWORDS);
7561 if (n) {
7562 n[1].i = location;
7563 n[2].i = count;
7564 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint64)));
7565 }
7566 if (ctx->ExecuteFlag) {
7567 CALL_Uniform3i64vARB(ctx->Exec, (location, count, v));
7568 }
7569 }
7570
7571 static void GLAPIENTRY
7572 save_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *v)
7573 {
7574 GET_CURRENT_CONTEXT(ctx);
7575 Node *n;
7576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7577 n = alloc_instruction(ctx, OPCODE_UNIFORM_4I64V, 2 + POINTER_DWORDS);
7578 if (n) {
7579 n[1].i = location;
7580 n[2].i = count;
7581 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLint64)));
7582 }
7583 if (ctx->ExecuteFlag) {
7584 CALL_Uniform4i64vARB(ctx->Exec, (location, count, v));
7585 }
7586 }
7587
7588 static void GLAPIENTRY
7589 save_Uniform1ui64ARB(GLint location, GLuint64 x)
7590 {
7591 GET_CURRENT_CONTEXT(ctx);
7592 Node *n;
7593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7594 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64, 3);
7595 if (n) {
7596 n[1].i = location;
7597 ASSIGN_UINT64_TO_NODES(n, 2, x);
7598 }
7599 if (ctx->ExecuteFlag) {
7600 CALL_Uniform1ui64ARB(ctx->Exec, (location, x));
7601 }
7602 }
7603
7604 static void GLAPIENTRY
7605 save_Uniform2ui64ARB(GLint location, GLuint64 x, GLuint64 y)
7606 {
7607 GET_CURRENT_CONTEXT(ctx);
7608 Node *n;
7609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7610 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64, 5);
7611 if (n) {
7612 n[1].i = location;
7613 ASSIGN_UINT64_TO_NODES(n, 2, x);
7614 ASSIGN_UINT64_TO_NODES(n, 4, y);
7615 }
7616 if (ctx->ExecuteFlag) {
7617 CALL_Uniform2ui64ARB(ctx->Exec, (location, x, y));
7618 }
7619 }
7620
7621 static void GLAPIENTRY
7622 save_Uniform3ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z)
7623 {
7624 GET_CURRENT_CONTEXT(ctx);
7625 Node *n;
7626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7627 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64, 7);
7628 if (n) {
7629 n[1].i = location;
7630 ASSIGN_UINT64_TO_NODES(n, 2, x);
7631 ASSIGN_UINT64_TO_NODES(n, 4, y);
7632 ASSIGN_UINT64_TO_NODES(n, 6, z);
7633 }
7634 if (ctx->ExecuteFlag) {
7635 CALL_Uniform3ui64ARB(ctx->Exec, (location, x, y, z));
7636 }
7637 }
7638
7639 static void GLAPIENTRY
7640 save_Uniform4ui64ARB(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w)
7641 {
7642 GET_CURRENT_CONTEXT(ctx);
7643 Node *n;
7644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7645 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64, 9);
7646 if (n) {
7647 n[1].i = location;
7648 ASSIGN_UINT64_TO_NODES(n, 2, x);
7649 ASSIGN_UINT64_TO_NODES(n, 4, y);
7650 ASSIGN_UINT64_TO_NODES(n, 6, z);
7651 ASSIGN_UINT64_TO_NODES(n, 8, w);
7652 }
7653 if (ctx->ExecuteFlag) {
7654 CALL_Uniform4ui64ARB(ctx->Exec, (location, x, y, z, w));
7655 }
7656 }
7657
7658 static void GLAPIENTRY
7659 save_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7660 {
7661 GET_CURRENT_CONTEXT(ctx);
7662 Node *n;
7663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7664 n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI64V, 2 + POINTER_DWORDS);
7665 if (n) {
7666 n[1].i = location;
7667 n[2].i = count;
7668 save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLuint64)));
7669 }
7670 if (ctx->ExecuteFlag) {
7671 CALL_Uniform1ui64vARB(ctx->Exec, (location, count, v));
7672 }
7673 }
7674
7675 static void GLAPIENTRY
7676 save_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7677 {
7678 GET_CURRENT_CONTEXT(ctx);
7679 Node *n;
7680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7681 n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI64V, 2 + POINTER_DWORDS);
7682 if (n) {
7683 n[1].i = location;
7684 n[2].i = count;
7685 save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLuint64)));
7686 }
7687 if (ctx->ExecuteFlag) {
7688 CALL_Uniform2ui64vARB(ctx->Exec, (location, count, v));
7689 }
7690 }
7691
7692 static void GLAPIENTRY
7693 save_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7694 {
7695 GET_CURRENT_CONTEXT(ctx);
7696 Node *n;
7697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7698 n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI64V, 2 + POINTER_DWORDS);
7699 if (n) {
7700 n[1].i = location;
7701 n[2].i = count;
7702 save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLuint64)));
7703 }
7704 if (ctx->ExecuteFlag) {
7705 CALL_Uniform3ui64vARB(ctx->Exec, (location, count, v));
7706 }
7707 }
7708
7709 static void GLAPIENTRY
7710 save_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *v)
7711 {
7712 GET_CURRENT_CONTEXT(ctx);
7713 Node *n;
7714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7715 n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI64V, 2 + POINTER_DWORDS);
7716 if (n) {
7717 n[1].i = location;
7718 n[2].i = count;
7719 save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLuint64)));
7720 }
7721 if (ctx->ExecuteFlag) {
7722 CALL_Uniform4ui64vARB(ctx->Exec, (location, count, v));
7723 }
7724 }
7725
7726 static void GLAPIENTRY
7727 save_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 x)
7728 {
7729 GET_CURRENT_CONTEXT(ctx);
7730 Node *n;
7731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7732 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64, 4);
7733 if (n) {
7734 n[1].ui = program;
7735 n[2].i = location;
7736 ASSIGN_INT64_TO_NODES(n, 3, x);
7737 }
7738 if (ctx->ExecuteFlag) {
7739 CALL_ProgramUniform1i64ARB(ctx->Exec, (program, location, x));
7740 }
7741 }
7742
7743 static void GLAPIENTRY
7744 save_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 x,
7745 GLint64 y)
7746 {
7747 GET_CURRENT_CONTEXT(ctx);
7748 Node *n;
7749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7750 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64, 6);
7751 if (n) {
7752 n[1].ui = program;
7753 n[2].i = location;
7754 ASSIGN_INT64_TO_NODES(n, 3, x);
7755 ASSIGN_INT64_TO_NODES(n, 5, y);
7756 }
7757 if (ctx->ExecuteFlag) {
7758 CALL_ProgramUniform2i64ARB(ctx->Exec, (program, location, x, y));
7759 }
7760 }
7761
7762 static void GLAPIENTRY
7763 save_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 x,
7764 GLint64 y, GLint64 z)
7765 {
7766 GET_CURRENT_CONTEXT(ctx);
7767 Node *n;
7768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7769 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64, 8);
7770 if (n) {
7771 n[1].ui = program;
7772 n[2].i = location;
7773 ASSIGN_INT64_TO_NODES(n, 3, x);
7774 ASSIGN_INT64_TO_NODES(n, 5, y);
7775 ASSIGN_INT64_TO_NODES(n, 7, z);
7776 }
7777 if (ctx->ExecuteFlag) {
7778 CALL_ProgramUniform3i64ARB(ctx->Exec, (program, location, x, y, z));
7779 }
7780 }
7781
7782 static void GLAPIENTRY
7783 save_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 x,
7784 GLint64 y, GLint64 z, GLint64 w)
7785 {
7786 GET_CURRENT_CONTEXT(ctx);
7787 Node *n;
7788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7789 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64, 10);
7790 if (n) {
7791 n[1].ui = program;
7792 n[2].i = location;
7793 ASSIGN_INT64_TO_NODES(n, 3, x);
7794 ASSIGN_INT64_TO_NODES(n, 5, y);
7795 ASSIGN_INT64_TO_NODES(n, 7, z);
7796 ASSIGN_INT64_TO_NODES(n, 9, w);
7797 }
7798 if (ctx->ExecuteFlag) {
7799 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7800 }
7801 }
7802
7803 static void GLAPIENTRY
7804 save_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count,
7805 const GLint64 *v)
7806 {
7807 GET_CURRENT_CONTEXT(ctx);
7808 Node *n;
7809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7810 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I64V, 3 + POINTER_DWORDS);
7811 if (n) {
7812 n[1].ui = program;
7813 n[2].i = location;
7814 n[3].i = count;
7815 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7816 }
7817 if (ctx->ExecuteFlag) {
7818 CALL_ProgramUniform1i64vARB(ctx->Exec, (program, location, count, v));
7819 }
7820 }
7821
7822 static void GLAPIENTRY
7823 save_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count,
7824 const GLint64 *v)
7825 {
7826 GET_CURRENT_CONTEXT(ctx);
7827 Node *n;
7828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7829 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I64V, 3 + POINTER_DWORDS);
7830 if (n) {
7831 n[1].ui = program;
7832 n[2].i = location;
7833 n[3].i = count;
7834 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7835 }
7836 if (ctx->ExecuteFlag) {
7837 CALL_ProgramUniform2i64vARB(ctx->Exec, (program, location, count, v));
7838 }
7839 }
7840
7841 static void GLAPIENTRY
7842 save_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count,
7843 const GLint64 *v)
7844 {
7845 GET_CURRENT_CONTEXT(ctx);
7846 Node *n;
7847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7848 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I64V, 3 + POINTER_DWORDS);
7849 if (n) {
7850 n[1].ui = program;
7851 n[2].i = location;
7852 n[3].i = count;
7853 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7854 }
7855 if (ctx->ExecuteFlag) {
7856 CALL_ProgramUniform3i64vARB(ctx->Exec, (program, location, count, v));
7857 }
7858 }
7859
7860 static void GLAPIENTRY
7861 save_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count,
7862 const GLint64 *v)
7863 {
7864 GET_CURRENT_CONTEXT(ctx);
7865 Node *n;
7866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7867 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I64V, 3 + POINTER_DWORDS);
7868 if (n) {
7869 n[1].ui = program;
7870 n[2].i = location;
7871 n[3].i = count;
7872 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint64)));
7873 }
7874 if (ctx->ExecuteFlag) {
7875 CALL_ProgramUniform4i64vARB(ctx->Exec, (program, location, count, v));
7876 }
7877 }
7878
7879 static void GLAPIENTRY
7880 save_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 x)
7881 {
7882 GET_CURRENT_CONTEXT(ctx);
7883 Node *n;
7884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7885 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64, 4);
7886 if (n) {
7887 n[1].ui = program;
7888 n[2].i = location;
7889 ASSIGN_UINT64_TO_NODES(n, 3, x);
7890 }
7891 if (ctx->ExecuteFlag) {
7892 CALL_ProgramUniform1ui64ARB(ctx->Exec, (program, location, x));
7893 }
7894 }
7895
7896 static void GLAPIENTRY
7897 save_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 x,
7898 GLuint64 y)
7899 {
7900 GET_CURRENT_CONTEXT(ctx);
7901 Node *n;
7902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7903 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64, 6);
7904 if (n) {
7905 n[1].ui = program;
7906 n[2].i = location;
7907 ASSIGN_UINT64_TO_NODES(n, 3, x);
7908 ASSIGN_UINT64_TO_NODES(n, 5, y);
7909 }
7910 if (ctx->ExecuteFlag) {
7911 CALL_ProgramUniform2ui64ARB(ctx->Exec, (program, location, x, y));
7912 }
7913 }
7914
7915 static void GLAPIENTRY
7916 save_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 x,
7917 GLuint64 y, GLuint64 z)
7918 {
7919 GET_CURRENT_CONTEXT(ctx);
7920 Node *n;
7921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7922 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64, 8);
7923 if (n) {
7924 n[1].ui = program;
7925 n[2].i = location;
7926 ASSIGN_UINT64_TO_NODES(n, 3, x);
7927 ASSIGN_UINT64_TO_NODES(n, 5, y);
7928 ASSIGN_UINT64_TO_NODES(n, 7, z);
7929 }
7930 if (ctx->ExecuteFlag) {
7931 CALL_ProgramUniform3ui64ARB(ctx->Exec, (program, location, x, y, z));
7932 }
7933 }
7934
7935 static void GLAPIENTRY
7936 save_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 x,
7937 GLuint64 y, GLuint64 z, GLuint64 w)
7938 {
7939 GET_CURRENT_CONTEXT(ctx);
7940 Node *n;
7941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7942 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64, 10);
7943 if (n) {
7944 n[1].ui = program;
7945 n[2].i = location;
7946 ASSIGN_UINT64_TO_NODES(n, 3, x);
7947 ASSIGN_UINT64_TO_NODES(n, 5, y);
7948 ASSIGN_UINT64_TO_NODES(n, 7, z);
7949 ASSIGN_UINT64_TO_NODES(n, 9, w);
7950 }
7951 if (ctx->ExecuteFlag) {
7952 CALL_ProgramUniform4i64ARB(ctx->Exec, (program, location, x, y, z, w));
7953 }
7954 }
7955
7956 static void GLAPIENTRY
7957 save_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count,
7958 const GLuint64 *v)
7959 {
7960 GET_CURRENT_CONTEXT(ctx);
7961 Node *n;
7962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7963 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI64V,
7964 3 + POINTER_DWORDS);
7965 if (n) {
7966 n[1].ui = program;
7967 n[2].i = location;
7968 n[3].i = count;
7969 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7970 }
7971 if (ctx->ExecuteFlag) {
7972 CALL_ProgramUniform1ui64vARB(ctx->Exec, (program, location, count, v));
7973 }
7974 }
7975
7976 static void GLAPIENTRY
7977 save_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count,
7978 const GLuint64 *v)
7979 {
7980 GET_CURRENT_CONTEXT(ctx);
7981 Node *n;
7982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
7983 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI64V,
7984 3 + POINTER_DWORDS);
7985 if (n) {
7986 n[1].ui = program;
7987 n[2].i = location;
7988 n[3].i = count;
7989 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
7990 }
7991 if (ctx->ExecuteFlag) {
7992 CALL_ProgramUniform2ui64vARB(ctx->Exec, (program, location, count, v));
7993 }
7994 }
7995
7996 static void GLAPIENTRY
7997 save_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count,
7998 const GLuint64 *v)
7999 {
8000 GET_CURRENT_CONTEXT(ctx);
8001 Node *n;
8002 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8003 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI64V,
8004 3 + POINTER_DWORDS);
8005 if (n) {
8006 n[1].ui = program;
8007 n[2].i = location;
8008 n[3].i = count;
8009 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8010 }
8011 if (ctx->ExecuteFlag) {
8012 CALL_ProgramUniform3ui64vARB(ctx->Exec, (program, location, count, v));
8013 }
8014 }
8015
8016 static void GLAPIENTRY
8017 save_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count,
8018 const GLuint64 *v)
8019 {
8020 GET_CURRENT_CONTEXT(ctx);
8021 Node *n;
8022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8023 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI64V,
8024 3 + POINTER_DWORDS);
8025 if (n) {
8026 n[1].ui = program;
8027 n[2].i = location;
8028 n[3].i = count;
8029 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint64)));
8030 }
8031 if (ctx->ExecuteFlag) {
8032 CALL_ProgramUniform4ui64vARB(ctx->Exec, (program, location, count, v));
8033 }
8034 }
8035
8036
8037 static void GLAPIENTRY
8038 save_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
8039 {
8040 GET_CURRENT_CONTEXT(ctx);
8041 Node *n;
8042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8043 n = alloc_instruction(ctx, OPCODE_USE_PROGRAM_STAGES, 3);
8044 if (n) {
8045 n[1].ui = pipeline;
8046 n[2].ui = stages;
8047 n[3].ui = program;
8048 }
8049 if (ctx->ExecuteFlag) {
8050 CALL_UseProgramStages(ctx->Exec, (pipeline, stages, program));
8051 }
8052 }
8053
8054 static void GLAPIENTRY
8055 save_ProgramUniform1f(GLuint program, GLint location, GLfloat x)
8056 {
8057 GET_CURRENT_CONTEXT(ctx);
8058 Node *n;
8059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8060 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1F, 3);
8061 if (n) {
8062 n[1].ui = program;
8063 n[2].i = location;
8064 n[3].f = x;
8065 }
8066 if (ctx->ExecuteFlag) {
8067 CALL_ProgramUniform1f(ctx->Exec, (program, location, x));
8068 }
8069 }
8070
8071 static void GLAPIENTRY
8072 save_ProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
8073 {
8074 GET_CURRENT_CONTEXT(ctx);
8075 Node *n;
8076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8077 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2F, 4);
8078 if (n) {
8079 n[1].ui = program;
8080 n[2].i = location;
8081 n[3].f = x;
8082 n[4].f = y;
8083 }
8084 if (ctx->ExecuteFlag) {
8085 CALL_ProgramUniform2f(ctx->Exec, (program, location, x, y));
8086 }
8087 }
8088
8089 static void GLAPIENTRY
8090 save_ProgramUniform3f(GLuint program, GLint location,
8091 GLfloat x, GLfloat y, GLfloat z)
8092 {
8093 GET_CURRENT_CONTEXT(ctx);
8094 Node *n;
8095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8096 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3F, 5);
8097 if (n) {
8098 n[1].ui = program;
8099 n[2].i = location;
8100 n[3].f = x;
8101 n[4].f = y;
8102 n[5].f = z;
8103 }
8104 if (ctx->ExecuteFlag) {
8105 CALL_ProgramUniform3f(ctx->Exec, (program, location, x, y, z));
8106 }
8107 }
8108
8109 static void GLAPIENTRY
8110 save_ProgramUniform4f(GLuint program, GLint location,
8111 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
8112 {
8113 GET_CURRENT_CONTEXT(ctx);
8114 Node *n;
8115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8116 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4F, 6);
8117 if (n) {
8118 n[1].ui = program;
8119 n[2].i = location;
8120 n[3].f = x;
8121 n[4].f = y;
8122 n[5].f = z;
8123 n[6].f = w;
8124 }
8125 if (ctx->ExecuteFlag) {
8126 CALL_ProgramUniform4f(ctx->Exec, (program, location, x, y, z, w));
8127 }
8128 }
8129
8130 static void GLAPIENTRY
8131 save_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
8132 const GLfloat *v)
8133 {
8134 GET_CURRENT_CONTEXT(ctx);
8135 Node *n;
8136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8137 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1FV, 3 + POINTER_DWORDS);
8138 if (n) {
8139 n[1].ui = program;
8140 n[2].i = location;
8141 n[3].i = count;
8142 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLfloat)));
8143 }
8144 if (ctx->ExecuteFlag) {
8145 CALL_ProgramUniform1fv(ctx->Exec, (program, location, count, v));
8146 }
8147 }
8148
8149 static void GLAPIENTRY
8150 save_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
8151 const GLfloat *v)
8152 {
8153 GET_CURRENT_CONTEXT(ctx);
8154 Node *n;
8155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8156 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2FV, 3 + POINTER_DWORDS);
8157 if (n) {
8158 n[1].ui = program;
8159 n[2].i = location;
8160 n[3].i = count;
8161 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLfloat)));
8162 }
8163 if (ctx->ExecuteFlag) {
8164 CALL_ProgramUniform2fv(ctx->Exec, (program, location, count, v));
8165 }
8166 }
8167
8168 static void GLAPIENTRY
8169 save_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
8170 const GLfloat *v)
8171 {
8172 GET_CURRENT_CONTEXT(ctx);
8173 Node *n;
8174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8175 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3FV, 3 + POINTER_DWORDS);
8176 if (n) {
8177 n[1].ui = program;
8178 n[2].i = location;
8179 n[3].i = count;
8180 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLfloat)));
8181 }
8182 if (ctx->ExecuteFlag) {
8183 CALL_ProgramUniform3fv(ctx->Exec, (program, location, count, v));
8184 }
8185 }
8186
8187 static void GLAPIENTRY
8188 save_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
8189 const GLfloat *v)
8190 {
8191 GET_CURRENT_CONTEXT(ctx);
8192 Node *n;
8193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8194 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4FV, 3 + POINTER_DWORDS);
8195 if (n) {
8196 n[1].ui = program;
8197 n[2].i = location;
8198 n[3].i = count;
8199 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLfloat)));
8200 }
8201 if (ctx->ExecuteFlag) {
8202 CALL_ProgramUniform4fv(ctx->Exec, (program, location, count, v));
8203 }
8204 }
8205
8206 static void GLAPIENTRY
8207 save_ProgramUniform1d(GLuint program, GLint location, GLdouble x)
8208 {
8209 GET_CURRENT_CONTEXT(ctx);
8210 Node *n;
8211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8212 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1D, 4);
8213 if (n) {
8214 n[1].ui = program;
8215 n[2].i = location;
8216 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8217 }
8218 if (ctx->ExecuteFlag) {
8219 CALL_ProgramUniform1d(ctx->Exec, (program, location, x));
8220 }
8221 }
8222
8223 static void GLAPIENTRY
8224 save_ProgramUniform2d(GLuint program, GLint location, GLdouble x, GLdouble y)
8225 {
8226 GET_CURRENT_CONTEXT(ctx);
8227 Node *n;
8228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8229 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2D, 6);
8230 if (n) {
8231 n[1].ui = program;
8232 n[2].i = location;
8233 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8234 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8235 }
8236 if (ctx->ExecuteFlag) {
8237 CALL_ProgramUniform2d(ctx->Exec, (program, location, x, y));
8238 }
8239 }
8240
8241 static void GLAPIENTRY
8242 save_ProgramUniform3d(GLuint program, GLint location,
8243 GLdouble x, GLdouble y, GLdouble z)
8244 {
8245 GET_CURRENT_CONTEXT(ctx);
8246 Node *n;
8247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8248 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3D, 8);
8249 if (n) {
8250 n[1].ui = program;
8251 n[2].i = location;
8252 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8253 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8254 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8255 }
8256 if (ctx->ExecuteFlag) {
8257 CALL_ProgramUniform3d(ctx->Exec, (program, location, x, y, z));
8258 }
8259 }
8260
8261 static void GLAPIENTRY
8262 save_ProgramUniform4d(GLuint program, GLint location,
8263 GLdouble x, GLdouble y, GLdouble z, GLdouble w)
8264 {
8265 GET_CURRENT_CONTEXT(ctx);
8266 Node *n;
8267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8268 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4D, 10);
8269 if (n) {
8270 n[1].ui = program;
8271 n[2].i = location;
8272 ASSIGN_DOUBLE_TO_NODES(n, 3, x);
8273 ASSIGN_DOUBLE_TO_NODES(n, 5, y);
8274 ASSIGN_DOUBLE_TO_NODES(n, 7, z);
8275 ASSIGN_DOUBLE_TO_NODES(n, 9, w);
8276 }
8277 if (ctx->ExecuteFlag) {
8278 CALL_ProgramUniform4d(ctx->Exec, (program, location, x, y, z, w));
8279 }
8280 }
8281
8282 static void GLAPIENTRY
8283 save_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
8284 const GLdouble *v)
8285 {
8286 GET_CURRENT_CONTEXT(ctx);
8287 Node *n;
8288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8289 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1DV, 3 + POINTER_DWORDS);
8290 if (n) {
8291 n[1].ui = program;
8292 n[2].i = location;
8293 n[3].i = count;
8294 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLdouble)));
8295 }
8296 if (ctx->ExecuteFlag) {
8297 CALL_ProgramUniform1dv(ctx->Exec, (program, location, count, v));
8298 }
8299 }
8300
8301 static void GLAPIENTRY
8302 save_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
8303 const GLdouble *v)
8304 {
8305 GET_CURRENT_CONTEXT(ctx);
8306 Node *n;
8307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8308 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2DV, 3 + POINTER_DWORDS);
8309 if (n) {
8310 n[1].ui = program;
8311 n[2].i = location;
8312 n[3].i = count;
8313 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLdouble)));
8314 }
8315 if (ctx->ExecuteFlag) {
8316 CALL_ProgramUniform2dv(ctx->Exec, (program, location, count, v));
8317 }
8318 }
8319
8320 static void GLAPIENTRY
8321 save_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
8322 const GLdouble *v)
8323 {
8324 GET_CURRENT_CONTEXT(ctx);
8325 Node *n;
8326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8327 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3DV, 3 + POINTER_DWORDS);
8328 if (n) {
8329 n[1].ui = program;
8330 n[2].i = location;
8331 n[3].i = count;
8332 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLdouble)));
8333 }
8334 if (ctx->ExecuteFlag) {
8335 CALL_ProgramUniform3dv(ctx->Exec, (program, location, count, v));
8336 }
8337 }
8338
8339 static void GLAPIENTRY
8340 save_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
8341 const GLdouble *v)
8342 {
8343 GET_CURRENT_CONTEXT(ctx);
8344 Node *n;
8345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8346 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4DV, 3 + POINTER_DWORDS);
8347 if (n) {
8348 n[1].ui = program;
8349 n[2].i = location;
8350 n[3].i = count;
8351 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLdouble)));
8352 }
8353 if (ctx->ExecuteFlag) {
8354 CALL_ProgramUniform4dv(ctx->Exec, (program, location, count, v));
8355 }
8356 }
8357
8358 static void GLAPIENTRY
8359 save_ProgramUniform1i(GLuint program, GLint location, GLint x)
8360 {
8361 GET_CURRENT_CONTEXT(ctx);
8362 Node *n;
8363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8364 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1I, 3);
8365 if (n) {
8366 n[1].ui = program;
8367 n[2].i = location;
8368 n[3].i = x;
8369 }
8370 if (ctx->ExecuteFlag) {
8371 CALL_ProgramUniform1i(ctx->Exec, (program, location, x));
8372 }
8373 }
8374
8375 static void GLAPIENTRY
8376 save_ProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
8377 {
8378 GET_CURRENT_CONTEXT(ctx);
8379 Node *n;
8380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8381 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2I, 4);
8382 if (n) {
8383 n[1].ui = program;
8384 n[2].i = location;
8385 n[3].i = x;
8386 n[4].i = y;
8387 }
8388 if (ctx->ExecuteFlag) {
8389 CALL_ProgramUniform2i(ctx->Exec, (program, location, x, y));
8390 }
8391 }
8392
8393 static void GLAPIENTRY
8394 save_ProgramUniform3i(GLuint program, GLint location,
8395 GLint x, GLint y, GLint z)
8396 {
8397 GET_CURRENT_CONTEXT(ctx);
8398 Node *n;
8399 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8400 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3I, 5);
8401 if (n) {
8402 n[1].ui = program;
8403 n[2].i = location;
8404 n[3].i = x;
8405 n[4].i = y;
8406 n[5].i = z;
8407 }
8408 if (ctx->ExecuteFlag) {
8409 CALL_ProgramUniform3i(ctx->Exec, (program, location, x, y, z));
8410 }
8411 }
8412
8413 static void GLAPIENTRY
8414 save_ProgramUniform4i(GLuint program, GLint location,
8415 GLint x, GLint y, GLint z, GLint w)
8416 {
8417 GET_CURRENT_CONTEXT(ctx);
8418 Node *n;
8419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8420 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4I, 6);
8421 if (n) {
8422 n[1].ui = program;
8423 n[2].i = location;
8424 n[3].i = x;
8425 n[4].i = y;
8426 n[5].i = z;
8427 n[6].i = w;
8428 }
8429 if (ctx->ExecuteFlag) {
8430 CALL_ProgramUniform4i(ctx->Exec, (program, location, x, y, z, w));
8431 }
8432 }
8433
8434 static void GLAPIENTRY
8435 save_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
8436 const GLint *v)
8437 {
8438 GET_CURRENT_CONTEXT(ctx);
8439 Node *n;
8440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8441 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1IV, 3 + POINTER_DWORDS);
8442 if (n) {
8443 n[1].ui = program;
8444 n[2].i = location;
8445 n[3].i = count;
8446 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLint)));
8447 }
8448 if (ctx->ExecuteFlag) {
8449 CALL_ProgramUniform1iv(ctx->Exec, (program, location, count, v));
8450 }
8451 }
8452
8453 static void GLAPIENTRY
8454 save_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
8455 const GLint *v)
8456 {
8457 GET_CURRENT_CONTEXT(ctx);
8458 Node *n;
8459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8460 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2IV, 3 + POINTER_DWORDS);
8461 if (n) {
8462 n[1].ui = program;
8463 n[2].i = location;
8464 n[3].i = count;
8465 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLint)));
8466 }
8467 if (ctx->ExecuteFlag) {
8468 CALL_ProgramUniform2iv(ctx->Exec, (program, location, count, v));
8469 }
8470 }
8471
8472 static void GLAPIENTRY
8473 save_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
8474 const GLint *v)
8475 {
8476 GET_CURRENT_CONTEXT(ctx);
8477 Node *n;
8478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8479 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3IV, 3 + POINTER_DWORDS);
8480 if (n) {
8481 n[1].ui = program;
8482 n[2].i = location;
8483 n[3].i = count;
8484 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLint)));
8485 }
8486 if (ctx->ExecuteFlag) {
8487 CALL_ProgramUniform3iv(ctx->Exec, (program, location, count, v));
8488 }
8489 }
8490
8491 static void GLAPIENTRY
8492 save_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
8493 const GLint *v)
8494 {
8495 GET_CURRENT_CONTEXT(ctx);
8496 Node *n;
8497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8498 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4IV, 3 + POINTER_DWORDS);
8499 if (n) {
8500 n[1].ui = program;
8501 n[2].i = location;
8502 n[3].i = count;
8503 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLint)));
8504 }
8505 if (ctx->ExecuteFlag) {
8506 CALL_ProgramUniform4iv(ctx->Exec, (program, location, count, v));
8507 }
8508 }
8509
8510 static void GLAPIENTRY
8511 save_ProgramUniform1ui(GLuint program, GLint location, GLuint x)
8512 {
8513 GET_CURRENT_CONTEXT(ctx);
8514 Node *n;
8515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8516 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UI, 3);
8517 if (n) {
8518 n[1].ui = program;
8519 n[2].i = location;
8520 n[3].ui = x;
8521 }
8522 if (ctx->ExecuteFlag) {
8523 CALL_ProgramUniform1ui(ctx->Exec, (program, location, x));
8524 }
8525 }
8526
8527 static void GLAPIENTRY
8528 save_ProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
8529 {
8530 GET_CURRENT_CONTEXT(ctx);
8531 Node *n;
8532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8533 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UI, 4);
8534 if (n) {
8535 n[1].ui = program;
8536 n[2].i = location;
8537 n[3].ui = x;
8538 n[4].ui = y;
8539 }
8540 if (ctx->ExecuteFlag) {
8541 CALL_ProgramUniform2ui(ctx->Exec, (program, location, x, y));
8542 }
8543 }
8544
8545 static void GLAPIENTRY
8546 save_ProgramUniform3ui(GLuint program, GLint location,
8547 GLuint x, GLuint y, GLuint z)
8548 {
8549 GET_CURRENT_CONTEXT(ctx);
8550 Node *n;
8551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8552 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UI, 5);
8553 if (n) {
8554 n[1].ui = program;
8555 n[2].i = location;
8556 n[3].ui = x;
8557 n[4].ui = y;
8558 n[5].ui = z;
8559 }
8560 if (ctx->ExecuteFlag) {
8561 CALL_ProgramUniform3ui(ctx->Exec, (program, location, x, y, z));
8562 }
8563 }
8564
8565 static void GLAPIENTRY
8566 save_ProgramUniform4ui(GLuint program, GLint location,
8567 GLuint x, GLuint y, GLuint z, GLuint w)
8568 {
8569 GET_CURRENT_CONTEXT(ctx);
8570 Node *n;
8571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8572 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UI, 6);
8573 if (n) {
8574 n[1].ui = program;
8575 n[2].i = location;
8576 n[3].ui = x;
8577 n[4].ui = y;
8578 n[5].ui = z;
8579 n[6].ui = w;
8580 }
8581 if (ctx->ExecuteFlag) {
8582 CALL_ProgramUniform4ui(ctx->Exec, (program, location, x, y, z, w));
8583 }
8584 }
8585
8586 static void GLAPIENTRY
8587 save_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
8588 const GLuint *v)
8589 {
8590 GET_CURRENT_CONTEXT(ctx);
8591 Node *n;
8592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8593 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_1UIV, 3 + POINTER_DWORDS);
8594 if (n) {
8595 n[1].ui = program;
8596 n[2].i = location;
8597 n[3].i = count;
8598 save_pointer(&n[4], memdup(v, count * 1 * sizeof(GLuint)));
8599 }
8600 if (ctx->ExecuteFlag) {
8601 CALL_ProgramUniform1uiv(ctx->Exec, (program, location, count, v));
8602 }
8603 }
8604
8605 static void GLAPIENTRY
8606 save_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
8607 const GLuint *v)
8608 {
8609 GET_CURRENT_CONTEXT(ctx);
8610 Node *n;
8611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8612 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_2UIV, 3 + POINTER_DWORDS);
8613 if (n) {
8614 n[1].ui = program;
8615 n[2].i = location;
8616 n[3].i = count;
8617 save_pointer(&n[4], memdup(v, count * 2 * sizeof(GLuint)));
8618 }
8619 if (ctx->ExecuteFlag) {
8620 CALL_ProgramUniform2uiv(ctx->Exec, (program, location, count, v));
8621 }
8622 }
8623
8624 static void GLAPIENTRY
8625 save_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
8626 const GLuint *v)
8627 {
8628 GET_CURRENT_CONTEXT(ctx);
8629 Node *n;
8630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8631 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_3UIV, 3 + POINTER_DWORDS);
8632 if (n) {
8633 n[1].ui = program;
8634 n[2].i = location;
8635 n[3].i = count;
8636 save_pointer(&n[4], memdup(v, count * 3 * sizeof(GLuint)));
8637 }
8638 if (ctx->ExecuteFlag) {
8639 CALL_ProgramUniform3uiv(ctx->Exec, (program, location, count, v));
8640 }
8641 }
8642
8643 static void GLAPIENTRY
8644 save_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
8645 const GLuint *v)
8646 {
8647 GET_CURRENT_CONTEXT(ctx);
8648 Node *n;
8649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8650 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_4UIV, 3 + POINTER_DWORDS);
8651 if (n) {
8652 n[1].ui = program;
8653 n[2].i = location;
8654 n[3].i = count;
8655 save_pointer(&n[4], memdup(v, count * 4 * sizeof(GLuint)));
8656 }
8657 if (ctx->ExecuteFlag) {
8658 CALL_ProgramUniform4uiv(ctx->Exec, (program, location, count, v));
8659 }
8660 }
8661
8662 static void GLAPIENTRY
8663 save_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
8664 GLboolean transpose, const GLfloat *v)
8665 {
8666 GET_CURRENT_CONTEXT(ctx);
8667 Node *n;
8668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8669 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22F,
8670 4 + POINTER_DWORDS);
8671 if (n) {
8672 n[1].ui = program;
8673 n[2].i = location;
8674 n[3].i = count;
8675 n[4].b = transpose;
8676 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLfloat)));
8677 }
8678 if (ctx->ExecuteFlag) {
8679 CALL_ProgramUniformMatrix2fv(ctx->Exec,
8680 (program, location, count, transpose, v));
8681 }
8682 }
8683
8684 static void GLAPIENTRY
8685 save_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
8686 GLboolean transpose, const GLfloat *v)
8687 {
8688 GET_CURRENT_CONTEXT(ctx);
8689 Node *n;
8690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8691 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23F,
8692 4 + POINTER_DWORDS);
8693 if (n) {
8694 n[1].ui = program;
8695 n[2].i = location;
8696 n[3].i = count;
8697 n[4].b = transpose;
8698 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLfloat)));
8699 }
8700 if (ctx->ExecuteFlag) {
8701 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
8702 (program, location, count, transpose, v));
8703 }
8704 }
8705
8706 static void GLAPIENTRY
8707 save_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
8708 GLboolean transpose, const GLfloat *v)
8709 {
8710 GET_CURRENT_CONTEXT(ctx);
8711 Node *n;
8712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8713 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24F,
8714 4 + POINTER_DWORDS);
8715 if (n) {
8716 n[1].ui = program;
8717 n[2].i = location;
8718 n[3].i = count;
8719 n[4].b = transpose;
8720 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLfloat)));
8721 }
8722 if (ctx->ExecuteFlag) {
8723 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
8724 (program, location, count, transpose, v));
8725 }
8726 }
8727
8728 static void GLAPIENTRY
8729 save_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
8730 GLboolean transpose, const GLfloat *v)
8731 {
8732 GET_CURRENT_CONTEXT(ctx);
8733 Node *n;
8734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8735 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32F,
8736 4 + POINTER_DWORDS);
8737 if (n) {
8738 n[1].ui = program;
8739 n[2].i = location;
8740 n[3].i = count;
8741 n[4].b = transpose;
8742 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLfloat)));
8743 }
8744 if (ctx->ExecuteFlag) {
8745 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
8746 (program, location, count, transpose, v));
8747 }
8748 }
8749
8750 static void GLAPIENTRY
8751 save_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
8752 GLboolean transpose, const GLfloat *v)
8753 {
8754 GET_CURRENT_CONTEXT(ctx);
8755 Node *n;
8756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8757 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33F,
8758 4 + POINTER_DWORDS);
8759 if (n) {
8760 n[1].ui = program;
8761 n[2].i = location;
8762 n[3].i = count;
8763 n[4].b = transpose;
8764 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLfloat)));
8765 }
8766 if (ctx->ExecuteFlag) {
8767 CALL_ProgramUniformMatrix3fv(ctx->Exec,
8768 (program, location, count, transpose, v));
8769 }
8770 }
8771
8772 static void GLAPIENTRY
8773 save_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
8774 GLboolean transpose, const GLfloat *v)
8775 {
8776 GET_CURRENT_CONTEXT(ctx);
8777 Node *n;
8778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8779 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34F,
8780 4 + POINTER_DWORDS);
8781 if (n) {
8782 n[1].ui = program;
8783 n[2].i = location;
8784 n[3].i = count;
8785 n[4].b = transpose;
8786 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLfloat)));
8787 }
8788 if (ctx->ExecuteFlag) {
8789 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
8790 (program, location, count, transpose, v));
8791 }
8792 }
8793
8794 static void GLAPIENTRY
8795 save_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
8796 GLboolean transpose, const GLfloat *v)
8797 {
8798 GET_CURRENT_CONTEXT(ctx);
8799 Node *n;
8800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8801 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42F,
8802 4 + POINTER_DWORDS);
8803 if (n) {
8804 n[1].ui = program;
8805 n[2].i = location;
8806 n[3].i = count;
8807 n[4].b = transpose;
8808 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLfloat)));
8809 }
8810 if (ctx->ExecuteFlag) {
8811 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
8812 (program, location, count, transpose, v));
8813 }
8814 }
8815
8816 static void GLAPIENTRY
8817 save_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
8818 GLboolean transpose, const GLfloat *v)
8819 {
8820 GET_CURRENT_CONTEXT(ctx);
8821 Node *n;
8822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8823 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43F,
8824 4 + POINTER_DWORDS);
8825 if (n) {
8826 n[1].ui = program;
8827 n[2].i = location;
8828 n[3].i = count;
8829 n[4].b = transpose;
8830 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLfloat)));
8831 }
8832 if (ctx->ExecuteFlag) {
8833 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
8834 (program, location, count, transpose, v));
8835 }
8836 }
8837
8838 static void GLAPIENTRY
8839 save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
8840 GLboolean transpose, const GLfloat *v)
8841 {
8842 GET_CURRENT_CONTEXT(ctx);
8843 Node *n;
8844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8845 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44F,
8846 4 + POINTER_DWORDS);
8847 if (n) {
8848 n[1].ui = program;
8849 n[2].i = location;
8850 n[3].i = count;
8851 n[4].b = transpose;
8852 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLfloat)));
8853 }
8854 if (ctx->ExecuteFlag) {
8855 CALL_ProgramUniformMatrix4fv(ctx->Exec,
8856 (program, location, count, transpose, v));
8857 }
8858 }
8859
8860 static void GLAPIENTRY
8861 save_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
8862 GLboolean transpose, const GLdouble *v)
8863 {
8864 GET_CURRENT_CONTEXT(ctx);
8865 Node *n;
8866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8867 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX22D,
8868 4 + POINTER_DWORDS);
8869 if (n) {
8870 n[1].ui = program;
8871 n[2].i = location;
8872 n[3].i = count;
8873 n[4].b = transpose;
8874 save_pointer(&n[5], memdup(v, count * 2 * 2 * sizeof(GLdouble)));
8875 }
8876 if (ctx->ExecuteFlag) {
8877 CALL_ProgramUniformMatrix2dv(ctx->Exec,
8878 (program, location, count, transpose, v));
8879 }
8880 }
8881
8882 static void GLAPIENTRY
8883 save_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
8884 GLboolean transpose, const GLdouble *v)
8885 {
8886 GET_CURRENT_CONTEXT(ctx);
8887 Node *n;
8888 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8889 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX23D,
8890 4 + POINTER_DWORDS);
8891 if (n) {
8892 n[1].ui = program;
8893 n[2].i = location;
8894 n[3].i = count;
8895 n[4].b = transpose;
8896 save_pointer(&n[5], memdup(v, count * 2 * 3 * sizeof(GLdouble)));
8897 }
8898 if (ctx->ExecuteFlag) {
8899 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
8900 (program, location, count, transpose, v));
8901 }
8902 }
8903
8904 static void GLAPIENTRY
8905 save_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
8906 GLboolean transpose, const GLdouble *v)
8907 {
8908 GET_CURRENT_CONTEXT(ctx);
8909 Node *n;
8910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8911 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX24D,
8912 4 + POINTER_DWORDS);
8913 if (n) {
8914 n[1].ui = program;
8915 n[2].i = location;
8916 n[3].i = count;
8917 n[4].b = transpose;
8918 save_pointer(&n[5], memdup(v, count * 2 * 4 * sizeof(GLdouble)));
8919 }
8920 if (ctx->ExecuteFlag) {
8921 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
8922 (program, location, count, transpose, v));
8923 }
8924 }
8925
8926 static void GLAPIENTRY
8927 save_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
8928 GLboolean transpose, const GLdouble *v)
8929 {
8930 GET_CURRENT_CONTEXT(ctx);
8931 Node *n;
8932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8933 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX32D,
8934 4 + POINTER_DWORDS);
8935 if (n) {
8936 n[1].ui = program;
8937 n[2].i = location;
8938 n[3].i = count;
8939 n[4].b = transpose;
8940 save_pointer(&n[5], memdup(v, count * 3 * 2 * sizeof(GLdouble)));
8941 }
8942 if (ctx->ExecuteFlag) {
8943 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
8944 (program, location, count, transpose, v));
8945 }
8946 }
8947
8948 static void GLAPIENTRY
8949 save_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
8950 GLboolean transpose, const GLdouble *v)
8951 {
8952 GET_CURRENT_CONTEXT(ctx);
8953 Node *n;
8954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8955 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX33D,
8956 4 + POINTER_DWORDS);
8957 if (n) {
8958 n[1].ui = program;
8959 n[2].i = location;
8960 n[3].i = count;
8961 n[4].b = transpose;
8962 save_pointer(&n[5], memdup(v, count * 3 * 3 * sizeof(GLdouble)));
8963 }
8964 if (ctx->ExecuteFlag) {
8965 CALL_ProgramUniformMatrix3dv(ctx->Exec,
8966 (program, location, count, transpose, v));
8967 }
8968 }
8969
8970 static void GLAPIENTRY
8971 save_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
8972 GLboolean transpose, const GLdouble *v)
8973 {
8974 GET_CURRENT_CONTEXT(ctx);
8975 Node *n;
8976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8977 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX34D,
8978 4 + POINTER_DWORDS);
8979 if (n) {
8980 n[1].ui = program;
8981 n[2].i = location;
8982 n[3].i = count;
8983 n[4].b = transpose;
8984 save_pointer(&n[5], memdup(v, count * 3 * 4 * sizeof(GLdouble)));
8985 }
8986 if (ctx->ExecuteFlag) {
8987 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
8988 (program, location, count, transpose, v));
8989 }
8990 }
8991
8992 static void GLAPIENTRY
8993 save_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
8994 GLboolean transpose, const GLdouble *v)
8995 {
8996 GET_CURRENT_CONTEXT(ctx);
8997 Node *n;
8998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
8999 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX42D,
9000 4 + POINTER_DWORDS);
9001 if (n) {
9002 n[1].ui = program;
9003 n[2].i = location;
9004 n[3].i = count;
9005 n[4].b = transpose;
9006 save_pointer(&n[5], memdup(v, count * 4 * 2 * sizeof(GLdouble)));
9007 }
9008 if (ctx->ExecuteFlag) {
9009 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
9010 (program, location, count, transpose, v));
9011 }
9012 }
9013
9014 static void GLAPIENTRY
9015 save_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
9016 GLboolean transpose, const GLdouble *v)
9017 {
9018 GET_CURRENT_CONTEXT(ctx);
9019 Node *n;
9020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9021 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX43D,
9022 4 + POINTER_DWORDS);
9023 if (n) {
9024 n[1].ui = program;
9025 n[2].i = location;
9026 n[3].i = count;
9027 n[4].b = transpose;
9028 save_pointer(&n[5], memdup(v, count * 4 * 3 * sizeof(GLdouble)));
9029 }
9030 if (ctx->ExecuteFlag) {
9031 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
9032 (program, location, count, transpose, v));
9033 }
9034 }
9035
9036 static void GLAPIENTRY
9037 save_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
9038 GLboolean transpose, const GLdouble *v)
9039 {
9040 GET_CURRENT_CONTEXT(ctx);
9041 Node *n;
9042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9043 n = alloc_instruction(ctx, OPCODE_PROGRAM_UNIFORM_MATRIX44D,
9044 4 + POINTER_DWORDS);
9045 if (n) {
9046 n[1].ui = program;
9047 n[2].i = location;
9048 n[3].i = count;
9049 n[4].b = transpose;
9050 save_pointer(&n[5], memdup(v, count * 4 * 4 * sizeof(GLdouble)));
9051 }
9052 if (ctx->ExecuteFlag) {
9053 CALL_ProgramUniformMatrix4dv(ctx->Exec,
9054 (program, location, count, transpose, v));
9055 }
9056 }
9057
9058 static void GLAPIENTRY
9059 save_ClipControl(GLenum origin, GLenum depth)
9060 {
9061 GET_CURRENT_CONTEXT(ctx);
9062 Node *n;
9063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9064 n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
9065 if (n) {
9066 n[1].e = origin;
9067 n[2].e = depth;
9068 }
9069 if (ctx->ExecuteFlag) {
9070 CALL_ClipControl(ctx->Exec, (origin, depth));
9071 }
9072 }
9073
9074 static void GLAPIENTRY
9075 save_ClampColorARB(GLenum target, GLenum clamp)
9076 {
9077 GET_CURRENT_CONTEXT(ctx);
9078 Node *n;
9079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9080 n = alloc_instruction(ctx, OPCODE_CLAMP_COLOR, 2);
9081 if (n) {
9082 n[1].e = target;
9083 n[2].e = clamp;
9084 }
9085 if (ctx->ExecuteFlag) {
9086 CALL_ClampColor(ctx->Exec, (target, clamp));
9087 }
9088 }
9089
9090 /** GL_EXT_texture_integer */
9091 static void GLAPIENTRY
9092 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
9093 {
9094 GET_CURRENT_CONTEXT(ctx);
9095 Node *n;
9096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9097 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4);
9098 if (n) {
9099 n[1].i = red;
9100 n[2].i = green;
9101 n[3].i = blue;
9102 n[4].i = alpha;
9103 }
9104 if (ctx->ExecuteFlag) {
9105 CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha));
9106 }
9107 }
9108
9109 /** GL_EXT_texture_integer */
9110 static void GLAPIENTRY
9111 save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
9112 {
9113 GET_CURRENT_CONTEXT(ctx);
9114 Node *n;
9115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9116 n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4);
9117 if (n) {
9118 n[1].ui = red;
9119 n[2].ui = green;
9120 n[3].ui = blue;
9121 n[4].ui = alpha;
9122 }
9123 if (ctx->ExecuteFlag) {
9124 CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha));
9125 }
9126 }
9127
9128 /** GL_EXT_texture_integer */
9129 static void GLAPIENTRY
9130 save_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
9131 {
9132 GET_CURRENT_CONTEXT(ctx);
9133 Node *n;
9134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9135 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_I, 6);
9136 if (n) {
9137 n[1].e = target;
9138 n[2].e = pname;
9139 n[3].i = params[0];
9140 n[4].i = params[1];
9141 n[5].i = params[2];
9142 n[6].i = params[3];
9143 }
9144 if (ctx->ExecuteFlag) {
9145 CALL_TexParameterIiv(ctx->Exec, (target, pname, params));
9146 }
9147 }
9148
9149 /** GL_EXT_texture_integer */
9150 static void GLAPIENTRY
9151 save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
9152 {
9153 GET_CURRENT_CONTEXT(ctx);
9154 Node *n;
9155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9156 n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6);
9157 if (n) {
9158 n[1].e = target;
9159 n[2].e = pname;
9160 n[3].ui = params[0];
9161 n[4].ui = params[1];
9162 n[5].ui = params[2];
9163 n[6].ui = params[3];
9164 }
9165 if (ctx->ExecuteFlag) {
9166 CALL_TexParameterIuiv(ctx->Exec, (target, pname, params));
9167 }
9168 }
9169
9170 /* GL_ARB_instanced_arrays */
9171 static void GLAPIENTRY
9172 save_VertexAttribDivisor(GLuint index, GLuint divisor)
9173 {
9174 GET_CURRENT_CONTEXT(ctx);
9175 Node *n;
9176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9177 n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2);
9178 if (n) {
9179 n[1].ui = index;
9180 n[2].ui = divisor;
9181 }
9182 if (ctx->ExecuteFlag) {
9183 CALL_VertexAttribDivisor(ctx->Exec, (index, divisor));
9184 }
9185 }
9186
9187
9188 /* GL_NV_texture_barrier */
9189 static void GLAPIENTRY
9190 save_TextureBarrierNV(void)
9191 {
9192 GET_CURRENT_CONTEXT(ctx);
9193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9194 alloc_instruction(ctx, OPCODE_TEXTURE_BARRIER_NV, 0);
9195 if (ctx->ExecuteFlag) {
9196 CALL_TextureBarrierNV(ctx->Exec, ());
9197 }
9198 }
9199
9200
9201 /* GL_ARB_sampler_objects */
9202 static void GLAPIENTRY
9203 save_BindSampler(GLuint unit, GLuint sampler)
9204 {
9205 Node *n;
9206 GET_CURRENT_CONTEXT(ctx);
9207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9208 n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
9209 if (n) {
9210 n[1].ui = unit;
9211 n[2].ui = sampler;
9212 }
9213 if (ctx->ExecuteFlag) {
9214 CALL_BindSampler(ctx->Exec, (unit, sampler));
9215 }
9216 }
9217
9218 static void GLAPIENTRY
9219 save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
9220 {
9221 Node *n;
9222 GET_CURRENT_CONTEXT(ctx);
9223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9224 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
9225 if (n) {
9226 n[1].ui = sampler;
9227 n[2].e = pname;
9228 n[3].i = params[0];
9229 if (pname == GL_TEXTURE_BORDER_COLOR) {
9230 n[4].i = params[1];
9231 n[5].i = params[2];
9232 n[6].i = params[3];
9233 }
9234 else {
9235 n[4].i = n[5].i = n[6].i = 0;
9236 }
9237 }
9238 if (ctx->ExecuteFlag) {
9239 CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
9240 }
9241 }
9242
9243 static void GLAPIENTRY
9244 save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
9245 {
9246 GLint parray[4];
9247 parray[0] = param;
9248 parray[1] = parray[2] = parray[3] = 0;
9249 save_SamplerParameteriv(sampler, pname, parray);
9250 }
9251
9252 static void GLAPIENTRY
9253 save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
9254 {
9255 Node *n;
9256 GET_CURRENT_CONTEXT(ctx);
9257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9258 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
9259 if (n) {
9260 n[1].ui = sampler;
9261 n[2].e = pname;
9262 n[3].f = params[0];
9263 if (pname == GL_TEXTURE_BORDER_COLOR) {
9264 n[4].f = params[1];
9265 n[5].f = params[2];
9266 n[6].f = params[3];
9267 }
9268 else {
9269 n[4].f = n[5].f = n[6].f = 0.0F;
9270 }
9271 }
9272 if (ctx->ExecuteFlag) {
9273 CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
9274 }
9275 }
9276
9277 static void GLAPIENTRY
9278 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
9279 {
9280 GLfloat parray[4];
9281 parray[0] = param;
9282 parray[1] = parray[2] = parray[3] = 0.0F;
9283 save_SamplerParameterfv(sampler, pname, parray);
9284 }
9285
9286 static void GLAPIENTRY
9287 save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
9288 {
9289 Node *n;
9290 GET_CURRENT_CONTEXT(ctx);
9291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9292 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
9293 if (n) {
9294 n[1].ui = sampler;
9295 n[2].e = pname;
9296 n[3].i = params[0];
9297 if (pname == GL_TEXTURE_BORDER_COLOR) {
9298 n[4].i = params[1];
9299 n[5].i = params[2];
9300 n[6].i = params[3];
9301 }
9302 else {
9303 n[4].i = n[5].i = n[6].i = 0;
9304 }
9305 }
9306 if (ctx->ExecuteFlag) {
9307 CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
9308 }
9309 }
9310
9311 static void GLAPIENTRY
9312 save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
9313 {
9314 Node *n;
9315 GET_CURRENT_CONTEXT(ctx);
9316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9317 n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
9318 if (n) {
9319 n[1].ui = sampler;
9320 n[2].e = pname;
9321 n[3].ui = params[0];
9322 if (pname == GL_TEXTURE_BORDER_COLOR) {
9323 n[4].ui = params[1];
9324 n[5].ui = params[2];
9325 n[6].ui = params[3];
9326 }
9327 else {
9328 n[4].ui = n[5].ui = n[6].ui = 0;
9329 }
9330 }
9331 if (ctx->ExecuteFlag) {
9332 CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
9333 }
9334 }
9335
9336 static void GLAPIENTRY
9337 save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
9338 {
9339 Node *n;
9340 GET_CURRENT_CONTEXT(ctx);
9341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9342 n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
9343 if (n) {
9344 union uint64_pair p;
9345 p.uint64 = timeout;
9346 n[1].bf = flags;
9347 n[2].ui = p.uint32[0];
9348 n[3].ui = p.uint32[1];
9349 save_pointer(&n[4], sync);
9350 }
9351 if (ctx->ExecuteFlag) {
9352 CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
9353 }
9354 }
9355
9356
9357 /** GL_NV_conditional_render */
9358 static void GLAPIENTRY
9359 save_BeginConditionalRender(GLuint queryId, GLenum mode)
9360 {
9361 GET_CURRENT_CONTEXT(ctx);
9362 Node *n;
9363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9364 n = alloc_instruction(ctx, OPCODE_BEGIN_CONDITIONAL_RENDER, 2);
9365 if (n) {
9366 n[1].i = queryId;
9367 n[2].e = mode;
9368 }
9369 if (ctx->ExecuteFlag) {
9370 CALL_BeginConditionalRender(ctx->Exec, (queryId, mode));
9371 }
9372 }
9373
9374 static void GLAPIENTRY
9375 save_EndConditionalRender(void)
9376 {
9377 GET_CURRENT_CONTEXT(ctx);
9378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9379 alloc_instruction(ctx, OPCODE_END_CONDITIONAL_RENDER, 0);
9380 if (ctx->ExecuteFlag) {
9381 CALL_EndConditionalRender(ctx->Exec, ());
9382 }
9383 }
9384
9385 static void GLAPIENTRY
9386 save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
9387 {
9388 GET_CURRENT_CONTEXT(ctx);
9389 Node *n;
9390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9391 n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
9392 if (n) {
9393 n[1].ui = prog;
9394 n[2].ui = index;
9395 n[3].ui = binding;
9396 }
9397 if (ctx->ExecuteFlag) {
9398 CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
9399 }
9400 }
9401
9402 static void GLAPIENTRY
9403 save_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
9404 const GLuint *indices)
9405 {
9406 GET_CURRENT_CONTEXT(ctx);
9407 Node *n;
9408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9409 n = alloc_instruction(ctx, OPCODE_UNIFORM_SUBROUTINES, 2 + POINTER_DWORDS);
9410 if (n) {
9411 GLint *indices_copy = NULL;
9412
9413 if (count > 0)
9414 indices_copy = memdup(indices, sizeof(GLuint) * 4 * count);
9415 n[1].e = shadertype;
9416 n[2].si = count;
9417 save_pointer(&n[3], indices_copy);
9418 }
9419 if (ctx->ExecuteFlag) {
9420 CALL_UniformSubroutinesuiv(ctx->Exec, (shadertype, count, indices));
9421 }
9422 }
9423
9424 /** GL_EXT_window_rectangles */
9425 static void GLAPIENTRY
9426 save_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
9427 {
9428 GET_CURRENT_CONTEXT(ctx);
9429 Node *n;
9430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9431 n = alloc_instruction(ctx, OPCODE_WINDOW_RECTANGLES, 2 + POINTER_DWORDS);
9432 if (n) {
9433 GLint *box_copy = NULL;
9434
9435 if (count > 0)
9436 box_copy = memdup(box, sizeof(GLint) * 4 * count);
9437 n[1].e = mode;
9438 n[2].si = count;
9439 save_pointer(&n[3], box_copy);
9440 }
9441 if (ctx->ExecuteFlag) {
9442 CALL_WindowRectanglesEXT(ctx->Exec, (mode, count, box));
9443 }
9444 }
9445
9446
9447 /** GL_NV_conservative_raster */
9448 static void GLAPIENTRY
9449 save_SubpixelPrecisionBiasNV(GLuint xbits, GLuint ybits)
9450 {
9451 GET_CURRENT_CONTEXT(ctx);
9452 Node *n;
9453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9454 n = alloc_instruction(ctx, OPCODE_SUBPIXEL_PRECISION_BIAS, 2);
9455 if (n) {
9456 n[1].ui = xbits;
9457 n[2].ui = ybits;
9458 }
9459 if (ctx->ExecuteFlag) {
9460 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (xbits, ybits));
9461 }
9462 }
9463
9464 /** GL_NV_conservative_raster_dilate */
9465 static void GLAPIENTRY
9466 save_ConservativeRasterParameterfNV(GLenum pname, GLfloat param)
9467 {
9468 GET_CURRENT_CONTEXT(ctx);
9469 Node *n;
9470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9471 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_F, 2);
9472 if (n) {
9473 n[1].e = pname;
9474 n[2].f = param;
9475 }
9476 if (ctx->ExecuteFlag) {
9477 CALL_ConservativeRasterParameterfNV(ctx->Exec, (pname, param));
9478 }
9479 }
9480
9481 /** GL_NV_conservative_raster_pre_snap_triangles */
9482 static void GLAPIENTRY
9483 save_ConservativeRasterParameteriNV(GLenum pname, GLint param)
9484 {
9485 GET_CURRENT_CONTEXT(ctx);
9486 Node *n;
9487 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9488 n = alloc_instruction(ctx, OPCODE_CONSERVATIVE_RASTER_PARAMETER_I, 2);
9489 if (n) {
9490 n[1].e = pname;
9491 n[2].i = param;
9492 }
9493 if (ctx->ExecuteFlag) {
9494 CALL_ConservativeRasterParameteriNV(ctx->Exec, (pname, param));
9495 }
9496 }
9497
9498 /** GL_EXT_direct_state_access */
9499
9500 static void GLAPIENTRY
9501 save_MatrixLoadfEXT(GLenum matrixMode, const GLfloat *m)
9502 {
9503 GET_CURRENT_CONTEXT(ctx);
9504 Node *n;
9505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9506 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD, 17);
9507 if (n) {
9508 n[1].e = matrixMode;
9509 for (unsigned i = 0; i < 16; i++) {
9510 n[2 + i].f = m[i];
9511 }
9512 }
9513 if (ctx->ExecuteFlag) {
9514 CALL_MatrixLoadfEXT(ctx->Exec, (matrixMode, m));
9515 }
9516 }
9517
9518 static void GLAPIENTRY
9519 save_MatrixLoaddEXT(GLenum matrixMode, const GLdouble *m)
9520 {
9521 GLfloat f[16];
9522 for (unsigned i = 0; i < 16; i++) {
9523 f[i] = (GLfloat) m[i];
9524 }
9525 save_MatrixLoadfEXT(matrixMode, f);
9526 }
9527
9528 static void GLAPIENTRY
9529 save_MatrixMultfEXT(GLenum matrixMode, const GLfloat * m)
9530 {
9531 GET_CURRENT_CONTEXT(ctx);
9532 Node *n;
9533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9534 n = alloc_instruction(ctx, OPCODE_MATRIX_MULT, 17);
9535 if (n) {
9536 n[1].e = matrixMode;
9537 for (unsigned i = 0; i < 16; i++) {
9538 n[2 + i].f = m[i];
9539 }
9540 }
9541 if (ctx->ExecuteFlag) {
9542 CALL_MatrixMultfEXT(ctx->Exec, (matrixMode, m));
9543 }
9544 }
9545
9546 static void GLAPIENTRY
9547 save_MatrixMultdEXT(GLenum matrixMode, const GLdouble * m)
9548 {
9549 GLfloat f[16];
9550 for (unsigned i = 0; i < 16; i++) {
9551 f[i] = (GLfloat) m[i];
9552 }
9553 save_MatrixMultfEXT(matrixMode, f);
9554 }
9555
9556 static void GLAPIENTRY
9557 save_MatrixRotatefEXT(GLenum matrixMode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
9558 {
9559 GET_CURRENT_CONTEXT(ctx);
9560 Node *n;
9561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9562 n = alloc_instruction(ctx, OPCODE_MATRIX_ROTATE, 5);
9563 if (n) {
9564 n[1].e = matrixMode;
9565 n[2].f = angle;
9566 n[3].f = x;
9567 n[4].f = y;
9568 n[5].f = z;
9569 }
9570 if (ctx->ExecuteFlag) {
9571 CALL_MatrixRotatefEXT(ctx->Exec, (matrixMode, angle, x, y, z));
9572 }
9573 }
9574
9575 static void GLAPIENTRY
9576 save_MatrixRotatedEXT(GLenum matrixMode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
9577 {
9578 save_MatrixRotatefEXT(matrixMode, (GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9579 }
9580
9581 static void GLAPIENTRY
9582 save_MatrixScalefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9583 {
9584 GET_CURRENT_CONTEXT(ctx);
9585 Node *n;
9586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9587 n = alloc_instruction(ctx, OPCODE_MATRIX_SCALE, 4);
9588 if (n) {
9589 n[1].e = matrixMode;
9590 n[2].f = x;
9591 n[3].f = y;
9592 n[4].f = z;
9593 }
9594 if (ctx->ExecuteFlag) {
9595 CALL_MatrixScalefEXT(ctx->Exec, (matrixMode, x, y, z));
9596 }
9597 }
9598
9599 static void GLAPIENTRY
9600 save_MatrixScaledEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9601 {
9602 save_MatrixScalefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9603 }
9604
9605 static void GLAPIENTRY
9606 save_MatrixTranslatefEXT(GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z)
9607 {
9608 GET_CURRENT_CONTEXT(ctx);
9609 Node *n;
9610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9611 n = alloc_instruction(ctx, OPCODE_MATRIX_TRANSLATE, 4);
9612 if (n) {
9613 n[1].e = matrixMode;
9614 n[2].f = x;
9615 n[3].f = y;
9616 n[4].f = z;
9617 }
9618 if (ctx->ExecuteFlag) {
9619 CALL_MatrixTranslatefEXT(ctx->Exec, (matrixMode, x, y, z));
9620 }
9621 }
9622
9623 static void GLAPIENTRY
9624 save_MatrixTranslatedEXT(GLenum matrixMode, GLdouble x, GLdouble y, GLdouble z)
9625 {
9626 save_MatrixTranslatefEXT(matrixMode, (GLfloat) x, (GLfloat) y, (GLfloat) z);
9627 }
9628
9629 static void GLAPIENTRY
9630 save_MatrixLoadIdentityEXT(GLenum matrixMode)
9631 {
9632 GET_CURRENT_CONTEXT(ctx);
9633 Node *n;
9634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9635 n = alloc_instruction(ctx, OPCODE_MATRIX_LOAD_IDENTITY, 1);
9636 if (n) {
9637 n[1].e = matrixMode;
9638 }
9639 if (ctx->ExecuteFlag) {
9640 CALL_MatrixLoadIdentityEXT(ctx->Exec, (matrixMode));
9641 }
9642 }
9643
9644 static void GLAPIENTRY
9645 save_MatrixOrthoEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9646 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9647 {
9648 GET_CURRENT_CONTEXT(ctx);
9649 Node *n;
9650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9651 n = alloc_instruction(ctx, OPCODE_MATRIX_ORTHO, 7);
9652 if (n) {
9653 n[1].e = matrixMode;
9654 n[2].f = (GLfloat) left;
9655 n[3].f = (GLfloat) right;
9656 n[4].f = (GLfloat) bottom;
9657 n[5].f = (GLfloat) top;
9658 n[6].f = (GLfloat) nearval;
9659 n[7].f = (GLfloat) farval;
9660 }
9661 if (ctx->ExecuteFlag) {
9662 CALL_MatrixOrthoEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9663 }
9664 }
9665
9666
9667 static void GLAPIENTRY
9668 save_MatrixFrustumEXT(GLenum matrixMode, GLdouble left, GLdouble right,
9669 GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval)
9670 {
9671 GET_CURRENT_CONTEXT(ctx);
9672 Node *n;
9673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9674 n = alloc_instruction(ctx, OPCODE_MATRIX_FRUSTUM, 7);
9675 if (n) {
9676 n[1].e = matrixMode;
9677 n[2].f = (GLfloat) left;
9678 n[3].f = (GLfloat) right;
9679 n[4].f = (GLfloat) bottom;
9680 n[5].f = (GLfloat) top;
9681 n[6].f = (GLfloat) nearval;
9682 n[7].f = (GLfloat) farval;
9683 }
9684 if (ctx->ExecuteFlag) {
9685 CALL_MatrixFrustumEXT(ctx->Exec, (matrixMode, left, right, bottom, top, nearval, farval));
9686 }
9687 }
9688
9689 static void GLAPIENTRY
9690 save_MatrixPushEXT(GLenum matrixMode)
9691 {
9692 GET_CURRENT_CONTEXT(ctx);
9693 Node* n;
9694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9695 n = alloc_instruction(ctx, OPCODE_MATRIX_PUSH, 1);
9696 if (n) {
9697 n[1].e = matrixMode;
9698 }
9699 if (ctx->ExecuteFlag) {
9700 CALL_MatrixPushEXT(ctx->Exec, (matrixMode));
9701 }
9702 }
9703
9704 static void GLAPIENTRY
9705 save_MatrixPopEXT(GLenum matrixMode)
9706 {
9707 GET_CURRENT_CONTEXT(ctx);
9708 Node* n;
9709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9710 n = alloc_instruction(ctx, OPCODE_MATRIX_POP, 1);
9711 if (n) {
9712 n[1].e = matrixMode;
9713 }
9714 if (ctx->ExecuteFlag) {
9715 CALL_MatrixPopEXT(ctx->Exec, (matrixMode));
9716 }
9717 }
9718
9719 static void GLAPIENTRY
9720 save_MatrixLoadTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9721 {
9722 GLfloat tm[16];
9723 _math_transposef(tm, m);
9724 save_MatrixLoadfEXT(matrixMode, tm);
9725 }
9726
9727 static void GLAPIENTRY
9728 save_MatrixLoadTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9729 {
9730 GLfloat tm[16];
9731 _math_transposefd(tm, m);
9732 save_MatrixLoadfEXT(matrixMode, tm);
9733 }
9734
9735 static void GLAPIENTRY
9736 save_MatrixMultTransposefEXT(GLenum matrixMode, const GLfloat m[16])
9737 {
9738 GLfloat tm[16];
9739 _math_transposef(tm, m);
9740 save_MatrixMultfEXT(matrixMode, tm);
9741 }
9742
9743 static void GLAPIENTRY
9744 save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16])
9745 {
9746 GLfloat tm[16];
9747 _math_transposefd(tm, m);
9748 save_MatrixMultfEXT(matrixMode, tm);
9749 }
9750
9751 static void GLAPIENTRY
9752 save_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname,
9753 const GLfloat *params)
9754 {
9755 GET_CURRENT_CONTEXT(ctx);
9756 Node *n;
9757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9758 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_F, 7);
9759 if (n) {
9760 n[1].ui = texture;
9761 n[2].e = target;
9762 n[3].e = pname;
9763 n[4].f = params[0];
9764 n[5].f = params[1];
9765 n[6].f = params[2];
9766 n[7].f = params[3];
9767 }
9768 if (ctx->ExecuteFlag) {
9769 CALL_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params));
9770 }
9771 }
9772
9773
9774 static void GLAPIENTRY
9775 save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param)
9776 {
9777 GLfloat parray[4];
9778 parray[0] = param;
9779 parray[1] = parray[2] = parray[3] = 0.0F;
9780 save_TextureParameterfvEXT(texture, target, pname, parray);
9781 }
9782
9783 static void GLAPIENTRY
9784 save_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params)
9785 {
9786 GET_CURRENT_CONTEXT(ctx);
9787 Node *n;
9788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9789 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_I, 7);
9790 if (n) {
9791 n[1].ui = texture;
9792 n[2].e = target;
9793 n[3].e = pname;
9794 n[4].i = params[0];
9795 n[5].i = params[1];
9796 n[6].i = params[2];
9797 n[7].i = params[3];
9798 }
9799 if (ctx->ExecuteFlag) {
9800 CALL_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params));
9801 }
9802 }
9803
9804 static void GLAPIENTRY
9805 save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param)
9806 {
9807 GLint fparam[4];
9808 fparam[0] = param;
9809 fparam[1] = fparam[2] = fparam[3] = 0;
9810 save_TextureParameterivEXT(texture, target, pname, fparam);
9811 }
9812
9813 static void GLAPIENTRY
9814 save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params)
9815 {
9816 GET_CURRENT_CONTEXT(ctx);
9817 Node *n;
9818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9819 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7);
9820 if (n) {
9821 n[1].ui = texture;
9822 n[2].e = target;
9823 n[3].e = pname;
9824 n[4].i = params[0];
9825 n[5].i = params[1];
9826 n[6].i = params[2];
9827 n[7].i = params[3];
9828 }
9829 if (ctx->ExecuteFlag) {
9830 CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params));
9831 }
9832 }
9833
9834 static void GLAPIENTRY
9835 save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params)
9836 {
9837 GET_CURRENT_CONTEXT(ctx);
9838 Node *n;
9839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9840 n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7);
9841 if (n) {
9842 n[1].ui = texture;
9843 n[2].e = target;
9844 n[3].e = pname;
9845 n[4].ui = params[0];
9846 n[5].ui = params[1];
9847 n[6].ui = params[2];
9848 n[7].ui = params[3];
9849 }
9850 if (ctx->ExecuteFlag) {
9851 CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params));
9852 }
9853 }
9854
9855
9856 static void GLAPIENTRY
9857 save_TextureImage1DEXT(GLuint texture, GLenum target,
9858 GLint level, GLint components,
9859 GLsizei width, GLint border,
9860 GLenum format, GLenum type, const GLvoid * pixels)
9861 {
9862 GET_CURRENT_CONTEXT(ctx);
9863 if (target == GL_PROXY_TEXTURE_1D) {
9864 /* don't compile, execute immediately */
9865 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9866 border, format, type, pixels));
9867 }
9868 else {
9869 Node *n;
9870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9871 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE1D, 8 + POINTER_DWORDS);
9872 if (n) {
9873 n[1].ui = texture;
9874 n[2].e = target;
9875 n[3].i = level;
9876 n[4].i = components;
9877 n[5].i = (GLint) width;
9878 n[6].i = border;
9879 n[7].e = format;
9880 n[8].e = type;
9881 save_pointer(&n[9],
9882 unpack_image(ctx, 1, width, 1, 1, format, type,
9883 pixels, &ctx->Unpack));
9884 }
9885 if (ctx->ExecuteFlag) {
9886 CALL_TextureImage1DEXT(ctx->Exec, (texture, target, level, components, width,
9887 border, format, type, pixels));
9888 }
9889 }
9890 }
9891
9892
9893 static void GLAPIENTRY
9894 save_TextureImage2DEXT(GLuint texture, GLenum target,
9895 GLint level, GLint components,
9896 GLsizei width, GLsizei height, GLint border,
9897 GLenum format, GLenum type, const GLvoid * pixels)
9898 {
9899 GET_CURRENT_CONTEXT(ctx);
9900 if (target == GL_PROXY_TEXTURE_2D) {
9901 /* don't compile, execute immediately */
9902 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9903 height, border, format, type, pixels));
9904 }
9905 else {
9906 Node *n;
9907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9908 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE2D, 9 + POINTER_DWORDS);
9909 if (n) {
9910 n[1].ui = texture;
9911 n[2].e = target;
9912 n[3].i = level;
9913 n[4].i = components;
9914 n[5].i = (GLint) width;
9915 n[6].i = (GLint) height;
9916 n[7].i = border;
9917 n[8].e = format;
9918 n[9].e = type;
9919 save_pointer(&n[10],
9920 unpack_image(ctx, 2, width, height, 1, format, type,
9921 pixels, &ctx->Unpack));
9922 }
9923 if (ctx->ExecuteFlag) {
9924 CALL_TextureImage2DEXT(ctx->Exec, (texture, target, level, components, width,
9925 height, border, format, type, pixels));
9926 }
9927 }
9928 }
9929
9930
9931 static void GLAPIENTRY
9932 save_TextureImage3DEXT(GLuint texture, GLenum target,
9933 GLint level, GLint internalFormat,
9934 GLsizei width, GLsizei height, GLsizei depth,
9935 GLint border,
9936 GLenum format, GLenum type, const GLvoid * pixels)
9937 {
9938 GET_CURRENT_CONTEXT(ctx);
9939 if (target == GL_PROXY_TEXTURE_3D) {
9940 /* don't compile, execute immediately */
9941 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat, width,
9942 height, depth, border, format, type,
9943 pixels));
9944 }
9945 else {
9946 Node *n;
9947 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9948 n = alloc_instruction(ctx, OPCODE_TEXTURE_IMAGE3D, 10 + POINTER_DWORDS);
9949 if (n) {
9950 n[1].ui = texture;
9951 n[2].e = target;
9952 n[3].i = level;
9953 n[4].i = (GLint) internalFormat;
9954 n[5].i = (GLint) width;
9955 n[6].i = (GLint) height;
9956 n[7].i = (GLint) depth;
9957 n[8].i = border;
9958 n[9].e = format;
9959 n[10].e = type;
9960 save_pointer(&n[11],
9961 unpack_image(ctx, 3, width, height, depth, format, type,
9962 pixels, &ctx->Unpack));
9963 }
9964 if (ctx->ExecuteFlag) {
9965 CALL_TextureImage3DEXT(ctx->Exec, (texture, target, level, internalFormat,
9966 width, height, depth, border, format,
9967 type, pixels));
9968 }
9969 }
9970 }
9971
9972
9973 static void GLAPIENTRY
9974 save_TextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
9975 GLsizei width, GLenum format, GLenum type,
9976 const GLvoid * pixels)
9977 {
9978 GET_CURRENT_CONTEXT(ctx);
9979 Node *n;
9980
9981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
9982
9983 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE1D, 7 + POINTER_DWORDS);
9984 if (n) {
9985 n[1].ui = texture;
9986 n[2].e = target;
9987 n[3].i = level;
9988 n[4].i = xoffset;
9989 n[5].i = (GLint) width;
9990 n[6].e = format;
9991 n[7].e = type;
9992 save_pointer(&n[8],
9993 unpack_image(ctx, 1, width, 1, 1, format, type,
9994 pixels, &ctx->Unpack));
9995 }
9996 if (ctx->ExecuteFlag) {
9997 CALL_TextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset, width,
9998 format, type, pixels));
9999 }
10000 }
10001
10002
10003 static void GLAPIENTRY
10004 save_TextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10005 GLint xoffset, GLint yoffset,
10006 GLsizei width, GLsizei height,
10007 GLenum format, GLenum type, const GLvoid * pixels)
10008 {
10009 GET_CURRENT_CONTEXT(ctx);
10010 Node *n;
10011
10012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10013
10014 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10015 if (n) {
10016 n[1].ui = texture;
10017 n[2].e = target;
10018 n[3].i = level;
10019 n[4].i = xoffset;
10020 n[5].i = yoffset;
10021 n[6].i = (GLint) width;
10022 n[7].i = (GLint) height;
10023 n[8].e = format;
10024 n[9].e = type;
10025 save_pointer(&n[10],
10026 unpack_image(ctx, 2, width, height, 1, format, type,
10027 pixels, &ctx->Unpack));
10028 }
10029 if (ctx->ExecuteFlag) {
10030 CALL_TextureSubImage2DEXT(ctx->Exec, (texture, target, level, xoffset, yoffset,
10031 width, height, format, type, pixels));
10032 }
10033 }
10034
10035
10036 static void GLAPIENTRY
10037 save_TextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10038 GLint xoffset, GLint yoffset, GLint zoffset,
10039 GLsizei width, GLsizei height, GLsizei depth,
10040 GLenum format, GLenum type, const GLvoid * pixels)
10041 {
10042 GET_CURRENT_CONTEXT(ctx);
10043 Node *n;
10044
10045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10046
10047 n = alloc_instruction(ctx, OPCODE_TEXTURE_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10048 if (n) {
10049 n[1].ui = texture;
10050 n[2].e = target;
10051 n[3].i = level;
10052 n[4].i = xoffset;
10053 n[5].i = yoffset;
10054 n[6].i = zoffset;
10055 n[7].i = (GLint) width;
10056 n[8].i = (GLint) height;
10057 n[9].i = (GLint) depth;
10058 n[10].e = format;
10059 n[11].e = type;
10060 save_pointer(&n[12],
10061 unpack_image(ctx, 3, width, height, depth, format, type,
10062 pixels, &ctx->Unpack));
10063 }
10064 if (ctx->ExecuteFlag) {
10065 CALL_TextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10066 xoffset, yoffset, zoffset,
10067 width, height, depth, format, type,
10068 pixels));
10069 }
10070 }
10071
10072 static void GLAPIENTRY
10073 save_CopyTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10074 GLenum internalformat, GLint x, GLint y,
10075 GLsizei width, GLint border)
10076 {
10077 GET_CURRENT_CONTEXT(ctx);
10078 Node *n;
10079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10080 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE1D, 8);
10081 if (n) {
10082 n[1].ui = texture;
10083 n[2].e = target;
10084 n[3].i = level;
10085 n[4].e = internalformat;
10086 n[5].i = x;
10087 n[6].i = y;
10088 n[7].i = width;
10089 n[8].i = border;
10090 }
10091 if (ctx->ExecuteFlag) {
10092 CALL_CopyTextureImage1DEXT(ctx->Exec, (texture, target, level,
10093 internalformat, x, y,
10094 width, border));
10095 }
10096 }
10097
10098 static void GLAPIENTRY
10099 save_CopyTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10100 GLenum internalformat,
10101 GLint x, GLint y, GLsizei width,
10102 GLsizei height, GLint border)
10103 {
10104 GET_CURRENT_CONTEXT(ctx);
10105 Node *n;
10106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10107 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_IMAGE2D, 9);
10108 if (n) {
10109 n[1].ui = texture;
10110 n[2].e = target;
10111 n[3].i = level;
10112 n[4].e = internalformat;
10113 n[5].i = x;
10114 n[6].i = y;
10115 n[7].i = width;
10116 n[8].i = height;
10117 n[9].i = border;
10118 }
10119 if (ctx->ExecuteFlag) {
10120 CALL_CopyTextureImage2DEXT(ctx->Exec, (texture, target, level,
10121 internalformat, x, y,
10122 width, height, border));
10123 }
10124 }
10125
10126 static void GLAPIENTRY
10127 save_CopyTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level,
10128 GLint xoffset, GLint x, GLint y, GLsizei width)
10129 {
10130 GET_CURRENT_CONTEXT(ctx);
10131 Node *n;
10132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10133 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE1D, 7);
10134 if (n) {
10135 n[1].ui = texture;
10136 n[2].e = target;
10137 n[3].i = level;
10138 n[4].i = xoffset;
10139 n[5].i = x;
10140 n[6].i = y;
10141 n[7].i = width;
10142 }
10143 if (ctx->ExecuteFlag) {
10144 CALL_CopyTextureSubImage1DEXT(ctx->Exec,
10145 (texture, target, level, xoffset, x, y, width));
10146 }
10147 }
10148
10149 static void GLAPIENTRY
10150 save_CopyTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level,
10151 GLint xoffset, GLint yoffset,
10152 GLint x, GLint y, GLsizei width, GLint height)
10153 {
10154 GET_CURRENT_CONTEXT(ctx);
10155 Node *n;
10156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10157 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, 9);
10158 if (n) {
10159 n[1].ui = texture;
10160 n[2].e = target;
10161 n[3].i = level;
10162 n[4].i = xoffset;
10163 n[5].i = yoffset;
10164 n[6].i = x;
10165 n[7].i = y;
10166 n[8].i = width;
10167 n[9].i = height;
10168 }
10169 if (ctx->ExecuteFlag) {
10170 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (texture, target, level,
10171 xoffset, yoffset,
10172 x, y, width, height));
10173 }
10174 }
10175
10176
10177 static void GLAPIENTRY
10178 save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level,
10179 GLint xoffset, GLint yoffset, GLint zoffset,
10180 GLint x, GLint y, GLsizei width, GLint height)
10181 {
10182 GET_CURRENT_CONTEXT(ctx);
10183 Node *n;
10184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10185 n = alloc_instruction(ctx, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, 10);
10186 if (n) {
10187 n[1].ui = texture;
10188 n[2].e = target;
10189 n[3].i = level;
10190 n[4].i = xoffset;
10191 n[5].i = yoffset;
10192 n[6].i = zoffset;
10193 n[7].i = x;
10194 n[8].i = y;
10195 n[9].i = width;
10196 n[10].i = height;
10197 }
10198 if (ctx->ExecuteFlag) {
10199 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (texture, target, level,
10200 xoffset, yoffset, zoffset,
10201 x, y, width, height));
10202 }
10203 }
10204
10205
10206 static void GLAPIENTRY
10207 save_BindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture)
10208 {
10209 GET_CURRENT_CONTEXT(ctx);
10210 Node *n;
10211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10212 n = alloc_instruction(ctx, OPCODE_BIND_MULTITEXTURE, 3);
10213 if (n) {
10214 n[1].e = texunit;
10215 n[2].e = target;
10216 n[3].ui = texture;
10217 }
10218 if (ctx->ExecuteFlag) {
10219 CALL_BindMultiTextureEXT(ctx->Exec, (texunit, target, texture));
10220 }
10221 }
10222
10223
10224 static void GLAPIENTRY
10225 save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname,
10226 const GLfloat *params)
10227 {
10228 GET_CURRENT_CONTEXT(ctx);
10229 Node *n;
10230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10231 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7);
10232 if (n) {
10233 n[1].e = texunit;
10234 n[2].e = target;
10235 n[3].e = pname;
10236 n[4].f = params[0];
10237 n[5].f = params[1];
10238 n[6].f = params[2];
10239 n[7].f = params[3];
10240 }
10241 if (ctx->ExecuteFlag) {
10242 CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params));
10243 }
10244 }
10245
10246
10247 static void GLAPIENTRY
10248 save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10249 {
10250 GLfloat parray[4];
10251 parray[0] = param;
10252 parray[1] = parray[2] = parray[3] = 0.0F;
10253 save_MultiTexParameterfvEXT(texunit, target, pname, parray);
10254 }
10255
10256 static void GLAPIENTRY
10257 save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10258 {
10259 GET_CURRENT_CONTEXT(ctx);
10260 Node *n;
10261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10262 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_I, 7);
10263 if (n) {
10264 n[1].e = texunit;
10265 n[2].e = target;
10266 n[3].e = pname;
10267 n[4].i = params[0];
10268 n[5].i = params[1];
10269 n[6].i = params[2];
10270 n[7].i = params[3];
10271 }
10272 if (ctx->ExecuteFlag) {
10273 CALL_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params));
10274 }
10275 }
10276
10277 static void GLAPIENTRY
10278 save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params)
10279 {
10280 GET_CURRENT_CONTEXT(ctx);
10281 Node *n;
10282 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10283 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7);
10284 if (n) {
10285 n[1].e = texunit;
10286 n[2].e = target;
10287 n[3].e = pname;
10288 n[4].i = params[0];
10289 n[5].i = params[1];
10290 n[6].i = params[2];
10291 n[7].i = params[3];
10292 }
10293 if (ctx->ExecuteFlag) {
10294 CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params));
10295 }
10296 }
10297
10298 static void GLAPIENTRY
10299 save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params)
10300 {
10301 GET_CURRENT_CONTEXT(ctx);
10302 Node *n;
10303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10304 n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7);
10305 if (n) {
10306 n[1].e = texunit;
10307 n[2].e = target;
10308 n[3].e = pname;
10309 n[4].ui = params[0];
10310 n[5].ui = params[1];
10311 n[6].ui = params[2];
10312 n[7].ui = params[3];
10313 }
10314 if (ctx->ExecuteFlag) {
10315 CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params));
10316 }
10317 }
10318
10319 static void GLAPIENTRY
10320 save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10321 {
10322 GLint fparam[4];
10323 fparam[0] = param;
10324 fparam[1] = fparam[2] = fparam[3] = 0;
10325 save_MultiTexParameterivEXT(texunit, target, pname, fparam);
10326 }
10327
10328
10329 static void GLAPIENTRY
10330 save_MultiTexImage1DEXT(GLenum texunit, GLenum target,
10331 GLint level, GLint components,
10332 GLsizei width, GLint border,
10333 GLenum format, GLenum type, const GLvoid * pixels)
10334 {
10335 GET_CURRENT_CONTEXT(ctx);
10336 if (target == GL_PROXY_TEXTURE_1D) {
10337 /* don't compile, execute immediately */
10338 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10339 border, format, type, pixels));
10340 }
10341 else {
10342 Node *n;
10343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10344 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE1D, 8 + POINTER_DWORDS);
10345 if (n) {
10346 n[1].e = texunit;
10347 n[2].e = target;
10348 n[3].i = level;
10349 n[4].i = components;
10350 n[5].i = (GLint) width;
10351 n[6].i = border;
10352 n[7].e = format;
10353 n[8].e = type;
10354 save_pointer(&n[9],
10355 unpack_image(ctx, 1, width, 1, 1, format, type,
10356 pixels, &ctx->Unpack));
10357 }
10358 if (ctx->ExecuteFlag) {
10359 CALL_MultiTexImage1DEXT(ctx->Exec, (texunit, target, level, components, width,
10360 border, format, type, pixels));
10361 }
10362 }
10363 }
10364
10365
10366 static void GLAPIENTRY
10367 save_MultiTexImage2DEXT(GLenum texunit, GLenum target,
10368 GLint level, GLint components,
10369 GLsizei width, GLsizei height, GLint border,
10370 GLenum format, GLenum type, const GLvoid * pixels)
10371 {
10372 GET_CURRENT_CONTEXT(ctx);
10373 if (target == GL_PROXY_TEXTURE_2D) {
10374 /* don't compile, execute immediately */
10375 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10376 height, border, format, type, pixels));
10377 }
10378 else {
10379 Node *n;
10380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10381 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE2D, 9 + POINTER_DWORDS);
10382 if (n) {
10383 n[1].e = texunit;
10384 n[2].e = target;
10385 n[3].i = level;
10386 n[4].i = components;
10387 n[5].i = (GLint) width;
10388 n[6].i = (GLint) height;
10389 n[7].i = border;
10390 n[8].e = format;
10391 n[9].e = type;
10392 save_pointer(&n[10],
10393 unpack_image(ctx, 2, width, height, 1, format, type,
10394 pixels, &ctx->Unpack));
10395 }
10396 if (ctx->ExecuteFlag) {
10397 CALL_MultiTexImage2DEXT(ctx->Exec, (texunit, target, level, components, width,
10398 height, border, format, type, pixels));
10399 }
10400 }
10401 }
10402
10403
10404 static void GLAPIENTRY
10405 save_MultiTexImage3DEXT(GLenum texunit, GLenum target,
10406 GLint level, GLint internalFormat,
10407 GLsizei width, GLsizei height, GLsizei depth,
10408 GLint border,
10409 GLenum format, GLenum type, const GLvoid * pixels)
10410 {
10411 GET_CURRENT_CONTEXT(ctx);
10412 if (target == GL_PROXY_TEXTURE_3D) {
10413 /* don't compile, execute immediately */
10414 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat, width,
10415 height, depth, border, format, type,
10416 pixels));
10417 }
10418 else {
10419 Node *n;
10420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10421 n = alloc_instruction(ctx, OPCODE_MULTITEX_IMAGE3D, 10 + POINTER_DWORDS);
10422 if (n) {
10423 n[1].e = texunit;
10424 n[2].e = target;
10425 n[3].i = level;
10426 n[4].i = (GLint) internalFormat;
10427 n[5].i = (GLint) width;
10428 n[6].i = (GLint) height;
10429 n[7].i = (GLint) depth;
10430 n[8].i = border;
10431 n[9].e = format;
10432 n[10].e = type;
10433 save_pointer(&n[11],
10434 unpack_image(ctx, 3, width, height, depth, format, type,
10435 pixels, &ctx->Unpack));
10436 }
10437 if (ctx->ExecuteFlag) {
10438 CALL_MultiTexImage3DEXT(ctx->Exec, (texunit, target, level, internalFormat,
10439 width, height, depth, border, format,
10440 type, pixels));
10441 }
10442 }
10443 }
10444
10445
10446 static void GLAPIENTRY
10447 save_MultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
10448 GLsizei width, GLenum format, GLenum type,
10449 const GLvoid * pixels)
10450 {
10451 GET_CURRENT_CONTEXT(ctx);
10452 Node *n;
10453
10454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10455
10456 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE1D, 7 + POINTER_DWORDS);
10457 if (n) {
10458 n[1].e = texunit;
10459 n[2].e = target;
10460 n[3].i = level;
10461 n[4].i = xoffset;
10462 n[5].i = (GLint) width;
10463 n[6].e = format;
10464 n[7].e = type;
10465 save_pointer(&n[8],
10466 unpack_image(ctx, 1, width, 1, 1, format, type,
10467 pixels, &ctx->Unpack));
10468 }
10469 if (ctx->ExecuteFlag) {
10470 CALL_MultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset, width,
10471 format, type, pixels));
10472 }
10473 }
10474
10475
10476 static void GLAPIENTRY
10477 save_MultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10478 GLint xoffset, GLint yoffset,
10479 GLsizei width, GLsizei height,
10480 GLenum format, GLenum type, const GLvoid * pixels)
10481 {
10482 GET_CURRENT_CONTEXT(ctx);
10483 Node *n;
10484
10485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10486
10487 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE2D, 9 + POINTER_DWORDS);
10488 if (n) {
10489 n[1].e = texunit;
10490 n[2].e = target;
10491 n[3].i = level;
10492 n[4].i = xoffset;
10493 n[5].i = yoffset;
10494 n[6].i = (GLint) width;
10495 n[7].i = (GLint) height;
10496 n[8].e = format;
10497 n[9].e = type;
10498 save_pointer(&n[10],
10499 unpack_image(ctx, 2, width, height, 1, format, type,
10500 pixels, &ctx->Unpack));
10501 }
10502 if (ctx->ExecuteFlag) {
10503 CALL_MultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level, xoffset, yoffset,
10504 width, height, format, type, pixels));
10505 }
10506 }
10507
10508
10509 static void GLAPIENTRY
10510 save_MultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10511 GLint xoffset, GLint yoffset, GLint zoffset,
10512 GLsizei width, GLsizei height, GLsizei depth,
10513 GLenum format, GLenum type, const GLvoid * pixels)
10514 {
10515 GET_CURRENT_CONTEXT(ctx);
10516 Node *n;
10517
10518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10519
10520 n = alloc_instruction(ctx, OPCODE_MULTITEX_SUB_IMAGE3D, 11 + POINTER_DWORDS);
10521 if (n) {
10522 n[1].e = texunit;
10523 n[2].e = target;
10524 n[3].i = level;
10525 n[4].i = xoffset;
10526 n[5].i = yoffset;
10527 n[6].i = zoffset;
10528 n[7].i = (GLint) width;
10529 n[8].i = (GLint) height;
10530 n[9].i = (GLint) depth;
10531 n[10].e = format;
10532 n[11].e = type;
10533 save_pointer(&n[12],
10534 unpack_image(ctx, 3, width, height, depth, format, type,
10535 pixels, &ctx->Unpack));
10536 }
10537 if (ctx->ExecuteFlag) {
10538 CALL_MultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10539 xoffset, yoffset, zoffset,
10540 width, height, depth, format, type,
10541 pixels));
10542 }
10543 }
10544
10545
10546 static void GLAPIENTRY
10547 save_CopyMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10548 GLenum internalformat, GLint x, GLint y,
10549 GLsizei width, GLint border)
10550 {
10551 GET_CURRENT_CONTEXT(ctx);
10552 Node *n;
10553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10554 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE1D, 8);
10555 if (n) {
10556 n[1].e = texunit;
10557 n[2].e = target;
10558 n[3].i = level;
10559 n[4].e = internalformat;
10560 n[5].i = x;
10561 n[6].i = y;
10562 n[7].i = width;
10563 n[8].i = border;
10564 }
10565 if (ctx->ExecuteFlag) {
10566 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10567 internalformat, x, y,
10568 width, border));
10569 }
10570 }
10571
10572
10573 static void GLAPIENTRY
10574 save_CopyMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
10575 GLenum internalformat,
10576 GLint x, GLint y, GLsizei width,
10577 GLsizei height, GLint border)
10578 {
10579 GET_CURRENT_CONTEXT(ctx);
10580 Node *n;
10581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10582 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_IMAGE2D, 9);
10583 if (n) {
10584 n[1].e = texunit;
10585 n[2].e = target;
10586 n[3].i = level;
10587 n[4].e = internalformat;
10588 n[5].i = x;
10589 n[6].i = y;
10590 n[7].i = width;
10591 n[8].i = height;
10592 n[9].i = border;
10593 }
10594 if (ctx->ExecuteFlag) {
10595 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
10596 internalformat, x, y,
10597 width, height, border));
10598 }
10599 }
10600
10601
10602 static void GLAPIENTRY
10603 save_CopyMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level,
10604 GLint xoffset, GLint x, GLint y, GLsizei width)
10605 {
10606 GET_CURRENT_CONTEXT(ctx);
10607 Node *n;
10608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10609 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE1D, 7);
10610 if (n) {
10611 n[1].e = texunit;
10612 n[2].e = target;
10613 n[3].i = level;
10614 n[4].i = xoffset;
10615 n[5].i = x;
10616 n[6].i = y;
10617 n[7].i = width;
10618 }
10619 if (ctx->ExecuteFlag) {
10620 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec,
10621 (texunit, target, level, xoffset, x, y, width));
10622 }
10623 }
10624
10625
10626 static void GLAPIENTRY
10627 save_CopyMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level,
10628 GLint xoffset, GLint yoffset,
10629 GLint x, GLint y, GLsizei width, GLint height)
10630 {
10631 GET_CURRENT_CONTEXT(ctx);
10632 Node *n;
10633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10634 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE2D, 9);
10635 if (n) {
10636 n[1].e = texunit;
10637 n[2].e = target;
10638 n[3].i = level;
10639 n[4].i = xoffset;
10640 n[5].i = yoffset;
10641 n[6].i = x;
10642 n[7].i = y;
10643 n[8].i = width;
10644 n[9].i = height;
10645 }
10646 if (ctx->ExecuteFlag) {
10647 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (texunit, target, level,
10648 xoffset, yoffset,
10649 x, y, width, height));
10650 }
10651 }
10652
10653
10654 static void GLAPIENTRY
10655 save_CopyMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level,
10656 GLint xoffset, GLint yoffset, GLint zoffset,
10657 GLint x, GLint y, GLsizei width, GLint height)
10658 {
10659 GET_CURRENT_CONTEXT(ctx);
10660 Node *n;
10661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10662 n = alloc_instruction(ctx, OPCODE_COPY_MULTITEX_SUB_IMAGE3D, 10);
10663 if (n) {
10664 n[1].e = texunit;
10665 n[2].e = target;
10666 n[3].i = level;
10667 n[4].i = xoffset;
10668 n[5].i = yoffset;
10669 n[6].i = zoffset;
10670 n[7].i = x;
10671 n[8].i = y;
10672 n[9].i = width;
10673 n[10].i = height;
10674 }
10675 if (ctx->ExecuteFlag) {
10676 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (texunit, target, level,
10677 xoffset, yoffset, zoffset,
10678 x, y, width, height));
10679 }
10680 }
10681
10682
10683 static void GLAPIENTRY
10684 save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params)
10685 {
10686 GET_CURRENT_CONTEXT(ctx);
10687 Node *n;
10688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10689 n = alloc_instruction(ctx, OPCODE_MULTITEXENV, 7);
10690 if (n) {
10691 n[1].e = texunit;
10692 n[2].e = target;
10693 n[3].e = pname;
10694 if (pname == GL_TEXTURE_ENV_COLOR) {
10695 n[4].f = params[0];
10696 n[5].f = params[1];
10697 n[6].f = params[2];
10698 n[7].f = params[3];
10699 }
10700 else {
10701 n[4].f = params[0];
10702 n[5].f = n[6].f = n[7].f = 0.0F;
10703 }
10704 }
10705 if (ctx->ExecuteFlag) {
10706 CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params));
10707 }
10708 }
10709
10710
10711 static void GLAPIENTRY
10712 save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param)
10713 {
10714 GLfloat parray[4];
10715 parray[0] = (GLfloat) param;
10716 parray[1] = parray[2] = parray[3] = 0.0F;
10717 save_MultiTexEnvfvEXT(texunit, target, pname, parray);
10718 }
10719
10720
10721 static void GLAPIENTRY
10722 save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param)
10723 {
10724 GLfloat p[4];
10725 p[0] = (GLfloat) param;
10726 p[1] = p[2] = p[3] = 0.0F;
10727 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10728 }
10729
10730
10731 static void GLAPIENTRY
10732 save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param)
10733 {
10734 GLfloat p[4];
10735 if (pname == GL_TEXTURE_ENV_COLOR) {
10736 p[0] = INT_TO_FLOAT(param[0]);
10737 p[1] = INT_TO_FLOAT(param[1]);
10738 p[2] = INT_TO_FLOAT(param[2]);
10739 p[3] = INT_TO_FLOAT(param[3]);
10740 }
10741 else {
10742 p[0] = (GLfloat) param[0];
10743 p[1] = p[2] = p[3] = 0.0F;
10744 }
10745 save_MultiTexEnvfvEXT(texunit, target, pname, p);
10746 }
10747
10748
10749 static void GLAPIENTRY
10750 save_CompressedTextureImage1DEXT(GLuint texture, GLenum target, GLint level,
10751 GLenum internalFormat, GLsizei width,
10752 GLint border, GLsizei imageSize,
10753 const GLvoid * data)
10754 {
10755 GET_CURRENT_CONTEXT(ctx);
10756 if (target == GL_PROXY_TEXTURE_1D) {
10757 /* don't compile, execute immediately */
10758 CALL_CompressedTextureImage1DEXT(ctx->Exec, (texture, target, level,
10759 internalFormat, width,
10760 border, imageSize,
10761 data));
10762 }
10763 else {
10764 Node *n;
10765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10766
10767 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_1D,
10768 7 + POINTER_DWORDS);
10769 if (n) {
10770 n[1].ui = texture;
10771 n[2].e = target;
10772 n[3].i = level;
10773 n[4].e = internalFormat;
10774 n[5].i = (GLint) width;
10775 n[6].i = border;
10776 n[7].i = imageSize;
10777 save_pointer(&n[8],
10778 copy_data(data, imageSize, "glCompressedTextureImage1DEXT"));
10779 }
10780 if (ctx->ExecuteFlag) {
10781 CALL_CompressedTextureImage1DEXT(ctx->Exec,
10782 (texture, target, level, internalFormat,
10783 width, border, imageSize, data));
10784 }
10785 }
10786 }
10787
10788
10789 static void GLAPIENTRY
10790 save_CompressedTextureImage2DEXT(GLuint texture, GLenum target, GLint level,
10791 GLenum internalFormat, GLsizei width,
10792 GLsizei height, GLint border, GLsizei imageSize,
10793 const GLvoid * data)
10794 {
10795 GET_CURRENT_CONTEXT(ctx);
10796 if (target == GL_PROXY_TEXTURE_2D) {
10797 /* don't compile, execute immediately */
10798 CALL_CompressedTextureImage2DEXT(ctx->Exec, (texture, target, level,
10799 internalFormat, width, height,
10800 border, imageSize, data));
10801 }
10802 else {
10803 Node *n;
10804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10805
10806 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_2D,
10807 8 + POINTER_DWORDS);
10808 if (n) {
10809 n[1].ui = texture;
10810 n[2].e = target;
10811 n[3].i = level;
10812 n[4].e = internalFormat;
10813 n[5].i = (GLint) width;
10814 n[6].i = (GLint) height;
10815 n[7].i = border;
10816 n[8].i = imageSize;
10817 save_pointer(&n[9],
10818 copy_data(data, imageSize, "glCompressedTextureImage2DEXT"));
10819 }
10820 if (ctx->ExecuteFlag) {
10821 CALL_CompressedTextureImage2DEXT(ctx->Exec,
10822 (texture, target, level, internalFormat,
10823 width, height, border, imageSize, data));
10824 }
10825 }
10826 }
10827
10828
10829 static void GLAPIENTRY
10830 save_CompressedTextureImage3DEXT(GLuint texture, GLenum target, GLint level,
10831 GLenum internalFormat, GLsizei width,
10832 GLsizei height, GLsizei depth, GLint border,
10833 GLsizei imageSize, const GLvoid * data)
10834 {
10835 GET_CURRENT_CONTEXT(ctx);
10836 if (target == GL_PROXY_TEXTURE_3D) {
10837 /* don't compile, execute immediately */
10838 CALL_CompressedTextureImage3DEXT(ctx->Exec, (texture, target, level,
10839 internalFormat, width,
10840 height, depth, border,
10841 imageSize, data));
10842 }
10843 else {
10844 Node *n;
10845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10846
10847 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_IMAGE_3D,
10848 9 + POINTER_DWORDS);
10849 if (n) {
10850 n[1].ui = texture;
10851 n[2].e = target;
10852 n[3].i = level;
10853 n[4].e = internalFormat;
10854 n[5].i = (GLint) width;
10855 n[6].i = (GLint) height;
10856 n[7].i = (GLint) depth;
10857 n[8].i = border;
10858 n[9].i = imageSize;
10859 save_pointer(&n[10],
10860 copy_data(data, imageSize, "glCompressedTextureImage3DEXT"));
10861 }
10862 if (ctx->ExecuteFlag) {
10863 CALL_CompressedTextureImage3DEXT(ctx->Exec,
10864 (texture, target, level, internalFormat,
10865 width, height, depth, border, imageSize,
10866 data));
10867 }
10868 }
10869 }
10870
10871
10872 static void GLAPIENTRY
10873 save_CompressedTextureSubImage1DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10874 GLsizei width, GLenum format,
10875 GLsizei imageSize, const GLvoid * data)
10876 {
10877 Node *n;
10878 GET_CURRENT_CONTEXT(ctx);
10879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10880
10881 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D,
10882 7 + POINTER_DWORDS);
10883 if (n) {
10884 n[1].ui = texture;
10885 n[2].e = target;
10886 n[3].i = level;
10887 n[4].i = xoffset;
10888 n[5].i = (GLint) width;
10889 n[6].e = format;
10890 n[7].i = imageSize;
10891 save_pointer(&n[8],
10892 copy_data(data, imageSize, "glCompressedTextureSubImage1DEXT"));
10893 }
10894 if (ctx->ExecuteFlag) {
10895 CALL_CompressedTextureSubImage1DEXT(ctx->Exec, (texture, target, level, xoffset,
10896 width, format, imageSize, data));
10897 }
10898 }
10899
10900
10901 static void GLAPIENTRY
10902 save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10903 GLint yoffset, GLsizei width, GLsizei height,
10904 GLenum format, GLsizei imageSize,
10905 const GLvoid * data)
10906 {
10907 Node *n;
10908 GET_CURRENT_CONTEXT(ctx);
10909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10910
10911 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D,
10912 9 + POINTER_DWORDS);
10913 if (n) {
10914 n[1].ui = texture;
10915 n[2].e = target;
10916 n[3].i = level;
10917 n[4].i = xoffset;
10918 n[5].i = yoffset;
10919 n[6].i = (GLint) width;
10920 n[7].i = (GLint) height;
10921 n[8].e = format;
10922 n[9].i = imageSize;
10923 save_pointer(&n[10],
10924 copy_data(data, imageSize, "glCompressedTextureSubImage2DEXT"));
10925 }
10926 if (ctx->ExecuteFlag) {
10927 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
10928 (texture, target, level, xoffset, yoffset,
10929 width, height, format, imageSize, data));
10930 }
10931 }
10932
10933
10934 static void GLAPIENTRY
10935 save_CompressedTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset,
10936 GLint yoffset, GLint zoffset, GLsizei width,
10937 GLsizei height, GLsizei depth, GLenum format,
10938 GLsizei imageSize, const GLvoid * data)
10939 {
10940 Node *n;
10941 GET_CURRENT_CONTEXT(ctx);
10942 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10943
10944 n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D,
10945 11 + POINTER_DWORDS);
10946 if (n) {
10947 n[1].ui = texture;
10948 n[2].e = target;
10949 n[3].i = level;
10950 n[4].i = xoffset;
10951 n[5].i = yoffset;
10952 n[6].i = zoffset;
10953 n[7].i = (GLint) width;
10954 n[8].i = (GLint) height;
10955 n[9].i = (GLint) depth;
10956 n[10].e = format;
10957 n[11].i = imageSize;
10958 save_pointer(&n[12],
10959 copy_data(data, imageSize, "glCompressedTextureSubImage3DEXT"));
10960 }
10961 if (ctx->ExecuteFlag) {
10962 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
10963 (texture, target, level, xoffset, yoffset,
10964 zoffset, width, height, depth, format,
10965 imageSize, data));
10966 }
10967 }
10968
10969
10970 static void GLAPIENTRY
10971 save_CompressedMultiTexImage1DEXT(GLenum texunit, GLenum target, GLint level,
10972 GLenum internalFormat, GLsizei width,
10973 GLint border, GLsizei imageSize,
10974 const GLvoid * data)
10975 {
10976 GET_CURRENT_CONTEXT(ctx);
10977 if (target == GL_PROXY_TEXTURE_1D) {
10978 /* don't compile, execute immediately */
10979 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (texunit, target, level,
10980 internalFormat, width,
10981 border, imageSize,
10982 data));
10983 }
10984 else {
10985 Node *n;
10986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
10987
10988 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_1D,
10989 7 + POINTER_DWORDS);
10990 if (n) {
10991 n[1].e = texunit;
10992 n[2].e = target;
10993 n[3].i = level;
10994 n[4].e = internalFormat;
10995 n[5].i = (GLint) width;
10996 n[6].i = border;
10997 n[7].i = imageSize;
10998 save_pointer(&n[8],
10999 copy_data(data, imageSize, "glCompressedMultiTexImage1DEXT"));
11000 }
11001 if (ctx->ExecuteFlag) {
11002 CALL_CompressedMultiTexImage1DEXT(ctx->Exec,
11003 (texunit, target, level, internalFormat,
11004 width, border, imageSize, data));
11005 }
11006 }
11007 }
11008
11009
11010 static void GLAPIENTRY
11011 save_CompressedMultiTexImage2DEXT(GLenum texunit, GLenum target, GLint level,
11012 GLenum internalFormat, GLsizei width,
11013 GLsizei height, GLint border, GLsizei imageSize,
11014 const GLvoid * data)
11015 {
11016 GET_CURRENT_CONTEXT(ctx);
11017 if (target == GL_PROXY_TEXTURE_2D) {
11018 /* don't compile, execute immediately */
11019 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (texunit, target, level,
11020 internalFormat, width, height,
11021 border, imageSize, data));
11022 }
11023 else {
11024 Node *n;
11025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11026
11027 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_2D,
11028 8 + POINTER_DWORDS);
11029 if (n) {
11030 n[1].e = texunit;
11031 n[2].e = target;
11032 n[3].i = level;
11033 n[4].e = internalFormat;
11034 n[5].i = (GLint) width;
11035 n[6].i = (GLint) height;
11036 n[7].i = border;
11037 n[8].i = imageSize;
11038 save_pointer(&n[9],
11039 copy_data(data, imageSize, "glCompressedMultiTexImage2DEXT"));
11040 }
11041 if (ctx->ExecuteFlag) {
11042 CALL_CompressedMultiTexImage2DEXT(ctx->Exec,
11043 (texunit, target, level, internalFormat,
11044 width, height, border, imageSize, data));
11045 }
11046 }
11047 }
11048
11049
11050 static void GLAPIENTRY
11051 save_CompressedMultiTexImage3DEXT(GLenum texunit, GLenum target, GLint level,
11052 GLenum internalFormat, GLsizei width,
11053 GLsizei height, GLsizei depth, GLint border,
11054 GLsizei imageSize, const GLvoid * data)
11055 {
11056 GET_CURRENT_CONTEXT(ctx);
11057 if (target == GL_PROXY_TEXTURE_3D) {
11058 /* don't compile, execute immediately */
11059 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (texunit, target, level,
11060 internalFormat, width,
11061 height, depth, border,
11062 imageSize, data));
11063 }
11064 else {
11065 Node *n;
11066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11067
11068 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_IMAGE_3D,
11069 9 + POINTER_DWORDS);
11070 if (n) {
11071 n[1].e = texunit;
11072 n[2].e = target;
11073 n[3].i = level;
11074 n[4].e = internalFormat;
11075 n[5].i = (GLint) width;
11076 n[6].i = (GLint) height;
11077 n[7].i = (GLint) depth;
11078 n[8].i = border;
11079 n[9].i = imageSize;
11080 save_pointer(&n[10],
11081 copy_data(data, imageSize, "glCompressedMultiTexImage3DEXT"));
11082 }
11083 if (ctx->ExecuteFlag) {
11084 CALL_CompressedMultiTexImage3DEXT(ctx->Exec,
11085 (texunit, target, level, internalFormat,
11086 width, height, depth, border, imageSize,
11087 data));
11088 }
11089 }
11090 }
11091
11092
11093 static void GLAPIENTRY
11094 save_CompressedMultiTexSubImage1DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11095 GLsizei width, GLenum format,
11096 GLsizei imageSize, const GLvoid * data)
11097 {
11098 Node *n;
11099 GET_CURRENT_CONTEXT(ctx);
11100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11101
11102 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D,
11103 7 + POINTER_DWORDS);
11104 if (n) {
11105 n[1].e = texunit;
11106 n[2].e = target;
11107 n[3].i = level;
11108 n[4].i = xoffset;
11109 n[5].i = (GLint) width;
11110 n[6].e = format;
11111 n[7].i = imageSize;
11112 save_pointer(&n[8],
11113 copy_data(data, imageSize, "glCompressedMultiTexSubImage1DEXT"));
11114 }
11115 if (ctx->ExecuteFlag) {
11116 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec, (texunit, target, level, xoffset,
11117 width, format, imageSize, data));
11118 }
11119 }
11120
11121
11122 static void GLAPIENTRY
11123 save_CompressedMultiTexSubImage2DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11124 GLint yoffset, GLsizei width, GLsizei height,
11125 GLenum format, GLsizei imageSize,
11126 const GLvoid * data)
11127 {
11128 Node *n;
11129 GET_CURRENT_CONTEXT(ctx);
11130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11131
11132 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D,
11133 9 + POINTER_DWORDS);
11134 if (n) {
11135 n[1].e = texunit;
11136 n[2].e = target;
11137 n[3].i = level;
11138 n[4].i = xoffset;
11139 n[5].i = yoffset;
11140 n[6].i = (GLint) width;
11141 n[7].i = (GLint) height;
11142 n[8].e = format;
11143 n[9].i = imageSize;
11144 save_pointer(&n[10],
11145 copy_data(data, imageSize, "glCompressedMultiTexSubImage2DEXT"));
11146 }
11147 if (ctx->ExecuteFlag) {
11148 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
11149 (texunit, target, level, xoffset, yoffset,
11150 width, height, format, imageSize, data));
11151 }
11152 }
11153
11154
11155 static void GLAPIENTRY
11156 save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, GLint xoffset,
11157 GLint yoffset, GLint zoffset, GLsizei width,
11158 GLsizei height, GLsizei depth, GLenum format,
11159 GLsizei imageSize, const GLvoid * data)
11160 {
11161 Node *n;
11162 GET_CURRENT_CONTEXT(ctx);
11163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11164
11165 n = alloc_instruction(ctx, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D,
11166 11 + POINTER_DWORDS);
11167 if (n) {
11168 n[1].e = texunit;
11169 n[2].e = target;
11170 n[3].i = level;
11171 n[4].i = xoffset;
11172 n[5].i = yoffset;
11173 n[6].i = zoffset;
11174 n[7].i = (GLint) width;
11175 n[8].i = (GLint) height;
11176 n[9].i = (GLint) depth;
11177 n[10].e = format;
11178 n[11].i = imageSize;
11179 save_pointer(&n[12],
11180 copy_data(data, imageSize, "glCompressedMultiTexSubImage3DEXT"));
11181 }
11182 if (ctx->ExecuteFlag) {
11183 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
11184 (texunit, target, level, xoffset, yoffset,
11185 zoffset, width, height, depth, format,
11186 imageSize, data));
11187 }
11188 }
11189
11190
11191 static void GLAPIENTRY
11192 save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len,
11193 const GLvoid * string)
11194 {
11195 GET_CURRENT_CONTEXT(ctx);
11196 Node *n;
11197
11198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11199
11200 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS);
11201 if (n) {
11202 GLubyte *programCopy = malloc(len);
11203 if (!programCopy) {
11204 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT");
11205 return;
11206 }
11207 memcpy(programCopy, string, len);
11208 n[1].ui = program;
11209 n[2].e = target;
11210 n[3].e = format;
11211 n[4].i = len;
11212 save_pointer(&n[5], programCopy);
11213 }
11214 if (ctx->ExecuteFlag) {
11215 CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string));
11216 }
11217 }
11218
11219
11220 static void GLAPIENTRY
11221 save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index,
11222 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
11223 {
11224 GET_CURRENT_CONTEXT(ctx);
11225 Node *n;
11226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
11227 n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7);
11228 if (n) {
11229 n[1].ui = program;
11230 n[2].e = target;
11231 n[3].ui = index;
11232 n[4].f = x;
11233 n[5].f = y;
11234 n[6].f = z;
11235 n[7].f = w;
11236 }
11237 if (ctx->ExecuteFlag) {
11238 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w));
11239 }
11240 }
11241
11242
11243 static void GLAPIENTRY
11244 save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index,
11245 const GLfloat *params)
11246 {
11247 save_NamedProgramLocalParameter4fEXT(program, target, index, params[0],
11248 params[1], params[2], params[3]);
11249 }
11250
11251
11252 static void GLAPIENTRY
11253 save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index,
11254 GLdouble x, GLdouble y,
11255 GLdouble z, GLdouble w)
11256 {
11257 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x,
11258 (GLfloat) y, (GLfloat) z, (GLfloat) w);
11259 }
11260
11261
11262 static void GLAPIENTRY
11263 save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index,
11264 const GLdouble *params)
11265 {
11266 save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0],
11267 (GLfloat) params[1], (GLfloat) params[2],
11268 (GLfloat) params[3]);
11269 }
11270
11271
11272 /**
11273 * Save an error-generating command into display list.
11274 *
11275 * KW: Will appear in the list before the vertex buffer containing the
11276 * command that provoked the error. I don't see this as a problem.
11277 */
11278 static void
11279 save_error(struct gl_context *ctx, GLenum error, const char *s)
11280 {
11281 Node *n;
11282 n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
11283 if (n) {
11284 n[1].e = error;
11285 save_pointer(&n[2], (void *) s);
11286 /* note: the data/string here doesn't have to be freed in
11287 * _mesa_delete_list() since the string is never dynamically
11288 * allocated.
11289 */
11290 }
11291 }
11292
11293
11294 /**
11295 * Compile an error into current display list.
11296 */
11297 void
11298 _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
11299 {
11300 if (ctx->CompileFlag)
11301 save_error(ctx, error, s);
11302 if (ctx->ExecuteFlag)
11303 _mesa_error(ctx, error, "%s", s);
11304 }
11305
11306
11307 /**
11308 * Test if ID names a display list.
11309 */
11310 static GLboolean
11311 islist(struct gl_context *ctx, GLuint list)
11312 {
11313 if (list > 0 && _mesa_lookup_list(ctx, list)) {
11314 return GL_TRUE;
11315 }
11316 else {
11317 return GL_FALSE;
11318 }
11319 }
11320
11321
11322
11323 /**********************************************************************/
11324 /* Display list execution */
11325 /**********************************************************************/
11326
11327
11328 /*
11329 * Execute a display list. Note that the ListBase offset must have already
11330 * been added before calling this function. I.e. the list argument is
11331 * the absolute list number, not relative to ListBase.
11332 * \param list - display list number
11333 */
11334 static void
11335 execute_list(struct gl_context *ctx, GLuint list)
11336 {
11337 struct gl_display_list *dlist;
11338 Node *n;
11339 GLboolean done;
11340
11341 if (list == 0 || !islist(ctx, list))
11342 return;
11343
11344 if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
11345 /* raise an error? */
11346 return;
11347 }
11348
11349 dlist = _mesa_lookup_list(ctx, list);
11350 if (!dlist)
11351 return;
11352
11353 ctx->ListState.CallDepth++;
11354
11355 vbo_save_BeginCallList(ctx, dlist);
11356
11357 n = dlist->Head;
11358
11359 done = GL_FALSE;
11360 while (!done) {
11361 const OpCode opcode = n[0].opcode;
11362
11363 if (is_ext_opcode(opcode)) {
11364 n += ext_opcode_execute(ctx, n);
11365 }
11366 else {
11367 switch (opcode) {
11368 case OPCODE_ERROR:
11369 _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
11370 break;
11371 case OPCODE_ACCUM:
11372 CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
11373 break;
11374 case OPCODE_ALPHA_FUNC:
11375 CALL_AlphaFunc(ctx->Exec, (n[1].e, n[2].f));
11376 break;
11377 case OPCODE_BIND_TEXTURE:
11378 CALL_BindTexture(ctx->Exec, (n[1].e, n[2].ui));
11379 break;
11380 case OPCODE_BITMAP:
11381 {
11382 const struct gl_pixelstore_attrib save = ctx->Unpack;
11383 ctx->Unpack = ctx->DefaultPacking;
11384 CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
11385 n[3].f, n[4].f, n[5].f, n[6].f,
11386 get_pointer(&n[7])));
11387 ctx->Unpack = save; /* restore */
11388 }
11389 break;
11390 case OPCODE_BLEND_COLOR:
11391 CALL_BlendColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11392 break;
11393 case OPCODE_BLEND_EQUATION:
11394 CALL_BlendEquation(ctx->Exec, (n[1].e));
11395 break;
11396 case OPCODE_BLEND_EQUATION_SEPARATE:
11397 CALL_BlendEquationSeparate(ctx->Exec, (n[1].e, n[2].e));
11398 break;
11399 case OPCODE_BLEND_FUNC_SEPARATE:
11400 CALL_BlendFuncSeparate(ctx->Exec,
11401 (n[1].e, n[2].e, n[3].e, n[4].e));
11402 break;
11403
11404 case OPCODE_BLEND_FUNC_I:
11405 /* GL_ARB_draw_buffers_blend */
11406 CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e));
11407 break;
11408 case OPCODE_BLEND_FUNC_SEPARATE_I:
11409 /* GL_ARB_draw_buffers_blend */
11410 CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e,
11411 n[4].e, n[5].e));
11412 break;
11413 case OPCODE_BLEND_EQUATION_I:
11414 /* GL_ARB_draw_buffers_blend */
11415 CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e));
11416 break;
11417 case OPCODE_BLEND_EQUATION_SEPARATE_I:
11418 /* GL_ARB_draw_buffers_blend */
11419 CALL_BlendEquationSeparateiARB(ctx->Exec,
11420 (n[1].ui, n[2].e, n[3].e));
11421 break;
11422
11423 case OPCODE_CALL_LIST:
11424 /* Generated by glCallList(), don't add ListBase */
11425 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11426 execute_list(ctx, n[1].ui);
11427 }
11428 break;
11429 case OPCODE_CALL_LISTS:
11430 if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
11431 CALL_CallLists(ctx->Exec, (n[1].i, n[2].e, get_pointer(&n[3])));
11432 }
11433 break;
11434 case OPCODE_CLEAR:
11435 CALL_Clear(ctx->Exec, (n[1].bf));
11436 break;
11437 case OPCODE_CLEAR_BUFFER_IV:
11438 {
11439 GLint value[4];
11440 value[0] = n[3].i;
11441 value[1] = n[4].i;
11442 value[2] = n[5].i;
11443 value[3] = n[6].i;
11444 CALL_ClearBufferiv(ctx->Exec, (n[1].e, n[2].i, value));
11445 }
11446 break;
11447 case OPCODE_CLEAR_BUFFER_UIV:
11448 {
11449 GLuint value[4];
11450 value[0] = n[3].ui;
11451 value[1] = n[4].ui;
11452 value[2] = n[5].ui;
11453 value[3] = n[6].ui;
11454 CALL_ClearBufferuiv(ctx->Exec, (n[1].e, n[2].i, value));
11455 }
11456 break;
11457 case OPCODE_CLEAR_BUFFER_FV:
11458 {
11459 GLfloat value[4];
11460 value[0] = n[3].f;
11461 value[1] = n[4].f;
11462 value[2] = n[5].f;
11463 value[3] = n[6].f;
11464 CALL_ClearBufferfv(ctx->Exec, (n[1].e, n[2].i, value));
11465 }
11466 break;
11467 case OPCODE_CLEAR_BUFFER_FI:
11468 CALL_ClearBufferfi(ctx->Exec, (n[1].e, n[2].i, n[3].f, n[4].i));
11469 break;
11470 case OPCODE_CLEAR_COLOR:
11471 CALL_ClearColor(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11472 break;
11473 case OPCODE_CLEAR_ACCUM:
11474 CALL_ClearAccum(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11475 break;
11476 case OPCODE_CLEAR_DEPTH:
11477 CALL_ClearDepth(ctx->Exec, ((GLclampd) n[1].f));
11478 break;
11479 case OPCODE_CLEAR_INDEX:
11480 CALL_ClearIndex(ctx->Exec, ((GLfloat) n[1].ui));
11481 break;
11482 case OPCODE_CLEAR_STENCIL:
11483 CALL_ClearStencil(ctx->Exec, (n[1].i));
11484 break;
11485 case OPCODE_CLIP_PLANE:
11486 {
11487 GLdouble eq[4];
11488 eq[0] = n[2].f;
11489 eq[1] = n[3].f;
11490 eq[2] = n[4].f;
11491 eq[3] = n[5].f;
11492 CALL_ClipPlane(ctx->Exec, (n[1].e, eq));
11493 }
11494 break;
11495 case OPCODE_COLOR_MASK:
11496 CALL_ColorMask(ctx->Exec, (n[1].b, n[2].b, n[3].b, n[4].b));
11497 break;
11498 case OPCODE_COLOR_MASK_INDEXED:
11499 CALL_ColorMaski(ctx->Exec, (n[1].ui, n[2].b, n[3].b,
11500 n[4].b, n[5].b));
11501 break;
11502 case OPCODE_COLOR_MATERIAL:
11503 CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
11504 break;
11505 case OPCODE_COPY_PIXELS:
11506 CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
11507 (GLsizei) n[3].i, (GLsizei) n[4].i,
11508 n[5].e));
11509 break;
11510 case OPCODE_COPY_TEX_IMAGE1D:
11511 CALL_CopyTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11512 n[5].i, n[6].i, n[7].i));
11513 break;
11514 case OPCODE_COPY_TEX_IMAGE2D:
11515 CALL_CopyTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i,
11516 n[5].i, n[6].i, n[7].i, n[8].i));
11517 break;
11518 case OPCODE_COPY_TEX_SUB_IMAGE1D:
11519 CALL_CopyTexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11520 n[4].i, n[5].i, n[6].i));
11521 break;
11522 case OPCODE_COPY_TEX_SUB_IMAGE2D:
11523 CALL_CopyTexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11524 n[4].i, n[5].i, n[6].i, n[7].i,
11525 n[8].i));
11526 break;
11527 case OPCODE_COPY_TEX_SUB_IMAGE3D:
11528 CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11529 n[4].i, n[5].i, n[6].i, n[7].i,
11530 n[8].i, n[9].i));
11531 break;
11532 case OPCODE_CULL_FACE:
11533 CALL_CullFace(ctx->Exec, (n[1].e));
11534 break;
11535 case OPCODE_DEPTH_FUNC:
11536 CALL_DepthFunc(ctx->Exec, (n[1].e));
11537 break;
11538 case OPCODE_DEPTH_MASK:
11539 CALL_DepthMask(ctx->Exec, (n[1].b));
11540 break;
11541 case OPCODE_DEPTH_RANGE:
11542 CALL_DepthRange(ctx->Exec,
11543 ((GLclampd) n[1].f, (GLclampd) n[2].f));
11544 break;
11545 case OPCODE_DISABLE:
11546 CALL_Disable(ctx->Exec, (n[1].e));
11547 break;
11548 case OPCODE_DISABLE_INDEXED:
11549 CALL_Disablei(ctx->Exec, (n[1].ui, n[2].e));
11550 break;
11551 case OPCODE_DRAW_BUFFER:
11552 CALL_DrawBuffer(ctx->Exec, (n[1].e));
11553 break;
11554 case OPCODE_DRAW_PIXELS:
11555 {
11556 const struct gl_pixelstore_attrib save = ctx->Unpack;
11557 ctx->Unpack = ctx->DefaultPacking;
11558 CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
11559 get_pointer(&n[5])));
11560 ctx->Unpack = save; /* restore */
11561 }
11562 break;
11563 case OPCODE_ENABLE:
11564 CALL_Enable(ctx->Exec, (n[1].e));
11565 break;
11566 case OPCODE_ENABLE_INDEXED:
11567 CALL_Enablei(ctx->Exec, (n[1].ui, n[2].e));
11568 break;
11569 case OPCODE_EVALMESH1:
11570 CALL_EvalMesh1(ctx->Exec, (n[1].e, n[2].i, n[3].i));
11571 break;
11572 case OPCODE_EVALMESH2:
11573 CALL_EvalMesh2(ctx->Exec,
11574 (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i));
11575 break;
11576 case OPCODE_FOG:
11577 {
11578 GLfloat p[4];
11579 p[0] = n[2].f;
11580 p[1] = n[3].f;
11581 p[2] = n[4].f;
11582 p[3] = n[5].f;
11583 CALL_Fogfv(ctx->Exec, (n[1].e, p));
11584 }
11585 break;
11586 case OPCODE_FRONT_FACE:
11587 CALL_FrontFace(ctx->Exec, (n[1].e));
11588 break;
11589 case OPCODE_FRUSTUM:
11590 CALL_Frustum(ctx->Exec,
11591 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11592 break;
11593 case OPCODE_HINT:
11594 CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
11595 break;
11596 case OPCODE_INDEX_MASK:
11597 CALL_IndexMask(ctx->Exec, (n[1].ui));
11598 break;
11599 case OPCODE_INIT_NAMES:
11600 CALL_InitNames(ctx->Exec, ());
11601 break;
11602 case OPCODE_LIGHT:
11603 {
11604 GLfloat p[4];
11605 p[0] = n[3].f;
11606 p[1] = n[4].f;
11607 p[2] = n[5].f;
11608 p[3] = n[6].f;
11609 CALL_Lightfv(ctx->Exec, (n[1].e, n[2].e, p));
11610 }
11611 break;
11612 case OPCODE_LIGHT_MODEL:
11613 {
11614 GLfloat p[4];
11615 p[0] = n[2].f;
11616 p[1] = n[3].f;
11617 p[2] = n[4].f;
11618 p[3] = n[5].f;
11619 CALL_LightModelfv(ctx->Exec, (n[1].e, p));
11620 }
11621 break;
11622 case OPCODE_LINE_STIPPLE:
11623 CALL_LineStipple(ctx->Exec, (n[1].i, n[2].us));
11624 break;
11625 case OPCODE_LINE_WIDTH:
11626 CALL_LineWidth(ctx->Exec, (n[1].f));
11627 break;
11628 case OPCODE_LIST_BASE:
11629 CALL_ListBase(ctx->Exec, (n[1].ui));
11630 break;
11631 case OPCODE_LOAD_IDENTITY:
11632 CALL_LoadIdentity(ctx->Exec, ());
11633 break;
11634 case OPCODE_LOAD_MATRIX:
11635 STATIC_ASSERT(sizeof(Node) == sizeof(GLfloat));
11636 CALL_LoadMatrixf(ctx->Exec, (&n[1].f));
11637 break;
11638 case OPCODE_LOAD_NAME:
11639 CALL_LoadName(ctx->Exec, (n[1].ui));
11640 break;
11641 case OPCODE_LOGIC_OP:
11642 CALL_LogicOp(ctx->Exec, (n[1].e));
11643 break;
11644 case OPCODE_MAP1:
11645 {
11646 GLenum target = n[1].e;
11647 GLint ustride = _mesa_evaluator_components(target);
11648 GLint uorder = n[5].i;
11649 GLfloat u1 = n[2].f;
11650 GLfloat u2 = n[3].f;
11651 CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
11652 (GLfloat *) get_pointer(&n[6])));
11653 }
11654 break;
11655 case OPCODE_MAP2:
11656 {
11657 GLenum target = n[1].e;
11658 GLfloat u1 = n[2].f;
11659 GLfloat u2 = n[3].f;
11660 GLfloat v1 = n[4].f;
11661 GLfloat v2 = n[5].f;
11662 GLint ustride = n[6].i;
11663 GLint vstride = n[7].i;
11664 GLint uorder = n[8].i;
11665 GLint vorder = n[9].i;
11666 CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
11667 v1, v2, vstride, vorder,
11668 (GLfloat *) get_pointer(&n[10])));
11669 }
11670 break;
11671 case OPCODE_MAPGRID1:
11672 CALL_MapGrid1f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
11673 break;
11674 case OPCODE_MAPGRID2:
11675 CALL_MapGrid2f(ctx->Exec,
11676 (n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
11677 break;
11678 case OPCODE_MATRIX_MODE:
11679 CALL_MatrixMode(ctx->Exec, (n[1].e));
11680 break;
11681 case OPCODE_MULT_MATRIX:
11682 CALL_MultMatrixf(ctx->Exec, (&n[1].f));
11683 break;
11684 case OPCODE_ORTHO:
11685 CALL_Ortho(ctx->Exec,
11686 (n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f));
11687 break;
11688 case OPCODE_PASSTHROUGH:
11689 CALL_PassThrough(ctx->Exec, (n[1].f));
11690 break;
11691 case OPCODE_PATCH_PARAMETER_I:
11692 CALL_PatchParameteri(ctx->Exec, (n[1].e, n[2].i));
11693 break;
11694 case OPCODE_PATCH_PARAMETER_FV_INNER:
11695 {
11696 GLfloat params[2];
11697 params[0] = n[2].f;
11698 params[1] = n[3].f;
11699 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11700 }
11701 break;
11702 case OPCODE_PATCH_PARAMETER_FV_OUTER:
11703 {
11704 GLfloat params[4];
11705 params[0] = n[2].f;
11706 params[1] = n[3].f;
11707 params[2] = n[4].f;
11708 params[3] = n[5].f;
11709 CALL_PatchParameterfv(ctx->Exec, (n[1].e, params));
11710 }
11711 break;
11712 case OPCODE_PIXEL_MAP:
11713 CALL_PixelMapfv(ctx->Exec,
11714 (n[1].e, n[2].i, get_pointer(&n[3])));
11715 break;
11716 case OPCODE_PIXEL_TRANSFER:
11717 CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
11718 break;
11719 case OPCODE_PIXEL_ZOOM:
11720 CALL_PixelZoom(ctx->Exec, (n[1].f, n[2].f));
11721 break;
11722 case OPCODE_POINT_SIZE:
11723 CALL_PointSize(ctx->Exec, (n[1].f));
11724 break;
11725 case OPCODE_POINT_PARAMETERS:
11726 {
11727 GLfloat params[3];
11728 params[0] = n[2].f;
11729 params[1] = n[3].f;
11730 params[2] = n[4].f;
11731 CALL_PointParameterfv(ctx->Exec, (n[1].e, params));
11732 }
11733 break;
11734 case OPCODE_POLYGON_MODE:
11735 CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
11736 break;
11737 case OPCODE_POLYGON_STIPPLE:
11738 {
11739 const struct gl_pixelstore_attrib save = ctx->Unpack;
11740 ctx->Unpack = ctx->DefaultPacking;
11741 CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
11742 ctx->Unpack = save; /* restore */
11743 }
11744 break;
11745 case OPCODE_POLYGON_OFFSET:
11746 CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));
11747 break;
11748 case OPCODE_POLYGON_OFFSET_CLAMP:
11749 CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11750 break;
11751 case OPCODE_POP_ATTRIB:
11752 CALL_PopAttrib(ctx->Exec, ());
11753 break;
11754 case OPCODE_POP_MATRIX:
11755 CALL_PopMatrix(ctx->Exec, ());
11756 break;
11757 case OPCODE_POP_NAME:
11758 CALL_PopName(ctx->Exec, ());
11759 break;
11760 case OPCODE_PRIORITIZE_TEXTURE:
11761 CALL_PrioritizeTextures(ctx->Exec, (1, &n[1].ui, &n[2].f));
11762 break;
11763 case OPCODE_PUSH_ATTRIB:
11764 CALL_PushAttrib(ctx->Exec, (n[1].bf));
11765 break;
11766 case OPCODE_PUSH_MATRIX:
11767 CALL_PushMatrix(ctx->Exec, ());
11768 break;
11769 case OPCODE_PUSH_NAME:
11770 CALL_PushName(ctx->Exec, (n[1].ui));
11771 break;
11772 case OPCODE_RASTER_POS:
11773 CALL_RasterPos4f(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11774 break;
11775 case OPCODE_READ_BUFFER:
11776 CALL_ReadBuffer(ctx->Exec, (n[1].e));
11777 break;
11778 case OPCODE_ROTATE:
11779 CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11780 break;
11781 case OPCODE_SCALE:
11782 CALL_Scalef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11783 break;
11784 case OPCODE_SCISSOR:
11785 CALL_Scissor(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
11786 break;
11787 case OPCODE_SHADE_MODEL:
11788 CALL_ShadeModel(ctx->Exec, (n[1].e));
11789 break;
11790 case OPCODE_PROVOKING_VERTEX:
11791 CALL_ProvokingVertex(ctx->Exec, (n[1].e));
11792 break;
11793 case OPCODE_STENCIL_FUNC:
11794 CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
11795 break;
11796 case OPCODE_STENCIL_MASK:
11797 CALL_StencilMask(ctx->Exec, (n[1].ui));
11798 break;
11799 case OPCODE_STENCIL_OP:
11800 CALL_StencilOp(ctx->Exec, (n[1].e, n[2].e, n[3].e));
11801 break;
11802 case OPCODE_STENCIL_FUNC_SEPARATE:
11803 CALL_StencilFuncSeparate(ctx->Exec,
11804 (n[1].e, n[2].e, n[3].i, n[4].ui));
11805 break;
11806 case OPCODE_STENCIL_MASK_SEPARATE:
11807 CALL_StencilMaskSeparate(ctx->Exec, (n[1].e, n[2].ui));
11808 break;
11809 case OPCODE_STENCIL_OP_SEPARATE:
11810 CALL_StencilOpSeparate(ctx->Exec,
11811 (n[1].e, n[2].e, n[3].e, n[4].e));
11812 break;
11813 case OPCODE_TEXENV:
11814 {
11815 GLfloat params[4];
11816 params[0] = n[3].f;
11817 params[1] = n[4].f;
11818 params[2] = n[5].f;
11819 params[3] = n[6].f;
11820 CALL_TexEnvfv(ctx->Exec, (n[1].e, n[2].e, params));
11821 }
11822 break;
11823 case OPCODE_TEXGEN:
11824 {
11825 GLfloat params[4];
11826 params[0] = n[3].f;
11827 params[1] = n[4].f;
11828 params[2] = n[5].f;
11829 params[3] = n[6].f;
11830 CALL_TexGenfv(ctx->Exec, (n[1].e, n[2].e, params));
11831 }
11832 break;
11833 case OPCODE_TEXPARAMETER:
11834 {
11835 GLfloat params[4];
11836 params[0] = n[3].f;
11837 params[1] = n[4].f;
11838 params[2] = n[5].f;
11839 params[3] = n[6].f;
11840 CALL_TexParameterfv(ctx->Exec, (n[1].e, n[2].e, params));
11841 }
11842 break;
11843 case OPCODE_TEX_IMAGE1D:
11844 {
11845 const struct gl_pixelstore_attrib save = ctx->Unpack;
11846 ctx->Unpack = ctx->DefaultPacking;
11847 CALL_TexImage1D(ctx->Exec, (n[1].e, /* target */
11848 n[2].i, /* level */
11849 n[3].i, /* components */
11850 n[4].i, /* width */
11851 n[5].e, /* border */
11852 n[6].e, /* format */
11853 n[7].e, /* type */
11854 get_pointer(&n[8])));
11855 ctx->Unpack = save; /* restore */
11856 }
11857 break;
11858 case OPCODE_TEX_IMAGE2D:
11859 {
11860 const struct gl_pixelstore_attrib save = ctx->Unpack;
11861 ctx->Unpack = ctx->DefaultPacking;
11862 CALL_TexImage2D(ctx->Exec, (n[1].e, /* target */
11863 n[2].i, /* level */
11864 n[3].i, /* components */
11865 n[4].i, /* width */
11866 n[5].i, /* height */
11867 n[6].e, /* border */
11868 n[7].e, /* format */
11869 n[8].e, /* type */
11870 get_pointer(&n[9])));
11871 ctx->Unpack = save; /* restore */
11872 }
11873 break;
11874 case OPCODE_TEX_IMAGE3D:
11875 {
11876 const struct gl_pixelstore_attrib save = ctx->Unpack;
11877 ctx->Unpack = ctx->DefaultPacking;
11878 CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
11879 n[2].i, /* level */
11880 n[3].i, /* components */
11881 n[4].i, /* width */
11882 n[5].i, /* height */
11883 n[6].i, /* depth */
11884 n[7].e, /* border */
11885 n[8].e, /* format */
11886 n[9].e, /* type */
11887 get_pointer(&n[10])));
11888 ctx->Unpack = save; /* restore */
11889 }
11890 break;
11891 case OPCODE_TEX_SUB_IMAGE1D:
11892 {
11893 const struct gl_pixelstore_attrib save = ctx->Unpack;
11894 ctx->Unpack = ctx->DefaultPacking;
11895 CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11896 n[4].i, n[5].e,
11897 n[6].e, get_pointer(&n[7])));
11898 ctx->Unpack = save; /* restore */
11899 }
11900 break;
11901 case OPCODE_TEX_SUB_IMAGE2D:
11902 {
11903 const struct gl_pixelstore_attrib save = ctx->Unpack;
11904 ctx->Unpack = ctx->DefaultPacking;
11905 CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11906 n[4].i, n[5].e,
11907 n[6].i, n[7].e, n[8].e,
11908 get_pointer(&n[9])));
11909 ctx->Unpack = save; /* restore */
11910 }
11911 break;
11912 case OPCODE_TEX_SUB_IMAGE3D:
11913 {
11914 const struct gl_pixelstore_attrib save = ctx->Unpack;
11915 ctx->Unpack = ctx->DefaultPacking;
11916 CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
11917 n[4].i, n[5].i, n[6].i, n[7].i,
11918 n[8].i, n[9].e, n[10].e,
11919 get_pointer(&n[11])));
11920 ctx->Unpack = save; /* restore */
11921 }
11922 break;
11923 case OPCODE_TRANSLATE:
11924 CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
11925 break;
11926 case OPCODE_VIEWPORT:
11927 CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
11928 (GLsizei) n[3].i, (GLsizei) n[4].i));
11929 break;
11930 case OPCODE_WINDOW_POS:
11931 CALL_WindowPos4fMESA(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
11932 break;
11933 case OPCODE_VIEWPORT_ARRAY_V:
11934 CALL_ViewportArrayv(ctx->Exec, (n[1].ui, n[2].si,
11935 get_pointer(&n[3])));
11936 break;
11937 case OPCODE_VIEWPORT_INDEXED_F:
11938 CALL_ViewportIndexedf(ctx->Exec, (n[1].ui, n[2].f, n[3].f, n[4].f,
11939 n[5].f));
11940 break;
11941 case OPCODE_VIEWPORT_INDEXED_FV: {
11942 GLfloat v[4];
11943 v[0] = n[2].f;
11944 v[1] = n[3].f;
11945 v[2] = n[4].f;
11946 v[3] = n[5].f;
11947 CALL_ViewportIndexedfv(ctx->Exec, (n[1].ui, v));
11948 break;
11949 }
11950 case OPCODE_SCISSOR_ARRAY_V:
11951 CALL_ScissorArrayv(ctx->Exec, (n[1].ui, n[2].si,
11952 get_pointer(&n[3])));
11953 break;
11954 case OPCODE_SCISSOR_INDEXED:
11955 CALL_ScissorIndexed(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].si,
11956 n[5].si));
11957 break;
11958 case OPCODE_SCISSOR_INDEXED_V: {
11959 GLint v[4];
11960 v[0] = n[2].i;
11961 v[1] = n[3].i;
11962 v[2] = n[4].si;
11963 v[3] = n[5].si;
11964 CALL_ScissorIndexedv(ctx->Exec, (n[1].ui, v));
11965 break;
11966 }
11967 case OPCODE_DEPTH_ARRAY_V:
11968 CALL_DepthRangeArrayv(ctx->Exec, (n[1].ui, n[2].si,
11969 get_pointer(&n[3])));
11970 break;
11971 case OPCODE_DEPTH_INDEXED:
11972 CALL_DepthRangeIndexed(ctx->Exec, (n[1].ui, n[2].f, n[3].f));
11973 break;
11974 case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
11975 CALL_ActiveTexture(ctx->Exec, (n[1].e));
11976 break;
11977 case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
11978 CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11979 n[4].i, n[5].i, n[6].i,
11980 get_pointer(&n[7])));
11981 break;
11982 case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
11983 CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11984 n[4].i, n[5].i, n[6].i,
11985 n[7].i, get_pointer(&n[8])));
11986 break;
11987 case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
11988 CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
11989 n[4].i, n[5].i, n[6].i,
11990 n[7].i, n[8].i,
11991 get_pointer(&n[9])));
11992 break;
11993 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
11994 CALL_CompressedTexSubImage1D(ctx->Exec,
11995 (n[1].e, n[2].i, n[3].i, n[4].i,
11996 n[5].e, n[6].i,
11997 get_pointer(&n[7])));
11998 break;
11999 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
12000 CALL_CompressedTexSubImage2D(ctx->Exec,
12001 (n[1].e, n[2].i, n[3].i, n[4].i,
12002 n[5].i, n[6].i, n[7].e, n[8].i,
12003 get_pointer(&n[9])));
12004 break;
12005 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
12006 CALL_CompressedTexSubImage3D(ctx->Exec,
12007 (n[1].e, n[2].i, n[3].i, n[4].i,
12008 n[5].i, n[6].i, n[7].i, n[8].i,
12009 n[9].e, n[10].i,
12010 get_pointer(&n[11])));
12011 break;
12012 case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
12013 CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
12014 break;
12015 case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
12016 CALL_WindowPos3f(ctx->Exec, (n[1].f, n[2].f, n[3].f));
12017 break;
12018 case OPCODE_BIND_PROGRAM_ARB: /* GL_ARB_vertex_program */
12019 CALL_BindProgramARB(ctx->Exec, (n[1].e, n[2].ui));
12020 break;
12021 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
12022 CALL_ProgramLocalParameter4fARB(ctx->Exec,
12023 (n[1].e, n[2].ui, n[3].f, n[4].f,
12024 n[5].f, n[6].f));
12025 break;
12026 case OPCODE_ACTIVE_STENCIL_FACE_EXT:
12027 CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
12028 break;
12029 case OPCODE_DEPTH_BOUNDS_EXT:
12030 CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
12031 break;
12032 case OPCODE_PROGRAM_STRING_ARB:
12033 CALL_ProgramStringARB(ctx->Exec,
12034 (n[1].e, n[2].e, n[3].i,
12035 get_pointer(&n[4])));
12036 break;
12037 case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
12038 CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
12039 n[4].f, n[5].f,
12040 n[6].f));
12041 break;
12042 case OPCODE_BEGIN_QUERY_ARB:
12043 CALL_BeginQuery(ctx->Exec, (n[1].e, n[2].ui));
12044 break;
12045 case OPCODE_END_QUERY_ARB:
12046 CALL_EndQuery(ctx->Exec, (n[1].e));
12047 break;
12048 case OPCODE_QUERY_COUNTER:
12049 CALL_QueryCounter(ctx->Exec, (n[1].ui, n[2].e));
12050 break;
12051 case OPCODE_BEGIN_QUERY_INDEXED:
12052 CALL_BeginQueryIndexed(ctx->Exec, (n[1].e, n[2].ui, n[3].ui));
12053 break;
12054 case OPCODE_END_QUERY_INDEXED:
12055 CALL_EndQueryIndexed(ctx->Exec, (n[1].e, n[2].ui));
12056 break;
12057 case OPCODE_DRAW_BUFFERS_ARB:
12058 {
12059 GLenum buffers[MAX_DRAW_BUFFERS];
12060 GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
12061 for (i = 0; i < count; i++)
12062 buffers[i] = n[2 + i].e;
12063 CALL_DrawBuffers(ctx->Exec, (n[1].i, buffers));
12064 }
12065 break;
12066 case OPCODE_BLIT_FRAMEBUFFER:
12067 CALL_BlitFramebuffer(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i,
12068 n[5].i, n[6].i, n[7].i, n[8].i,
12069 n[9].i, n[10].e));
12070 break;
12071 case OPCODE_PRIMITIVE_RESTART_NV:
12072 CALL_PrimitiveRestartNV(ctx->Exec, ());
12073 break;
12074
12075 case OPCODE_USE_PROGRAM:
12076 CALL_UseProgram(ctx->Exec, (n[1].ui));
12077 break;
12078 case OPCODE_UNIFORM_1F:
12079 CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
12080 break;
12081 case OPCODE_UNIFORM_2F:
12082 CALL_Uniform2f(ctx->Exec, (n[1].i, n[2].f, n[3].f));
12083 break;
12084 case OPCODE_UNIFORM_3F:
12085 CALL_Uniform3f(ctx->Exec, (n[1].i, n[2].f, n[3].f, n[4].f));
12086 break;
12087 case OPCODE_UNIFORM_4F:
12088 CALL_Uniform4f(ctx->Exec,
12089 (n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
12090 break;
12091 case OPCODE_UNIFORM_1FV:
12092 CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12093 break;
12094 case OPCODE_UNIFORM_2FV:
12095 CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12096 break;
12097 case OPCODE_UNIFORM_3FV:
12098 CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12099 break;
12100 case OPCODE_UNIFORM_4FV:
12101 CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12102 break;
12103 case OPCODE_UNIFORM_1D: {
12104 union float64_pair x;
12105
12106 x.uint32[0] = n[2].ui;
12107 x.uint32[1] = n[3].ui;
12108
12109 CALL_Uniform1d(ctx->Exec, (n[1].i, x.d));
12110 break;
12111 }
12112 case OPCODE_UNIFORM_2D: {
12113 union float64_pair x;
12114 union float64_pair y;
12115
12116 x.uint32[0] = n[2].ui;
12117 x.uint32[1] = n[3].ui;
12118 y.uint32[0] = n[4].ui;
12119 y.uint32[1] = n[5].ui;
12120
12121 CALL_Uniform2d(ctx->Exec, (n[1].i, x.d, y.d));
12122 break;
12123 }
12124 case OPCODE_UNIFORM_3D: {
12125 union float64_pair x;
12126 union float64_pair y;
12127 union float64_pair z;
12128
12129 x.uint32[0] = n[2].ui;
12130 x.uint32[1] = n[3].ui;
12131 y.uint32[0] = n[4].ui;
12132 y.uint32[1] = n[5].ui;
12133 z.uint32[0] = n[6].ui;
12134 z.uint32[1] = n[7].ui;
12135
12136 CALL_Uniform3d(ctx->Exec, (n[1].i, x.d, y.d, z.d));
12137 break;
12138 }
12139 case OPCODE_UNIFORM_4D: {
12140 union float64_pair x;
12141 union float64_pair y;
12142 union float64_pair z;
12143 union float64_pair w;
12144
12145 x.uint32[0] = n[2].ui;
12146 x.uint32[1] = n[3].ui;
12147 y.uint32[0] = n[4].ui;
12148 y.uint32[1] = n[5].ui;
12149 z.uint32[0] = n[6].ui;
12150 z.uint32[1] = n[7].ui;
12151 w.uint32[0] = n[8].ui;
12152 w.uint32[1] = n[9].ui;
12153
12154 CALL_Uniform4d(ctx->Exec, (n[1].i, x.d, y.d, z.d, w.d));
12155 break;
12156 }
12157 case OPCODE_UNIFORM_1DV:
12158 CALL_Uniform1dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12159 break;
12160 case OPCODE_UNIFORM_2DV:
12161 CALL_Uniform2dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12162 break;
12163 case OPCODE_UNIFORM_3DV:
12164 CALL_Uniform3dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12165 break;
12166 case OPCODE_UNIFORM_4DV:
12167 CALL_Uniform4dv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12168 break;
12169 case OPCODE_UNIFORM_1I:
12170 CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
12171 break;
12172 case OPCODE_UNIFORM_2I:
12173 CALL_Uniform2i(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12174 break;
12175 case OPCODE_UNIFORM_3I:
12176 CALL_Uniform3i(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12177 break;
12178 case OPCODE_UNIFORM_4I:
12179 CALL_Uniform4i(ctx->Exec,
12180 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12181 break;
12182 case OPCODE_UNIFORM_1IV:
12183 CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12184 break;
12185 case OPCODE_UNIFORM_2IV:
12186 CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12187 break;
12188 case OPCODE_UNIFORM_3IV:
12189 CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12190 break;
12191 case OPCODE_UNIFORM_4IV:
12192 CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12193 break;
12194 case OPCODE_UNIFORM_1UI:
12195 CALL_Uniform1ui(ctx->Exec, (n[1].i, n[2].i));
12196 break;
12197 case OPCODE_UNIFORM_2UI:
12198 CALL_Uniform2ui(ctx->Exec, (n[1].i, n[2].i, n[3].i));
12199 break;
12200 case OPCODE_UNIFORM_3UI:
12201 CALL_Uniform3ui(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12202 break;
12203 case OPCODE_UNIFORM_4UI:
12204 CALL_Uniform4ui(ctx->Exec,
12205 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
12206 break;
12207 case OPCODE_UNIFORM_1UIV:
12208 CALL_Uniform1uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12209 break;
12210 case OPCODE_UNIFORM_2UIV:
12211 CALL_Uniform2uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12212 break;
12213 case OPCODE_UNIFORM_3UIV:
12214 CALL_Uniform3uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12215 break;
12216 case OPCODE_UNIFORM_4UIV:
12217 CALL_Uniform4uiv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12218 break;
12219 case OPCODE_UNIFORM_MATRIX22:
12220 CALL_UniformMatrix2fv(ctx->Exec,
12221 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12222 break;
12223 case OPCODE_UNIFORM_MATRIX33:
12224 CALL_UniformMatrix3fv(ctx->Exec,
12225 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12226 break;
12227 case OPCODE_UNIFORM_MATRIX44:
12228 CALL_UniformMatrix4fv(ctx->Exec,
12229 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12230 break;
12231 case OPCODE_UNIFORM_MATRIX23:
12232 CALL_UniformMatrix2x3fv(ctx->Exec,
12233 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12234 break;
12235 case OPCODE_UNIFORM_MATRIX32:
12236 CALL_UniformMatrix3x2fv(ctx->Exec,
12237 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12238 break;
12239 case OPCODE_UNIFORM_MATRIX24:
12240 CALL_UniformMatrix2x4fv(ctx->Exec,
12241 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12242 break;
12243 case OPCODE_UNIFORM_MATRIX42:
12244 CALL_UniformMatrix4x2fv(ctx->Exec,
12245 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12246 break;
12247 case OPCODE_UNIFORM_MATRIX34:
12248 CALL_UniformMatrix3x4fv(ctx->Exec,
12249 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12250 break;
12251 case OPCODE_UNIFORM_MATRIX43:
12252 CALL_UniformMatrix4x3fv(ctx->Exec,
12253 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12254 break;
12255 case OPCODE_UNIFORM_MATRIX22D:
12256 CALL_UniformMatrix2dv(ctx->Exec,
12257 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12258 break;
12259 case OPCODE_UNIFORM_MATRIX33D:
12260 CALL_UniformMatrix3dv(ctx->Exec,
12261 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12262 break;
12263 case OPCODE_UNIFORM_MATRIX44D:
12264 CALL_UniformMatrix4dv(ctx->Exec,
12265 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12266 break;
12267 case OPCODE_UNIFORM_MATRIX23D:
12268 CALL_UniformMatrix2x3dv(ctx->Exec,
12269 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12270 break;
12271 case OPCODE_UNIFORM_MATRIX32D:
12272 CALL_UniformMatrix3x2dv(ctx->Exec,
12273 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12274 break;
12275 case OPCODE_UNIFORM_MATRIX24D:
12276 CALL_UniformMatrix2x4dv(ctx->Exec,
12277 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12278 break;
12279 case OPCODE_UNIFORM_MATRIX42D:
12280 CALL_UniformMatrix4x2dv(ctx->Exec,
12281 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12282 break;
12283 case OPCODE_UNIFORM_MATRIX34D:
12284 CALL_UniformMatrix3x4dv(ctx->Exec,
12285 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12286 break;
12287 case OPCODE_UNIFORM_MATRIX43D:
12288 CALL_UniformMatrix4x3dv(ctx->Exec,
12289 (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
12290 break;
12291
12292 case OPCODE_UNIFORM_1I64: {
12293 union int64_pair x;
12294
12295 x.int32[0] = n[2].i;
12296 x.int32[1] = n[3].i;
12297
12298 CALL_Uniform1i64ARB(ctx->Exec, (n[1].i, x.int64));
12299 break;
12300 }
12301 case OPCODE_UNIFORM_2I64: {
12302 union int64_pair x;
12303 union int64_pair y;
12304
12305 x.int32[0] = n[2].i;
12306 x.int32[1] = n[3].i;
12307 y.int32[0] = n[4].i;
12308 y.int32[1] = n[5].i;
12309
12310 CALL_Uniform2i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64));
12311 break;
12312 }
12313 case OPCODE_UNIFORM_3I64: {
12314 union int64_pair x;
12315 union int64_pair y;
12316 union int64_pair z;
12317
12318 x.int32[0] = n[2].i;
12319 x.int32[1] = n[3].i;
12320 y.int32[0] = n[4].i;
12321 y.int32[1] = n[5].i;
12322 z.int32[0] = n[6].i;
12323 z.int32[1] = n[7].i;
12324
12325
12326 CALL_Uniform3i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64));
12327 break;
12328 }
12329 case OPCODE_UNIFORM_4I64: {
12330 union int64_pair x;
12331 union int64_pair y;
12332 union int64_pair z;
12333 union int64_pair w;
12334
12335 x.int32[0] = n[2].i;
12336 x.int32[1] = n[3].i;
12337 y.int32[0] = n[4].i;
12338 y.int32[1] = n[5].i;
12339 z.int32[0] = n[6].i;
12340 z.int32[1] = n[7].i;
12341 w.int32[0] = n[8].i;
12342 w.int32[1] = n[9].i;
12343
12344 CALL_Uniform4i64ARB(ctx->Exec, (n[1].i, x.int64, y.int64, z.int64, w.int64));
12345 break;
12346 }
12347 case OPCODE_UNIFORM_1I64V:
12348 CALL_Uniform1i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12349 break;
12350 case OPCODE_UNIFORM_2I64V:
12351 CALL_Uniform2i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12352 break;
12353 case OPCODE_UNIFORM_3I64V:
12354 CALL_Uniform3i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12355 break;
12356 case OPCODE_UNIFORM_4I64V:
12357 CALL_Uniform4i64vARB(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
12358 break;
12359 case OPCODE_UNIFORM_1UI64: {
12360 union uint64_pair x;
12361
12362 x.uint32[0] = n[2].ui;
12363 x.uint32[1] = n[3].ui;
12364
12365 CALL_Uniform1ui64ARB(ctx->Exec, (n[1].i, x.uint64));
12366 break;
12367 }
12368 case OPCODE_UNIFORM_2UI64: {
12369 union uint64_pair x;
12370 union uint64_pair y;
12371
12372 x.uint32[0] = n[2].ui;
12373 x.uint32[1] = n[3].ui;
12374 y.uint32[0] = n[4].ui;
12375 y.uint32[1] = n[5].ui;
12376
12377 CALL_Uniform2ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64));
12378 break;
12379 }
12380 case OPCODE_UNIFORM_3UI64: {
12381 union uint64_pair x;
12382 union uint64_pair y;
12383 union uint64_pair z;
12384
12385 x.uint32[0] = n[2].ui;
12386 x.uint32[1] = n[3].ui;
12387 y.uint32[0] = n[4].ui;
12388 y.uint32[1] = n[5].ui;
12389 z.uint32[0] = n[6].ui;
12390 z.uint32[1] = n[7].ui;
12391
12392
12393 CALL_Uniform3ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12394 z.uint64));
12395 break;
12396 }
12397 case OPCODE_UNIFORM_4UI64: {
12398 union uint64_pair x;
12399 union uint64_pair y;
12400 union uint64_pair z;
12401 union uint64_pair w;
12402
12403 x.uint32[0] = n[2].ui;
12404 x.uint32[1] = n[3].ui;
12405 y.uint32[0] = n[4].ui;
12406 y.uint32[1] = n[5].ui;
12407 z.uint32[0] = n[6].ui;
12408 z.uint32[1] = n[7].ui;
12409 w.uint32[0] = n[8].ui;
12410 w.uint32[1] = n[9].ui;
12411
12412 CALL_Uniform4ui64ARB(ctx->Exec, (n[1].i, x.uint64, y.uint64,
12413 z.uint64, w.uint64));
12414 break;
12415 }
12416 case OPCODE_UNIFORM_1UI64V:
12417 CALL_Uniform1ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12418 get_pointer(&n[3])));
12419 break;
12420 case OPCODE_UNIFORM_2UI64V:
12421 CALL_Uniform2ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12422 get_pointer(&n[3])));
12423 break;
12424 case OPCODE_UNIFORM_3UI64V:
12425 CALL_Uniform3ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12426 get_pointer(&n[3])));
12427 break;
12428 case OPCODE_UNIFORM_4UI64V:
12429 CALL_Uniform4ui64vARB(ctx->Exec, (n[1].i, n[2].i,
12430 get_pointer(&n[3])));
12431 break;
12432
12433 case OPCODE_PROGRAM_UNIFORM_1I64: {
12434 union int64_pair x;
12435
12436 x.int32[0] = n[3].i;
12437 x.int32[1] = n[4].i;
12438
12439 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64));
12440 break;
12441 }
12442 case OPCODE_PROGRAM_UNIFORM_2I64: {
12443 union int64_pair x;
12444 union int64_pair y;
12445
12446 x.int32[0] = n[3].i;
12447 x.int32[1] = n[4].i;
12448 y.int32[0] = n[5].i;
12449 y.int32[1] = n[6].i;
12450
12451 CALL_ProgramUniform2i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12452 y.int64));
12453 break;
12454 }
12455 case OPCODE_PROGRAM_UNIFORM_3I64: {
12456 union int64_pair x;
12457 union int64_pair y;
12458 union int64_pair z;
12459
12460 x.int32[0] = n[3].i;
12461 x.int32[1] = n[4].i;
12462 y.int32[0] = n[5].i;
12463 y.int32[1] = n[6].i;
12464 z.int32[0] = n[7].i;
12465 z.int32[1] = n[8].i;
12466
12467 CALL_ProgramUniform3i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12468 y.int64, z.int64));
12469 break;
12470 }
12471 case OPCODE_PROGRAM_UNIFORM_4I64: {
12472 union int64_pair x;
12473 union int64_pair y;
12474 union int64_pair z;
12475 union int64_pair w;
12476
12477 x.int32[0] = n[3].i;
12478 x.int32[1] = n[4].i;
12479 y.int32[0] = n[5].i;
12480 y.int32[1] = n[6].i;
12481 z.int32[0] = n[7].i;
12482 z.int32[1] = n[8].i;
12483 w.int32[0] = n[9].i;
12484 w.int32[1] = n[10].i;
12485
12486 CALL_ProgramUniform4i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.int64,
12487 y.int64, z.int64, w.int64));
12488 break;
12489 }
12490 case OPCODE_PROGRAM_UNIFORM_1I64V:
12491 CALL_ProgramUniform1i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12492 get_pointer(&n[4])));
12493 break;
12494 case OPCODE_PROGRAM_UNIFORM_2I64V:
12495 CALL_ProgramUniform2i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12496 get_pointer(&n[4])));
12497 break;
12498 case OPCODE_PROGRAM_UNIFORM_3I64V:
12499 CALL_ProgramUniform3i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12500 get_pointer(&n[4])));
12501 break;
12502 case OPCODE_PROGRAM_UNIFORM_4I64V:
12503 CALL_ProgramUniform4i64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12504 get_pointer(&n[4])));
12505 break;
12506 case OPCODE_PROGRAM_UNIFORM_1UI64: {
12507 union uint64_pair x;
12508
12509 x.uint32[0] = n[3].ui;
12510 x.uint32[1] = n[4].ui;
12511
12512 CALL_ProgramUniform1i64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64));
12513 break;
12514 }
12515 case OPCODE_PROGRAM_UNIFORM_2UI64: {
12516 union uint64_pair x;
12517 union uint64_pair y;
12518
12519 x.uint32[0] = n[3].ui;
12520 x.uint32[1] = n[4].ui;
12521 y.uint32[0] = n[5].ui;
12522 y.uint32[1] = n[6].ui;
12523
12524 CALL_ProgramUniform2ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12525 y.uint64));
12526 break;
12527 }
12528 case OPCODE_PROGRAM_UNIFORM_3UI64: {
12529 union uint64_pair x;
12530 union uint64_pair y;
12531 union uint64_pair z;
12532
12533 x.uint32[0] = n[3].ui;
12534 x.uint32[1] = n[4].ui;
12535 y.uint32[0] = n[5].ui;
12536 y.uint32[1] = n[6].ui;
12537 z.uint32[0] = n[7].ui;
12538 z.uint32[1] = n[8].ui;
12539
12540 CALL_ProgramUniform3ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12541 y.uint64, z.uint64));
12542 break;
12543 }
12544 case OPCODE_PROGRAM_UNIFORM_4UI64: {
12545 union uint64_pair x;
12546 union uint64_pair y;
12547 union uint64_pair z;
12548 union uint64_pair w;
12549
12550 x.uint32[0] = n[3].ui;
12551 x.uint32[1] = n[4].ui;
12552 y.uint32[0] = n[5].ui;
12553 y.uint32[1] = n[6].ui;
12554 z.uint32[0] = n[7].ui;
12555 z.uint32[1] = n[8].ui;
12556 w.uint32[0] = n[9].ui;
12557 w.uint32[1] = n[10].ui;
12558
12559 CALL_ProgramUniform4ui64ARB(ctx->Exec, (n[1].ui, n[2].i, x.uint64,
12560 y.uint64, z.uint64, w.uint64));
12561 break;
12562 }
12563 case OPCODE_PROGRAM_UNIFORM_1UI64V:
12564 CALL_ProgramUniform1ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12565 get_pointer(&n[4])));
12566 break;
12567 case OPCODE_PROGRAM_UNIFORM_2UI64V:
12568 CALL_ProgramUniform2ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12569 get_pointer(&n[4])));
12570 break;
12571 case OPCODE_PROGRAM_UNIFORM_3UI64V:
12572 CALL_ProgramUniform3ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12573 get_pointer(&n[4])));
12574 break;
12575 case OPCODE_PROGRAM_UNIFORM_4UI64V:
12576 CALL_ProgramUniform4ui64vARB(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12577 get_pointer(&n[4])));
12578 break;
12579
12580 case OPCODE_USE_PROGRAM_STAGES:
12581 CALL_UseProgramStages(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
12582 break;
12583 case OPCODE_PROGRAM_UNIFORM_1F:
12584 CALL_ProgramUniform1f(ctx->Exec, (n[1].ui, n[2].i, n[3].f));
12585 break;
12586 case OPCODE_PROGRAM_UNIFORM_2F:
12587 CALL_ProgramUniform2f(ctx->Exec, (n[1].ui, n[2].i, n[3].f, n[4].f));
12588 break;
12589 case OPCODE_PROGRAM_UNIFORM_3F:
12590 CALL_ProgramUniform3f(ctx->Exec, (n[1].ui, n[2].i,
12591 n[3].f, n[4].f, n[5].f));
12592 break;
12593 case OPCODE_PROGRAM_UNIFORM_4F:
12594 CALL_ProgramUniform4f(ctx->Exec, (n[1].ui, n[2].i,
12595 n[3].f, n[4].f, n[5].f, n[6].f));
12596 break;
12597 case OPCODE_PROGRAM_UNIFORM_1FV:
12598 CALL_ProgramUniform1fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12599 get_pointer(&n[4])));
12600 break;
12601 case OPCODE_PROGRAM_UNIFORM_2FV:
12602 CALL_ProgramUniform2fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12603 get_pointer(&n[4])));
12604 break;
12605 case OPCODE_PROGRAM_UNIFORM_3FV:
12606 CALL_ProgramUniform3fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12607 get_pointer(&n[4])));
12608 break;
12609 case OPCODE_PROGRAM_UNIFORM_4FV:
12610 CALL_ProgramUniform4fv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12611 get_pointer(&n[4])));
12612 break;
12613 case OPCODE_PROGRAM_UNIFORM_1D: {
12614 union float64_pair x;
12615
12616 x.uint32[0] = n[3].ui;
12617 x.uint32[1] = n[4].ui;
12618
12619 CALL_ProgramUniform1d(ctx->Exec, (n[1].ui, n[2].i, x.d));
12620 break;
12621 }
12622 case OPCODE_PROGRAM_UNIFORM_2D: {
12623 union float64_pair x;
12624 union float64_pair y;
12625
12626 x.uint32[0] = n[3].ui;
12627 x.uint32[1] = n[4].ui;
12628 y.uint32[0] = n[5].ui;
12629 y.uint32[1] = n[6].ui;
12630
12631 CALL_ProgramUniform2d(ctx->Exec, (n[1].ui, n[2].i, x.d, y.d));
12632 break;
12633 }
12634 case OPCODE_PROGRAM_UNIFORM_3D: {
12635 union float64_pair x;
12636 union float64_pair y;
12637 union float64_pair z;
12638
12639 x.uint32[0] = n[3].ui;
12640 x.uint32[1] = n[4].ui;
12641 y.uint32[0] = n[5].ui;
12642 y.uint32[1] = n[6].ui;
12643 z.uint32[0] = n[7].ui;
12644 z.uint32[1] = n[8].ui;
12645
12646 CALL_ProgramUniform3d(ctx->Exec, (n[1].ui, n[2].i,
12647 x.d, y.d, z.d));
12648 break;
12649 }
12650 case OPCODE_PROGRAM_UNIFORM_4D: {
12651 union float64_pair x;
12652 union float64_pair y;
12653 union float64_pair z;
12654 union float64_pair w;
12655
12656 x.uint32[0] = n[3].ui;
12657 x.uint32[1] = n[4].ui;
12658 y.uint32[0] = n[5].ui;
12659 y.uint32[1] = n[6].ui;
12660 z.uint32[0] = n[7].ui;
12661 z.uint32[1] = n[8].ui;
12662 w.uint32[0] = n[9].ui;
12663 w.uint32[1] = n[10].ui;
12664
12665 CALL_ProgramUniform4d(ctx->Exec, (n[1].ui, n[2].i,
12666 x.d, y.d, z.d, w.d));
12667 break;
12668 }
12669 case OPCODE_PROGRAM_UNIFORM_1DV:
12670 CALL_ProgramUniform1dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12671 get_pointer(&n[4])));
12672 break;
12673 case OPCODE_PROGRAM_UNIFORM_2DV:
12674 CALL_ProgramUniform2dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12675 get_pointer(&n[4])));
12676 break;
12677 case OPCODE_PROGRAM_UNIFORM_3DV:
12678 CALL_ProgramUniform3dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12679 get_pointer(&n[4])));
12680 break;
12681 case OPCODE_PROGRAM_UNIFORM_4DV:
12682 CALL_ProgramUniform4dv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12683 get_pointer(&n[4])));
12684 break;
12685 case OPCODE_PROGRAM_UNIFORM_1I:
12686 CALL_ProgramUniform1i(ctx->Exec, (n[1].ui, n[2].i, n[3].i));
12687 break;
12688 case OPCODE_PROGRAM_UNIFORM_2I:
12689 CALL_ProgramUniform2i(ctx->Exec, (n[1].ui, n[2].i, n[3].i, n[4].i));
12690 break;
12691 case OPCODE_PROGRAM_UNIFORM_3I:
12692 CALL_ProgramUniform3i(ctx->Exec, (n[1].ui, n[2].i,
12693 n[3].i, n[4].i, n[5].i));
12694 break;
12695 case OPCODE_PROGRAM_UNIFORM_4I:
12696 CALL_ProgramUniform4i(ctx->Exec, (n[1].ui, n[2].i,
12697 n[3].i, n[4].i, n[5].i, n[6].i));
12698 break;
12699 case OPCODE_PROGRAM_UNIFORM_1IV:
12700 CALL_ProgramUniform1iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12701 get_pointer(&n[4])));
12702 break;
12703 case OPCODE_PROGRAM_UNIFORM_2IV:
12704 CALL_ProgramUniform2iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12705 get_pointer(&n[4])));
12706 break;
12707 case OPCODE_PROGRAM_UNIFORM_3IV:
12708 CALL_ProgramUniform3iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12709 get_pointer(&n[4])));
12710 break;
12711 case OPCODE_PROGRAM_UNIFORM_4IV:
12712 CALL_ProgramUniform4iv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12713 get_pointer(&n[4])));
12714 break;
12715 case OPCODE_PROGRAM_UNIFORM_1UI:
12716 CALL_ProgramUniform1ui(ctx->Exec, (n[1].ui, n[2].i, n[3].ui));
12717 break;
12718 case OPCODE_PROGRAM_UNIFORM_2UI:
12719 CALL_ProgramUniform2ui(ctx->Exec, (n[1].ui, n[2].i,
12720 n[3].ui, n[4].ui));
12721 break;
12722 case OPCODE_PROGRAM_UNIFORM_3UI:
12723 CALL_ProgramUniform3ui(ctx->Exec, (n[1].ui, n[2].i,
12724 n[3].ui, n[4].ui, n[5].ui));
12725 break;
12726 case OPCODE_PROGRAM_UNIFORM_4UI:
12727 CALL_ProgramUniform4ui(ctx->Exec, (n[1].ui, n[2].i,
12728 n[3].ui,
12729 n[4].ui, n[5].ui, n[6].ui));
12730 break;
12731 case OPCODE_PROGRAM_UNIFORM_1UIV:
12732 CALL_ProgramUniform1uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12733 get_pointer(&n[4])));
12734 break;
12735 case OPCODE_PROGRAM_UNIFORM_2UIV:
12736 CALL_ProgramUniform2uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12737 get_pointer(&n[4])));
12738 break;
12739 case OPCODE_PROGRAM_UNIFORM_3UIV:
12740 CALL_ProgramUniform3uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12741 get_pointer(&n[4])));
12742 break;
12743 case OPCODE_PROGRAM_UNIFORM_4UIV:
12744 CALL_ProgramUniform4uiv(ctx->Exec, (n[1].ui, n[2].i, n[3].i,
12745 get_pointer(&n[4])));
12746 break;
12747 case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
12748 CALL_ProgramUniformMatrix2fv(ctx->Exec,
12749 (n[1].ui, n[2].i, n[3].i, n[4].b,
12750 get_pointer(&n[5])));
12751 break;
12752 case OPCODE_PROGRAM_UNIFORM_MATRIX23F:
12753 CALL_ProgramUniformMatrix2x3fv(ctx->Exec,
12754 (n[1].ui, n[2].i, n[3].i, n[4].b,
12755 get_pointer(&n[5])));
12756 break;
12757 case OPCODE_PROGRAM_UNIFORM_MATRIX24F:
12758 CALL_ProgramUniformMatrix2x4fv(ctx->Exec,
12759 (n[1].ui, n[2].i, n[3].i, n[4].b,
12760 get_pointer(&n[5])));
12761 break;
12762 case OPCODE_PROGRAM_UNIFORM_MATRIX32F:
12763 CALL_ProgramUniformMatrix3x2fv(ctx->Exec,
12764 (n[1].ui, n[2].i, n[3].i, n[4].b,
12765 get_pointer(&n[5])));
12766 break;
12767 case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
12768 CALL_ProgramUniformMatrix3fv(ctx->Exec,
12769 (n[1].ui, n[2].i, n[3].i, n[4].b,
12770 get_pointer(&n[5])));
12771 break;
12772 case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
12773 CALL_ProgramUniformMatrix3x4fv(ctx->Exec,
12774 (n[1].ui, n[2].i, n[3].i, n[4].b,
12775 get_pointer(&n[5])));
12776 break;
12777 case OPCODE_PROGRAM_UNIFORM_MATRIX42F:
12778 CALL_ProgramUniformMatrix4x2fv(ctx->Exec,
12779 (n[1].ui, n[2].i, n[3].i, n[4].b,
12780 get_pointer(&n[5])));
12781 break;
12782 case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
12783 CALL_ProgramUniformMatrix4x3fv(ctx->Exec,
12784 (n[1].ui, n[2].i, n[3].i, n[4].b,
12785 get_pointer(&n[5])));
12786 break;
12787 case OPCODE_PROGRAM_UNIFORM_MATRIX44F:
12788 CALL_ProgramUniformMatrix4fv(ctx->Exec,
12789 (n[1].ui, n[2].i, n[3].i, n[4].b,
12790 get_pointer(&n[5])));
12791 break;
12792 case OPCODE_PROGRAM_UNIFORM_MATRIX22D:
12793 CALL_ProgramUniformMatrix2dv(ctx->Exec,
12794 (n[1].ui, n[2].i, n[3].i, n[4].b,
12795 get_pointer(&n[5])));
12796 break;
12797 case OPCODE_PROGRAM_UNIFORM_MATRIX23D:
12798 CALL_ProgramUniformMatrix2x3dv(ctx->Exec,
12799 (n[1].ui, n[2].i, n[3].i, n[4].b,
12800 get_pointer(&n[5])));
12801 break;
12802 case OPCODE_PROGRAM_UNIFORM_MATRIX24D:
12803 CALL_ProgramUniformMatrix2x4dv(ctx->Exec,
12804 (n[1].ui, n[2].i, n[3].i, n[4].b,
12805 get_pointer(&n[5])));
12806 break;
12807 case OPCODE_PROGRAM_UNIFORM_MATRIX32D:
12808 CALL_ProgramUniformMatrix3x2dv(ctx->Exec,
12809 (n[1].ui, n[2].i, n[3].i, n[4].b,
12810 get_pointer(&n[5])));
12811 break;
12812 case OPCODE_PROGRAM_UNIFORM_MATRIX33D:
12813 CALL_ProgramUniformMatrix3dv(ctx->Exec,
12814 (n[1].ui, n[2].i, n[3].i, n[4].b,
12815 get_pointer(&n[5])));
12816 break;
12817 case OPCODE_PROGRAM_UNIFORM_MATRIX34D:
12818 CALL_ProgramUniformMatrix3x4dv(ctx->Exec,
12819 (n[1].ui, n[2].i, n[3].i, n[4].b,
12820 get_pointer(&n[5])));
12821 break;
12822 case OPCODE_PROGRAM_UNIFORM_MATRIX42D:
12823 CALL_ProgramUniformMatrix4x2dv(ctx->Exec,
12824 (n[1].ui, n[2].i, n[3].i, n[4].b,
12825 get_pointer(&n[5])));
12826 break;
12827 case OPCODE_PROGRAM_UNIFORM_MATRIX43D:
12828 CALL_ProgramUniformMatrix4x3dv(ctx->Exec,
12829 (n[1].ui, n[2].i, n[3].i, n[4].b,
12830 get_pointer(&n[5])));
12831 break;
12832 case OPCODE_PROGRAM_UNIFORM_MATRIX44D:
12833 CALL_ProgramUniformMatrix4dv(ctx->Exec,
12834 (n[1].ui, n[2].i, n[3].i, n[4].b,
12835 get_pointer(&n[5])));
12836 break;
12837
12838 case OPCODE_CLIP_CONTROL:
12839 CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
12840 break;
12841
12842 case OPCODE_CLAMP_COLOR:
12843 CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
12844 break;
12845
12846 case OPCODE_BIND_FRAGMENT_SHADER_ATI:
12847 CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
12848 break;
12849 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
12850 CALL_SetFragmentShaderConstantATI(ctx->Exec, (n[1].ui, &n[2].f));
12851 break;
12852 case OPCODE_ATTR_1F_NV:
12853 CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
12854 break;
12855 case OPCODE_ATTR_2F_NV:
12856 CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
12857 break;
12858 case OPCODE_ATTR_3F_NV:
12859 CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
12860 break;
12861 case OPCODE_ATTR_4F_NV:
12862 CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
12863 break;
12864 case OPCODE_ATTR_1F_ARB:
12865 CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
12866 break;
12867 case OPCODE_ATTR_2F_ARB:
12868 CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
12869 break;
12870 case OPCODE_ATTR_3F_ARB:
12871 CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
12872 break;
12873 case OPCODE_ATTR_4F_ARB:
12874 CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
12875 break;
12876 case OPCODE_ATTR_1I:
12877 CALL_VertexAttribI1iEXT(ctx->Exec, (n[1].e, n[2].i));
12878 break;
12879 case OPCODE_ATTR_2I:
12880 CALL_VertexAttribI2ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12881 break;
12882 case OPCODE_ATTR_3I:
12883 CALL_VertexAttribI3ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12884 break;
12885 case OPCODE_ATTR_4I:
12886 CALL_VertexAttribI4ivEXT(ctx->Exec, (n[1].e, &n[2].i));
12887 break;
12888 case OPCODE_ATTR_1D: {
12889 GLdouble *d = (GLdouble *) &n[2];
12890 CALL_VertexAttribL1d(ctx->Exec, (n[1].ui, *d));
12891 break;
12892 }
12893 case OPCODE_ATTR_2D: {
12894 GLdouble *d = (GLdouble *) &n[2];
12895 CALL_VertexAttribL2dv(ctx->Exec, (n[1].ui, d));
12896 break;
12897 }
12898 case OPCODE_ATTR_3D: {
12899 GLdouble *d = (GLdouble *) &n[2];
12900 CALL_VertexAttribL3dv(ctx->Exec, (n[1].ui, d));
12901 break;
12902 }
12903 case OPCODE_ATTR_4D: {
12904 GLdouble *d = (GLdouble *) &n[2];
12905 CALL_VertexAttribL4dv(ctx->Exec, (n[1].ui, d));
12906 break;
12907 }
12908 case OPCODE_ATTR_1UI64: {
12909 uint64_t *ui64 = (uint64_t *) &n[2];
12910 CALL_VertexAttribL1ui64ARB(ctx->Exec, (n[1].ui, *ui64));
12911 break;
12912 }
12913 case OPCODE_MATERIAL:
12914 CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
12915 break;
12916 case OPCODE_BEGIN:
12917 CALL_Begin(ctx->Exec, (n[1].e));
12918 break;
12919 case OPCODE_END:
12920 CALL_End(ctx->Exec, ());
12921 break;
12922 case OPCODE_RECTF:
12923 CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
12924 break;
12925 case OPCODE_EVAL_C1:
12926 CALL_EvalCoord1f(ctx->Exec, (n[1].f));
12927 break;
12928 case OPCODE_EVAL_C2:
12929 CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
12930 break;
12931 case OPCODE_EVAL_P1:
12932 CALL_EvalPoint1(ctx->Exec, (n[1].i));
12933 break;
12934 case OPCODE_EVAL_P2:
12935 CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
12936 break;
12937
12938 /* GL_EXT_texture_integer */
12939 case OPCODE_CLEARCOLOR_I:
12940 CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));
12941 break;
12942 case OPCODE_CLEARCOLOR_UI:
12943 CALL_ClearColorIuiEXT(ctx->Exec,
12944 (n[1].ui, n[2].ui, n[3].ui, n[4].ui));
12945 break;
12946 case OPCODE_TEXPARAMETER_I:
12947 {
12948 GLint params[4];
12949 params[0] = n[3].i;
12950 params[1] = n[4].i;
12951 params[2] = n[5].i;
12952 params[3] = n[6].i;
12953 CALL_TexParameterIiv(ctx->Exec, (n[1].e, n[2].e, params));
12954 }
12955 break;
12956 case OPCODE_TEXPARAMETER_UI:
12957 {
12958 GLuint params[4];
12959 params[0] = n[3].ui;
12960 params[1] = n[4].ui;
12961 params[2] = n[5].ui;
12962 params[3] = n[6].ui;
12963 CALL_TexParameterIuiv(ctx->Exec, (n[1].e, n[2].e, params));
12964 }
12965 break;
12966
12967 case OPCODE_VERTEX_ATTRIB_DIVISOR:
12968 /* GL_ARB_instanced_arrays */
12969 CALL_VertexAttribDivisor(ctx->Exec, (n[1].ui, n[2].ui));
12970 break;
12971
12972 case OPCODE_TEXTURE_BARRIER_NV:
12973 CALL_TextureBarrierNV(ctx->Exec, ());
12974 break;
12975
12976 /* GL_EXT/ARB_transform_feedback */
12977 case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
12978 CALL_BeginTransformFeedback(ctx->Exec, (n[1].e));
12979 break;
12980 case OPCODE_END_TRANSFORM_FEEDBACK:
12981 CALL_EndTransformFeedback(ctx->Exec, ());
12982 break;
12983 case OPCODE_BIND_TRANSFORM_FEEDBACK:
12984 CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12985 break;
12986 case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
12987 CALL_PauseTransformFeedback(ctx->Exec, ());
12988 break;
12989 case OPCODE_RESUME_TRANSFORM_FEEDBACK:
12990 CALL_ResumeTransformFeedback(ctx->Exec, ());
12991 break;
12992 case OPCODE_DRAW_TRANSFORM_FEEDBACK:
12993 CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
12994 break;
12995 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM:
12996 CALL_DrawTransformFeedbackStream(ctx->Exec,
12997 (n[1].e, n[2].ui, n[3].ui));
12998 break;
12999 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED:
13000 CALL_DrawTransformFeedbackInstanced(ctx->Exec,
13001 (n[1].e, n[2].ui, n[3].si));
13002 break;
13003 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED:
13004 CALL_DrawTransformFeedbackStreamInstanced(ctx->Exec,
13005 (n[1].e, n[2].ui, n[3].ui, n[4].si));
13006 break;
13007
13008
13009 case OPCODE_BIND_SAMPLER:
13010 CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
13011 break;
13012 case OPCODE_SAMPLER_PARAMETERIV:
13013 {
13014 GLint params[4];
13015 params[0] = n[3].i;
13016 params[1] = n[4].i;
13017 params[2] = n[5].i;
13018 params[3] = n[6].i;
13019 CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
13020 }
13021 break;
13022 case OPCODE_SAMPLER_PARAMETERFV:
13023 {
13024 GLfloat params[4];
13025 params[0] = n[3].f;
13026 params[1] = n[4].f;
13027 params[2] = n[5].f;
13028 params[3] = n[6].f;
13029 CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
13030 }
13031 break;
13032 case OPCODE_SAMPLER_PARAMETERIIV:
13033 {
13034 GLint params[4];
13035 params[0] = n[3].i;
13036 params[1] = n[4].i;
13037 params[2] = n[5].i;
13038 params[3] = n[6].i;
13039 CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
13040 }
13041 break;
13042 case OPCODE_SAMPLER_PARAMETERUIV:
13043 {
13044 GLuint params[4];
13045 params[0] = n[3].ui;
13046 params[1] = n[4].ui;
13047 params[2] = n[5].ui;
13048 params[3] = n[6].ui;
13049 CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
13050 }
13051 break;
13052
13053 /* ARB_compute_shader */
13054 case OPCODE_DISPATCH_COMPUTE:
13055 CALL_DispatchCompute(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13056 break;
13057
13058 /* GL_ARB_sync */
13059 case OPCODE_WAIT_SYNC:
13060 {
13061 union uint64_pair p;
13062 p.uint32[0] = n[2].ui;
13063 p.uint32[1] = n[3].ui;
13064 CALL_WaitSync(ctx->Exec,
13065 (get_pointer(&n[4]), n[1].bf, p.uint64));
13066 }
13067 break;
13068
13069 /* GL_NV_conditional_render */
13070 case OPCODE_BEGIN_CONDITIONAL_RENDER:
13071 CALL_BeginConditionalRender(ctx->Exec, (n[1].i, n[2].e));
13072 break;
13073 case OPCODE_END_CONDITIONAL_RENDER:
13074 CALL_EndConditionalRender(ctx->Exec, ());
13075 break;
13076
13077 case OPCODE_UNIFORM_BLOCK_BINDING:
13078 CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
13079 break;
13080
13081 case OPCODE_UNIFORM_SUBROUTINES:
13082 CALL_UniformSubroutinesuiv(ctx->Exec, (n[1].e, n[2].si,
13083 get_pointer(&n[3])));
13084 break;
13085
13086 /* GL_EXT_window_rectangles */
13087 case OPCODE_WINDOW_RECTANGLES:
13088 CALL_WindowRectanglesEXT(
13089 ctx->Exec, (n[1].e, n[2].si, get_pointer(&n[3])));
13090 break;
13091
13092 /* GL_NV_conservative_raster */
13093 case OPCODE_SUBPIXEL_PRECISION_BIAS:
13094 CALL_SubpixelPrecisionBiasNV(ctx->Exec, (n[1].ui, n[2].ui));
13095 break;
13096
13097 /* GL_NV_conservative_raster_dilate */
13098 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_F:
13099 CALL_ConservativeRasterParameterfNV(ctx->Exec, (n[1].e, n[2].f));
13100 break;
13101
13102 /* GL_NV_conservative_raster_pre_snap_triangles */
13103 case OPCODE_CONSERVATIVE_RASTER_PARAMETER_I:
13104 CALL_ConservativeRasterParameteriNV(ctx->Exec, (n[1].e, n[2].i));
13105 break;
13106
13107 /* GL_EXT_direct_state_access */
13108 case OPCODE_MATRIX_LOAD:
13109 CALL_MatrixLoadfEXT(ctx->Exec, (n[1].e, &n[2].f));
13110 break;
13111 case OPCODE_MATRIX_MULT:
13112 CALL_MatrixMultfEXT(ctx->Exec, (n[1].e, &n[2].f));
13113 break;
13114 case OPCODE_MATRIX_ROTATE:
13115 CALL_MatrixRotatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f));
13116 break;
13117 case OPCODE_MATRIX_SCALE:
13118 CALL_MatrixScalefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
13119 break;
13120 case OPCODE_MATRIX_TRANSLATE:
13121 CALL_MatrixTranslatefEXT(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f));
13122 break;
13123 case OPCODE_MATRIX_LOAD_IDENTITY:
13124 CALL_MatrixLoadIdentityEXT(ctx->Exec, (n[1].e));
13125 break;
13126 case OPCODE_MATRIX_ORTHO:
13127 CALL_MatrixOrthoEXT(ctx->Exec, (n[1].e,
13128 n[2].f, n[3].f, n[4].f,
13129 n[5].f, n[6].f, n[7].f));
13130 break;
13131 case OPCODE_MATRIX_FRUSTUM:
13132 CALL_MatrixFrustumEXT(ctx->Exec, (n[1].e,
13133 n[2].f, n[3].f, n[4].f,
13134 n[5].f, n[6].f, n[7].f));
13135 break;
13136 case OPCODE_MATRIX_PUSH:
13137 CALL_MatrixPushEXT(ctx->Exec, (n[1].e));
13138 break;
13139 case OPCODE_MATRIX_POP:
13140 CALL_MatrixPopEXT(ctx->Exec, (n[1].e));
13141 break;
13142 case OPCODE_TEXTUREPARAMETER_F:
13143 {
13144 GLfloat params[4];
13145 params[0] = n[4].f;
13146 params[1] = n[5].f;
13147 params[2] = n[6].f;
13148 params[3] = n[7].f;
13149 CALL_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13150 }
13151 break;
13152 case OPCODE_TEXTUREPARAMETER_I:
13153 {
13154 GLint params[4];
13155 params[0] = n[4].i;
13156 params[1] = n[5].i;
13157 params[2] = n[6].i;
13158 params[3] = n[7].i;
13159 CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13160 }
13161 break;
13162 case OPCODE_TEXTUREPARAMETER_II:
13163 {
13164 GLint params[4];
13165 params[0] = n[4].i;
13166 params[1] = n[5].i;
13167 params[2] = n[6].i;
13168 params[3] = n[7].i;
13169 CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13170 }
13171 break;
13172 case OPCODE_TEXTUREPARAMETER_IUI:
13173 {
13174 GLuint params[4];
13175 params[0] = n[4].ui;
13176 params[1] = n[5].ui;
13177 params[2] = n[6].ui;
13178 params[3] = n[7].ui;
13179 CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params));
13180 }
13181 break;
13182 case OPCODE_TEXTURE_IMAGE1D:
13183 {
13184 const struct gl_pixelstore_attrib save = ctx->Unpack;
13185 ctx->Unpack = ctx->DefaultPacking;
13186 CALL_TextureImage1DEXT(ctx->Exec, (n[1].ui, /* texture */
13187 n[2].e, /* target */
13188 n[3].i, /* level */
13189 n[4].i, /* components */
13190 n[5].i, /* width */
13191 n[6].e, /* border */
13192 n[7].e, /* format */
13193 n[8].e, /* type */
13194 get_pointer(&n[9])));
13195 ctx->Unpack = save; /* restore */
13196 }
13197 break;
13198 case OPCODE_TEXTURE_IMAGE2D:
13199 {
13200 const struct gl_pixelstore_attrib save = ctx->Unpack;
13201 ctx->Unpack = ctx->DefaultPacking;
13202 CALL_TextureImage2DEXT(ctx->Exec, (n[1].ui, /* texture */
13203 n[2].e, /* target */
13204 n[3].i, /* level */
13205 n[4].i, /* components */
13206 n[5].i, /* width */
13207 n[6].i, /* height */
13208 n[7].e, /* border */
13209 n[8].e, /* format */
13210 n[9].e, /* type */
13211 get_pointer(&n[10])));
13212 ctx->Unpack = save; /* restore */
13213 }
13214 break;
13215 case OPCODE_TEXTURE_IMAGE3D:
13216 {
13217 const struct gl_pixelstore_attrib save = ctx->Unpack;
13218 ctx->Unpack = ctx->DefaultPacking;
13219 CALL_TextureImage3DEXT(ctx->Exec, (n[1].ui, /* texture */
13220 n[2].e, /* target */
13221 n[3].i, /* level */
13222 n[4].i, /* components */
13223 n[5].i, /* width */
13224 n[6].i, /* height */
13225 n[7].i, /* depth */
13226 n[8].e, /* border */
13227 n[9].e, /* format */
13228 n[10].e, /* type */
13229 get_pointer(&n[11])));
13230 ctx->Unpack = save; /* restore */
13231 }
13232 break;
13233 case OPCODE_TEXTURE_SUB_IMAGE1D:
13234 {
13235 const struct gl_pixelstore_attrib save = ctx->Unpack;
13236 ctx->Unpack = ctx->DefaultPacking;
13237 CALL_TextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13238 n[4].i, n[5].i, n[6].e,
13239 n[7].e, get_pointer(&n[8])));
13240 ctx->Unpack = save; /* restore */
13241 }
13242 break;
13243 case OPCODE_TEXTURE_SUB_IMAGE2D:
13244 {
13245 const struct gl_pixelstore_attrib save = ctx->Unpack;
13246 ctx->Unpack = ctx->DefaultPacking;
13247 CALL_TextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13248 n[4].i, n[5].i, n[6].e,
13249 n[7].i, n[8].e, n[9].e,
13250 get_pointer(&n[10])));
13251 ctx->Unpack = save;
13252 }
13253 break;
13254 case OPCODE_TEXTURE_SUB_IMAGE3D:
13255 {
13256 const struct gl_pixelstore_attrib save = ctx->Unpack;
13257 ctx->Unpack = ctx->DefaultPacking;
13258 CALL_TextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13259 n[4].i, n[5].i, n[6].i,
13260 n[7].i, n[8].i, n[9].i,
13261 n[10].e, n[11].e,
13262 get_pointer(&n[12])));
13263 ctx->Unpack = save; /* restore */
13264 }
13265 break;
13266 case OPCODE_COPY_TEXTURE_IMAGE1D:
13267 CALL_CopyTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13268 n[4].e, n[5].i, n[6].i,
13269 n[7].i, n[8].i));
13270 break;
13271 case OPCODE_COPY_TEXTURE_IMAGE2D:
13272 CALL_CopyTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13273 n[4].e, n[5].i, n[6].i,
13274 n[7].i, n[8].i, n[9].i));
13275 break;
13276 case OPCODE_COPY_TEXTURE_SUB_IMAGE1D:
13277 CALL_CopyTextureSubImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13278 n[4].i, n[5].i, n[6].i,
13279 n[7].i));
13280 break;
13281 case OPCODE_COPY_TEXTURE_SUB_IMAGE2D:
13282 CALL_CopyTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13283 n[4].i, n[5].i, n[6].i,
13284 n[7].i, n[8].i, n[9].i));
13285 break;
13286 case OPCODE_COPY_TEXTURE_SUB_IMAGE3D:
13287 CALL_CopyTextureSubImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13288 n[4].i, n[5].i, n[6].i,
13289 n[7].i, n[8].i, n[9].i,
13290 n[10].i));
13291 break;
13292 case OPCODE_BIND_MULTITEXTURE:
13293 CALL_BindMultiTextureEXT(ctx->Exec, (n[1].e, n[2].e, n[3].ui));
13294 break;
13295 case OPCODE_MULTITEXPARAMETER_F:
13296 {
13297 GLfloat params[4];
13298 params[0] = n[4].f;
13299 params[1] = n[5].f;
13300 params[2] = n[6].f;
13301 params[3] = n[7].f;
13302 CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13303 }
13304 break;
13305 case OPCODE_MULTITEXPARAMETER_I:
13306 {
13307 GLint params[4];
13308 params[0] = n[4].i;
13309 params[1] = n[5].i;
13310 params[2] = n[6].i;
13311 params[3] = n[7].i;
13312 CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13313 }
13314 break;
13315 case OPCODE_MULTITEXPARAMETER_II:
13316 {
13317 GLint params[4];
13318 params[0] = n[4].i;
13319 params[1] = n[5].i;
13320 params[2] = n[6].i;
13321 params[3] = n[7].i;
13322 CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13323 }
13324 break;
13325 case OPCODE_MULTITEXPARAMETER_IUI:
13326 {
13327 GLuint params[4];
13328 params[0] = n[4].ui;
13329 params[1] = n[5].ui;
13330 params[2] = n[6].ui;
13331 params[3] = n[7].ui;
13332 CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13333 }
13334 break;
13335 case OPCODE_MULTITEX_IMAGE1D:
13336 {
13337 const struct gl_pixelstore_attrib save = ctx->Unpack;
13338 ctx->Unpack = ctx->DefaultPacking;
13339 CALL_MultiTexImage1DEXT(ctx->Exec, (n[1].e, /* texture */
13340 n[2].e, /* target */
13341 n[3].i, /* level */
13342 n[4].i, /* components */
13343 n[5].i, /* width */
13344 n[6].e, /* border */
13345 n[7].e, /* format */
13346 n[8].e, /* type */
13347 get_pointer(&n[9])));
13348 ctx->Unpack = save; /* restore */
13349 }
13350 break;
13351 case OPCODE_MULTITEX_IMAGE2D:
13352 {
13353 const struct gl_pixelstore_attrib save = ctx->Unpack;
13354 ctx->Unpack = ctx->DefaultPacking;
13355 CALL_MultiTexImage2DEXT(ctx->Exec, (n[1].e, /* texture */
13356 n[2].e, /* target */
13357 n[3].i, /* level */
13358 n[4].i, /* components */
13359 n[5].i, /* width */
13360 n[6].i, /* height */
13361 n[7].e, /* border */
13362 n[8].e, /* format */
13363 n[9].e, /* type */
13364 get_pointer(&n[10])));
13365 ctx->Unpack = save; /* restore */
13366 }
13367 break;
13368 case OPCODE_MULTITEX_IMAGE3D:
13369 {
13370 const struct gl_pixelstore_attrib save = ctx->Unpack;
13371 ctx->Unpack = ctx->DefaultPacking;
13372 CALL_MultiTexImage3DEXT(ctx->Exec, (n[1].e, /* texture */
13373 n[2].e, /* target */
13374 n[3].i, /* level */
13375 n[4].i, /* components */
13376 n[5].i, /* width */
13377 n[6].i, /* height */
13378 n[7].i, /* depth */
13379 n[8].e, /* border */
13380 n[9].e, /* format */
13381 n[10].e, /* type */
13382 get_pointer(&n[11])));
13383 ctx->Unpack = save; /* restore */
13384 }
13385 break;
13386 case OPCODE_MULTITEX_SUB_IMAGE1D:
13387 {
13388 const struct gl_pixelstore_attrib save = ctx->Unpack;
13389 ctx->Unpack = ctx->DefaultPacking;
13390 CALL_MultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13391 n[4].i, n[5].i, n[6].e,
13392 n[7].e, get_pointer(&n[8])));
13393 ctx->Unpack = save; /* restore */
13394 }
13395 break;
13396 case OPCODE_MULTITEX_SUB_IMAGE2D:
13397 {
13398 const struct gl_pixelstore_attrib save = ctx->Unpack;
13399 ctx->Unpack = ctx->DefaultPacking;
13400 CALL_MultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13401 n[4].i, n[5].i, n[6].e,
13402 n[7].i, n[8].e, n[9].e,
13403 get_pointer(&n[10])));
13404 ctx->Unpack = save; /* restore */
13405 }
13406 break;
13407 case OPCODE_MULTITEX_SUB_IMAGE3D:
13408 {
13409 const struct gl_pixelstore_attrib save = ctx->Unpack;
13410 ctx->Unpack = ctx->DefaultPacking;
13411 CALL_MultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13412 n[4].i, n[5].i, n[6].i,
13413 n[7].i, n[8].i, n[9].i,
13414 n[10].e, n[11].e,
13415 get_pointer(&n[12])));
13416 ctx->Unpack = save; /* restore */
13417 }
13418 break;
13419 case OPCODE_COPY_MULTITEX_IMAGE1D:
13420 CALL_CopyMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13421 n[4].e, n[5].i, n[6].i,
13422 n[7].i, n[8].i));
13423 break;
13424 case OPCODE_COPY_MULTITEX_IMAGE2D:
13425 CALL_CopyMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13426 n[4].e, n[5].i, n[6].i,
13427 n[7].i, n[8].i, n[9].i));
13428 break;
13429 case OPCODE_COPY_MULTITEX_SUB_IMAGE1D:
13430 CALL_CopyMultiTexSubImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13431 n[4].i, n[5].i, n[6].i,
13432 n[7].i));
13433 break;
13434 case OPCODE_COPY_MULTITEX_SUB_IMAGE2D:
13435 CALL_CopyMultiTexSubImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13436 n[4].i, n[5].i, n[6].i,
13437 n[7].i, n[8].i, n[9].i));
13438 break;
13439 case OPCODE_COPY_MULTITEX_SUB_IMAGE3D:
13440 CALL_CopyMultiTexSubImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13441 n[4].i, n[5].i, n[6].i,
13442 n[7].i, n[8].i, n[9].i,
13443 n[10].i));
13444 break;
13445 case OPCODE_MULTITEXENV:
13446 {
13447 GLfloat params[4];
13448 params[0] = n[4].f;
13449 params[1] = n[5].f;
13450 params[2] = n[6].f;
13451 params[3] = n[7].f;
13452 CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params));
13453 }
13454 break;
13455 case OPCODE_COMPRESSED_TEXTURE_IMAGE_1D:
13456 CALL_CompressedTextureImage1DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13457 n[4].e, n[5].i, n[6].i,
13458 n[7].i, get_pointer(&n[8])));
13459 break;
13460 case OPCODE_COMPRESSED_TEXTURE_IMAGE_2D:
13461 CALL_CompressedTextureImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13462 n[4].e, n[5].i, n[6].i,
13463 n[7].i, n[8].i,
13464 get_pointer(&n[9])));
13465 break;
13466 case OPCODE_COMPRESSED_TEXTURE_IMAGE_3D:
13467 CALL_CompressedTextureImage3DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i,
13468 n[4].e, n[5].i, n[6].i,
13469 n[7].i, n[8].i, n[9].i,
13470 get_pointer(&n[10])));
13471 break;
13472 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_1D:
13473 CALL_CompressedTextureSubImage1DEXT(ctx->Exec,
13474 (n[1].ui, n[2].e, n[3].i, n[4].i,
13475 n[5].i, n[6].e, n[7].i,
13476 get_pointer(&n[8])));
13477 break;
13478 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D:
13479 CALL_CompressedTextureSubImage2DEXT(ctx->Exec,
13480 (n[1].ui, n[2].e, n[3].i, n[4].i,
13481 n[5].i, n[6].i, n[7].i, n[8].e,
13482 n[9].i, get_pointer(&n[10])));
13483 break;
13484 case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_3D:
13485 CALL_CompressedTextureSubImage3DEXT(ctx->Exec,
13486 (n[1].ui, n[2].e, n[3].i, n[4].i,
13487 n[5].i, n[6].i, n[7].i, n[8].i,
13488 n[9].i, n[10].e, n[11].i,
13489 get_pointer(&n[12])));
13490 break;
13491 case OPCODE_COMPRESSED_MULTITEX_IMAGE_1D:
13492 CALL_CompressedMultiTexImage1DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13493 n[4].e, n[5].i, n[6].i,
13494 n[7].i, get_pointer(&n[8])));
13495 break;
13496 case OPCODE_COMPRESSED_MULTITEX_IMAGE_2D:
13497 CALL_CompressedMultiTexImage2DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13498 n[4].e, n[5].i, n[6].i,
13499 n[7].i, n[8].i,
13500 get_pointer(&n[9])));
13501 break;
13502 case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D:
13503 CALL_CompressedMultiTexImage3DEXT(ctx->Exec, (n[1].e, n[2].e, n[3].i,
13504 n[4].e, n[5].i, n[6].i,
13505 n[7].i, n[8].i, n[9].i,
13506 get_pointer(&n[10])));
13507 break;
13508 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D:
13509 CALL_CompressedMultiTexSubImage1DEXT(ctx->Exec,
13510 (n[1].e, n[2].e, n[3].i, n[4].i,
13511 n[5].i, n[6].e, n[7].i,
13512 get_pointer(&n[8])));
13513 break;
13514 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D:
13515 CALL_CompressedMultiTexSubImage2DEXT(ctx->Exec,
13516 (n[1].e, n[2].e, n[3].i, n[4].i,
13517 n[5].i, n[6].i, n[7].i, n[8].e,
13518 n[9].i, get_pointer(&n[10])));
13519 break;
13520 case OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D:
13521 CALL_CompressedMultiTexSubImage3DEXT(ctx->Exec,
13522 (n[1].e, n[2].e, n[3].i, n[4].i,
13523 n[5].i, n[6].i, n[7].i, n[8].i,
13524 n[9].i, n[10].e, n[11].i,
13525 get_pointer(&n[12])));
13526 break;
13527 case OPCODE_NAMED_PROGRAM_STRING:
13528 CALL_NamedProgramStringEXT(ctx->Exec,
13529 (n[1].ui, n[2].e, n[3].e, n[4].i,
13530 get_pointer(&n[5])));
13531 break;
13532 case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER:
13533 CALL_NamedProgramLocalParameter4fEXT(ctx->Exec,
13534 (n[1].ui, n[2].e, n[3].ui, n[4].f,
13535 n[5].f, n[6].f, n[7].f));
13536 break;
13537
13538 case OPCODE_CONTINUE:
13539 n = (Node *) get_pointer(&n[1]);
13540 break;
13541 case OPCODE_NOP:
13542 /* no-op */
13543 break;
13544 case OPCODE_END_OF_LIST:
13545 done = GL_TRUE;
13546 break;
13547 default:
13548 {
13549 char msg[1000];
13550 _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
13551 (int) opcode);
13552 _mesa_problem(ctx, "%s", msg);
13553 }
13554 done = GL_TRUE;
13555 }
13556
13557 /* increment n to point to next compiled command */
13558 if (opcode != OPCODE_CONTINUE) {
13559 assert(InstSize[opcode] > 0);
13560 n += InstSize[opcode];
13561 }
13562 }
13563 }
13564
13565 vbo_save_EndCallList(ctx);
13566
13567 ctx->ListState.CallDepth--;
13568 }
13569
13570
13571
13572 /**********************************************************************/
13573 /* GL functions */
13574 /**********************************************************************/
13575
13576 /**
13577 * Test if a display list number is valid.
13578 */
13579 GLboolean GLAPIENTRY
13580 _mesa_IsList(GLuint list)
13581 {
13582 GET_CURRENT_CONTEXT(ctx);
13583 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13584 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
13585 return islist(ctx, list);
13586 }
13587
13588
13589 /**
13590 * Delete a sequence of consecutive display lists.
13591 */
13592 void GLAPIENTRY
13593 _mesa_DeleteLists(GLuint list, GLsizei range)
13594 {
13595 GET_CURRENT_CONTEXT(ctx);
13596 GLuint i;
13597 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13598 ASSERT_OUTSIDE_BEGIN_END(ctx);
13599
13600 if (range < 0) {
13601 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteLists");
13602 return;
13603 }
13604
13605 if (range > 1) {
13606 /* We may be deleting a set of bitmap lists. See if there's a
13607 * bitmap atlas to free.
13608 */
13609 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, list);
13610 if (atlas) {
13611 _mesa_delete_bitmap_atlas(ctx, atlas);
13612 _mesa_HashRemove(ctx->Shared->BitmapAtlas, list);
13613 }
13614 }
13615
13616 for (i = list; i < list + range; i++) {
13617 destroy_list(ctx, i);
13618 }
13619 }
13620
13621
13622 /**
13623 * Return a display list number, n, such that lists n through n+range-1
13624 * are free.
13625 */
13626 GLuint GLAPIENTRY
13627 _mesa_GenLists(GLsizei range)
13628 {
13629 GET_CURRENT_CONTEXT(ctx);
13630 GLuint base;
13631 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13632 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
13633
13634 if (range < 0) {
13635 _mesa_error(ctx, GL_INVALID_VALUE, "glGenLists");
13636 return 0;
13637 }
13638 if (range == 0) {
13639 return 0;
13640 }
13641
13642 /*
13643 * Make this an atomic operation
13644 */
13645 _mesa_HashLockMutex(ctx->Shared->DisplayList);
13646
13647 base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
13648 if (base) {
13649 /* reserve the list IDs by with empty/dummy lists */
13650 GLint i;
13651 for (i = 0; i < range; i++) {
13652 _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
13653 make_list(base + i, 1));
13654 }
13655 }
13656
13657 if (USE_BITMAP_ATLAS &&
13658 range > 16 &&
13659 ctx->Driver.DrawAtlasBitmaps) {
13660 /* "range > 16" is a rough heuristic to guess when glGenLists might be
13661 * used to allocate display lists for glXUseXFont or wglUseFontBitmaps.
13662 * Create the empty atlas now.
13663 */
13664 struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
13665 if (!atlas) {
13666 atlas = alloc_bitmap_atlas(ctx, base);
13667 }
13668 if (atlas) {
13669 /* Atlas _should_ be new/empty now, but clobbering is OK */
13670 assert(atlas->numBitmaps == 0);
13671 atlas->numBitmaps = range;
13672 }
13673 }
13674
13675 _mesa_HashUnlockMutex(ctx->Shared->DisplayList);
13676
13677 return base;
13678 }
13679
13680
13681 /**
13682 * Begin a new display list.
13683 */
13684 void GLAPIENTRY
13685 _mesa_NewList(GLuint name, GLenum mode)
13686 {
13687 GET_CURRENT_CONTEXT(ctx);
13688
13689 FLUSH_CURRENT(ctx, 0); /* must be called before assert */
13690 ASSERT_OUTSIDE_BEGIN_END(ctx);
13691
13692 if (MESA_VERBOSE & VERBOSE_API)
13693 _mesa_debug(ctx, "glNewList %u %s\n", name,
13694 _mesa_enum_to_string(mode));
13695
13696 if (name == 0) {
13697 _mesa_error(ctx, GL_INVALID_VALUE, "glNewList");
13698 return;
13699 }
13700
13701 if (mode != GL_COMPILE && mode != GL_COMPILE_AND_EXECUTE) {
13702 _mesa_error(ctx, GL_INVALID_ENUM, "glNewList");
13703 return;
13704 }
13705
13706 if (ctx->ListState.CurrentList) {
13707 /* already compiling a display list */
13708 _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList");
13709 return;
13710 }
13711
13712 ctx->CompileFlag = GL_TRUE;
13713 ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
13714
13715 /* Reset accumulated list state */
13716 invalidate_saved_current_state( ctx );
13717
13718 /* Allocate new display list */
13719 ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE);
13720 ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
13721 ctx->ListState.CurrentPos = 0;
13722
13723 vbo_save_NewList(ctx, name, mode);
13724
13725 ctx->CurrentServerDispatch = ctx->Save;
13726 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13727 if (ctx->MarshalExec == NULL) {
13728 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13729 }
13730 }
13731
13732
13733 /**
13734 * End definition of current display list.
13735 */
13736 void GLAPIENTRY
13737 _mesa_EndList(void)
13738 {
13739 GET_CURRENT_CONTEXT(ctx);
13740 SAVE_FLUSH_VERTICES(ctx);
13741 FLUSH_VERTICES(ctx, 0);
13742
13743 if (MESA_VERBOSE & VERBOSE_API)
13744 _mesa_debug(ctx, "glEndList\n");
13745
13746 if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
13747 _mesa_error(ctx, GL_INVALID_OPERATION,
13748 "glEndList() called inside glBegin/End");
13749 }
13750
13751 /* Check that a list is under construction */
13752 if (!ctx->ListState.CurrentList) {
13753 _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
13754 return;
13755 }
13756
13757 /* Call before emitting END_OF_LIST, in case the driver wants to
13758 * emit opcodes itself.
13759 */
13760 vbo_save_EndList(ctx);
13761
13762 (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
13763
13764 trim_list(ctx);
13765
13766 /* Destroy old list, if any */
13767 destroy_list(ctx, ctx->ListState.CurrentList->Name);
13768
13769 /* Install the new list */
13770 _mesa_HashInsert(ctx->Shared->DisplayList,
13771 ctx->ListState.CurrentList->Name,
13772 ctx->ListState.CurrentList);
13773
13774
13775 if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
13776 mesa_print_display_list(ctx->ListState.CurrentList->Name);
13777
13778 ctx->ListState.CurrentList = NULL;
13779 ctx->ListState.CurrentBlock = NULL;
13780 ctx->ListState.CurrentPos = 0;
13781 ctx->ExecuteFlag = GL_TRUE;
13782 ctx->CompileFlag = GL_FALSE;
13783
13784 ctx->CurrentServerDispatch = ctx->Exec;
13785 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13786 if (ctx->MarshalExec == NULL) {
13787 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13788 }
13789 }
13790
13791
13792 void GLAPIENTRY
13793 _mesa_CallList(GLuint list)
13794 {
13795 GLboolean save_compile_flag;
13796 GET_CURRENT_CONTEXT(ctx);
13797 FLUSH_CURRENT(ctx, 0);
13798
13799 if (MESA_VERBOSE & VERBOSE_API)
13800 _mesa_debug(ctx, "glCallList %d\n", list);
13801
13802 if (list == 0) {
13803 _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
13804 return;
13805 }
13806
13807 if (0)
13808 mesa_print_display_list( list );
13809
13810 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
13811 * execute the display list, and restore the CompileFlag.
13812 */
13813 save_compile_flag = ctx->CompileFlag;
13814 if (save_compile_flag) {
13815 ctx->CompileFlag = GL_FALSE;
13816 }
13817
13818 execute_list(ctx, list);
13819 ctx->CompileFlag = save_compile_flag;
13820
13821 /* also restore API function pointers to point to "save" versions */
13822 if (save_compile_flag) {
13823 ctx->CurrentServerDispatch = ctx->Save;
13824 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13825 if (ctx->MarshalExec == NULL) {
13826 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13827 }
13828 }
13829 }
13830
13831
13832 /**
13833 * Try to execute a glCallLists() command where the display lists contain
13834 * glBitmap commands with a texture atlas.
13835 * \return true for success, false otherwise
13836 */
13837 static bool
13838 render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
13839 const void *lists)
13840 {
13841 struct gl_bitmap_atlas *atlas;
13842 int i;
13843
13844 if (!USE_BITMAP_ATLAS ||
13845 !ctx->Current.RasterPosValid ||
13846 ctx->List.ListBase == 0 ||
13847 type != GL_UNSIGNED_BYTE ||
13848 !ctx->Driver.DrawAtlasBitmaps) {
13849 /* unsupported */
13850 return false;
13851 }
13852
13853 atlas = lookup_bitmap_atlas(ctx, ctx->List.ListBase);
13854
13855 if (!atlas) {
13856 /* Even if glGenLists wasn't called, we can still try to create
13857 * the atlas now.
13858 */
13859 atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
13860 }
13861
13862 if (atlas && !atlas->complete && !atlas->incomplete) {
13863 /* Try to build the bitmap atlas now.
13864 * If the atlas was created in glGenLists, we'll have recorded the
13865 * number of lists (bitmaps). Otherwise, take a guess at 256.
13866 */
13867 if (atlas->numBitmaps == 0)
13868 atlas->numBitmaps = 256;
13869 build_bitmap_atlas(ctx, atlas, ctx->List.ListBase);
13870 }
13871
13872 if (!atlas || !atlas->complete) {
13873 return false;
13874 }
13875
13876 /* check that all display list IDs are in the atlas */
13877 for (i = 0; i < n; i++) {
13878 const GLubyte *ids = (const GLubyte *) lists;
13879
13880 if (ids[i] >= atlas->numBitmaps) {
13881 return false;
13882 }
13883 }
13884
13885 ctx->Driver.DrawAtlasBitmaps(ctx, atlas, n, (const GLubyte *) lists);
13886
13887 return true;
13888 }
13889
13890
13891 /**
13892 * Execute glCallLists: call multiple display lists.
13893 */
13894 void GLAPIENTRY
13895 _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
13896 {
13897 GET_CURRENT_CONTEXT(ctx);
13898 GLint i;
13899 GLboolean save_compile_flag;
13900
13901 if (MESA_VERBOSE & VERBOSE_API)
13902 _mesa_debug(ctx, "glCallLists %d\n", n);
13903
13904 switch (type) {
13905 case GL_BYTE:
13906 case GL_UNSIGNED_BYTE:
13907 case GL_SHORT:
13908 case GL_UNSIGNED_SHORT:
13909 case GL_INT:
13910 case GL_UNSIGNED_INT:
13911 case GL_FLOAT:
13912 case GL_2_BYTES:
13913 case GL_3_BYTES:
13914 case GL_4_BYTES:
13915 /* OK */
13916 break;
13917 default:
13918 _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
13919 return;
13920 }
13921
13922 if (n < 0) {
13923 _mesa_error(ctx, GL_INVALID_VALUE, "glCallLists(n < 0)");
13924 return;
13925 } else if (n == 0 || lists == NULL) {
13926 /* nothing to do */
13927 return;
13928 }
13929
13930 if (render_bitmap_atlas(ctx, n, type, lists)) {
13931 return;
13932 }
13933
13934 /* Save the CompileFlag status, turn it off, execute display list,
13935 * and restore the CompileFlag.
13936 */
13937 save_compile_flag = ctx->CompileFlag;
13938 ctx->CompileFlag = GL_FALSE;
13939
13940 for (i = 0; i < n; i++) {
13941 GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists));
13942 execute_list(ctx, list);
13943 }
13944
13945 ctx->CompileFlag = save_compile_flag;
13946
13947 /* also restore API function pointers to point to "save" versions */
13948 if (save_compile_flag) {
13949 ctx->CurrentServerDispatch = ctx->Save;
13950 _glapi_set_dispatch(ctx->CurrentServerDispatch);
13951 if (ctx->MarshalExec == NULL) {
13952 ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
13953 }
13954 }
13955 }
13956
13957
13958 /**
13959 * Set the offset added to list numbers in glCallLists.
13960 */
13961 void GLAPIENTRY
13962 _mesa_ListBase(GLuint base)
13963 {
13964 GET_CURRENT_CONTEXT(ctx);
13965 FLUSH_VERTICES(ctx, 0); /* must be called before assert */
13966 ASSERT_OUTSIDE_BEGIN_END(ctx);
13967 ctx->List.ListBase = base;
13968 }
13969
13970 /**
13971 * Setup the given dispatch table to point to Mesa's display list
13972 * building functions.
13973 *
13974 * This does not include any of the tnl functions - they are
13975 * initialized from _mesa_init_api_defaults and from the active vtxfmt
13976 * struct.
13977 */
13978 void
13979 _mesa_initialize_save_table(const struct gl_context *ctx)
13980 {
13981 struct _glapi_table *table = ctx->Save;
13982 int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
13983
13984 /* Initially populate the dispatch table with the contents of the
13985 * normal-execution dispatch table. This lets us skip populating functions
13986 * that should be called directly instead of compiled into display lists.
13987 */
13988 memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
13989
13990 _mesa_loopback_init_api_table(ctx, table);
13991
13992 /* VBO functions */
13993 vbo_initialize_save_dispatch(ctx, table);
13994
13995 /* GL 1.0 */
13996 SET_Accum(table, save_Accum);
13997 SET_AlphaFunc(table, save_AlphaFunc);
13998 SET_Bitmap(table, save_Bitmap);
13999 SET_BlendFunc(table, save_BlendFunc);
14000 SET_CallList(table, save_CallList);
14001 SET_CallLists(table, save_CallLists);
14002 SET_Clear(table, save_Clear);
14003 SET_ClearAccum(table, save_ClearAccum);
14004 SET_ClearColor(table, save_ClearColor);
14005 SET_ClearDepth(table, save_ClearDepth);
14006 SET_ClearIndex(table, save_ClearIndex);
14007 SET_ClearStencil(table, save_ClearStencil);
14008 SET_ClipPlane(table, save_ClipPlane);
14009 SET_ColorMask(table, save_ColorMask);
14010 SET_ColorMaski(table, save_ColorMaskIndexed);
14011 SET_ColorMaterial(table, save_ColorMaterial);
14012 SET_CopyPixels(table, save_CopyPixels);
14013 SET_CullFace(table, save_CullFace);
14014 SET_DepthFunc(table, save_DepthFunc);
14015 SET_DepthMask(table, save_DepthMask);
14016 SET_DepthRange(table, save_DepthRange);
14017 SET_Disable(table, save_Disable);
14018 SET_Disablei(table, save_DisableIndexed);
14019 SET_DrawBuffer(table, save_DrawBuffer);
14020 SET_DrawPixels(table, save_DrawPixels);
14021 SET_Enable(table, save_Enable);
14022 SET_Enablei(table, save_EnableIndexed);
14023 SET_EvalMesh1(table, save_EvalMesh1);
14024 SET_EvalMesh2(table, save_EvalMesh2);
14025 SET_Fogf(table, save_Fogf);
14026 SET_Fogfv(table, save_Fogfv);
14027 SET_Fogi(table, save_Fogi);
14028 SET_Fogiv(table, save_Fogiv);
14029 SET_FrontFace(table, save_FrontFace);
14030 SET_Frustum(table, save_Frustum);
14031 SET_Hint(table, save_Hint);
14032 SET_IndexMask(table, save_IndexMask);
14033 SET_InitNames(table, save_InitNames);
14034 SET_LightModelf(table, save_LightModelf);
14035 SET_LightModelfv(table, save_LightModelfv);
14036 SET_LightModeli(table, save_LightModeli);
14037 SET_LightModeliv(table, save_LightModeliv);
14038 SET_Lightf(table, save_Lightf);
14039 SET_Lightfv(table, save_Lightfv);
14040 SET_Lighti(table, save_Lighti);
14041 SET_Lightiv(table, save_Lightiv);
14042 SET_LineStipple(table, save_LineStipple);
14043 SET_LineWidth(table, save_LineWidth);
14044 SET_ListBase(table, save_ListBase);
14045 SET_LoadIdentity(table, save_LoadIdentity);
14046 SET_LoadMatrixd(table, save_LoadMatrixd);
14047 SET_LoadMatrixf(table, save_LoadMatrixf);
14048 SET_LoadName(table, save_LoadName);
14049 SET_LogicOp(table, save_LogicOp);
14050 SET_Map1d(table, save_Map1d);
14051 SET_Map1f(table, save_Map1f);
14052 SET_Map2d(table, save_Map2d);
14053 SET_Map2f(table, save_Map2f);
14054 SET_MapGrid1d(table, save_MapGrid1d);
14055 SET_MapGrid1f(table, save_MapGrid1f);
14056 SET_MapGrid2d(table, save_MapGrid2d);
14057 SET_MapGrid2f(table, save_MapGrid2f);
14058 SET_MatrixMode(table, save_MatrixMode);
14059 SET_MultMatrixd(table, save_MultMatrixd);
14060 SET_MultMatrixf(table, save_MultMatrixf);
14061 SET_NewList(table, save_NewList);
14062 SET_Ortho(table, save_Ortho);
14063 SET_PassThrough(table, save_PassThrough);
14064 SET_PixelMapfv(table, save_PixelMapfv);
14065 SET_PixelMapuiv(table, save_PixelMapuiv);
14066 SET_PixelMapusv(table, save_PixelMapusv);
14067 SET_PixelTransferf(table, save_PixelTransferf);
14068 SET_PixelTransferi(table, save_PixelTransferi);
14069 SET_PixelZoom(table, save_PixelZoom);
14070 SET_PointSize(table, save_PointSize);
14071 SET_PolygonMode(table, save_PolygonMode);
14072 SET_PolygonOffset(table, save_PolygonOffset);
14073 SET_PolygonStipple(table, save_PolygonStipple);
14074 SET_PopAttrib(table, save_PopAttrib);
14075 SET_PopMatrix(table, save_PopMatrix);
14076 SET_PopName(table, save_PopName);
14077 SET_PushAttrib(table, save_PushAttrib);
14078 SET_PushMatrix(table, save_PushMatrix);
14079 SET_PushName(table, save_PushName);
14080 SET_RasterPos2d(table, save_RasterPos2d);
14081 SET_RasterPos2dv(table, save_RasterPos2dv);
14082 SET_RasterPos2f(table, save_RasterPos2f);
14083 SET_RasterPos2fv(table, save_RasterPos2fv);
14084 SET_RasterPos2i(table, save_RasterPos2i);
14085 SET_RasterPos2iv(table, save_RasterPos2iv);
14086 SET_RasterPos2s(table, save_RasterPos2s);
14087 SET_RasterPos2sv(table, save_RasterPos2sv);
14088 SET_RasterPos3d(table, save_RasterPos3d);
14089 SET_RasterPos3dv(table, save_RasterPos3dv);
14090 SET_RasterPos3f(table, save_RasterPos3f);
14091 SET_RasterPos3fv(table, save_RasterPos3fv);
14092 SET_RasterPos3i(table, save_RasterPos3i);
14093 SET_RasterPos3iv(table, save_RasterPos3iv);
14094 SET_RasterPos3s(table, save_RasterPos3s);
14095 SET_RasterPos3sv(table, save_RasterPos3sv);
14096 SET_RasterPos4d(table, save_RasterPos4d);
14097 SET_RasterPos4dv(table, save_RasterPos4dv);
14098 SET_RasterPos4f(table, save_RasterPos4f);
14099 SET_RasterPos4fv(table, save_RasterPos4fv);
14100 SET_RasterPos4i(table, save_RasterPos4i);
14101 SET_RasterPos4iv(table, save_RasterPos4iv);
14102 SET_RasterPos4s(table, save_RasterPos4s);
14103 SET_RasterPos4sv(table, save_RasterPos4sv);
14104 SET_ReadBuffer(table, save_ReadBuffer);
14105 SET_Rectf(table, save_Rectf);
14106 SET_Rotated(table, save_Rotated);
14107 SET_Rotatef(table, save_Rotatef);
14108 SET_Scaled(table, save_Scaled);
14109 SET_Scalef(table, save_Scalef);
14110 SET_Scissor(table, save_Scissor);
14111 SET_ShadeModel(table, save_ShadeModel);
14112 SET_StencilFunc(table, save_StencilFunc);
14113 SET_StencilMask(table, save_StencilMask);
14114 SET_StencilOp(table, save_StencilOp);
14115 SET_TexEnvf(table, save_TexEnvf);
14116 SET_TexEnvfv(table, save_TexEnvfv);
14117 SET_TexEnvi(table, save_TexEnvi);
14118 SET_TexEnviv(table, save_TexEnviv);
14119 SET_TexGend(table, save_TexGend);
14120 SET_TexGendv(table, save_TexGendv);
14121 SET_TexGenf(table, save_TexGenf);
14122 SET_TexGenfv(table, save_TexGenfv);
14123 SET_TexGeni(table, save_TexGeni);
14124 SET_TexGeniv(table, save_TexGeniv);
14125 SET_TexImage1D(table, save_TexImage1D);
14126 SET_TexImage2D(table, save_TexImage2D);
14127 SET_TexParameterf(table, save_TexParameterf);
14128 SET_TexParameterfv(table, save_TexParameterfv);
14129 SET_TexParameteri(table, save_TexParameteri);
14130 SET_TexParameteriv(table, save_TexParameteriv);
14131 SET_Translated(table, save_Translated);
14132 SET_Translatef(table, save_Translatef);
14133 SET_Viewport(table, save_Viewport);
14134
14135 /* GL 1.1 */
14136 SET_BindTexture(table, save_BindTexture);
14137 SET_CopyTexImage1D(table, save_CopyTexImage1D);
14138 SET_CopyTexImage2D(table, save_CopyTexImage2D);
14139 SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
14140 SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
14141 SET_PrioritizeTextures(table, save_PrioritizeTextures);
14142 SET_TexSubImage1D(table, save_TexSubImage1D);
14143 SET_TexSubImage2D(table, save_TexSubImage2D);
14144
14145 /* GL 1.2 */
14146 SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
14147 SET_TexImage3D(table, save_TexImage3D);
14148 SET_TexSubImage3D(table, save_TexSubImage3D);
14149
14150 /* GL 2.0 */
14151 SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
14152 SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
14153 SET_StencilOpSeparate(table, save_StencilOpSeparate);
14154
14155 /* ATI_separate_stencil */
14156 SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
14157
14158 /* GL_ARB_imaging */
14159 /* Not all are supported */
14160 SET_BlendColor(table, save_BlendColor);
14161 SET_BlendEquation(table, save_BlendEquation);
14162
14163 /* 2. GL_EXT_blend_color */
14164 #if 0
14165 SET_BlendColorEXT(table, save_BlendColorEXT);
14166 #endif
14167
14168 /* 6. GL_EXT_texture3d */
14169 #if 0
14170 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
14171 SET_TexImage3DEXT(table, save_TexImage3DEXT);
14172 SET_TexSubImage3DEXT(table, save_TexSubImage3D);
14173 #endif
14174
14175 /* 37. GL_EXT_blend_minmax */
14176 #if 0
14177 SET_BlendEquationEXT(table, save_BlendEquationEXT);
14178 #endif
14179
14180 /* 54. GL_EXT_point_parameters */
14181 SET_PointParameterf(table, save_PointParameterfEXT);
14182 SET_PointParameterfv(table, save_PointParameterfvEXT);
14183
14184 /* 91. GL_ARB_tessellation_shader */
14185 SET_PatchParameteri(table, save_PatchParameteri);
14186 SET_PatchParameterfv(table, save_PatchParameterfv);
14187
14188 /* 100. ARB_viewport_array */
14189 SET_ViewportArrayv(table, save_ViewportArrayv);
14190 SET_ViewportIndexedf(table, save_ViewportIndexedf);
14191 SET_ViewportIndexedfv(table, save_ViewportIndexedfv);
14192 SET_ScissorArrayv(table, save_ScissorArrayv);
14193 SET_ScissorIndexed(table, save_ScissorIndexed);
14194 SET_ScissorIndexedv(table, save_ScissorIndexedv);
14195 SET_DepthRangeArrayv(table, save_DepthRangeArrayv);
14196 SET_DepthRangeIndexed(table, save_DepthRangeIndexed);
14197
14198 /* 122. ARB_compute_shader */
14199 SET_DispatchCompute(table, save_DispatchCompute);
14200 SET_DispatchComputeIndirect(table, save_DispatchComputeIndirect);
14201
14202 /* 173. GL_EXT_blend_func_separate */
14203 SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
14204
14205 /* 197. GL_MESA_window_pos */
14206 SET_WindowPos2d(table, save_WindowPos2dMESA);
14207 SET_WindowPos2dv(table, save_WindowPos2dvMESA);
14208 SET_WindowPos2f(table, save_WindowPos2fMESA);
14209 SET_WindowPos2fv(table, save_WindowPos2fvMESA);
14210 SET_WindowPos2i(table, save_WindowPos2iMESA);
14211 SET_WindowPos2iv(table, save_WindowPos2ivMESA);
14212 SET_WindowPos2s(table, save_WindowPos2sMESA);
14213 SET_WindowPos2sv(table, save_WindowPos2svMESA);
14214 SET_WindowPos3d(table, save_WindowPos3dMESA);
14215 SET_WindowPos3dv(table, save_WindowPos3dvMESA);
14216 SET_WindowPos3f(table, save_WindowPos3fMESA);
14217 SET_WindowPos3fv(table, save_WindowPos3fvMESA);
14218 SET_WindowPos3i(table, save_WindowPos3iMESA);
14219 SET_WindowPos3iv(table, save_WindowPos3ivMESA);
14220 SET_WindowPos3s(table, save_WindowPos3sMESA);
14221 SET_WindowPos3sv(table, save_WindowPos3svMESA);
14222 SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
14223 SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
14224 SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
14225 SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
14226 SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
14227 SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
14228 SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
14229 SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
14230
14231 /* 245. GL_ATI_fragment_shader */
14232 SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
14233 SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
14234
14235 /* 262. GL_NV_point_sprite */
14236 SET_PointParameteri(table, save_PointParameteriNV);
14237 SET_PointParameteriv(table, save_PointParameterivNV);
14238
14239 /* 268. GL_EXT_stencil_two_side */
14240 SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
14241
14242 /* ???. GL_EXT_depth_bounds_test */
14243 SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
14244
14245 /* ARB 1. GL_ARB_multitexture */
14246 SET_ActiveTexture(table, save_ActiveTextureARB);
14247
14248 /* ARB 3. GL_ARB_transpose_matrix */
14249 SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB);
14250 SET_LoadTransposeMatrixf(table, save_LoadTransposeMatrixfARB);
14251 SET_MultTransposeMatrixd(table, save_MultTransposeMatrixdARB);
14252 SET_MultTransposeMatrixf(table, save_MultTransposeMatrixfARB);
14253
14254 /* ARB 5. GL_ARB_multisample */
14255 SET_SampleCoverage(table, save_SampleCoverageARB);
14256
14257 /* ARB 12. GL_ARB_texture_compression */
14258 SET_CompressedTexImage3D(table, save_CompressedTexImage3DARB);
14259 SET_CompressedTexImage2D(table, save_CompressedTexImage2DARB);
14260 SET_CompressedTexImage1D(table, save_CompressedTexImage1DARB);
14261 SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB);
14262 SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB);
14263 SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB);
14264
14265 /* ARB 14. GL_ARB_point_parameters */
14266 /* aliased with EXT_point_parameters functions */
14267
14268 /* ARB 25. GL_ARB_window_pos */
14269 /* aliased with MESA_window_pos functions */
14270
14271 /* ARB 26. GL_ARB_vertex_program */
14272 /* ARB 27. GL_ARB_fragment_program */
14273 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
14274 SET_ProgramStringARB(table, save_ProgramStringARB);
14275 SET_BindProgramARB(table, save_BindProgramARB);
14276 SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
14277 SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
14278 SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
14279 SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
14280 SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
14281 SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
14282 SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
14283 SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
14284
14285 SET_BeginQuery(table, save_BeginQueryARB);
14286 SET_EndQuery(table, save_EndQueryARB);
14287 SET_QueryCounter(table, save_QueryCounter);
14288
14289 SET_DrawBuffers(table, save_DrawBuffersARB);
14290
14291 SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
14292
14293 SET_UseProgram(table, save_UseProgram);
14294 SET_Uniform1f(table, save_Uniform1fARB);
14295 SET_Uniform2f(table, save_Uniform2fARB);
14296 SET_Uniform3f(table, save_Uniform3fARB);
14297 SET_Uniform4f(table, save_Uniform4fARB);
14298 SET_Uniform1fv(table, save_Uniform1fvARB);
14299 SET_Uniform2fv(table, save_Uniform2fvARB);
14300 SET_Uniform3fv(table, save_Uniform3fvARB);
14301 SET_Uniform4fv(table, save_Uniform4fvARB);
14302 SET_Uniform1i(table, save_Uniform1iARB);
14303 SET_Uniform2i(table, save_Uniform2iARB);
14304 SET_Uniform3i(table, save_Uniform3iARB);
14305 SET_Uniform4i(table, save_Uniform4iARB);
14306 SET_Uniform1iv(table, save_Uniform1ivARB);
14307 SET_Uniform2iv(table, save_Uniform2ivARB);
14308 SET_Uniform3iv(table, save_Uniform3ivARB);
14309 SET_Uniform4iv(table, save_Uniform4ivARB);
14310 SET_UniformMatrix2fv(table, save_UniformMatrix2fvARB);
14311 SET_UniformMatrix3fv(table, save_UniformMatrix3fvARB);
14312 SET_UniformMatrix4fv(table, save_UniformMatrix4fvARB);
14313 SET_UniformMatrix2x3fv(table, save_UniformMatrix2x3fv);
14314 SET_UniformMatrix3x2fv(table, save_UniformMatrix3x2fv);
14315 SET_UniformMatrix2x4fv(table, save_UniformMatrix2x4fv);
14316 SET_UniformMatrix4x2fv(table, save_UniformMatrix4x2fv);
14317 SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv);
14318 SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv);
14319
14320 /* 299. GL_EXT_blend_equation_separate */
14321 SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT);
14322
14323 /* GL_EXT_gpu_program_parameters */
14324 SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
14325 SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
14326
14327 /* 364. GL_EXT_provoking_vertex */
14328 SET_ProvokingVertex(table, save_ProvokingVertexEXT);
14329
14330 /* GL_EXT_texture_integer */
14331 SET_ClearColorIiEXT(table, save_ClearColorIi);
14332 SET_ClearColorIuiEXT(table, save_ClearColorIui);
14333 SET_TexParameterIiv(table, save_TexParameterIiv);
14334 SET_TexParameterIuiv(table, save_TexParameterIuiv);
14335
14336 /* GL_ARB_clip_control */
14337 SET_ClipControl(table, save_ClipControl);
14338
14339 /* GL_ARB_color_buffer_float */
14340 SET_ClampColor(table, save_ClampColorARB);
14341
14342 /* GL 3.0 */
14343 SET_ClearBufferiv(table, save_ClearBufferiv);
14344 SET_ClearBufferuiv(table, save_ClearBufferuiv);
14345 SET_ClearBufferfv(table, save_ClearBufferfv);
14346 SET_ClearBufferfi(table, save_ClearBufferfi);
14347 SET_Uniform1ui(table, save_Uniform1ui);
14348 SET_Uniform2ui(table, save_Uniform2ui);
14349 SET_Uniform3ui(table, save_Uniform3ui);
14350 SET_Uniform4ui(table, save_Uniform4ui);
14351 SET_Uniform1uiv(table, save_Uniform1uiv);
14352 SET_Uniform2uiv(table, save_Uniform2uiv);
14353 SET_Uniform3uiv(table, save_Uniform3uiv);
14354 SET_Uniform4uiv(table, save_Uniform4uiv);
14355
14356 /* GL_ARB_gpu_shader_fp64 */
14357 SET_Uniform1d(table, save_Uniform1d);
14358 SET_Uniform2d(table, save_Uniform2d);
14359 SET_Uniform3d(table, save_Uniform3d);
14360 SET_Uniform4d(table, save_Uniform4d);
14361 SET_Uniform1dv(table, save_Uniform1dv);
14362 SET_Uniform2dv(table, save_Uniform2dv);
14363 SET_Uniform3dv(table, save_Uniform3dv);
14364 SET_Uniform4dv(table, save_Uniform4dv);
14365 SET_UniformMatrix2dv(table, save_UniformMatrix2dv);
14366 SET_UniformMatrix3dv(table, save_UniformMatrix3dv);
14367 SET_UniformMatrix4dv(table, save_UniformMatrix4dv);
14368 SET_UniformMatrix2x3dv(table, save_UniformMatrix2x3dv);
14369 SET_UniformMatrix3x2dv(table, save_UniformMatrix3x2dv);
14370 SET_UniformMatrix2x4dv(table, save_UniformMatrix2x4dv);
14371 SET_UniformMatrix4x2dv(table, save_UniformMatrix4x2dv);
14372 SET_UniformMatrix3x4dv(table, save_UniformMatrix3x4dv);
14373 SET_UniformMatrix4x3dv(table, save_UniformMatrix4x3dv);
14374
14375 /* GL_ARB_gpu_shader_int64 */
14376 SET_Uniform1i64ARB(table, save_Uniform1i64ARB);
14377 SET_Uniform2i64ARB(table, save_Uniform2i64ARB);
14378 SET_Uniform3i64ARB(table, save_Uniform3i64ARB);
14379 SET_Uniform4i64ARB(table, save_Uniform4i64ARB);
14380 SET_Uniform1i64vARB(table, save_Uniform1i64vARB);
14381 SET_Uniform2i64vARB(table, save_Uniform2i64vARB);
14382 SET_Uniform3i64vARB(table, save_Uniform3i64vARB);
14383 SET_Uniform4i64vARB(table, save_Uniform4i64vARB);
14384 SET_Uniform1ui64ARB(table, save_Uniform1ui64ARB);
14385 SET_Uniform2ui64ARB(table, save_Uniform2ui64ARB);
14386 SET_Uniform3ui64ARB(table, save_Uniform3ui64ARB);
14387 SET_Uniform4ui64ARB(table, save_Uniform4ui64ARB);
14388 SET_Uniform1ui64vARB(table, save_Uniform1ui64vARB);
14389 SET_Uniform2ui64vARB(table, save_Uniform2ui64vARB);
14390 SET_Uniform3ui64vARB(table, save_Uniform3ui64vARB);
14391 SET_Uniform4ui64vARB(table, save_Uniform4ui64vARB);
14392
14393 SET_ProgramUniform1i64ARB(table, save_ProgramUniform1i64ARB);
14394 SET_ProgramUniform2i64ARB(table, save_ProgramUniform2i64ARB);
14395 SET_ProgramUniform3i64ARB(table, save_ProgramUniform3i64ARB);
14396 SET_ProgramUniform4i64ARB(table, save_ProgramUniform4i64ARB);
14397 SET_ProgramUniform1i64vARB(table, save_ProgramUniform1i64vARB);
14398 SET_ProgramUniform2i64vARB(table, save_ProgramUniform2i64vARB);
14399 SET_ProgramUniform3i64vARB(table, save_ProgramUniform3i64vARB);
14400 SET_ProgramUniform4i64vARB(table, save_ProgramUniform4i64vARB);
14401 SET_ProgramUniform1ui64ARB(table, save_ProgramUniform1ui64ARB);
14402 SET_ProgramUniform2ui64ARB(table, save_ProgramUniform2ui64ARB);
14403 SET_ProgramUniform3ui64ARB(table, save_ProgramUniform3ui64ARB);
14404 SET_ProgramUniform4ui64ARB(table, save_ProgramUniform4ui64ARB);
14405 SET_ProgramUniform1ui64vARB(table, save_ProgramUniform1ui64vARB);
14406 SET_ProgramUniform2ui64vARB(table, save_ProgramUniform2ui64vARB);
14407 SET_ProgramUniform3ui64vARB(table, save_ProgramUniform3ui64vARB);
14408 SET_ProgramUniform4ui64vARB(table, save_ProgramUniform4ui64vARB);
14409
14410 /* These are: */
14411 SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
14412 SET_EndTransformFeedback(table, save_EndTransformFeedback);
14413 SET_BindTransformFeedback(table, save_BindTransformFeedback);
14414 SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
14415 SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
14416 SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
14417 SET_DrawTransformFeedbackStream(table, save_DrawTransformFeedbackStream);
14418 SET_DrawTransformFeedbackInstanced(table,
14419 save_DrawTransformFeedbackInstanced);
14420 SET_DrawTransformFeedbackStreamInstanced(table,
14421 save_DrawTransformFeedbackStreamInstanced);
14422 SET_BeginQueryIndexed(table, save_BeginQueryIndexed);
14423 SET_EndQueryIndexed(table, save_EndQueryIndexed);
14424
14425 /* GL_ARB_instanced_arrays */
14426 SET_VertexAttribDivisor(table, save_VertexAttribDivisor);
14427
14428 /* GL_NV_texture_barrier */
14429 SET_TextureBarrierNV(table, save_TextureBarrierNV);
14430
14431 SET_BindSampler(table, save_BindSampler);
14432 SET_SamplerParameteri(table, save_SamplerParameteri);
14433 SET_SamplerParameterf(table, save_SamplerParameterf);
14434 SET_SamplerParameteriv(table, save_SamplerParameteriv);
14435 SET_SamplerParameterfv(table, save_SamplerParameterfv);
14436 SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
14437 SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
14438
14439 /* GL_ARB_draw_buffer_blend */
14440 SET_BlendFunciARB(table, save_BlendFunci);
14441 SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
14442 SET_BlendEquationiARB(table, save_BlendEquationi);
14443 SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
14444
14445 /* GL_NV_conditional_render */
14446 SET_BeginConditionalRender(table, save_BeginConditionalRender);
14447 SET_EndConditionalRender(table, save_EndConditionalRender);
14448
14449 /* GL_ARB_sync */
14450 SET_WaitSync(table, save_WaitSync);
14451
14452 /* GL_ARB_uniform_buffer_object */
14453 SET_UniformBlockBinding(table, save_UniformBlockBinding);
14454
14455 /* GL_ARB_shader_subroutines */
14456 SET_UniformSubroutinesuiv(table, save_UniformSubroutinesuiv);
14457
14458 /* GL_ARB_draw_instanced */
14459 SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
14460 SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
14461
14462 /* GL_ARB_draw_elements_base_vertex */
14463 SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
14464
14465 /* GL_ARB_base_instance */
14466 SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
14467 SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
14468 SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
14469
14470 /* GL_ARB_draw_indirect / GL_ARB_multi_draw_indirect */
14471 SET_DrawArraysIndirect(table, save_DrawArraysIndirect);
14472 SET_DrawElementsIndirect(table, save_DrawElementsIndirect);
14473 SET_MultiDrawArraysIndirect(table, save_MultiDrawArraysIndirect);
14474 SET_MultiDrawElementsIndirect(table, save_MultiDrawElementsIndirect);
14475
14476 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
14477 SET_UseProgramStages(table, save_UseProgramStages);
14478 SET_ProgramUniform1f(table, save_ProgramUniform1f);
14479 SET_ProgramUniform2f(table, save_ProgramUniform2f);
14480 SET_ProgramUniform3f(table, save_ProgramUniform3f);
14481 SET_ProgramUniform4f(table, save_ProgramUniform4f);
14482 SET_ProgramUniform1fv(table, save_ProgramUniform1fv);
14483 SET_ProgramUniform2fv(table, save_ProgramUniform2fv);
14484 SET_ProgramUniform3fv(table, save_ProgramUniform3fv);
14485 SET_ProgramUniform4fv(table, save_ProgramUniform4fv);
14486 SET_ProgramUniform1d(table, save_ProgramUniform1d);
14487 SET_ProgramUniform2d(table, save_ProgramUniform2d);
14488 SET_ProgramUniform3d(table, save_ProgramUniform3d);
14489 SET_ProgramUniform4d(table, save_ProgramUniform4d);
14490 SET_ProgramUniform1dv(table, save_ProgramUniform1dv);
14491 SET_ProgramUniform2dv(table, save_ProgramUniform2dv);
14492 SET_ProgramUniform3dv(table, save_ProgramUniform3dv);
14493 SET_ProgramUniform4dv(table, save_ProgramUniform4dv);
14494 SET_ProgramUniform1i(table, save_ProgramUniform1i);
14495 SET_ProgramUniform2i(table, save_ProgramUniform2i);
14496 SET_ProgramUniform3i(table, save_ProgramUniform3i);
14497 SET_ProgramUniform4i(table, save_ProgramUniform4i);
14498 SET_ProgramUniform1iv(table, save_ProgramUniform1iv);
14499 SET_ProgramUniform2iv(table, save_ProgramUniform2iv);
14500 SET_ProgramUniform3iv(table, save_ProgramUniform3iv);
14501 SET_ProgramUniform4iv(table, save_ProgramUniform4iv);
14502 SET_ProgramUniform1ui(table, save_ProgramUniform1ui);
14503 SET_ProgramUniform2ui(table, save_ProgramUniform2ui);
14504 SET_ProgramUniform3ui(table, save_ProgramUniform3ui);
14505 SET_ProgramUniform4ui(table, save_ProgramUniform4ui);
14506 SET_ProgramUniform1uiv(table, save_ProgramUniform1uiv);
14507 SET_ProgramUniform2uiv(table, save_ProgramUniform2uiv);
14508 SET_ProgramUniform3uiv(table, save_ProgramUniform3uiv);
14509 SET_ProgramUniform4uiv(table, save_ProgramUniform4uiv);
14510 SET_ProgramUniformMatrix2fv(table, save_ProgramUniformMatrix2fv);
14511 SET_ProgramUniformMatrix3fv(table, save_ProgramUniformMatrix3fv);
14512 SET_ProgramUniformMatrix4fv(table, save_ProgramUniformMatrix4fv);
14513 SET_ProgramUniformMatrix2x3fv(table, save_ProgramUniformMatrix2x3fv);
14514 SET_ProgramUniformMatrix3x2fv(table, save_ProgramUniformMatrix3x2fv);
14515 SET_ProgramUniformMatrix2x4fv(table, save_ProgramUniformMatrix2x4fv);
14516 SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv);
14517 SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv);
14518 SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv);
14519 SET_ProgramUniformMatrix2dv(table, save_ProgramUniformMatrix2dv);
14520 SET_ProgramUniformMatrix3dv(table, save_ProgramUniformMatrix3dv);
14521 SET_ProgramUniformMatrix4dv(table, save_ProgramUniformMatrix4dv);
14522 SET_ProgramUniformMatrix2x3dv(table, save_ProgramUniformMatrix2x3dv);
14523 SET_ProgramUniformMatrix3x2dv(table, save_ProgramUniformMatrix3x2dv);
14524 SET_ProgramUniformMatrix2x4dv(table, save_ProgramUniformMatrix2x4dv);
14525 SET_ProgramUniformMatrix4x2dv(table, save_ProgramUniformMatrix4x2dv);
14526 SET_ProgramUniformMatrix3x4dv(table, save_ProgramUniformMatrix3x4dv);
14527 SET_ProgramUniformMatrix4x3dv(table, save_ProgramUniformMatrix4x3dv);
14528
14529 /* GL_{ARB,EXT}_polygon_offset_clamp */
14530 SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT);
14531
14532 /* GL_EXT_window_rectangles */
14533 SET_WindowRectanglesEXT(table, save_WindowRectanglesEXT);
14534
14535 /* GL_NV_conservative_raster */
14536 SET_SubpixelPrecisionBiasNV(table, save_SubpixelPrecisionBiasNV);
14537
14538 /* GL_NV_conservative_raster_dilate */
14539 SET_ConservativeRasterParameterfNV(table, save_ConservativeRasterParameterfNV);
14540
14541 /* GL_NV_conservative_raster_pre_snap_triangles */
14542 SET_ConservativeRasterParameteriNV(table, save_ConservativeRasterParameteriNV);
14543
14544 /* GL_EXT_direct_state_access */
14545 SET_MatrixLoadfEXT(table, save_MatrixLoadfEXT);
14546 SET_MatrixLoaddEXT(table, save_MatrixLoaddEXT);
14547 SET_MatrixMultfEXT(table, save_MatrixMultfEXT);
14548 SET_MatrixMultdEXT(table, save_MatrixMultdEXT);
14549 SET_MatrixRotatefEXT(table, save_MatrixRotatefEXT);
14550 SET_MatrixRotatedEXT(table, save_MatrixRotatedEXT);
14551 SET_MatrixScalefEXT(table, save_MatrixScalefEXT);
14552 SET_MatrixScaledEXT(table, save_MatrixScaledEXT);
14553 SET_MatrixTranslatefEXT(table, save_MatrixTranslatefEXT);
14554 SET_MatrixTranslatedEXT(table, save_MatrixTranslatedEXT);
14555 SET_MatrixLoadIdentityEXT(table, save_MatrixLoadIdentityEXT);
14556 SET_MatrixOrthoEXT(table, save_MatrixOrthoEXT);
14557 SET_MatrixFrustumEXT(table, save_MatrixFrustumEXT);
14558 SET_MatrixPushEXT(table, save_MatrixPushEXT);
14559 SET_MatrixPopEXT(table, save_MatrixPopEXT);
14560 SET_MatrixLoadTransposefEXT(table, save_MatrixLoadTransposefEXT);
14561 SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT);
14562 SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT);
14563 SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT);
14564 SET_TextureParameteriEXT(table, save_TextureParameteriEXT);
14565 SET_TextureParameterivEXT(table, save_TextureParameterivEXT);
14566 SET_TextureParameterfEXT(table, save_TextureParameterfEXT);
14567 SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT);
14568 SET_TextureParameterIivEXT(table, save_TextureParameterIivEXT);
14569 SET_TextureParameterIuivEXT(table, save_TextureParameterIuivEXT);
14570 SET_TextureImage1DEXT(table, save_TextureImage1DEXT);
14571 SET_TextureImage2DEXT(table, save_TextureImage2DEXT);
14572 SET_TextureImage3DEXT(table, save_TextureImage3DEXT);
14573 SET_TextureSubImage1DEXT(table, save_TextureSubImage1DEXT);
14574 SET_TextureSubImage2DEXT(table, save_TextureSubImage2DEXT);
14575 SET_TextureSubImage3DEXT(table, save_TextureSubImage3DEXT);
14576 SET_CopyTextureImage1DEXT(table, save_CopyTextureImage1DEXT);
14577 SET_CopyTextureImage2DEXT(table, save_CopyTextureImage2DEXT);
14578 SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT);
14579 SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT);
14580 SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT);
14581 SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT);
14582 SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT);
14583 SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT);
14584 SET_MultiTexParameterIivEXT(table, save_MultiTexParameterIivEXT);
14585 SET_MultiTexParameterIuivEXT(table, save_MultiTexParameterIuivEXT);
14586 SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT);
14587 SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT);
14588 SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT);
14589 SET_MultiTexImage2DEXT(table, save_MultiTexImage2DEXT);
14590 SET_MultiTexImage3DEXT(table, save_MultiTexImage3DEXT);
14591 SET_MultiTexSubImage1DEXT(table, save_MultiTexSubImage1DEXT);
14592 SET_MultiTexSubImage2DEXT(table, save_MultiTexSubImage2DEXT);
14593 SET_MultiTexSubImage3DEXT(table, save_MultiTexSubImage3DEXT);
14594 SET_CopyMultiTexImage1DEXT(table, save_CopyMultiTexImage1DEXT);
14595 SET_CopyMultiTexImage2DEXT(table, save_CopyMultiTexImage2DEXT);
14596 SET_CopyMultiTexSubImage1DEXT(table, save_CopyMultiTexSubImage1DEXT);
14597 SET_CopyMultiTexSubImage2DEXT(table, save_CopyMultiTexSubImage2DEXT);
14598 SET_CopyMultiTexSubImage3DEXT(table, save_CopyMultiTexSubImage3DEXT);
14599 SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT);
14600 SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT);
14601 SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT);
14602 SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT);
14603 SET_CompressedTextureImage1DEXT(table, save_CompressedTextureImage1DEXT);
14604 SET_CompressedTextureImage2DEXT(table, save_CompressedTextureImage2DEXT);
14605 SET_CompressedTextureImage3DEXT(table, save_CompressedTextureImage3DEXT);
14606 SET_CompressedTextureSubImage1DEXT(table, save_CompressedTextureSubImage1DEXT);
14607 SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT);
14608 SET_CompressedTextureSubImage3DEXT(table, save_CompressedTextureSubImage3DEXT);
14609 SET_CompressedMultiTexImage1DEXT(table, save_CompressedMultiTexImage1DEXT);
14610 SET_CompressedMultiTexImage2DEXT(table, save_CompressedMultiTexImage2DEXT);
14611 SET_CompressedMultiTexImage3DEXT(table, save_CompressedMultiTexImage3DEXT);
14612 SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT);
14613 SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT);
14614 SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT);
14615 SET_NamedProgramStringEXT(table, save_NamedProgramStringEXT);
14616 SET_NamedProgramLocalParameter4dEXT(table, save_NamedProgramLocalParameter4dEXT);
14617 SET_NamedProgramLocalParameter4dvEXT(table, save_NamedProgramLocalParameter4dvEXT);
14618 SET_NamedProgramLocalParameter4fEXT(table, save_NamedProgramLocalParameter4fEXT);
14619 SET_NamedProgramLocalParameter4fvEXT(table, save_NamedProgramLocalParameter4fvEXT);
14620 }
14621
14622
14623
14624 static const char *
14625 enum_string(GLenum k)
14626 {
14627 return _mesa_enum_to_string(k);
14628 }
14629
14630
14631 /**
14632 * Print the commands in a display list. For debugging only.
14633 * TODO: many commands aren't handled yet.
14634 * \param fname filename to write display list to. If null, use stdout.
14635 */
14636 static void GLAPIENTRY
14637 print_list(struct gl_context *ctx, GLuint list, const char *fname)
14638 {
14639 struct gl_display_list *dlist;
14640 Node *n;
14641 GLboolean done;
14642 FILE *f = stdout;
14643
14644 if (fname) {
14645 f = fopen(fname, "w");
14646 if (!f)
14647 return;
14648 }
14649
14650 if (!islist(ctx, list)) {
14651 fprintf(f, "%u is not a display list ID\n", list);
14652 goto out;
14653 }
14654
14655 dlist = _mesa_lookup_list(ctx, list);
14656 if (!dlist) {
14657 goto out;
14658 }
14659
14660 n = dlist->Head;
14661
14662 fprintf(f, "START-LIST %u, address %p\n", list, (void *) n);
14663
14664 done = n ? GL_FALSE : GL_TRUE;
14665 while (!done) {
14666 const OpCode opcode = n[0].opcode;
14667
14668 if (is_ext_opcode(opcode)) {
14669 n += ext_opcode_print(ctx, n, f);
14670 }
14671 else {
14672 switch (opcode) {
14673 case OPCODE_ACCUM:
14674 fprintf(f, "Accum %s %g\n", enum_string(n[1].e), n[2].f);
14675 break;
14676 case OPCODE_ACTIVE_TEXTURE:
14677 fprintf(f, "ActiveTexture(%s)\n", enum_string(n[1].e));
14678 break;
14679 case OPCODE_BITMAP:
14680 fprintf(f, "Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
14681 n[3].f, n[4].f, n[5].f, n[6].f,
14682 get_pointer(&n[7]));
14683 break;
14684 case OPCODE_BLEND_COLOR:
14685 fprintf(f, "BlendColor %f, %f, %f, %f\n",
14686 n[1].f, n[2].f, n[3].f, n[4].f);
14687 break;
14688 case OPCODE_BLEND_EQUATION:
14689 fprintf(f, "BlendEquation %s\n",
14690 enum_string(n[1].e));
14691 break;
14692 case OPCODE_BLEND_EQUATION_SEPARATE:
14693 fprintf(f, "BlendEquationSeparate %s, %s\n",
14694 enum_string(n[1].e),
14695 enum_string(n[2].e));
14696 break;
14697 case OPCODE_BLEND_FUNC_SEPARATE:
14698 fprintf(f, "BlendFuncSeparate %s, %s, %s, %s\n",
14699 enum_string(n[1].e),
14700 enum_string(n[2].e),
14701 enum_string(n[3].e),
14702 enum_string(n[4].e));
14703 break;
14704 case OPCODE_BLEND_EQUATION_I:
14705 fprintf(f, "BlendEquationi %u, %s\n",
14706 n[1].ui, enum_string(n[2].e));
14707 break;
14708 case OPCODE_BLEND_EQUATION_SEPARATE_I:
14709 fprintf(f, "BlendEquationSeparatei %u, %s, %s\n",
14710 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14711 break;
14712 case OPCODE_BLEND_FUNC_I:
14713 fprintf(f, "BlendFunci %u, %s, %s\n",
14714 n[1].ui, enum_string(n[2].e), enum_string(n[3].e));
14715 break;
14716 case OPCODE_BLEND_FUNC_SEPARATE_I:
14717 fprintf(f, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
14718 n[1].ui,
14719 enum_string(n[2].e),
14720 enum_string(n[3].e),
14721 enum_string(n[4].e),
14722 enum_string(n[5].e));
14723 break;
14724 case OPCODE_CALL_LIST:
14725 fprintf(f, "CallList %d\n", (int) n[1].ui);
14726 break;
14727 case OPCODE_CALL_LISTS:
14728 fprintf(f, "CallLists %d, %s\n", n[1].i, enum_string(n[1].e));
14729 break;
14730 case OPCODE_DISABLE:
14731 fprintf(f, "Disable %s\n", enum_string(n[1].e));
14732 break;
14733 case OPCODE_ENABLE:
14734 fprintf(f, "Enable %s\n", enum_string(n[1].e));
14735 break;
14736 case OPCODE_FRUSTUM:
14737 fprintf(f, "Frustum %g %g %g %g %g %g\n",
14738 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14739 break;
14740 case OPCODE_LINE_STIPPLE:
14741 fprintf(f, "LineStipple %d %x\n", n[1].i, (int) n[2].us);
14742 break;
14743 case OPCODE_LINE_WIDTH:
14744 fprintf(f, "LineWidth %f\n", n[1].f);
14745 break;
14746 case OPCODE_LOAD_IDENTITY:
14747 fprintf(f, "LoadIdentity\n");
14748 break;
14749 case OPCODE_LOAD_MATRIX:
14750 fprintf(f, "LoadMatrix\n");
14751 fprintf(f, " %8f %8f %8f %8f\n",
14752 n[1].f, n[5].f, n[9].f, n[13].f);
14753 fprintf(f, " %8f %8f %8f %8f\n",
14754 n[2].f, n[6].f, n[10].f, n[14].f);
14755 fprintf(f, " %8f %8f %8f %8f\n",
14756 n[3].f, n[7].f, n[11].f, n[15].f);
14757 fprintf(f, " %8f %8f %8f %8f\n",
14758 n[4].f, n[8].f, n[12].f, n[16].f);
14759 break;
14760 case OPCODE_MULT_MATRIX:
14761 fprintf(f, "MultMatrix (or Rotate)\n");
14762 fprintf(f, " %8f %8f %8f %8f\n",
14763 n[1].f, n[5].f, n[9].f, n[13].f);
14764 fprintf(f, " %8f %8f %8f %8f\n",
14765 n[2].f, n[6].f, n[10].f, n[14].f);
14766 fprintf(f, " %8f %8f %8f %8f\n",
14767 n[3].f, n[7].f, n[11].f, n[15].f);
14768 fprintf(f, " %8f %8f %8f %8f\n",
14769 n[4].f, n[8].f, n[12].f, n[16].f);
14770 break;
14771 case OPCODE_ORTHO:
14772 fprintf(f, "Ortho %g %g %g %g %g %g\n",
14773 n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f);
14774 break;
14775 case OPCODE_POINT_SIZE:
14776 fprintf(f, "PointSize %f\n", n[1].f);
14777 break;
14778 case OPCODE_POP_ATTRIB:
14779 fprintf(f, "PopAttrib\n");
14780 break;
14781 case OPCODE_POP_MATRIX:
14782 fprintf(f, "PopMatrix\n");
14783 break;
14784 case OPCODE_POP_NAME:
14785 fprintf(f, "PopName\n");
14786 break;
14787 case OPCODE_PUSH_ATTRIB:
14788 fprintf(f, "PushAttrib %x\n", n[1].bf);
14789 break;
14790 case OPCODE_PUSH_MATRIX:
14791 fprintf(f, "PushMatrix\n");
14792 break;
14793 case OPCODE_PUSH_NAME:
14794 fprintf(f, "PushName %d\n", (int) n[1].ui);
14795 break;
14796 case OPCODE_RASTER_POS:
14797 fprintf(f, "RasterPos %g %g %g %g\n",
14798 n[1].f, n[2].f, n[3].f, n[4].f);
14799 break;
14800 case OPCODE_ROTATE:
14801 fprintf(f, "Rotate %g %g %g %g\n",
14802 n[1].f, n[2].f, n[3].f, n[4].f);
14803 break;
14804 case OPCODE_SCALE:
14805 fprintf(f, "Scale %g %g %g\n", n[1].f, n[2].f, n[3].f);
14806 break;
14807 case OPCODE_TRANSLATE:
14808 fprintf(f, "Translate %g %g %g\n", n[1].f, n[2].f, n[3].f);
14809 break;
14810 case OPCODE_BIND_TEXTURE:
14811 fprintf(f, "BindTexture %s %d\n",
14812 _mesa_enum_to_string(n[1].ui), n[2].ui);
14813 break;
14814 case OPCODE_SHADE_MODEL:
14815 fprintf(f, "ShadeModel %s\n", _mesa_enum_to_string(n[1].ui));
14816 break;
14817 case OPCODE_MAP1:
14818 fprintf(f, "Map1 %s %.3f %.3f %d %d\n",
14819 _mesa_enum_to_string(n[1].ui),
14820 n[2].f, n[3].f, n[4].i, n[5].i);
14821 break;
14822 case OPCODE_MAP2:
14823 fprintf(f, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
14824 _mesa_enum_to_string(n[1].ui),
14825 n[2].f, n[3].f, n[4].f, n[5].f,
14826 n[6].i, n[7].i, n[8].i, n[9].i);
14827 break;
14828 case OPCODE_MAPGRID1:
14829 fprintf(f, "MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f);
14830 break;
14831 case OPCODE_MAPGRID2:
14832 fprintf(f, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
14833 n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
14834 break;
14835 case OPCODE_EVALMESH1:
14836 fprintf(f, "EvalMesh1 %d %d\n", n[1].i, n[2].i);
14837 break;
14838 case OPCODE_EVALMESH2:
14839 fprintf(f, "EvalMesh2 %d %d %d %d\n",
14840 n[1].i, n[2].i, n[3].i, n[4].i);
14841 break;
14842
14843 case OPCODE_ATTR_1F_NV:
14844 fprintf(f, "ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f);
14845 break;
14846 case OPCODE_ATTR_2F_NV:
14847 fprintf(f, "ATTR_2F_NV attr %d: %f %f\n",
14848 n[1].i, n[2].f, n[3].f);
14849 break;
14850 case OPCODE_ATTR_3F_NV:
14851 fprintf(f, "ATTR_3F_NV attr %d: %f %f %f\n",
14852 n[1].i, n[2].f, n[3].f, n[4].f);
14853 break;
14854 case OPCODE_ATTR_4F_NV:
14855 fprintf(f, "ATTR_4F_NV attr %d: %f %f %f %f\n",
14856 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14857 break;
14858 case OPCODE_ATTR_1F_ARB:
14859 fprintf(f, "ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f);
14860 break;
14861 case OPCODE_ATTR_2F_ARB:
14862 fprintf(f, "ATTR_2F_ARB attr %d: %f %f\n",
14863 n[1].i, n[2].f, n[3].f);
14864 break;
14865 case OPCODE_ATTR_3F_ARB:
14866 fprintf(f, "ATTR_3F_ARB attr %d: %f %f %f\n",
14867 n[1].i, n[2].f, n[3].f, n[4].f);
14868 break;
14869 case OPCODE_ATTR_4F_ARB:
14870 fprintf(f, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
14871 n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
14872 break;
14873
14874 case OPCODE_MATERIAL:
14875 fprintf(f, "MATERIAL %x %x: %f %f %f %f\n",
14876 n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
14877 break;
14878 case OPCODE_BEGIN:
14879 fprintf(f, "BEGIN %x\n", n[1].i);
14880 break;
14881 case OPCODE_END:
14882 fprintf(f, "END\n");
14883 break;
14884 case OPCODE_RECTF:
14885 fprintf(f, "RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f,
14886 n[4].f);
14887 break;
14888 case OPCODE_EVAL_C1:
14889 fprintf(f, "EVAL_C1 %f\n", n[1].f);
14890 break;
14891 case OPCODE_EVAL_C2:
14892 fprintf(f, "EVAL_C2 %f %f\n", n[1].f, n[2].f);
14893 break;
14894 case OPCODE_EVAL_P1:
14895 fprintf(f, "EVAL_P1 %d\n", n[1].i);
14896 break;
14897 case OPCODE_EVAL_P2:
14898 fprintf(f, "EVAL_P2 %d %d\n", n[1].i, n[2].i);
14899 break;
14900
14901 case OPCODE_PROVOKING_VERTEX:
14902 fprintf(f, "ProvokingVertex %s\n",
14903 _mesa_enum_to_string(n[1].ui));
14904 break;
14905
14906 /*
14907 * meta opcodes/commands
14908 */
14909 case OPCODE_ERROR:
14910 fprintf(f, "Error: %s %s\n", enum_string(n[1].e),
14911 (const char *) get_pointer(&n[2]));
14912 break;
14913 case OPCODE_CONTINUE:
14914 fprintf(f, "DISPLAY-LIST-CONTINUE\n");
14915 n = (Node *) get_pointer(&n[1]);
14916 break;
14917 case OPCODE_NOP:
14918 fprintf(f, "NOP\n");
14919 break;
14920 case OPCODE_END_OF_LIST:
14921 fprintf(f, "END-LIST %u\n", list);
14922 done = GL_TRUE;
14923 break;
14924 default:
14925 if (opcode < 0 || opcode > OPCODE_END_OF_LIST) {
14926 printf
14927 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
14928 opcode, (void *) n);
14929 goto out;
14930 }
14931 else {
14932 fprintf(f, "command %d, %u operands\n", opcode,
14933 InstSize[opcode]);
14934 }
14935 }
14936 /* increment n to point to next compiled command */
14937 if (opcode != OPCODE_CONTINUE) {
14938 assert(InstSize[opcode] > 0);
14939 n += InstSize[opcode];
14940 }
14941 }
14942 }
14943
14944 out:
14945 fflush(f);
14946 if (fname)
14947 fclose(f);
14948 }
14949
14950
14951
14952 /**
14953 * Clients may call this function to help debug display list problems.
14954 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
14955 * changed, or break in the future without notice.
14956 */
14957 void
14958 mesa_print_display_list(GLuint list)
14959 {
14960 GET_CURRENT_CONTEXT(ctx);
14961 print_list(ctx, list, NULL);
14962 }
14963
14964
14965 /**********************************************************************/
14966 /***** Initialization *****/
14967 /**********************************************************************/
14968
14969 void
14970 _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
14971 const GLvertexformat *vfmt)
14972 {
14973 SET_CallList(disp, vfmt->CallList);
14974 SET_CallLists(disp, vfmt->CallLists);
14975 }
14976
14977
14978 /**
14979 * Initialize display list state for given context.
14980 */
14981 void
14982 _mesa_init_display_list(struct gl_context *ctx)
14983 {
14984 static GLboolean tableInitialized = GL_FALSE;
14985 GLvertexformat *vfmt = &ctx->ListState.ListVtxfmt;
14986
14987 /* zero-out the instruction size table, just once */
14988 if (!tableInitialized) {
14989 memset(InstSize, 0, sizeof(InstSize));
14990 tableInitialized = GL_TRUE;
14991 }
14992
14993 /* extension info */
14994 ctx->ListExt = CALLOC_STRUCT(gl_list_extensions);
14995
14996 /* Display list */
14997 ctx->ListState.CallDepth = 0;
14998 ctx->ExecuteFlag = GL_TRUE;
14999 ctx->CompileFlag = GL_FALSE;
15000 ctx->ListState.CurrentBlock = NULL;
15001 ctx->ListState.CurrentPos = 0;
15002
15003 /* Display List group */
15004 ctx->List.ListBase = 0;
15005
15006 InstSize[OPCODE_NOP] = 1;
15007
15008 #define NAME_AE(x) _ae_##x
15009 #define NAME_CALLLIST(x) save_##x
15010 #define NAME(x) save_##x
15011 #define NAME_ES(x) save_##x##ARB
15012
15013 #include "vbo/vbo_init_tmp.h"
15014 }
15015
15016
15017 void
15018 _mesa_free_display_list_data(struct gl_context *ctx)
15019 {
15020 free(ctx->ListExt);
15021 ctx->ListExt = NULL;
15022 }